[
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "content": "*Issue #, if available:*\n\n*Description of changes:*\n\n\nBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.\n"
  },
  {
    "path": ".github/workflows/commit-checks.yml",
    "content": "name: commit checks\non:\n  push:\njobs:\n  run:\n    name: tests\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        go-version: ['^1.16.0', '^1.15.0', '^1.14.0']\n    env:\n      GO111MODULE: 'off'\n      GOPATH: ${{ github.workspace }}/go\n      REPO_PATH: ${{ github.workspace }}/go/src/github.com/twitchtv/twirp\n    steps:\n    - uses: actions/checkout@v2\n      with:\n        # Relative path under github.workspace to place the repository\n        path: ./go/src/github.com/twitchtv/twirp\n    - name: Install Go\n      uses: actions/setup-go@v2\n      with:\n        go-version: ${{ matrix.go-version }}\n    - name: Run Go Tests\n      run: |\n        cd ${{ env.REPO_PATH }}\n        go test -race ./...\n    - name: Run clientcompat Tests\n      run: |\n        cd ${{ env.REPO_PATH }}\n        GOBIN=\"${{env.REPO_PATH}}/bin\" go install ./clientcompat\n        GOBIN=\"${{env.REPO_PATH}}/bin\" go install ./clientcompat/gocompat\n        ./bin/clientcompat -client ./bin/gocompat\n"
  },
  {
    "path": ".github/workflows/stale.yaml",
    "content": "name: \"Stale issue handler\"\non:\n  workflow_dispatch:\n  schedule:\n  - cron: \"0 0 * * *\" # This action would run every day at midnight\n\njobs: # Job to close stale PRs and issues. Documentation on the github action https://github.com/marketplace/actions/close-stale-issues\n  stale:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/stale@v3\n      with:\n        repo-token: ${{ secrets.GITHUB_TOKEN }}\n        stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label / comment or this will be closed in 5 days'\n        stale-pr-message: 'This PR is stale because it has been open for 60 days with no activity. Remove stale label / comment or this will be closed in 5 days'\n        days-before-stale: 60\n        days-before-close: 5\n        stale-pr-label: 'no-pr-activity'\n        stale-issue-label: 'no-issue-activity'\n        exempt-pr-labels: 'pending'\n        exempt-issue-labels: 'pending'\n"
  },
  {
    "path": ".gitignore",
    "content": "*.test\nnpm-debug.log\n\n/bin\n/release\n/build\n"
  },
  {
    "path": ".travis.yml",
    "content": "sudo: false\nlanguage: go\ngo:\n- 1.13.x\n- 1.14.x\n- 1.15.x\n- tip\nscript:\n- go install ./...\n- go test -race ./...\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing\n\nThanks for helping make Twirp better! This is great!\n\n## Twirp Design Principles\n\nContributions to Twirp should align with the project’s design principles:\n\n- Maintain backwards compatibility. Twirp has been in production at Twitch since 2016 and released to the public in January 2018. It is currently used by many companies and individuals with a variety of needs. There must be a compelling use-case and solid reasoning behind a major version upgrade.\n- Simple wire protocol and minimal public API. Fewer things in the core means fewer things to break. In addition, it ensures lower friction updates and easier to maintain implementations in other languages.\n- Avoid surprising behavior. For instance, mechanisms that can alter a program’s control flow in a surprising way (such as middleware or observability hooks) should be treated with caution.\n- Prefer pragmatism over bleeding-edge. Users should be able to deploy and accept updates to Twirp even if they are conservative on updating its dependencies. This includes Go, the protobuf compiler and runtime libraries, and the HTTP protocol.\n- Keep configuration to a minimum. For example: avoid adding flags to code generation commands, so that generated code is predictable across versions and platforms.\n- Limit dependencies where possible, so that they are easier to integrate and upgrade.\n- Prefer generated code over shared libraries between services and clients, so that it is easier to implement changes without forcing a lock-step upgrade across the ecosystem.\n\nExamples of contributions that should be addressed with high priority:\n\n- Security updates.\n- Performance improvements.\n- Supporting new versions of key dependencies such as Go and Protobuf.\n- Documentation.\n- Making Twirp easier to integrate with other tools.\n\n## Report an Issue\n\nIf you have run into a bug or want to discuss a new feature, please [file an issue](https://github.com/twitchtv/twirp/issues). If you'd rather not publicly discuss the issue, please email security@twitch.tv.\n\n## Contributing Code with Pull Requests\n\nTwirp uses github pull requests. Fork, hack away at your changes and submit. Most pull requests will go through a few iterations before they get merged. Different contributors will sometimes have different opinions, and often patches will need to be revised before they can get merged.\n\n### Requirements\n\n- Add tests that cover your contribution. Overall code coverage should not decrease.\n- Twirp officially supports the last 3 releases of Go.\n- Protobuf version 3.x.x to generate code with the protoc command.\n- For linters and other tools, we use [retool](https://github.com/twitchtv/retool). If `make setup` is not able to install it, you can install it in your path with `go get github.com/twitchtv/retool` and then install tools with `retool build`.\n\n### Running tests\n\nGenerally you want to make changes and run `make`, which will install all\ndependencies we know about, build the core, and run tests. A few notes:\n\n- Clone the repo on `$GOPATH/src/github.com/twitchtv/twirp` (go modules not supported yet).\n- Run Go unit tests with `make test`.\n- Most tests of the Go server are in `internal/twirptest/service_test.go`.\n- Integration tests running the full stack in Go are in the [clientcompat](./clientcompat) directory.\n\n## Contributing Documentation\n\nTwirp's docs are generated with [Docusaurus](https://docusaurus.io/). You can safely edit anything inside the [docs](./docs) directory, adding new pages or editing them. You can edit the sidebar by editing [website/sidebars.json](./website/sidebars.json).\n\nTo render and review your changes, run docusaurus's local server. See [Install docusaurus on your machine](https://docusaurus.io/docs/en/installation.html).\n\n1. `cd website`\n2. `npm install`\n3. `npm start`\n4. Navigate to http://localhost:3000/twirp to see how it looks.\n\nPublish the new docs on the `gh-pages` branch. See [this guide](https://docusaurus.io/docs/en/tutorial-publish-site) for details.\n\n```\nGIT_USER=<your-github-username> CURRENT_BRANCH=gh-pages USE_SSH=true npm run publish-gh-pages\n```\n\n## Making a New Release\n\nReleasing versions is the responsibility of the core maintainers. Most people\ncan skip this section.\n\nTwirp uses GitHub releases. To make a new release:\n\n1.  Merge all changes that should be included in the release into the main branch.\n2.  Update the version constant in `internal/gen/version.go`. Please respect [semantic versioning](http://semver.org/): `v<major>.<minor>.<patch>`.\n3.  Run `make test_all` to re-generate code and run tests. Check that generated test files include the new version in the header comment.\n4.  Add a new commit to main with a message like \"Version vX.X.X release\" and push.\n5.  Tag the commit you just made: `git tag vX.X.X` and `git push origin --tags`.\n6.  Go to GitHub https://github.com/twitchtv/twirp/releases and \"Draft a new release\".\n7.  Make sure that all new functionality is properly documented, on code comments, PR description, and include links and/or upgrade instructions on the release. For example the [v7 release](https://github.com/twitchtv/twirp/releases/tag/v7.0.0). Minor releases can just include a link to the PR/PRs that were merged included into the release.\n\n## Code of Conduct\n\nThis project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).\nFor more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact\nopensource-codeofconduct@amazon.com with any additional questions or comments.\n\n## Licensing\n\nSee the [LICENSE](https://github.com/twitchtv/twirp/blob/main/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.\n\nWe may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.\n"
  },
  {
    "path": "Gopkg.toml",
    "content": "# The importable parts of Twirp have no external dependencies. They just use the\n# standard library. But both protoc-gen-twirp and Twirp's tests *do* have some\n# dependencies, and this manifest lists them.\n#\n# All dependencies are specified as overrides, not constraints, so that dep\n# doesn't get confused if someone imports Twirp. We don't want to falsely\n# require any particular versions of these libraries - they are *only* for\n# tests and building main packages.\n\n[[override]]\n  name = \"google.golang.org/protobuf\"\n  version = \"1.26.0\"\n\n[[override]]\n  name = \"github.com/pkg/errors\"\n  version = \"0.8.0\"\n\n[[override]]\n  name = \"github.com/stretchr/testify\"\n  version = \"1.2.0\"\n\n[prune]\n  unused-packages = true\n  go-tests = true\n  non-go = true\n"
  },
  {
    "path": "LICENSE",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "Makefile",
    "content": "PATH := ${PWD}/_tools/bin:${PWD}/bin:${PATH}\nexport GO111MODULE=off\n\nall: setup test_all\n\n.PHONY: setup generate test_all test test_clientcompat\n\nsetup:\n\t./check_protoc_version.sh\n\tGOPATH=\"$$PWD/_tools\" GOBIN=\"$$PWD/_tools/bin\" go get github.com/twitchtv/retool\n\t./_tools/bin/retool build\n\ngenerate:\n\t# Recompile and install generator\n\tGOBIN=\"$$PWD/bin\" go install -v ./protoc-gen-twirp\n\t# Generate code from go:generate comments\n\tgo generate ./...\n\ntest_all: setup test test_clientcompat\n\ntest: generate\n\t./_tools/bin/errcheck ./internal/twirptest\n\tgo test -race ./...\n\ntest_clientcompat: generate\n\tGOBIN=\"$$PWD/bin\" go install ./clientcompat\n\tGOBIN=\"$$PWD/bin\" go install ./clientcompat/gocompat\n\t./bin/clientcompat -client ./bin/gocompat\n"
  },
  {
    "path": "NOTICE",
    "content": "Twirp\nCopyright 2018 Twitch Interactive, Inc.  All Rights Reserved. \n"
  },
  {
    "path": "PROTOCOL.md",
    "content": "# Twirp Wire Protocol\n\nThis document defines the Twirp wire protocol over HTTP. The\ncurrent protocol version is v7.\n\n## Overview\n\nThe Twirp wire protocol is a simple RPC protocol based on HTTP and\nProtocol Buffers (proto). The protocol uses HTTP URLs to specify the\nRPC endpoints, and sends/receives proto messages as HTTP\nrequest/response bodies.\n\nTo use Twirp, developers first define their APIs using proto files,\nthen use Twirp tools to generate the client and the server libraries.\nThe generated libraries implement the Twirp wire protocol, using the\nstandard HTTP library provided by the programming language runtime or\nthe operating system. Once the client and the server are implemented,\nthe client can communicate with the server by making RPC calls.\n\nThe Twirp wire protocol supports both binary and JSON encodings of\nproto messages, and works with any HTTP client and any HTTP version.\n\n### URLs\n\nIn [ABNF syntax](https://tools.ietf.org/html/rfc5234), Twirp's URLs\nhave the following format:\n\n```abnf\nURL ::= Base-URL [ Prefix ] \"/\" [ Package \".\" ] Service \"/\" Method\n```\n\nThe Twirp wire protocol uses HTTP URLs to specify the RPC\nendpoints on the server for sending the requests. Such direct mapping\nmakes the request routing simple and efficient. The Twirp URLs have\nthe following components.\n\n* **Base-URL** is the virtual location of a Twirp API server, which is\n  typically published via API documentation or service discovery.\n  Currently, it should only contain URL `scheme` and `authority`. For\n  example, \"https://example.com\".\n* **Prefix** is usually \"/twirp\", but it could be empty \"\", or an\n  arbitrary path like \"/my/custom/prefix\".\n* **Package** is the proto `package` name for an API, which is often\n  considered as an API version. For example,\n  `example.calendar.v1`. This component is omitted if the API\n  definition doesn't have a package name.\n* **Service** is the proto `service` name for an API. For example,\n  `CalendarService`.\n* **Method** is the proto `rpc` name for an API method. For example,\n  `CreateEvent`.\n\n### Requests\n\nTwirp always uses HTTP POST method to send requests, because it\nclosely matches the semantics of RPC methods.\n\nThe **Request-Headers** are normal HTTP headers. The Twirp wire\nprotocol uses the following headers.\n\n* **Content-Type** header indicates the proto message encoding, which\n  should be one of \"application/protobuf\", \"application/json\". The\n  server uses this value to decide how to parse the request body,\n  and encode the response body.\n\nThe **Request-Body** is the encoded request message, contained in the\nHTTP request body. The encoding is specified by the `Content-Type`\nheader.\n\n### Responses\n\nThe **Response-Headers** are just normal HTTP response headers. The\nTwirp wire protocol uses the following headers.\n\n* **Content-Type** The value should be either \"application/protobuf\"\n  or \"application/json\" to indicate the encoding of the response\n  message. It must match the \"Content-Type\" header in the request.\n\nThe **Request-Body** is the encoded response message contained in the\nHTTP response body. The encoding is specified by the `Content-Type`\nheader.\n\n### Example\n\nThe following example shows a simple Echo API definition and its\ncorresponding wire payloads.\n\nThe example assumes the server base URL is \"https://example.com\".\n\n```proto\nsyntax = \"proto3\";\n\npackage example.echoer;\n\nservice Echo {\n  rpc Hello(HelloRequest) returns (HelloResponse);\n}\n\nmessage HelloRequest {\n  string message;\n}\n\nmessage HelloResponse {\n  string message;\n}\n```\n\n**Proto Request**\n\n```\nPOST /twirp/example.echoer.Echo/Hello HTTP/1.1\nHost: example.com\nContent-Type: application/protobuf\nContent-Length: 15\n\n<encoded HelloRequest>\n```\n\n**JSON Request**\n\n```\nPOST /twirp/example.echoer.Echo/Hello HTTP/1.1\nHost: example.com\nContent-Type: application/json\nContent-Length: 27\n\n{\"message\":\"Hello, World!\"}\n```\n\n**Proto Response**\n\n```\nHTTP/1.1 200 OK\nContent-Type: application/protobuf\nContent-Length: 15\n\n<encoded HelloResponse>\n```\n\n**JSON Response**\n\n```\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 27\n\n{\"message\":\"Hello, World!\"}\n```\n\n\n## Errors\n\nTwirp error responses are always JSON-encoded, regardless of\nthe request's Content-Type, with a corresponding\n`Content-Type: application/json` header. This ensures that\nthe errors are human-readable in any setting.\n\nTwirp errors are a JSON object with the keys:\n\n* **code**: One of the Twirp error codes as a string.\n* **msg**: A human-readable message describing the error\n  as a string.\n* **meta**: (optional) An object with string values holding\n  arbitrary additional metadata describing the error.\n\nExample:\n\n```json\n{\n  \"code\": \"internal\",\n  \"msg\": \"Something went wrong\"\n}\n```\n\nExample with metadata:\n\n```json\n{\n  \"code\": \"permission_denied\",\n  \"msg\": \"Thou shall not pass\",\n  \"meta\": {\n    \"target\": \"Balrog\",\n    \"power\": \"999\"\n  }\n}\n```\n\n### Error Codes\n\nTwirp errors always include an error code. This code is represented\nas a string and must be one of a fixed set of codes, listed in the\ntable below. Each code has an associated HTTP Status Code. When a\nserver responds with the given error code, it must set the\ncorresponding HTTP Status Code for the response.\n\n| Twirp Error Code    | HTTP Status | Description\n| ------------------- | ----------- | -----------\n| canceled            | 408 | The operation was cancelled.\n| unknown             | 500 | An unknown error occurred. For example, this can be used when handling errors raised by APIs that do not return any error information.\n| invalid_argument    | 400 | The client specified an invalid argument. This indicates arguments that are invalid regardless of the state of the system (i.e. a malformed file name, required argument, number out of range, etc.).\n| malformed           | 400 | The client sent a message which could not be decoded. This may mean that the message was encoded improperly or that the client and server have incompatible message definitions.\n| deadline_exceeded   | 408 | Operation expired before completion. For operations that change the state of the system, this error may be returned even if the operation has completed successfully (timeout).\n| not_found           | 404 | Some requested entity was not found.\n| bad_route           | 404 | The requested URL path wasn't routable to a Twirp service and method. This is returned by generated server code and should not be returned by application code (use \"not_found\" or \"unimplemented\" instead).\n| already_exists      | 409 | An attempt to create an entity failed because one already exists.\n| permission_denied   | 403 | The caller does not have permission to execute the specified operation. It must not be used if the caller cannot be identified (use \"unauthenticated\" instead).\n| unauthenticated     | 401 | The request does not have valid authentication credentials for the operation.\n| resource_exhausted  | 429 | Some resource has been exhausted or rate-limited, perhaps a per-user quota, or perhaps the entire file system is out of space.\n| failed_precondition | 412 | The operation was rejected because the system is not in a state required for the operation's execution. For example, doing an rmdir operation on a directory that is non-empty, or on a non-directory object, or when having conflicting read-modify-write on the same resource.\n| aborted             | 409 | The operation was aborted, typically due to a concurrency issue like sequencer check failures, transaction aborts, etc.\n| out_of_range        | 400 | The operation was attempted past the valid range. For example, seeking or reading past end of a paginated collection. Unlike \"invalid_argument\", this error indicates a problem that may be fixed if the system state changes (i.e. adding more items to the collection). There is a fair bit of overlap between \"failed_precondition\" and \"out_of_range\". We recommend using \"out_of_range\" (the more specific error) when it applies so that callers who are iterating through a space can easily look for an \"out_of_range\" error to detect when they are done.\n| unimplemented       | 501 | The operation is not implemented or not supported/enabled in this service.\n| internal            | 500 | When some invariants expected by the underlying system have been broken. In other words, something bad happened in the library or backend service. Twirp specific issues like wire and serialization problems are also reported as \"internal\" errors.\n| unavailable         | 503 | The service is currently unavailable. This is most likely a transient condition and may be corrected by retrying with a backoff.\n| data_loss            | 500 | The operation resulted in unrecoverable data loss or corruption.\n\n"
  },
  {
    "path": "README.md",
    "content": "![Twirp Logo](./logo.png) [![Build Status](https://travis-ci.org/twitchtv/twirp.svg?branch=main)](https://travis-ci.org/twitchtv/twirp) [![Go Report Card](https://goreportcard.com/badge/github.com/twitchtv/twirp)](https://goreportcard.com/report/github.com/twitchtv/twirp) [![GoDoc](https://godoc.org/github.com/twitchtv/twirp?status.svg)](https://godoc.org/github.com/twitchtv/twirp)\n\n---\n\nTwirp is a framework for service-to-service communication emphasizing simplicity\nand minimalism. It generates routing and serialization from API definition files\nand lets you focus on your application's logic instead of thinking about\nfolderol like HTTP methods and paths and JSON.\n\nTwirp is similar to [gRPC](http://www.grpc.io/), but without the custom\nHTTP server and transport implementations: it runs on the standard library's\nextremely-well-tested-and-high-performance `net/http` Server. It can run on HTTP\n1.1, not just http/2, and supports JSON serialization for easy debugging.\n\nAlong the way, you get autogenerated clients and a simple, smart framework for\npassing error messages. Nice!\n\nRead more about the motivation behind on the [announcement blog post](https://blog.twitch.tv/en/2018/01/16/twirp-a-sweet-new-rpc-framework-for-go-5f2febbf35f/).\n\n### Documentation\n\n * [Getting Started](https://twitchtv.github.io/twirp/docs/intro.html)\n * [Usage Example](https://twitchtv.github.io/twirp/docs/example.html)\n * [Errors](https://twitchtv.github.io/twirp/docs/errors.html)\n * More: https://twitchtv.github.io/twirp/\n\n### Implementations in other languages\n\nThis repo contains the generator and runtime library for the Go implementation.\n\nHere is a list of some third-party implementations in other languages.\n\n|    Language    | Clients | Servers | Repository |\n|----------------|---------|---------|------------|\n| **Crystal**    |    ✓    |    ✓    | [github.com/mloughran/twirp.cr](https://github.com/mloughran/twirp.cr)\n| **Dart**       |    ✓    |         | [github.com/apptreesoftware/protoc-gen-twirp_dart](https://github.com/apptreesoftware/protoc-gen-twirp_dart)\n| **Elixir**     |    ✓    |    ✓    | [github.com/keathley/twirp-elixir](https://github.com/keathley/twirp-elixir)\n| **Java**       |    ✓    |    ✓    | [github.com/fajran/protoc-gen-twirp_java_jaxrs](https://github.com/fajran/protoc-gen-twirp_java_jaxrs)\n| **Java**       |         |    ✓    | [github.com/devork/flit](https://github.com/devork/flit)\n| **Java**       |         |    ✓    | [github.com/github/flit](https://github.com/github/flit)\n| **JavaScript** |    ✓    |         | [github.com/thechriswalker/protoc-gen-twirp_js](https://github.com/thechriswalker/protoc-gen-twirp_js)\n| **JavaScript** |    ✓    |         | [github.com/Xe/twirp-codegens/cmd/protoc-gen-twirp_jsbrowser](https://github.com/Xe/twirp-codegens)\n| **JavaScript** |    ✓    |    ✓    | [github.com/tatethurston/TwirpScript](https://github.com/tatethurston/TwirpScript)\n| **Kotlin**     |    ✓    |         | [github.com/collectiveidea/twirp-kmm](https://github.com/collectiveidea/twirp-kmm)\n| **PHP**        |    ✓    |    ✓    | [github.com/twirphp/twirp](https://github.com/twirphp/twirp)\n| **Python3**    |    ✓    |    ✓    | [github.com/verloop/twirpy](https://github.com/verloop/twirpy)\n| **Ruby**       |    ✓    |    ✓    | [github.com/twitchtv/twirp-ruby](https://github.com/twitchtv/twirp-ruby)\n| **Rust**       |    ✓    |    ✓    | [github.com/sourcefrog/prost-twirp](https://github.com/sourcefrog/prost-twirp)\n| **Scala**      |    ✓    |    ✓    | [github.com/soundcloud/twinagle](https://github.com/soundcloud/twinagle)\n| **Swagger**    |    ✓    |    ✓    | [github.com/go-bridget/twirp-swagger-gen](https://github.com/go-bridget/twirp-swagger-gen)\n| **Swift**      |    ✓    |         | [github.com/CrazyHulk/protoc-gen-swiftwirp](https://github.com/CrazyHulk/protoc-gen-swiftwirp)\n| **Typescript** |    ✓    |    ✓    | [github.com/hopin-team/twirp-ts](https://github.com/hopin-team/twirp-ts)\n| **Typescript** |    ✓    |    ✓    | [github.com/tatethurston/TwirpScript](https://github.com/tatethurston/TwirpScript)\n| **Typescript** |    ✓    |    ✓    | [github.com/timostamm/protobuf-ts](https://github.com/timostamm/protobuf-ts)\n\n### Support and Community\n\nWe have a channel on the Gophers slack, [#twirp](https://gophers.slack.com/messages/twirp),\nwhich is the best place to get quick answers to your questions. You can join the\nGopher slack [here](https://invite.slack.golangbridge.org/).\n\n### Releases\n\nTwirp follows semantic versioning through git tags, and uses GitHub Releases for\nrelease notes and upgrade guides:\n[Twirp Releases](https://github.com/twitchtv/twirp/releases)\n\n### Contributing\n\nCheck out [CONTRIBUTING.md](./CONTRIBUTING.md) for notes on making contributions.\n\n### License\n\nThis library is licensed under the Apache 2.0 License.\n"
  },
  {
    "path": "THIRD_PARTY",
    "content": "** Protobuf -- https://github.com/protocolbuffers/protobuf-go\nCopyright 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": "_tools/.gitignore",
    "content": "/bin/\n/pkg/\n/manifest.json\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/errcheck/LICENSE",
    "content": "Copyright (c) 2013 Kamil Kisiel\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/errcheck/README.md",
    "content": "# errcheck\n\nerrcheck is a program for checking for unchecked errors in go programs.\n\n[![Build Status](https://travis-ci.org/kisielk/errcheck.png?branch=master)](https://travis-ci.org/kisielk/errcheck)\n\n## Install\n\n    go get -u github.com/kisielk/errcheck\n\nerrcheck requires Go 1.6 or newer and depends on the package go/loader from the golang.org/x/tools repository.\n\n## Use\n\nFor basic usage, just give the package path of interest as the first argument:\n\n    errcheck github.com/kisielk/errcheck/testdata\n\nTo check all packages beneath the current directory:\n\n    errcheck ./...\n\nOr check all packages in your $GOPATH and $GOROOT:\n\n    errcheck all\n\nerrcheck also recognizes the following command-line options:\n\nThe `-tags` flag takes a space-separated list of build tags, just like `go\nbuild`. If you are using any custom build tags in your code base, you may need\nto specify the relevant tags here.\n\nThe `-asserts` flag enables checking for ignored type assertion results. It\ntakes no arguments.\n\nThe `-blank` flag enables checking for assignments of errors to the\nblank identifier. It takes no arguments.\n\n\n## Excluding functions\n\nUse the `-exclude` flag to specify a path to a file containing a list of functions to\nbe excluded.\n\n    errcheck -exclude errcheck_excludes.txt path/to/package\n\nThe file should contain one function signature per line. The format for function signatures is\n`package.FunctionName` while for methods it's `(package.Receiver).MethodName` for value receivers\nand `(*package.Receiver).MethodName` for pointer receivers.\n\nAn example of an exclude file is:\n\n    io/ioutil.ReadFile\n    (*net/http.Client).Do\n\nThe exclude list is combined with an internal list for functions in the Go standard library that\nhave an error return type but are documented to never return an error.\n\n\n### The deprecated method\n\nThe `-ignore` flag takes a comma-separated list of pairs of the form package:regex.\nFor each package, the regex describes which functions to ignore within that package.\nThe package may be omitted to have the regex apply to all packages.\n\nFor example, you may wish to ignore common operations like Read and Write:\n\n    errcheck -ignore '[rR]ead|[wW]rite' path/to/package\n\nor you may wish to ignore common functions like the `print` variants in `fmt`:\n\n    errcheck -ignore 'fmt:[FS]?[Pp]rint*' path/to/package\n\nThe `-ignorepkg` flag takes a comma-separated list of package import paths\nto ignore:\n\n    errcheck -ignorepkg 'fmt,encoding/binary' path/to/package\n\nNote that this is equivalent to:\n\n    errcheck -ignore 'fmt:.*,encoding/binary:.*' path/to/package\n\nIf a regex is provided for a package `pkg` via `-ignore`, and `pkg` also appears\nin the list of packages passed to `-ignorepkg`, the latter takes precedence;\nthat is, all functions within `pkg` will be ignored.\n\nNote that by default the `fmt` package is ignored entirely, unless a regex is\nspecified for it. To disable this, specify a regex that matches nothing:\n\n    errcheck -ignore 'fmt:a^' path/to/package\n\nThe `-ignoretests` flag disables checking of `_test.go` files. It takes\nno arguments.\n\n## Cgo\n\nCurrently errcheck is unable to check packages that `import \"C\"` due to limitations\nin the importer.\n\nHowever, you can use errcheck on packages that depend on those which use cgo. In\norder for this to work you need to `go install` the cgo dependencies before running\nerrcheck on the dependant packages.\n\nSee https://github.com/kisielk/errcheck/issues/16 for more details.\n\n## Exit Codes\n\nerrcheck returns 1 if any problems were found in the checked files.\nIt returns 2 if there were any other failures.\n\n# Editor Integration\n\n## Emacs\n\n[go-errcheck.el](https://github.com/dominikh/go-errcheck.el)\nintegrates errcheck with Emacs by providing a `go-errcheck` command\nand customizable variables to automatically pass flags to errcheck.\n\n## Vim\n\n[vim-go](https://github.com/fatih/vim-go) can run errcheck via both its `:GoErrCheck`\nand `:GoMetaLinter` commands.\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/errcheck/internal/errcheck/errcheck.go",
    "content": "// Package errcheck is the library used to implement the errcheck command-line tool.\n//\n// Note: The API of this package has not been finalized and may change at any point.\npackage errcheck\n\nimport (\n\t\"bufio\"\n\t\"errors\"\n\t\"fmt\"\n\t\"go/ast\"\n\t\"go/build\"\n\t\"go/token\"\n\t\"go/types\"\n\t\"os\"\n\t\"regexp\"\n\t\"sort\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"golang.org/x/tools/go/loader\"\n)\n\nvar errorType *types.Interface\n\nfunc init() {\n\terrorType = types.Universe.Lookup(\"error\").Type().Underlying().(*types.Interface)\n\n}\n\nvar (\n\t// ErrNoGoFiles is returned when CheckPackage is run on a package with no Go source files\n\tErrNoGoFiles = errors.New(\"package contains no go source files\")\n)\n\n// UncheckedError indicates the position of an unchecked error return.\ntype UncheckedError struct {\n\tPos  token.Position\n\tLine string\n}\n\n// UncheckedErrors is returned from the CheckPackage function if the package contains\n// any unchecked errors.\n// Errors should be appended using the Append method, which is safe to use concurrently.\ntype UncheckedErrors struct {\n\tmu sync.Mutex\n\n\t// Errors is a list of all the unchecked errors in the package.\n\t// Printing an error reports its position within the file and the contents of the line.\n\tErrors []UncheckedError\n}\n\nfunc (e *UncheckedErrors) Append(errors ...UncheckedError) {\n\te.mu.Lock()\n\tdefer e.mu.Unlock()\n\te.Errors = append(e.Errors, errors...)\n}\n\nfunc (e *UncheckedErrors) Error() string {\n\treturn fmt.Sprintf(\"%d unchecked errors\", len(e.Errors))\n}\n\n// Len is the number of elements in the collection.\nfunc (e *UncheckedErrors) Len() int { return len(e.Errors) }\n\n// Swap swaps the elements with indexes i and j.\nfunc (e *UncheckedErrors) Swap(i, j int) { e.Errors[i], e.Errors[j] = e.Errors[j], e.Errors[i] }\n\ntype byName struct{ *UncheckedErrors }\n\n// Less reports whether the element with index i should sort before the element with index j.\nfunc (e byName) Less(i, j int) bool {\n\tei, ej := e.Errors[i], e.Errors[j]\n\n\tpi, pj := ei.Pos, ej.Pos\n\n\tif pi.Filename != pj.Filename {\n\t\treturn pi.Filename < pj.Filename\n\t}\n\tif pi.Line != pj.Line {\n\t\treturn pi.Line < pj.Line\n\t}\n\tif pi.Column != pj.Column {\n\t\treturn pi.Column < pj.Column\n\t}\n\n\treturn ei.Line < ej.Line\n}\n\ntype Checker struct {\n\t// ignore is a map of package names to regular expressions. Identifiers from a package are\n\t// checked against its regular expressions and if any of the expressions match the call\n\t// is not checked.\n\tIgnore map[string]*regexp.Regexp\n\n\t// If blank is true then assignments to the blank identifier are also considered to be\n\t// ignored errors.\n\tBlank bool\n\n\t// If asserts is true then ignored type assertion results are also checked\n\tAsserts bool\n\n\t// build tags\n\tTags []string\n\n\tVerbose bool\n\n\t// If true, checking of of _test.go files is disabled\n\tWithoutTests bool\n\n\texclude map[string]bool\n}\n\nfunc NewChecker() *Checker {\n\tc := Checker{}\n\tc.SetExclude(map[string]bool{})\n\treturn &c\n}\n\nfunc (c *Checker) SetExclude(l map[string]bool) {\n\t// Default exclude for stdlib functions\n\tc.exclude = map[string]bool{\n\t\t\"math/rand.Read\":         true,\n\t\t\"(*math/rand.Rand).Read\": true,\n\n\t\t\"(*bytes.Buffer).Write\":       true,\n\t\t\"(*bytes.Buffer).WriteByte\":   true,\n\t\t\"(*bytes.Buffer).WriteRune\":   true,\n\t\t\"(*bytes.Buffer).WriteString\": true,\n\t}\n\tfor k := range l {\n\t\tc.exclude[k] = true\n\t}\n}\n\nfunc (c *Checker) logf(msg string, args ...interface{}) {\n\tif c.Verbose {\n\t\tfmt.Fprintf(os.Stderr, msg+\"\\n\", args...)\n\t}\n}\n\nfunc (c *Checker) load(paths ...string) (*loader.Program, error) {\n\tctx := build.Default\n\tfor _, tag := range c.Tags {\n\t\tctx.BuildTags = append(ctx.BuildTags, tag)\n\t}\n\tloadcfg := loader.Config{\n\t\tBuild: &ctx,\n\t}\n\trest, err := loadcfg.FromArgs(paths, !c.WithoutTests)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not parse arguments: %s\", err)\n\t}\n\tif len(rest) > 0 {\n\t\treturn nil, fmt.Errorf(\"unhandled extra arguments: %v\", rest)\n\t}\n\n\treturn loadcfg.Load()\n}\n\n// CheckPackages checks packages for errors.\nfunc (c *Checker) CheckPackages(paths ...string) error {\n\tprogram, err := c.load(paths...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not type check: %s\", err)\n\t}\n\n\tvar wg sync.WaitGroup\n\tu := &UncheckedErrors{}\n\tfor _, pkgInfo := range program.InitialPackages() {\n\t\tif pkgInfo.Pkg.Path() == \"unsafe\" { // not a real package\n\t\t\tcontinue\n\t\t}\n\n\t\twg.Add(1)\n\n\t\tgo func(pkgInfo *loader.PackageInfo) {\n\t\t\tdefer wg.Done()\n\t\t\tc.logf(\"Checking %s\", pkgInfo.Pkg.Path())\n\n\t\t\tv := &visitor{\n\t\t\t\tprog:    program,\n\t\t\t\tpkg:     pkgInfo,\n\t\t\t\tignore:  c.Ignore,\n\t\t\t\tblank:   c.Blank,\n\t\t\t\tasserts: c.Asserts,\n\t\t\t\tlines:   make(map[string][]string),\n\t\t\t\texclude: c.exclude,\n\t\t\t\terrors:  []UncheckedError{},\n\t\t\t}\n\n\t\t\tfor _, astFile := range v.pkg.Files {\n\t\t\t\tast.Walk(v, astFile)\n\t\t\t}\n\t\t\tu.Append(v.errors...)\n\t\t}(pkgInfo)\n\t}\n\n\twg.Wait()\n\tif u.Len() > 0 {\n\t\tsort.Sort(byName{u})\n\t\treturn u\n\t}\n\treturn nil\n}\n\n// visitor implements the errcheck algorithm\ntype visitor struct {\n\tprog    *loader.Program\n\tpkg     *loader.PackageInfo\n\tignore  map[string]*regexp.Regexp\n\tblank   bool\n\tasserts bool\n\tlines   map[string][]string\n\texclude map[string]bool\n\n\terrors []UncheckedError\n}\n\nfunc (v *visitor) excludeCall(call *ast.CallExpr) bool {\n\tsel, ok := call.Fun.(*ast.SelectorExpr)\n\tif !ok {\n\t\treturn false\n\t}\n\tfn, ok := v.pkg.ObjectOf(sel.Sel).(*types.Func)\n\tif !ok {\n\t\t// Shouldn't happen, but be paranoid\n\t\treturn false\n\t}\n\t// The name is fully qualified by the import path, possible type,\n\t// function/method name and pointer receiver.\n\t//\n\t// TODO(dh): vendored packages will have /vendor/ in their name,\n\t// thus not matching vendored standard library packages. If we\n\t// want to support vendored stdlib packages, we need to implement\n\t// FullName with our own logic.\n\tname := fn.FullName()\n\treturn v.exclude[name]\n}\n\nfunc (v *visitor) ignoreCall(call *ast.CallExpr) bool {\n\tif v.excludeCall(call) {\n\t\treturn true\n\t}\n\n\t// Try to get an identifier.\n\t// Currently only supports simple expressions:\n\t//     1. f()\n\t//     2. x.y.f()\n\tvar id *ast.Ident\n\tswitch exp := call.Fun.(type) {\n\tcase (*ast.Ident):\n\t\tid = exp\n\tcase (*ast.SelectorExpr):\n\t\tid = exp.Sel\n\tdefault:\n\t\t// eg: *ast.SliceExpr, *ast.IndexExpr\n\t}\n\n\tif id == nil {\n\t\treturn false\n\t}\n\n\t// If we got an identifier for the function, see if it is ignored\n\tif re, ok := v.ignore[\"\"]; ok && re.MatchString(id.Name) {\n\t\treturn true\n\t}\n\n\tif obj := v.pkg.Uses[id]; obj != nil {\n\t\tif pkg := obj.Pkg(); pkg != nil {\n\t\t\tif re, ok := v.ignore[pkg.Path()]; ok {\n\t\t\t\treturn re.MatchString(id.Name)\n\t\t\t}\n\n\t\t\t// if current package being considered is vendored, check to see if it should be ignored based\n\t\t\t// on the unvendored path.\n\t\t\tif nonVendoredPkg, ok := nonVendoredPkgPath(pkg.Path()); ok {\n\t\t\t\tif re, ok := v.ignore[nonVendoredPkg]; ok {\n\t\t\t\t\treturn re.MatchString(id.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false\n}\n\n// nonVendoredPkgPath returns the unvendored version of the provided package path (or returns the provided path if it\n// does not represent a vendored path). The second return value is true if the provided package was vendored, false\n// otherwise.\nfunc nonVendoredPkgPath(pkgPath string) (string, bool) {\n\tlastVendorIndex := strings.LastIndex(pkgPath, \"/vendor/\")\n\tif lastVendorIndex == -1 {\n\t\treturn pkgPath, false\n\t}\n\treturn pkgPath[lastVendorIndex+len(\"/vendor/\"):], true\n}\n\n// errorsByArg returns a slice s such that\n// len(s) == number of return types of call\n// s[i] == true iff return type at position i from left is an error type\nfunc (v *visitor) errorsByArg(call *ast.CallExpr) []bool {\n\tswitch t := v.pkg.Types[call].Type.(type) {\n\tcase *types.Named:\n\t\t// Single return\n\t\treturn []bool{isErrorType(t)}\n\tcase *types.Pointer:\n\t\t// Single return via pointer\n\t\treturn []bool{isErrorType(t)}\n\tcase *types.Tuple:\n\t\t// Multiple returns\n\t\ts := make([]bool, t.Len())\n\t\tfor i := 0; i < t.Len(); i++ {\n\t\t\tswitch et := t.At(i).Type().(type) {\n\t\t\tcase *types.Named:\n\t\t\t\t// Single return\n\t\t\t\ts[i] = isErrorType(et)\n\t\t\tcase *types.Pointer:\n\t\t\t\t// Single return via pointer\n\t\t\t\ts[i] = isErrorType(et)\n\t\t\tdefault:\n\t\t\t\ts[i] = false\n\t\t\t}\n\t\t}\n\t\treturn s\n\t}\n\treturn []bool{false}\n}\n\nfunc (v *visitor) callReturnsError(call *ast.CallExpr) bool {\n\tif v.isRecover(call) {\n\t\treturn true\n\t}\n\tfor _, isError := range v.errorsByArg(call) {\n\t\tif isError {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n// isRecover returns true if the given CallExpr is a call to the built-in recover() function.\nfunc (v *visitor) isRecover(call *ast.CallExpr) bool {\n\tif fun, ok := call.Fun.(*ast.Ident); ok {\n\t\tif _, ok := v.pkg.Uses[fun].(*types.Builtin); ok {\n\t\t\treturn fun.Name == \"recover\"\n\t\t}\n\t}\n\treturn false\n}\n\nfunc (v *visitor) addErrorAtPosition(position token.Pos) {\n\tpos := v.prog.Fset.Position(position)\n\tlines, ok := v.lines[pos.Filename]\n\tif !ok {\n\t\tlines = readfile(pos.Filename)\n\t\tv.lines[pos.Filename] = lines\n\t}\n\n\tline := \"??\"\n\tif pos.Line-1 < len(lines) {\n\t\tline = strings.TrimSpace(lines[pos.Line-1])\n\t}\n\tv.errors = append(v.errors, UncheckedError{pos, line})\n}\n\nfunc readfile(filename string) []string {\n\tvar f, err = os.Open(filename)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tvar lines []string\n\tvar scanner = bufio.NewScanner(f)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines\n}\n\nfunc (v *visitor) Visit(node ast.Node) ast.Visitor {\n\tswitch stmt := node.(type) {\n\tcase *ast.ExprStmt:\n\t\tif call, ok := stmt.X.(*ast.CallExpr); ok {\n\t\t\tif !v.ignoreCall(call) && v.callReturnsError(call) {\n\t\t\t\tv.addErrorAtPosition(call.Lparen)\n\t\t\t}\n\t\t}\n\tcase *ast.GoStmt:\n\t\tif !v.ignoreCall(stmt.Call) && v.callReturnsError(stmt.Call) {\n\t\t\tv.addErrorAtPosition(stmt.Call.Lparen)\n\t\t}\n\tcase *ast.DeferStmt:\n\t\tif !v.ignoreCall(stmt.Call) && v.callReturnsError(stmt.Call) {\n\t\t\tv.addErrorAtPosition(stmt.Call.Lparen)\n\t\t}\n\tcase *ast.AssignStmt:\n\t\tif len(stmt.Rhs) == 1 {\n\t\t\t// single value on rhs; check against lhs identifiers\n\t\t\tif call, ok := stmt.Rhs[0].(*ast.CallExpr); ok {\n\t\t\t\tif !v.blank {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif v.ignoreCall(call) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tisError := v.errorsByArg(call)\n\t\t\t\tfor i := 0; i < len(stmt.Lhs); i++ {\n\t\t\t\t\tif id, ok := stmt.Lhs[i].(*ast.Ident); ok {\n\t\t\t\t\t\t// We shortcut calls to recover() because errorsByArg can't\n\t\t\t\t\t\t// check its return types for errors since it returns interface{}.\n\t\t\t\t\t\tif id.Name == \"_\" && (v.isRecover(call) || isError[i]) {\n\t\t\t\t\t\t\tv.addErrorAtPosition(id.NamePos)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if assert, ok := stmt.Rhs[0].(*ast.TypeAssertExpr); ok {\n\t\t\t\tif !v.asserts {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif assert.Type == nil {\n\t\t\t\t\t// type switch\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif len(stmt.Lhs) < 2 {\n\t\t\t\t\t// assertion result not read\n\t\t\t\t\tv.addErrorAtPosition(stmt.Rhs[0].Pos())\n\t\t\t\t} else if id, ok := stmt.Lhs[1].(*ast.Ident); ok && v.blank && id.Name == \"_\" {\n\t\t\t\t\t// assertion result ignored\n\t\t\t\t\tv.addErrorAtPosition(id.NamePos)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// multiple value on rhs; in this case a call can't return\n\t\t\t// multiple values. Assume len(stmt.Lhs) == len(stmt.Rhs)\n\t\t\tfor i := 0; i < len(stmt.Lhs); i++ {\n\t\t\t\tif id, ok := stmt.Lhs[i].(*ast.Ident); ok {\n\t\t\t\t\tif call, ok := stmt.Rhs[i].(*ast.CallExpr); ok {\n\t\t\t\t\t\tif !v.blank {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif v.ignoreCall(call) {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif id.Name == \"_\" && v.callReturnsError(call) {\n\t\t\t\t\t\t\tv.addErrorAtPosition(id.NamePos)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if assert, ok := stmt.Rhs[i].(*ast.TypeAssertExpr); ok {\n\t\t\t\t\t\tif !v.asserts {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif assert.Type == nil {\n\t\t\t\t\t\t\t// Shouldn't happen anyway, no multi assignment in type switches\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tv.addErrorAtPosition(id.NamePos)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tdefault:\n\t}\n\treturn v\n}\n\nfunc isErrorType(t types.Type) bool {\n\treturn types.Implements(t, errorType)\n}\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/errcheck/main.go",
    "content": "package main\n\nimport (\n\t\"bufio\"\n\t\"flag\"\n\t\"fmt\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strings\"\n\n\t\"github.com/kisielk/errcheck/internal/errcheck\"\n\t\"github.com/kisielk/gotool\"\n)\n\nconst (\n\texitCodeOk int = iota\n\texitUncheckedError\n\texitFatalError\n)\n\nvar abspath bool\n\ntype ignoreFlag map[string]*regexp.Regexp\n\nfunc (f ignoreFlag) String() string {\n\tpairs := make([]string, 0, len(f))\n\tfor pkg, re := range f {\n\t\tprefix := \"\"\n\t\tif pkg != \"\" {\n\t\t\tprefix = pkg + \":\"\n\t\t}\n\t\tpairs = append(pairs, prefix+re.String())\n\t}\n\treturn fmt.Sprintf(\"%q\", strings.Join(pairs, \",\"))\n}\n\nfunc (f ignoreFlag) Set(s string) error {\n\tif s == \"\" {\n\t\treturn nil\n\t}\n\tfor _, pair := range strings.Split(s, \",\") {\n\t\tcolonIndex := strings.Index(pair, \":\")\n\t\tvar pkg, re string\n\t\tif colonIndex == -1 {\n\t\t\tpkg = \"\"\n\t\t\tre = pair\n\t\t} else {\n\t\t\tpkg = pair[:colonIndex]\n\t\t\tre = pair[colonIndex+1:]\n\t\t}\n\t\tregex, err := regexp.Compile(re)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tf[pkg] = regex\n\t}\n\treturn nil\n}\n\ntype tagsFlag []string\n\nfunc (f *tagsFlag) String() string {\n\treturn fmt.Sprintf(\"%q\", strings.Join(*f, \" \"))\n}\n\nfunc (f *tagsFlag) Set(s string) error {\n\tif s == \"\" {\n\t\treturn nil\n\t}\n\ttags := strings.Split(s, \" \")\n\tif tags == nil {\n\t\treturn nil\n\t}\n\tfor _, tag := range tags {\n\t\tif tag != \"\" {\n\t\t\t*f = append(*f, tag)\n\t\t}\n\t}\n\treturn nil\n}\n\nvar dotStar = regexp.MustCompile(\".*\")\n\nfunc reportUncheckedErrors(e *errcheck.UncheckedErrors) {\n\twd, err := os.Getwd()\n\tif err != nil {\n\t\twd = \"\"\n\t}\n\tfor _, uncheckedError := range e.Errors {\n\t\tpos := uncheckedError.Pos.String()\n\t\tif !abspath {\n\t\t\tnewPos, err := filepath.Rel(wd, pos)\n\t\t\tif err == nil {\n\t\t\t\tpos = newPos\n\t\t\t}\n\t\t}\n\t\tfmt.Printf(\"%s:\\t%s\\n\", pos, uncheckedError.Line)\n\t}\n}\n\nfunc mainCmd(args []string) int {\n\truntime.GOMAXPROCS(runtime.NumCPU())\n\n\tchecker := errcheck.NewChecker()\n\tpaths, err := parseFlags(checker, args)\n\tif err != exitCodeOk {\n\t\treturn err\n\t}\n\n\tif err := checker.CheckPackages(paths...); err != nil {\n\t\tif e, ok := err.(*errcheck.UncheckedErrors); ok {\n\t\t\treportUncheckedErrors(e)\n\t\t\treturn exitUncheckedError\n\t\t} else if err == errcheck.ErrNoGoFiles {\n\t\t\tfmt.Fprintln(os.Stderr, err)\n\t\t\treturn exitCodeOk\n\t\t}\n\t\tfmt.Fprintf(os.Stderr, \"error: failed to check packages: %s\\n\", err)\n\t\treturn exitFatalError\n\t}\n\treturn exitCodeOk\n}\n\nfunc parseFlags(checker *errcheck.Checker, args []string) ([]string, int) {\n\tflags := flag.NewFlagSet(args[0], flag.ContinueOnError)\n\tflags.BoolVar(&checker.Blank, \"blank\", false, \"if true, check for errors assigned to blank identifier\")\n\tflags.BoolVar(&checker.Asserts, \"asserts\", false, \"if true, check for ignored type assertion results\")\n\tflags.BoolVar(&checker.WithoutTests, \"ignoretests\", false, \"if true, checking of _test.go files is disabled\")\n\tflags.BoolVar(&checker.Verbose, \"verbose\", false, \"produce more verbose logging\")\n\n\tflags.BoolVar(&abspath, \"abspath\", false, \"print absolute paths to files\")\n\n\ttags := tagsFlag{}\n\tflags.Var(&tags, \"tags\", \"space-separated list of build tags to include\")\n\tignorePkg := flags.String(\"ignorepkg\", \"\", \"comma-separated list of package paths to ignore\")\n\tignore := ignoreFlag(map[string]*regexp.Regexp{\n\t\t\"fmt\": dotStar,\n\t})\n\tflags.Var(ignore, \"ignore\", \"[deprecated] comma-separated list of pairs of the form pkg:regex\\n\"+\n\t\t\"            the regex is used to ignore names within pkg.\")\n\n\tvar excludeFile string\n\tflags.StringVar(&excludeFile, \"exclude\", \"\", \"Path to a file containing a list of functions to exclude from checking\")\n\n\tif err := flags.Parse(args[1:]); err != nil {\n\t\treturn nil, exitFatalError\n\t}\n\n\tif excludeFile != \"\" {\n\t\texclude := make(map[string]bool)\n\t\tfh, err := os.Open(excludeFile)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Could not read exclude file: %s\\n\", err)\n\t\t\treturn nil, exitFatalError\n\t\t}\n\t\tscanner := bufio.NewScanner(fh)\n\t\tfor scanner.Scan() {\n\t\t\texclude[scanner.Text()] = true\n\t\t}\n\t\tif err := scanner.Err(); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Could not read exclude file: %s\\n\", err)\n\t\t\treturn nil, exitFatalError\n\t\t}\n\t\tchecker.SetExclude(exclude)\n\t}\n\n\tchecker.Tags = tags\n\tfor _, pkg := range strings.Split(*ignorePkg, \",\") {\n\t\tif pkg != \"\" {\n\t\t\tignore[pkg] = dotStar\n\t\t}\n\t}\n\tchecker.Ignore = ignore\n\n\t// ImportPaths normalizes paths and expands '...'\n\treturn gotool.ImportPaths(flags.Args()), exitCodeOk\n}\n\nfunc main() {\n\tos.Exit(mainCmd(os.Args))\n}\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/gotool/LEGAL",
    "content": "All the files in this distribution are covered under either the MIT\nlicense (see the file LICENSE) except some files mentioned below.\n\nmatch.go, match_test.go:\n\n    Copyright (c) 2009 The Go Authors. All rights reserved.\n\n    Redistribution and use in source and binary forms, with or without\n    modification, are permitted provided that the following conditions are\n    met:\n\n       * Redistributions of source code must retain the above copyright\n    notice, this list of conditions and the following disclaimer.\n       * Redistributions in binary form must reproduce the above\n    copyright notice, this list of conditions and the following disclaimer\n    in the documentation and/or other materials provided with the\n    distribution.\n       * Neither the name of Google Inc. nor the names of its\n    contributors may be used to endorse or promote products derived from\n    this software without specific prior written permission.\n\n    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n    \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/gotool/LICENSE",
    "content": "Copyright (c) 2013 Kamil Kisiel <kamil@kamilkisiel.net>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/gotool/README.md",
    "content": "gotool\n======\n[![GoDoc](https://godoc.org/github.com/kisielk/gotool?status.svg)](https://godoc.org/github.com/kisielk/gotool)\n[![Build Status](https://travis-ci.org/kisielk/gotool.svg?branch=master)](https://travis-ci.org/kisielk/gotool)\n\nPackage gotool contains utility functions used to implement the standard \"cmd/go\" tool, provided as a convenience to developers who want to write tools with similar semantics.\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/gotool/go13.go",
    "content": "// +build !go1.4\n\npackage gotool\n\nimport (\n\t\"go/build\"\n\t\"path/filepath\"\n\t\"runtime\"\n)\n\nvar gorootSrc = filepath.Join(runtime.GOROOT(), \"src\", \"pkg\")\n\nfunc shouldIgnoreImport(p *build.Package) bool {\n\treturn true\n}\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/gotool/go14-15.go",
    "content": "// +build go1.4,!go1.6\n\npackage gotool\n\nimport (\n\t\"go/build\"\n\t\"path/filepath\"\n\t\"runtime\"\n)\n\nvar gorootSrc = filepath.Join(runtime.GOROOT(), \"src\")\n\nfunc shouldIgnoreImport(p *build.Package) bool {\n\treturn true\n}\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/gotool/go16-18.go",
    "content": "// +build go1.6,!go1.9\n\npackage gotool\n\nimport (\n\t\"go/build\"\n\t\"path/filepath\"\n\t\"runtime\"\n)\n\nvar gorootSrc = filepath.Join(runtime.GOROOT(), \"src\")\n\nfunc shouldIgnoreImport(p *build.Package) bool {\n\treturn p == nil || len(p.InvalidGoFiles) == 0\n}\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/gotool/internal/load/path.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// +build go1.9\n\npackage load\n\nimport (\n\t\"strings\"\n)\n\n// hasPathPrefix reports whether the path s begins with the\n// elements in prefix.\nfunc hasPathPrefix(s, prefix string) bool {\n\tswitch {\n\tdefault:\n\t\treturn false\n\tcase len(s) == len(prefix):\n\t\treturn s == prefix\n\tcase len(s) > len(prefix):\n\t\tif prefix != \"\" && prefix[len(prefix)-1] == '/' {\n\t\t\treturn strings.HasPrefix(s, prefix)\n\t\t}\n\t\treturn s[len(prefix)] == '/' && s[:len(prefix)] == prefix\n\t}\n}\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/gotool/internal/load/pkg.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\n// +build go1.9\n\n// Package load loads packages.\npackage load\n\nimport (\n\t\"strings\"\n)\n\n// isStandardImportPath reports whether $GOROOT/src/path should be considered\n// part of the standard distribution. For historical reasons we allow people to add\n// their own code to $GOROOT instead of using $GOPATH, but we assume that\n// code will start with a domain name (dot in the first element).\nfunc isStandardImportPath(path string) bool {\n\ti := strings.Index(path, \"/\")\n\tif i < 0 {\n\t\ti = len(path)\n\t}\n\telem := path[:i]\n\treturn !strings.Contains(elem, \".\")\n}\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/gotool/internal/load/search.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// +build go1.9\n\npackage load\n\nimport (\n\t\"fmt\"\n\t\"go/build\"\n\t\"log\"\n\t\"os\"\n\t\"path\"\n\t\"path/filepath\"\n\t\"regexp\"\n\t\"strings\"\n)\n\n// Context specifies values for operation of ImportPaths that would\n// otherwise come from cmd/go/internal/cfg package.\n//\n// This is a construct added for gotool purposes and doesn't have\n// an equivalent upstream in cmd/go.\ntype Context struct {\n\t// BuildContext is the build context to use.\n\tBuildContext build.Context\n\n\t// GOROOTsrc is the location of the src directory in GOROOT.\n\t// At this time, it's used only in MatchPackages to skip\n\t// GOOROOT/src entry from BuildContext.SrcDirs output.\n\tGOROOTsrc string\n}\n\n// allPackages returns all the packages that can be found\n// under the $GOPATH directories and $GOROOT matching pattern.\n// The pattern is either \"all\" (all packages), \"std\" (standard packages),\n// \"cmd\" (standard commands), or a path including \"...\".\nfunc (c *Context) allPackages(pattern string) []string {\n\tpkgs := c.MatchPackages(pattern)\n\tif len(pkgs) == 0 {\n\t\tfmt.Fprintf(os.Stderr, \"warning: %q matched no packages\\n\", pattern)\n\t}\n\treturn pkgs\n}\n\n// allPackagesInFS is like allPackages but is passed a pattern\n// beginning ./ or ../, meaning it should scan the tree rooted\n// at the given directory. There are ... in the pattern too.\nfunc (c *Context) allPackagesInFS(pattern string) []string {\n\tpkgs := c.MatchPackagesInFS(pattern)\n\tif len(pkgs) == 0 {\n\t\tfmt.Fprintf(os.Stderr, \"warning: %q matched no packages\\n\", pattern)\n\t}\n\treturn pkgs\n}\n\n// MatchPackages returns a list of package paths matching pattern\n// (see go help packages for pattern syntax).\nfunc (c *Context) MatchPackages(pattern string) []string {\n\tmatch := func(string) bool { return true }\n\ttreeCanMatch := func(string) bool { return true }\n\tif !IsMetaPackage(pattern) {\n\t\tmatch = matchPattern(pattern)\n\t\ttreeCanMatch = treeCanMatchPattern(pattern)\n\t}\n\n\thave := map[string]bool{\n\t\t\"builtin\": true, // ignore pseudo-package that exists only for documentation\n\t}\n\tif !c.BuildContext.CgoEnabled {\n\t\thave[\"runtime/cgo\"] = true // ignore during walk\n\t}\n\tvar pkgs []string\n\n\tfor _, src := range c.BuildContext.SrcDirs() {\n\t\tif (pattern == \"std\" || pattern == \"cmd\") && src != c.GOROOTsrc {\n\t\t\tcontinue\n\t\t}\n\t\tsrc = filepath.Clean(src) + string(filepath.Separator)\n\t\troot := src\n\t\tif pattern == \"cmd\" {\n\t\t\troot += \"cmd\" + string(filepath.Separator)\n\t\t}\n\t\tfilepath.Walk(root, func(path string, fi os.FileInfo, err error) error {\n\t\t\tif err != nil || path == src {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\twant := true\n\t\t\t// Avoid .foo, _foo, and testdata directory trees.\n\t\t\t_, elem := filepath.Split(path)\n\t\t\tif strings.HasPrefix(elem, \".\") || strings.HasPrefix(elem, \"_\") || elem == \"testdata\" {\n\t\t\t\twant = false\n\t\t\t}\n\n\t\t\tname := filepath.ToSlash(path[len(src):])\n\t\t\tif pattern == \"std\" && (!isStandardImportPath(name) || name == \"cmd\") {\n\t\t\t\t// The name \"std\" is only the standard library.\n\t\t\t\t// If the name is cmd, it's the root of the command tree.\n\t\t\t\twant = false\n\t\t\t}\n\t\t\tif !treeCanMatch(name) {\n\t\t\t\twant = false\n\t\t\t}\n\n\t\t\tif !fi.IsDir() {\n\t\t\t\tif fi.Mode()&os.ModeSymlink != 0 && want {\n\t\t\t\t\tif target, err := os.Stat(path); err == nil && target.IsDir() {\n\t\t\t\t\t\tfmt.Fprintf(os.Stderr, \"warning: ignoring symlink %s\\n\", path)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif !want {\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\n\t\t\tif have[name] {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\thave[name] = true\n\t\t\tif !match(name) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tpkg, err := c.BuildContext.ImportDir(path, 0)\n\t\t\tif err != nil {\n\t\t\t\tif _, noGo := err.(*build.NoGoError); noGo {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we are expanding \"cmd\", skip main\n\t\t\t// packages under cmd/vendor. At least as of\n\t\t\t// March, 2017, there is one there for the\n\t\t\t// vendored pprof tool.\n\t\t\tif pattern == \"cmd\" && strings.HasPrefix(pkg.ImportPath, \"cmd/vendor\") && pkg.Name == \"main\" {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tpkgs = append(pkgs, name)\n\t\t\treturn nil\n\t\t})\n\t}\n\treturn pkgs\n}\n\n// MatchPackagesInFS returns a list of package paths matching pattern,\n// which must begin with ./ or ../\n// (see go help packages for pattern syntax).\nfunc (c *Context) MatchPackagesInFS(pattern string) []string {\n\t// Find directory to begin the scan.\n\t// Could be smarter but this one optimization\n\t// is enough for now, since ... is usually at the\n\t// end of a path.\n\ti := strings.Index(pattern, \"...\")\n\tdir, _ := path.Split(pattern[:i])\n\n\t// pattern begins with ./ or ../.\n\t// path.Clean will discard the ./ but not the ../.\n\t// We need to preserve the ./ for pattern matching\n\t// and in the returned import paths.\n\tprefix := \"\"\n\tif strings.HasPrefix(pattern, \"./\") {\n\t\tprefix = \"./\"\n\t}\n\tmatch := matchPattern(pattern)\n\n\tvar pkgs []string\n\tfilepath.Walk(dir, func(path string, fi os.FileInfo, err error) error {\n\t\tif err != nil || !fi.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tif path == dir {\n\t\t\t// filepath.Walk starts at dir and recurses. For the recursive case,\n\t\t\t// the path is the result of filepath.Join, which calls filepath.Clean.\n\t\t\t// The initial case is not Cleaned, though, so we do this explicitly.\n\t\t\t//\n\t\t\t// This converts a path like \"./io/\" to \"io\". Without this step, running\n\t\t\t// \"cd $GOROOT/src; go list ./io/...\" would incorrectly skip the io\n\t\t\t// package, because prepending the prefix \"./\" to the unclean path would\n\t\t\t// result in \"././io\", and match(\"././io\") returns false.\n\t\t\tpath = filepath.Clean(path)\n\t\t}\n\n\t\t// Avoid .foo, _foo, and testdata directory trees, but do not avoid \".\" or \"..\".\n\t\t_, elem := filepath.Split(path)\n\t\tdot := strings.HasPrefix(elem, \".\") && elem != \".\" && elem != \"..\"\n\t\tif dot || strings.HasPrefix(elem, \"_\") || elem == \"testdata\" {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\n\t\tname := prefix + filepath.ToSlash(path)\n\t\tif !match(name) {\n\t\t\treturn nil\n\t\t}\n\n\t\t// We keep the directory if we can import it, or if we can't import it\n\t\t// due to invalid Go source files. This means that directories containing\n\t\t// parse errors will be built (and fail) instead of being silently skipped\n\t\t// as not matching the pattern. Go 1.5 and earlier skipped, but that\n\t\t// behavior means people miss serious mistakes.\n\t\t// See golang.org/issue/11407.\n\t\tif p, err := c.BuildContext.ImportDir(path, 0); err != nil && (p == nil || len(p.InvalidGoFiles) == 0) {\n\t\t\tif _, noGo := err.(*build.NoGoError); !noGo {\n\t\t\t\tlog.Print(err)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tpkgs = append(pkgs, name)\n\t\treturn nil\n\t})\n\treturn pkgs\n}\n\n// treeCanMatchPattern(pattern)(name) reports whether\n// name or children of name can possibly match pattern.\n// Pattern is the same limited glob accepted by matchPattern.\nfunc treeCanMatchPattern(pattern string) func(name string) bool {\n\twildCard := false\n\tif i := strings.Index(pattern, \"...\"); i >= 0 {\n\t\twildCard = true\n\t\tpattern = pattern[:i]\n\t}\n\treturn func(name string) bool {\n\t\treturn len(name) <= len(pattern) && hasPathPrefix(pattern, name) ||\n\t\t\twildCard && strings.HasPrefix(name, pattern)\n\t}\n}\n\n// matchPattern(pattern)(name) reports whether\n// name matches pattern. Pattern is a limited glob\n// pattern in which '...' means 'any string' and there\n// is no other special syntax.\n// Unfortunately, there are two special cases. Quoting \"go help packages\":\n//\n// First, /... at the end of the pattern can match an empty string,\n// so that net/... matches both net and packages in its subdirectories, like net/http.\n// Second, any slash-separted pattern element containing a wildcard never\n// participates in a match of the \"vendor\" element in the path of a vendored\n// package, so that ./... does not match packages in subdirectories of\n// ./vendor or ./mycode/vendor, but ./vendor/... and ./mycode/vendor/... do.\n// Note, however, that a directory named vendor that itself contains code\n// is not a vendored package: cmd/vendor would be a command named vendor,\n// and the pattern cmd/... matches it.\nfunc matchPattern(pattern string) func(name string) bool {\n\t// Convert pattern to regular expression.\n\t// The strategy for the trailing /... is to nest it in an explicit ? expression.\n\t// The strategy for the vendor exclusion is to change the unmatchable\n\t// vendor strings to a disallowed code point (vendorChar) and to use\n\t// \"(anything but that codepoint)*\" as the implementation of the ... wildcard.\n\t// This is a bit complicated but the obvious alternative,\n\t// namely a hand-written search like in most shell glob matchers,\n\t// is too easy to make accidentally exponential.\n\t// Using package regexp guarantees linear-time matching.\n\n\tconst vendorChar = \"\\x00\"\n\n\tif strings.Contains(pattern, vendorChar) {\n\t\treturn func(name string) bool { return false }\n\t}\n\n\tre := regexp.QuoteMeta(pattern)\n\tre = replaceVendor(re, vendorChar)\n\tswitch {\n\tcase strings.HasSuffix(re, `/`+vendorChar+`/\\.\\.\\.`):\n\t\tre = strings.TrimSuffix(re, `/`+vendorChar+`/\\.\\.\\.`) + `(/vendor|/` + vendorChar + `/\\.\\.\\.)`\n\tcase re == vendorChar+`/\\.\\.\\.`:\n\t\tre = `(/vendor|/` + vendorChar + `/\\.\\.\\.)`\n\tcase strings.HasSuffix(re, `/\\.\\.\\.`):\n\t\tre = strings.TrimSuffix(re, `/\\.\\.\\.`) + `(/\\.\\.\\.)?`\n\t}\n\tre = strings.Replace(re, `\\.\\.\\.`, `[^`+vendorChar+`]*`, -1)\n\n\treg := regexp.MustCompile(`^` + re + `$`)\n\n\treturn func(name string) bool {\n\t\tif strings.Contains(name, vendorChar) {\n\t\t\treturn false\n\t\t}\n\t\treturn reg.MatchString(replaceVendor(name, vendorChar))\n\t}\n}\n\n// replaceVendor returns the result of replacing\n// non-trailing vendor path elements in x with repl.\nfunc replaceVendor(x, repl string) string {\n\tif !strings.Contains(x, \"vendor\") {\n\t\treturn x\n\t}\n\telem := strings.Split(x, \"/\")\n\tfor i := 0; i < len(elem)-1; i++ {\n\t\tif elem[i] == \"vendor\" {\n\t\t\telem[i] = repl\n\t\t}\n\t}\n\treturn strings.Join(elem, \"/\")\n}\n\n// ImportPaths returns the import paths to use for the given command line.\nfunc (c *Context) ImportPaths(args []string) []string {\n\targs = c.ImportPathsNoDotExpansion(args)\n\tvar out []string\n\tfor _, a := range args {\n\t\tif strings.Contains(a, \"...\") {\n\t\t\tif build.IsLocalImport(a) {\n\t\t\t\tout = append(out, c.allPackagesInFS(a)...)\n\t\t\t} else {\n\t\t\t\tout = append(out, c.allPackages(a)...)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, a)\n\t}\n\treturn out\n}\n\n// ImportPathsNoDotExpansion returns the import paths to use for the given\n// command line, but it does no ... expansion.\nfunc (c *Context) ImportPathsNoDotExpansion(args []string) []string {\n\tif len(args) == 0 {\n\t\treturn []string{\".\"}\n\t}\n\tvar out []string\n\tfor _, a := range args {\n\t\t// Arguments are supposed to be import paths, but\n\t\t// as a courtesy to Windows developers, rewrite \\ to /\n\t\t// in command-line arguments. Handles .\\... and so on.\n\t\tif filepath.Separator == '\\\\' {\n\t\t\ta = strings.Replace(a, `\\`, `/`, -1)\n\t\t}\n\n\t\t// Put argument in canonical form, but preserve leading ./.\n\t\tif strings.HasPrefix(a, \"./\") {\n\t\t\ta = \"./\" + path.Clean(a)\n\t\t\tif a == \"./.\" {\n\t\t\t\ta = \".\"\n\t\t\t}\n\t\t} else {\n\t\t\ta = path.Clean(a)\n\t\t}\n\t\tif IsMetaPackage(a) {\n\t\t\tout = append(out, c.allPackages(a)...)\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, a)\n\t}\n\treturn out\n}\n\n// IsMetaPackage checks if name is a reserved package name that expands to multiple packages.\nfunc IsMetaPackage(name string) bool {\n\treturn name == \"std\" || name == \"cmd\" || name == \"all\"\n}\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/gotool/match.go",
    "content": "// Copyright (c) 2009 The Go Authors. All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//    * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//    * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//    * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// +build go1.9\n\npackage gotool\n\nimport (\n\t\"path/filepath\"\n\n\t\"github.com/kisielk/gotool/internal/load\"\n)\n\n// importPaths returns the import paths to use for the given command line.\nfunc (c *Context) importPaths(args []string) []string {\n\tlctx := load.Context{\n\t\tBuildContext: c.BuildContext,\n\t\tGOROOTsrc:    c.joinPath(c.BuildContext.GOROOT, \"src\"),\n\t}\n\treturn lctx.ImportPaths(args)\n}\n\n// joinPath calls c.BuildContext.JoinPath (if not nil) or else filepath.Join.\n//\n// It's a copy of the unexported build.Context.joinPath helper.\nfunc (c *Context) joinPath(elem ...string) string {\n\tif f := c.BuildContext.JoinPath; f != nil {\n\t\treturn f(elem...)\n\t}\n\treturn filepath.Join(elem...)\n}\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/gotool/match18.go",
    "content": "// Copyright (c) 2009 The Go Authors. All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//    * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//    * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//    * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// +build !go1.9\n\npackage gotool\n\nimport (\n\t\"fmt\"\n\t\"go/build\"\n\t\"log\"\n\t\"os\"\n\t\"path\"\n\t\"path/filepath\"\n\t\"regexp\"\n\t\"strings\"\n)\n\n// This file contains code from the Go distribution.\n\n// matchPattern(pattern)(name) reports whether\n// name matches pattern. Pattern is a limited glob\n// pattern in which '...' means 'any string' and there\n// is no other special syntax.\nfunc matchPattern(pattern string) func(name string) bool {\n\tre := regexp.QuoteMeta(pattern)\n\tre = strings.Replace(re, `\\.\\.\\.`, `.*`, -1)\n\t// Special case: foo/... matches foo too.\n\tif strings.HasSuffix(re, `/.*`) {\n\t\tre = re[:len(re)-len(`/.*`)] + `(/.*)?`\n\t}\n\treg := regexp.MustCompile(`^` + re + `$`)\n\treturn reg.MatchString\n}\n\n// matchPackages returns a list of package paths matching pattern\n// (see go help packages for pattern syntax).\nfunc (c *Context) matchPackages(pattern string) []string {\n\tmatch := func(string) bool { return true }\n\ttreeCanMatch := func(string) bool { return true }\n\tif !isMetaPackage(pattern) {\n\t\tmatch = matchPattern(pattern)\n\t\ttreeCanMatch = treeCanMatchPattern(pattern)\n\t}\n\n\thave := map[string]bool{\n\t\t\"builtin\": true, // ignore pseudo-package that exists only for documentation\n\t}\n\tif !c.BuildContext.CgoEnabled {\n\t\thave[\"runtime/cgo\"] = true // ignore during walk\n\t}\n\tvar pkgs []string\n\n\tfor _, src := range c.BuildContext.SrcDirs() {\n\t\tif (pattern == \"std\" || pattern == \"cmd\") && src != gorootSrc {\n\t\t\tcontinue\n\t\t}\n\t\tsrc = filepath.Clean(src) + string(filepath.Separator)\n\t\troot := src\n\t\tif pattern == \"cmd\" {\n\t\t\troot += \"cmd\" + string(filepath.Separator)\n\t\t}\n\t\tfilepath.Walk(root, func(path string, fi os.FileInfo, err error) error {\n\t\t\tif err != nil || !fi.IsDir() || path == src {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\t// Avoid .foo, _foo, and testdata directory trees.\n\t\t\t_, elem := filepath.Split(path)\n\t\t\tif strings.HasPrefix(elem, \".\") || strings.HasPrefix(elem, \"_\") || elem == \"testdata\" {\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\n\t\t\tname := filepath.ToSlash(path[len(src):])\n\t\t\tif pattern == \"std\" && (!isStandardImportPath(name) || name == \"cmd\") {\n\t\t\t\t// The name \"std\" is only the standard library.\n\t\t\t\t// If the name is cmd, it's the root of the command tree.\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\t\t\tif !treeCanMatch(name) {\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\t\t\tif have[name] {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\thave[name] = true\n\t\t\tif !match(name) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\t_, err = c.BuildContext.ImportDir(path, 0)\n\t\t\tif err != nil {\n\t\t\t\tif _, noGo := err.(*build.NoGoError); noGo {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t\tpkgs = append(pkgs, name)\n\t\t\treturn nil\n\t\t})\n\t}\n\treturn pkgs\n}\n\n// importPathsNoDotExpansion returns the import paths to use for the given\n// command line, but it does no ... expansion.\nfunc (c *Context) importPathsNoDotExpansion(args []string) []string {\n\tif len(args) == 0 {\n\t\treturn []string{\".\"}\n\t}\n\tvar out []string\n\tfor _, a := range args {\n\t\t// Arguments are supposed to be import paths, but\n\t\t// as a courtesy to Windows developers, rewrite \\ to /\n\t\t// in command-line arguments. Handles .\\... and so on.\n\t\tif filepath.Separator == '\\\\' {\n\t\t\ta = strings.Replace(a, `\\`, `/`, -1)\n\t\t}\n\n\t\t// Put argument in canonical form, but preserve leading ./.\n\t\tif strings.HasPrefix(a, \"./\") {\n\t\t\ta = \"./\" + path.Clean(a)\n\t\t\tif a == \"./.\" {\n\t\t\t\ta = \".\"\n\t\t\t}\n\t\t} else {\n\t\t\ta = path.Clean(a)\n\t\t}\n\t\tif isMetaPackage(a) {\n\t\t\tout = append(out, c.allPackages(a)...)\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, a)\n\t}\n\treturn out\n}\n\n// importPaths returns the import paths to use for the given command line.\nfunc (c *Context) importPaths(args []string) []string {\n\targs = c.importPathsNoDotExpansion(args)\n\tvar out []string\n\tfor _, a := range args {\n\t\tif strings.Contains(a, \"...\") {\n\t\t\tif build.IsLocalImport(a) {\n\t\t\t\tout = append(out, c.allPackagesInFS(a)...)\n\t\t\t} else {\n\t\t\t\tout = append(out, c.allPackages(a)...)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, a)\n\t}\n\treturn out\n}\n\n// allPackages returns all the packages that can be found\n// under the $GOPATH directories and $GOROOT matching pattern.\n// The pattern is either \"all\" (all packages), \"std\" (standard packages),\n// \"cmd\" (standard commands), or a path including \"...\".\nfunc (c *Context) allPackages(pattern string) []string {\n\tpkgs := c.matchPackages(pattern)\n\tif len(pkgs) == 0 {\n\t\tfmt.Fprintf(os.Stderr, \"warning: %q matched no packages\\n\", pattern)\n\t}\n\treturn pkgs\n}\n\n// allPackagesInFS is like allPackages but is passed a pattern\n// beginning ./ or ../, meaning it should scan the tree rooted\n// at the given directory. There are ... in the pattern too.\nfunc (c *Context) allPackagesInFS(pattern string) []string {\n\tpkgs := c.matchPackagesInFS(pattern)\n\tif len(pkgs) == 0 {\n\t\tfmt.Fprintf(os.Stderr, \"warning: %q matched no packages\\n\", pattern)\n\t}\n\treturn pkgs\n}\n\n// matchPackagesInFS returns a list of package paths matching pattern,\n// which must begin with ./ or ../\n// (see go help packages for pattern syntax).\nfunc (c *Context) matchPackagesInFS(pattern string) []string {\n\t// Find directory to begin the scan.\n\t// Could be smarter but this one optimization\n\t// is enough for now, since ... is usually at the\n\t// end of a path.\n\ti := strings.Index(pattern, \"...\")\n\tdir, _ := path.Split(pattern[:i])\n\n\t// pattern begins with ./ or ../.\n\t// path.Clean will discard the ./ but not the ../.\n\t// We need to preserve the ./ for pattern matching\n\t// and in the returned import paths.\n\tprefix := \"\"\n\tif strings.HasPrefix(pattern, \"./\") {\n\t\tprefix = \"./\"\n\t}\n\tmatch := matchPattern(pattern)\n\n\tvar pkgs []string\n\tfilepath.Walk(dir, func(path string, fi os.FileInfo, err error) error {\n\t\tif err != nil || !fi.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tif path == dir {\n\t\t\t// filepath.Walk starts at dir and recurses. For the recursive case,\n\t\t\t// the path is the result of filepath.Join, which calls filepath.Clean.\n\t\t\t// The initial case is not Cleaned, though, so we do this explicitly.\n\t\t\t//\n\t\t\t// This converts a path like \"./io/\" to \"io\". Without this step, running\n\t\t\t// \"cd $GOROOT/src; go list ./io/...\" would incorrectly skip the io\n\t\t\t// package, because prepending the prefix \"./\" to the unclean path would\n\t\t\t// result in \"././io\", and match(\"././io\") returns false.\n\t\t\tpath = filepath.Clean(path)\n\t\t}\n\n\t\t// Avoid .foo, _foo, and testdata directory trees, but do not avoid \".\" or \"..\".\n\t\t_, elem := filepath.Split(path)\n\t\tdot := strings.HasPrefix(elem, \".\") && elem != \".\" && elem != \"..\"\n\t\tif dot || strings.HasPrefix(elem, \"_\") || elem == \"testdata\" {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\n\t\tname := prefix + filepath.ToSlash(path)\n\t\tif !match(name) {\n\t\t\treturn nil\n\t\t}\n\n\t\t// We keep the directory if we can import it, or if we can't import it\n\t\t// due to invalid Go source files. This means that directories containing\n\t\t// parse errors will be built (and fail) instead of being silently skipped\n\t\t// as not matching the pattern. Go 1.5 and earlier skipped, but that\n\t\t// behavior means people miss serious mistakes.\n\t\t// See golang.org/issue/11407.\n\t\tif p, err := c.BuildContext.ImportDir(path, 0); err != nil && shouldIgnoreImport(p) {\n\t\t\tif _, noGo := err.(*build.NoGoError); !noGo {\n\t\t\t\tlog.Print(err)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tpkgs = append(pkgs, name)\n\t\treturn nil\n\t})\n\treturn pkgs\n}\n\n// isMetaPackage checks if name is a reserved package name that expands to multiple packages.\nfunc isMetaPackage(name string) bool {\n\treturn name == \"std\" || name == \"cmd\" || name == \"all\"\n}\n\n// isStandardImportPath reports whether $GOROOT/src/path should be considered\n// part of the standard distribution. For historical reasons we allow people to add\n// their own code to $GOROOT instead of using $GOPATH, but we assume that\n// code will start with a domain name (dot in the first element).\nfunc isStandardImportPath(path string) bool {\n\ti := strings.Index(path, \"/\")\n\tif i < 0 {\n\t\ti = len(path)\n\t}\n\telem := path[:i]\n\treturn !strings.Contains(elem, \".\")\n}\n\n// hasPathPrefix reports whether the path s begins with the\n// elements in prefix.\nfunc hasPathPrefix(s, prefix string) bool {\n\tswitch {\n\tdefault:\n\t\treturn false\n\tcase len(s) == len(prefix):\n\t\treturn s == prefix\n\tcase len(s) > len(prefix):\n\t\tif prefix != \"\" && prefix[len(prefix)-1] == '/' {\n\t\t\treturn strings.HasPrefix(s, prefix)\n\t\t}\n\t\treturn s[len(prefix)] == '/' && s[:len(prefix)] == prefix\n\t}\n}\n\n// treeCanMatchPattern(pattern)(name) reports whether\n// name or children of name can possibly match pattern.\n// Pattern is the same limited glob accepted by matchPattern.\nfunc treeCanMatchPattern(pattern string) func(name string) bool {\n\twildCard := false\n\tif i := strings.Index(pattern, \"...\"); i >= 0 {\n\t\twildCard = true\n\t\tpattern = pattern[:i]\n\t}\n\treturn func(name string) bool {\n\t\treturn len(name) <= len(pattern) && hasPathPrefix(pattern, name) ||\n\t\t\twildCard && strings.HasPrefix(name, pattern)\n\t}\n}\n"
  },
  {
    "path": "_tools/src/github.com/kisielk/gotool/tool.go",
    "content": "// Package gotool contains utility functions used to implement the standard\n// \"cmd/go\" tool, provided as a convenience to developers who want to write\n// tools with similar semantics.\npackage gotool\n\nimport \"go/build\"\n\n// Export functions here to make it easier to keep the implementations up to date with upstream.\n\n// DefaultContext is the default context that uses build.Default.\nvar DefaultContext = Context{\n\tBuildContext: build.Default,\n}\n\n// A Context specifies the supporting context.\ntype Context struct {\n\t// BuildContext is the build.Context that is used when computing import paths.\n\tBuildContext build.Context\n}\n\n// ImportPaths returns the import paths to use for the given command line.\n//\n// The path \"all\" is expanded to all packages in $GOPATH and $GOROOT.\n// The path \"std\" is expanded to all packages in the Go standard library.\n// The path \"cmd\" is expanded to all Go standard commands.\n// The string \"...\" is treated as a wildcard within a path.\n// When matching recursively, directories are ignored if they are prefixed with\n// a dot or an underscore (such as \".foo\" or \"_foo\"), or are named \"testdata\".\n// Relative import paths are not converted to full import paths.\n// If args is empty, a single element \".\" is returned.\nfunc (c *Context) ImportPaths(args []string) []string {\n\treturn c.importPaths(args)\n}\n\n// ImportPaths returns the import paths to use for the given command line\n// using default context.\n//\n// The path \"all\" is expanded to all packages in $GOPATH and $GOROOT.\n// The path \"std\" is expanded to all packages in the Go standard library.\n// The path \"cmd\" is expanded to all Go standard commands.\n// The string \"...\" is treated as a wildcard within a path.\n// When matching recursively, directories are ignored if they are prefixed with\n// a dot or an underscore (such as \".foo\" or \"_foo\"), or are named \"testdata\".\n// Relative import paths are not converted to full import paths.\n// If args is empty, a single element \".\" is returned.\nfunc ImportPaths(args []string) []string {\n\treturn DefaultContext.importPaths(args)\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2017 Twitch Interactive, Inc.\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/README.md",
    "content": "# Retool: Vendor thy tools! #\n\n[![Build Status](https://travis-ci.org/twitchtv/retool.svg?branch=master)](https://travis-ci.org/twitchtv/retool)\n[![Windows Build status](https://ci.appveyor.com/api/projects/status/06x2vd5nh683iscu/branch/master?svg=true&passingText=Windows%20build%20passing&pendingText=Windows%20build%20pending&failingText=Windows%20build%20failing)](https://ci.appveyor.com/project/spenczar/retool/branch/master)\n\n\n## what is this ##\n\nretool helps manage the versions of _tools_ that you use with your\nrepository. These are executables that are a crucial part of your\ndevelopment environment, but aren't imported by any of your code, so\nthey don't get scooped up by glide or godep (or any other vendoring\ntool).\n\nSome examples of tools:\n\n - [github.com/tools/godep](https://github.com/tools/godep) is a tool to\n   vendor Go packages.\n - [github.com/golang/protobuf/protoc-gen-go](https://github.com/golang/protobuf/protoc-gen-go)\n   is a tool to compile Go code from protobuf definitions.\n - [github.com/maxbrunsfeld/counterfeiter](https://github.com/maxbrunsfeld/counterfeiter)\n   is a tool to generate mocks of interfaces.\n\nYou want this if you use code generation: if everybody has a different\nversion of the code generator, then you'll get meaningless churn across\nruns of the generator unless everyone is pinned to the right version.\n\nYou might also want this if you use linters or tools like\n[github.com/kisielk/errcheck](https://github.com/kisielk/errcheck) in an\nautomated fashion and you want to make sure that everyone has the same\nversion so you can pass flags to the linter with confidence.\n\nretool pins on a per-project basis. It works by making a complete GOPATH\nwithin your project. You can choose to commit the source files for those\ntools, if you like.\n\n## usage ##\n\nThe expected workflow is something like this:\n\nInstall retool:\n```sh\ngo get github.com/twitchtv/retool\n```\n\nAdd a tool dependency:\n```sh\nretool add github.com/jteeuwen/go-bindata/go-bindata origin/master\n```\n\nUse it to generate code:\n```sh\nretool do go-bindata -pkg testdata -o ./testdata/testdata.go ./testdata/data.json\n```\n\n---\n\nThere are a few other commands that you'll use much less often:\n\nUpgrade a tool to its latest version:\n```sh\nretool upgrade github.com/spf13/hugo origin/master\n# or to a particular tag\nretool upgrade github.com/spf13/hugo v0.17\n```\n\nStop using that tool you dont like anymore:\n```sh\nretool remove github.com/tools/godep\n```\n\nCompile all the tools that other people have vendored in a project:\n```sh\n# compiles everything without using the network - useful for isolated build environments\nretool build\n```\n\nDouble-check that you're in sync by comparing everything with upstream versions:\n```sh\n# makes sure your tools match tools.json by comparing against their remotes\nretool sync\n```\n\n## why would i need to manage these things  ##\n\n**TL;DR:** if you work with anyone else on your project, and they have\ndifferent versions of their tools, everything turns to shit.\n\nOne of the best parts about Go is that it is very, very simple. This\nmakes it straightforward to write code generation utilities. You don't\nneed to generate code for every project, but in large ones, code\ngeneration can help you be much more productive.\n\nLike, if you're writing tests that use an interface, you can use code\ngeneration to quickly whip up structs which mock the interface so you\ncan force them to return errors. This way, you can test edge cases for\nyour interaction points with\ninterfaces. [github.com/maxbrunsfeld/counterfeiter](https://github.com/maxbrunsfeld/counterfeiter)\ndoes this pretty well!\n\nIf you want to use the generated code, you should check in the\ngenerated `.go` code to git, not just the sources, so that build boxes\nand the like don't need all these code generation tools, and so that\n`go get` just works cleanly.\n\nThis poses a problem, though, as soon as you start working with other\npeople on your project: if you have different versions of your code\ngeneration tools, which generate slightly different output, you'll get\nlots of meaningless churn in your commits. This sucks! There has to be\na better way!\n\n## the retool way ##\n\nretool records the versions of tools you want in a file, `tools.json`.\nThe file looks like this:\n\n```json\n{\n  \"Tools\": [\n    {\n      \"Repository\": \"github.com/golang/protobuf/protoc-gen-go\",\n      \"Commit\": \"2fea9e168bab814ca0c6e292a6be164f624fc6ca\"\n    }\n  ]\n}\n```\n\nTools are identified by repo and commit. Each tool in `tools.json` will\nbe installed to `_tools`, which is a private GOPATH just dedicated to\nkeeping track of these tools.\n\nIn practice, you don't need to know much about `tools.json`. You check\nit in to git so that everybody stays in sync, but you manage it with\n`retool add|upgrade|remove`.\n\nWhen it's time to generate code, **instead of `go generate ./...`**, you\nuse `retool do go generate ./...` to use your sweet, vendored tools.\nThis really just calls `PATH=$PWD/_tools/bin:PATH go generate ./...`; if\nyou want to do anything fancy, you can feel free to use that path too.\n\n## contributing to retool ##\n\nAny pull requests are extremely welcome! If you run into problems or\nhave questions, please raise a github issue!\n\nRetool's tests are mostly integration tests. They require a working Go\ncompiler, a working version of git, and network access.\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/add.go",
    "content": "package main\n\nfunc (s spec) add(t *tool) {\n\tif s.find(t) != -1 {\n\t\tlog(t.Repository + \" already installed (did you mean retool upgrade?)\")\n\t\treturn\n\t}\n\n\ts.Tools = append(s.Tools, t)\n\n\ts.sync()\n\n\terr := s.write()\n\tif err != nil {\n\t\tfatal(\"unable to add \"+t.Repository, err)\n\t}\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/build.go",
    "content": "package main\n\n// builds all tools in the spec file using whatever is installed in the tool directory (_tools,\n// typically). Shouldn't do any network if _tools is set up correctly.\nfunc (s spec) build() {\n\terr := setGoEnv()\n\tif err != nil {\n\t\tfatal(\"unable to set GOPATH and GOBIN env variables\", err)\n\t}\n\n\tm := getManifest()\n\tfor _, t := range s.Tools {\n\t\terr := install(t)\n\t\tif err != nil {\n\t\t\tfatalExec(\"go install \"+t.Repository, err)\n\t\t}\n\t}\n\tm.replace(s.Tools)\n\tm.write()\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/clean.go",
    "content": "package main\n\nimport (\n\t\"fmt\"\n\t\"go/build\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n)\n\ntype stringSet map[string]struct{}\n\nfunc (ss stringSet) add(val string) { ss[val] = struct{}{} }\nfunc (ss stringSet) has(val string) bool {\n\t_, ok := ss[val]\n\treturn ok\n}\n\n// compute the set of dependencies for a list of packages. The packages must\n// already be present in toolDirPath.\nfunc dependencies(pkgs []string) stringSet {\n\tdeps := stringSet{}\n\n\tbuildCtx := build.Default\n\tbuildCtx.GOPATH = toolDirPath\n\n\tvar resolve func(string, []string)\n\tresolve = func(parent string, pkgs []string) {\n\t\tfor _, pkg := range pkgs {\n\t\t\tif !strings.Contains(pkg, \".\") {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tp, err := buildCtx.Import(pkg, filepath.Join(toolDirPath, \"src\", parent), 0)\n\t\t\tif err != nil {\n\t\t\t\tfatal(fmt.Sprintf(\"couldn't import package %q\", pkg), err)\n\t\t\t}\n\n\t\t\tif deps.has(p.ImportPath) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tdeps.add(p.ImportPath)\n\t\t\tresolve(p.ImportPath, p.Imports)\n\t\t}\n\t}\n\n\tresolve(\"\", pkgs)\n\n\treturn deps\n}\n\n// Remove unused files and unused packages from toolDirPath.\nfunc clean(pkgs []string) {\n\tdeps := dependencies(pkgs)\n\tbase := filepath.Join(toolDirPath, \"src\")\n\n\t// Resolve any symlinks in the packages to keep, because we're going\n\t// to walk through the file system, so we need to trim stuff by\n\t// _filename_.\n\tfor pkgPath := range deps {\n\t\tfullPath := filepath.Join(base, pkgPath)\n\t\tresolved, err := filepath.EvalSymlinks(fullPath)\n\t\tif err != nil {\n\t\t\tfatal(fmt.Sprintf(\"couldn't eval symlinks in %q\", pkgPath), err)\n\t\t}\n\t\t// Undo the filepath.Join from above\n\t\tpkgPath, err = filepath.Rel(base, resolved)\n\t\tif err != nil {\n\t\t\tfatal(fmt.Sprintf(\"couldn't eval symlinks in %q\", pkgPath), err)\n\t\t}\n\t\tdeps.add(pkgPath)\n\t}\n\n\tvar toDelete []string\n\terr := filepath.Walk(base, func(path string, info os.FileInfo, err error) error {\n\t\t// Bubble up errors\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Skip the root directory\n\t\tif base == path {\n\t\t\treturn nil\n\t\t}\n\n\t\t// Get the package directory\n\t\tpkg, err := filepath.Rel(base, path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Delete files in packages that aren't in packages we need to build the\n\t\t// tools, and any non-go, non-legal files in packages we *do* need.\n\t\tif info.Mode().IsRegular() {\n\t\t\tpkg = filepath.Dir(pkg)\n\t\t\tif !(deps.has(pkg) && keepFile(path)) {\n\t\t\t\ttoDelete = append(toDelete, path)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\t// If the path is a directory that's specially marked for preservation, keep\n\t\t// it and all its contents.\n\t\tif info.IsDir() && preserveDirectory(path) {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\n\t\t// If the folder is a kept package or a parent, don't delete it and keep recursing\n\t\tfor p := range deps {\n\t\t\tif strings.HasPrefix(p, pkg) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\t// Otherwise this is a package that isn't imported at all. Delete it and stop recursing\n\t\ttoDelete = append(toDelete, path)\n\t\treturn filepath.SkipDir\n\t})\n\n\tif err != nil {\n\t\tfatal(\"unable to clean _tools\", err)\n\t}\n\n\tfor _, path := range toDelete {\n\t\terr = os.RemoveAll(path)\n\t\tif err != nil {\n\t\t\tfatal(\"unable to remove file or directory\", err)\n\t\t}\n\t}\n}\n\nfunc keepFile(filename string) bool {\n\tif strings.HasSuffix(filename, \"_test.go\") {\n\t\treturn false\n\t}\n\n\tswitch filepath.Ext(filename) {\n\tcase \".go\", \".s\", \".c\", \".h\":\n\t\treturn true\n\t}\n\n\tif isLegalFile(filename) {\n\t\treturn true\n\t}\n\treturn false\n}\n\nvar commonLegalFilePrefixes = []string{\n\t\"licence\", // UK spelling\n\t\"license\", // US spelling\n\t\"copying\",\n\t\"unlicense\",\n\t\"copyright\",\n\t\"copyleft\",\n\t\"authors\",\n\t\"contributors\",\n\t\"readme\", // often has a license inline\n}\n\nvar commonLegalFileSubstrings = []string{\n\t\"legal\",\n\t\"notice\",\n\t\"disclaimer\",\n\t\"patent\",\n\t\"third-party\",\n\t\"thirdparty\",\n}\n\nfunc isLegalFile(filename string) bool {\n\tbase := strings.ToLower(filepath.Base(filename))\n\tfor _, p := range commonLegalFilePrefixes {\n\t\tif strings.HasPrefix(base, p) {\n\t\t\treturn true\n\t\t}\n\t}\n\tfor _, s := range commonLegalFileSubstrings {\n\t\tif strings.Contains(base, s) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n// List of directories that should be completely preserved if they are present.\nvar preservedDirectories = []string{\n\t// gometalinter vendors its own linters and relies on this directory's\n\t// existence. See issue #7.\n\tfilepath.Join(\"github.com\", \"alecthomas\", \"gometalinter\", \"_linters\"),\n\n\t// sqlboiler requires template files to exist at runtime. See pull request #25.\n\tfilepath.Join(\"github.com\", \"vattle\", \"sqlboiler\", \"templates\"),\n\tfilepath.Join(\"github.com\", \"vattle\", \"sqlboiler\", \"templates_test\"),\n\tfilepath.Join(\"github.com\", \"volatiletech\", \"sqlboiler\", \"templates\"),\n\tfilepath.Join(\"github.com\", \"volatiletech\", \"sqlboiler\", \"templates_test\"),\n}\n\n// checks whether path is in the list of preserved directories.\nfunc preserveDirectory(path string) bool {\n\tfor _, d := range preservedDirectories {\n\t\tif strings.HasSuffix(path, d) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/do.go",
    "content": "package main\n\nimport (\n\t\"os\"\n\t\"os/exec\"\n\t\"path/filepath\"\n\t\"strings\"\n)\n\nfunc setPath() error {\n\tprevpath := os.Getenv(\"PATH\")\n\tnewPath := filepath.Join(toolDirPath, \"bin\") + string(os.PathListSeparator) + prevpath\n\treturn os.Setenv(\"PATH\", newPath)\n}\n\n// setGoEnv sets GOBIN and GOPATH to point to _tools/bin and $GOPATH:_tools,\n// respectively. This is done for github.com/alecthomas/gometalinter\n// compatibility: gometalinter vendors its own linters, and checks for their\n// existence by checking in each GOPATH entry for\n// src/github.com/alecthomas/gometalinter/_linters.\n//\n// GOBIN is set so gometalinter will use it to decide where to put its vendored\n// linters with the gometalinter --install command, and so that it prefers the\n// binaries built in _tools/bin when executing linters.\nfunc setGoEnv() error {\n\tnewGoBin := filepath.Join(toolDirPath, \"bin\")\n\tif err := os.Setenv(\"GOBIN\", newGoBin); err != nil {\n\t\treturn err\n\t}\n\n\tprevGoPath := os.Getenv(\"GOPATH\")\n\tnewGoPath := prevGoPath + string(os.PathListSeparator) + toolDirPath\n\treturn os.Setenv(\"GOPATH\", newGoPath)\n}\n\nfunc do() {\n\targs := positionalArgs\n\tif len(args) == 0 {\n\t\tfatal(\"no command passed to retool do\", nil)\n\t}\n\n\tif err := setPath(); err != nil {\n\t\tfatal(\"unable to set PATH\", err)\n\t}\n\tif err := setGoEnv(); err != nil {\n\t\tfatal(\"unable to set up go environment variables\", err)\n\t}\n\n\tcmd := exec.Command(args[0], args[1:]...)\n\tcmd.Stdin = os.Stdin\n\tcmd.Stderr = os.Stderr\n\tcmd.Stdout = os.Stdout\n\n\terr := cmd.Run()\n\tif err != nil {\n\t\tmsg := \"failed on '\" + strings.Join(args, \" \") + \"'\"\n\t\tfatal(msg, err)\n\t}\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/input.go",
    "content": "package main\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"os\"\n)\n\nvar (\n\tverboseFlag = flag.Bool(\"verbose\", false, \"Enable more detailed output that may be helpful for troubleshooting.\")\n\tforkFlag    = flag.String(\"f\", \"\", \"Use a fork of the repository rather than the default upstream\")\n\n\t// TODO: Refactor so that this global state is not necessary.\n\tpositionalArgs []string\n)\n\nfunc verbosef(format string, a ...interface{}) {\n\tif *verboseFlag {\n\t\t_, _ = fmt.Fprintf(os.Stderr, format, a...)\n\t}\n}\n\nfunc parseArgs() (command string, t *tool) {\n\tif !flag.Parsed() {\n\t\tpanic(\"parseArgs expects that flags have already been parsed\")\n\t}\n\n\targs := flag.Args()\n\n\tif len(args) < 1 {\n\t\tprintUsageAndExit(\"\", 1)\n\t}\n\n\tcommand = args[0]\n\targs = args[1:]\n\tt = new(tool)\n\tpositionalArgs = args\n\n\tswitch command {\n\tcase \"version\":\n\t\tassertArgLength(args, command, 0)\n\t\treturn \"version\", t\n\n\tcase \"sync\":\n\t\tassertArgLength(args, command, 0)\n\t\treturn \"sync\", t\n\n\tcase \"add\":\n\t\tassertArgLength(args, command, 2)\n\t\tt.Repository = args[0]\n\t\tt.ref = args[1]\n\t\tt.Fork = *forkFlag\n\t\treturn \"add\", t\n\n\tcase \"upgrade\":\n\t\tassertArgLength(args, command, 2)\n\t\tt.Repository = args[0]\n\t\tt.ref = args[1]\n\t\tt.Fork = *forkFlag\n\t\treturn \"upgrade\", t\n\n\tcase \"remove\":\n\t\tassertArgLength(args, command, 1)\n\t\tt.Repository = args[0]\n\t\treturn \"remove\", t\n\n\tcase \"do\":\n\t\t// A variable number of arguments are permissible for the 'do' subcommand; they are passed via t.PositionalArgs.\n\t\treturn \"do\", t\n\n\tcase \"clean\":\n\t\tassertArgLength(args, command, 0)\n\t\treturn \"clean\", t\n\n\tcase \"build\":\n\t\tassertArgLength(args, command, 0)\n\t\treturn \"build\", t\n\n\tcase \"help\":\n\t\tassertArgLength(args, command, 1)\n\t\tprintUsageAndExit(args[0], 0)\n\n\tdefault:\n\t\tprintUsageAndExit(\"\", 1)\n\t}\n\treturn \"\", t\n}\n\nfunc assertArgLength(args []string, command string, arglength int) {\n\tif len(args) != arglength {\n\t\tprintUsageAndExit(command, 1)\n\t}\n}\n\nfunc printUsageAndExit(command string, exitCode int) {\n\tswitch command {\n\tcase \"add\":\n\t\tfmt.Println(addUsage)\n\tcase \"remove\":\n\t\tfmt.Println(removeUsage)\n\tcase \"upgrade\":\n\t\tfmt.Println(upgradeUsage)\n\tcase \"sync\":\n\t\tfmt.Println(syncUsage)\n\tcase \"do\":\n\t\tfmt.Println(doUsage)\n\tcase \"clean\":\n\t\tfmt.Println(cleanUsage)\n\tcase \"build\":\n\t\tfmt.Println(buildUsage)\n\tdefault:\n\t\tfmt.Println(usage)\n\t}\n\tos.Exit(exitCode)\n}\n\nconst usage = `usage: retool (add | remove | upgrade | sync | do | build | help)\n\nuse retool with a subcommand:\n\nadd will add a tool\nremove will remove a tool\nupgrade will upgrade a tool\nsync will synchronize your _tools with tools.json, downloading if necessary\nbuild will compile all the tools in _tools\ndo will run stuff using your installed tools\n\nhelp [command] will describe a command in more detail\nversion will print the installed version of retool\n`\n\nconst addUsage = `usage: retool add [repository] [commit]\n\neg: retool add github.com/tools/godep 3020345802e4bff23902cfc1d19e90a79fae714e\n\nAdd will mark a repository as a tool you want to use. It will rewrite\ntools.json to record this fact. It will then fetch the repository,\nreset it to the desired commit, and install it to _tools/bin.\n\nYou can also use a symbolic reference, like 'master' or\n'origin/master' or 'origin/v1.0'. Retool will end up parsing this and\nstoring the underlying SHA.\n`\n\nconst upgradeUsage = `usage: retool upgrade [repository] [commit]\n\neg: retool upgrade github.com/tools/godep 3020345802e4bff23902cfc1d19e90a79fae714e\n\nUpgrade set the commit SHA of a tool you want to use. It will\nrewrite tools.json to record this fact. It will then fetch the\nrepository, reset it to the desired commit, and install it to\n_tools/bin.\n\nYou can also use a symbolic reference, like 'master' or\n'origin/master' or 'origin/v1.0'. Retool will end up parsing this and\nstoring the underlying SHA.\n`\n\nconst removeUsage = `usage: retool remove [repository]\n\neg: retool remove github.com/tools/godep\n\nRemove will remove a tool from your tools.json. It won't delete the\nunderlying repo from _tools, because it might be a dependency of some\nother tool. If you want to clean things up, retool sync will clear out\nunused dependencies.\n`\n\nconst syncUsage = `usage: retool sync\n\nSync will synchronize your _tools directory to match tools.json. It will do this by making network\ncalls to download tools and set them to the right versions.\n\nIf you want to just install whatever is in _tools/src without using network, see 'retool build'.\n`\n\nconst doUsage = `usage: retool do [command and args]\n\nretool do will make sure your _tools directory is synced, and then\nexecute a command with the tools installed in _tools.\n\nThis is just\n  retool sync && PATH=$PWD/_tools/bin:$PATH [command and args]\nThat works too.\n`\n\nconst cleanUsage = `usage: retool clean\n\nretool clean has no effect, but still exists for compatibility.\n`\n\nconst buildUsage = `usage: retool build\n\nretool build will compile all the tools listed in tools.json, obeying whatever is currently\ndownloaded into _tools. It will not do additional network calls. This is typically useful for\ncompiling vendored tools so you can use them inside isolated environments.\n\nretool sync is the more full-featured version of retool build. It will actually do git fetches to\nmake sure the right stuff gets installed, but this requires network access.\n`\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/main.go",
    "content": "package main\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/Masterminds/semver\"\n)\n\nvar version = semver.MustParse(\"v1.3.5\")\n\nfunc main() {\n\tflag.Parse()\n\tif err := ensureTooldir(); err != nil {\n\t\tfatal(\"failed to locate or create tool directory\", err)\n\t}\n\tcmd, tool := parseArgs()\n\n\tif cmd == \"version\" {\n\t\tfmt.Fprintf(os.Stdout, \"retool %s\", version)\n\t\tos.Exit(0)\n\t}\n\n\tif !specExists() {\n\t\tif cmd == \"add\" {\n\t\t\terr := writeBlankSpec()\n\t\t\tif err != nil {\n\t\t\t\tfatal(\"failed to write blank spec\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tfatal(\"tools.json does not yet exist. You need to add a tool first with 'retool add'\", nil)\n\t\t}\n\t}\n\n\ts, err := read()\n\tif err != nil {\n\t\tfatal(\"failed to load tools.json\", err)\n\t}\n\n\tswitch cmd {\n\tcase \"add\":\n\t\ts.add(tool)\n\tcase \"upgrade\":\n\t\ts.upgrade(tool)\n\tcase \"remove\":\n\t\ts.remove(tool)\n\tcase \"build\":\n\t\ts.build()\n\tcase \"sync\":\n\t\ts.sync()\n\tcase \"do\":\n\t\ts.sync()\n\t\tdo()\n\tcase \"clean\":\n\t\tlog(\"the clean subcommand is deprecated and has no effect\")\n\tdefault:\n\t\tfatal(fmt.Sprintf(\"unknown cmd %q\", cmd), nil)\n\t}\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/manifest.go",
    "content": "package main\n\nimport (\n\t\"encoding/json\"\n\t\"os\"\n\t\"path/filepath\"\n)\n\nconst manifestFile = \"manifest.json\"\n\ntype manifest map[string]string\n\nfunc getManifest() manifest {\n\tm := manifest{}\n\n\tfile, err := os.Open(filepath.Join(toolDirPath, manifestFile))\n\tif err != nil {\n\t\treturn m\n\t}\n\tdefer func() {\n\t\t_ = file.Close()\n\t}()\n\n\terr = json.NewDecoder(file).Decode(&m)\n\tif err != nil {\n\t\tfatal(\"Failed to decode manifest\", err)\n\t}\n\treturn m\n}\n\nfunc (m manifest) write() {\n\tf, err := os.Create(filepath.Join(toolDirPath, manifestFile))\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\t_ = f.Close()\n\t}()\n\n\tbytes, err := json.MarshalIndent(m, \"\", \"  \")\n\tif err != nil {\n\t\treturn\n\t}\n\n\t_, _ = f.Write(bytes)\n}\n\nfunc (m manifest) outOfDate(ts []*tool) bool {\n\t// Make a copy to check for elements in ts but not m\n\tm2 := make(map[string]string)\n\tfor k, v := range m {\n\t\tm2[k] = v\n\t}\n\n\tfor _, t := range ts {\n\t\tif v, ok := m[t.Repository]; !ok || v != t.Commit {\n\t\t\treturn true\n\t\t}\n\t\tdelete(m2, t.Repository)\n\t}\n\n\treturn len(m2) != 0\n}\n\nfunc (m manifest) replace(ts []*tool) {\n\tfor k := range m {\n\t\tdelete(m, k)\n\t}\n\tfor _, t := range ts {\n\t\tm[t.Repository] = t.Commit\n\t}\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/print.go",
    "content": "package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"os/exec\"\n\n\t\"github.com/pkg/errors\"\n)\n\nfunc log(msg string) {\n\tfmt.Fprintf(os.Stderr, \"retool: %s\\n\", msg)\n}\n\nfunc fatal(msg string, err error) {\n\tif err == nil {\n\t\tfmt.Fprintf(os.Stderr, \"retool: fatal err: %s\\n\", msg)\n\t} else {\n\t\tfmt.Fprintf(os.Stderr, \"retool: fatal err: %s: %s\\n\", msg, err)\n\t}\n\tos.Exit(1)\n}\n\nfunc fatalExec(cmd string, err error) {\n\tif exErr, ok := errors.Cause(err).(*exec.ExitError); ok {\n\t\tfatal(fmt.Sprintf(\"execution error on %q: %s\", cmd, exErr.Stderr), err)\n\t} else {\n\t\tfatal(fmt.Sprintf(\"execution error on %q\", cmd), err)\n\t}\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/remove.go",
    "content": "package main\n\nfunc (s spec) remove(t *tool) {\n\tidx := s.find(t)\n\tif idx == -1 {\n\t\tfatal(t.Repository+\" is not in tools.json\", nil)\n\t}\n\ts.Tools = append(s.Tools[:idx], s.Tools[idx+1:]...)\n\terr := s.write()\n\tif err != nil {\n\t\tfatal(\"unable to remove \"+t.Repository, err)\n\t}\n\n\ts.sync()\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/spec.go",
    "content": "package main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"os\"\n\t\"path/filepath\"\n\n\t\"github.com/Masterminds/semver\"\n)\n\n// Filename to read/write the spec data.\nconst specfile = \"tools.json\"\n\ntype spec struct {\n\tTools         []*tool\n\tRetoolVersion *semver.Version\n}\n\n// jsonSpec is a helper type to describe the JSON encoding of a spec\ntype jsonSpec struct {\n\tTools         []*tool\n\tRetoolVersion string\n}\n\nfunc (s *spec) UnmarshalJSON(data []byte) error {\n\tjs := new(jsonSpec)\n\tif err := json.Unmarshal(data, js); err != nil {\n\t\treturn err\n\t}\n\tif js.RetoolVersion != \"\" {\n\t\tv, err := semver.NewVersion(js.RetoolVersion)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.RetoolVersion = v\n\t}\n\ts.Tools = js.Tools\n\treturn nil\n}\n\nfunc (s spec) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(&jsonSpec{\n\t\tTools:         s.Tools,\n\t\tRetoolVersion: s.RetoolVersion.String(),\n\t})\n}\n\nfunc (s spec) write() error {\n\tspecfilePath := filepath.Join(baseDirPath, specfile)\n\n\tf, err := os.Create(specfilePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to open %s: %s\", specfile, err)\n\t}\n\tdefer func() {\n\t\t_ = f.Close()\n\t}()\n\n\t// s.write() is called when we have successfully added, removed, or upgraded a\n\t// tool. The success of that operation indicates that we should be comfortable\n\t// bumping up this version.\n\ts.RetoolVersion = version\n\n\tbytes, err := json.MarshalIndent(s, \"\", \"  \")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to marshal json spec: %s\", err)\n\t}\n\n\t_, err = f.Write(bytes)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to write %s: %s\", specfile, err)\n\t}\n\n\treturn nil\n}\n\nfunc (s spec) find(t *tool) int {\n\tfor i, tt := range s.Tools {\n\t\tif t.Repository == tt.Repository {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}\n\nfunc (s spec) cleanup() {\n\tvar pkgs []string\n\tfor _, t := range s.Tools {\n\t\tpkgs = append(pkgs, t.Repository)\n\t}\n\tclean(pkgs)\n}\n\nfunc readPath(path string) (spec, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn spec{}, fmt.Errorf(\"unable to open spec file at %s: %s\", path, err)\n\t}\n\tdefer func() {\n\t\t_ = file.Close()\n\t}()\n\n\ts := new(spec)\n\terr = json.NewDecoder(file).Decode(s)\n\tif err != nil {\n\t\treturn spec{}, err\n\t}\n\treturn *s, nil\n}\n\nfunc read() (spec, error) {\n\tspecfilePath := filepath.Join(baseDirPath, specfile)\n\treturn readPath(specfilePath)\n}\n\nfunc specExists() bool {\n\tspecfilePath := filepath.Join(baseDirPath, specfile)\n\n\t_, err := os.Stat(specfilePath)\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\tif err != nil {\n\t\tfatal(\"unable to stat tools.json: %s\", err)\n\t}\n\treturn true\n}\n\nfunc writeBlankSpec() error {\n\treturn spec{\n\t\tTools:         []*tool{},\n\t\tRetoolVersion: version,\n\t}.write()\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/sync.go",
    "content": "package main\n\nimport \"os\"\n\nfunc (s spec) sync() {\n\tm := getManifest()\n\tif m.outOfDate(s.Tools) {\n\t\t// Delete existing tools directory\n\t\terr := os.RemoveAll(toolDirPath)\n\t\tif err != nil {\n\t\t\tfatalExec(\"failed to remove _tools \", err)\n\t\t}\n\n\t\t// Recreate the tools directory\n\t\terr = ensureTooldir()\n\t\tif err != nil {\n\t\t\tfatal(\"failed to ensure tool dir\", err)\n\t\t}\n\n\t\t// Download everything to tool directory\n\t\tfor _, t := range s.Tools {\n\t\t\terr = download(t)\n\t\t\tif err != nil {\n\t\t\t\tfatalExec(\"failed to sync \"+t.Repository, err)\n\t\t\t}\n\t\t}\n\n\t\t// Install the packages\n\t\ts.build()\n\n\t\t// Delete unneccessary source files\n\t\ts.cleanup()\n\t}\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/tool.go",
    "content": "package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"os/exec\"\n\t\"path/filepath\"\n\t\"strings\"\n\n\t\"github.com/pkg/errors\"\n)\n\ntype tool struct {\n\tRepository string // eg \"github.com/tools/godep\"\n\tCommit     string // eg \"3020345802e4bff23902cfc1d19e90a79fae714e\"\n\tref        string // eg \"origin/master\"\n\tFork       string `json:\"Fork,omitempty\"` // eg \"code.jusin.tv/twitch/godep\"\n}\n\nfunc (t *tool) path() string {\n\treturn filepath.Join(toolDirPath, \"src\", t.Repository)\n}\n\nfunc (t *tool) executable() string {\n\treturn filepath.Base(t.Repository)\n}\n\nfunc setEnvVar(cmd *exec.Cmd, key, val string) {\n\tvar env []string\n\tif cmd.Env != nil {\n\t\tenv = cmd.Env\n\t} else {\n\t\tenv = os.Environ()\n\t}\n\n\tenvSet := false\n\tfor i, envVar := range env {\n\t\tif strings.HasPrefix(envVar, key+\"=\") {\n\t\t\tenv[i] = key + \"=\" + val\n\t\t\tenvSet = true\n\t\t}\n\t}\n\tif !envSet {\n\t\tenv = append(cmd.Env, key+\"=\"+val)\n\t}\n\n\tcmd.Env = env\n}\n\nfunc get(t *tool) error {\n\tlog(\"downloading \" + t.Repository)\n\tcmd := exec.Command(\"go\", \"get\", \"-d\", t.Repository)\n\tsetEnvVar(cmd, \"GOPATH\", toolDirPath)\n\t_, err := cmd.Output()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to 'go get' tool\")\n\t}\n\treturn err\n}\n\nfunc setVersion(t *tool) error {\n\t// If we're using a fork, add it\n\tif t.Fork != \"\" {\n\t\tcmd := exec.Command(\"git\", \"remote\")\n\t\tcmd.Dir = t.path()\n\t\tb, err := cmd.Output()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\trs := strings.Split(string(b), \"\\n\")\n\t\tcontainsFork := false\n\t\tfor _, r := range rs {\n\t\t\tif r == \"fork\" {\n\t\t\t\tcontainsFork = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif containsFork {\n\t\t\tcmd = exec.Command(\"git\", \"remote\", \"rm\", \"fork\")\n\t\t\tcmd.Dir = t.path()\n\t\t\t_, err = cmd.Output()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tcmd = exec.Command(\"git\", \"remote\", \"add\", \"-f\", \"fork\", t.Fork)\n\t\tcmd.Dir = t.path()\n\t\t_, err = cmd.Output()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog(\"setting version for \" + t.Repository)\n\tcmd := exec.Command(\"git\", \"fetch\")\n\tcmd.Dir = t.path()\n\t_, err := cmd.Output()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If we have a symbolic reference, parse it\n\tif t.ref != \"\" {\n\t\tlog(fmt.Sprintf(\"parsing revision %q\", t.ref))\n\t\tcmd = exec.Command(\"git\", \"rev-parse\", t.ref)\n\t\tcmd.Dir = t.path()\n\n\t\tvar out []byte\n\t\tout, err = cmd.Output()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tt.Commit = strings.TrimSpace(string(out))\n\t\tlog(fmt.Sprintf(\"parsed as %q\", t.Commit))\n\t}\n\n\tcmd = exec.Command(\"git\", \"checkout\", t.Commit)\n\tcmd.Dir = t.path()\n\t_, err = cmd.Output()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to 'git checkout' tool\")\n\t}\n\n\t// Re-run 'go get' in case the new version has a different set of dependencies.\n\tcmd = exec.Command(\"go\", \"get\", \"-d\", t.Repository)\n\tsetEnvVar(cmd, \"GOPATH\", toolDirPath)\n\t_, err = cmd.Output()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to 'go get' tool\")\n\t}\n\treturn err\n}\n\nfunc download(t *tool) error {\n\terr := get(t)\n\tif err != nil {\n\t\tfatalExec(\"go get -d \"+t.Repository, err)\n\t}\n\n\terr = setVersion(t)\n\tif err != nil {\n\t\tfatalExec(\"git checkout \"+t.Commit, err)\n\t}\n\n\treturn nil\n}\n\nfunc install(t *tool) error {\n\tlog(\"installing \" + t.Repository)\n\tcmd := exec.Command(\"go\", \"install\", t.Repository)\n\tsetEnvVar(cmd, \"GOPATH\", toolDirPath)\n\t_, err := cmd.Output()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to 'go install' tool\")\n\t}\n\treturn err\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/tooldir.go",
    "content": "package main\n\nimport (\n\t\"flag\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"os/exec\"\n\t\"path\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"syscall\"\n\n\t\"github.com/pkg/errors\"\n)\n\nconst (\n\ttoolDirName = \"_tools\"\n)\n\nvar (\n\tbaseDir = flag.String(\"base-dir\", \"\",\n\t\t\"Path of project root.  If not specified and the working directory is within a git repository, the root of \"+\n\t\t\t\"the repository is used.  If the working directory is not within a git repository, the working directory \"+\n\t\t\t\"is used.\")\n\ttoolDir = flag.String(\"tool-dir\", \"\",\n\t\t\"Path where tools are stored.  The default value is the subdirectory of -base-dir named '_tools'.\")\n\n\t// These globals are set by ensureTooldir() after factoring in the flags above.\n\tbaseDirPath string\n\ttoolDirPath string\n)\n\n// If the working directory is within a git repository, return the path of the repository's root; otherwise, return the\n// empty string.  An error is returned iff invoking 'git' fails for some other reason.\nfunc getRepoRoot() (string, error) {\n\tcmd := exec.Command(\"git\", \"rev-parse\", \"--show-toplevel\")\n\tstdout, err := cmd.Output()\n\tif err != nil {\n\t\tif exitErr, ok := err.(*exec.ExitError); ok {\n\t\t\texitStatus := exitErr.Sys().(syscall.WaitStatus).ExitStatus()\n\t\t\tif exitStatus == 128 { // not in a repository\n\t\t\t\treturn \"\", nil\n\t\t\t}\n\t\t}\n\t\treturn \"\", errors.Wrap(err, \"failed to invoke git\")\n\t}\n\trepoRoot := strings.TrimSpace(string(stdout))\n\treturn repoRoot, nil\n}\n\nfunc ensureTooldir() error {\n\tvar err error\n\n\tbaseDirPath = *baseDir\n\tif baseDirPath == \"\" {\n\t\tvar repoRootPath string\n\t\trepoRootPath, err = getRepoRoot()\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to check for enclosing git repository\")\n\t\t}\n\t\tif repoRootPath == \"\" {\n\t\t\tbaseDirPath, err = os.Getwd()\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"failed to get working directory\")\n\t\t\t}\n\t\t} else {\n\t\t\tbaseDirPath = repoRootPath\n\t\t}\n\t}\n\n\ttoolDirPath = *toolDir\n\tif toolDirPath == \"\" {\n\t\ttoolDirPath = filepath.Join(baseDirPath, toolDirName)\n\t}\n\n\tverbosef(\"base dir: %v\\n\", baseDirPath)\n\tverbosef(\"tool dir: %v\\n\", toolDirPath)\n\n\tstat, err := os.Stat(toolDirPath)\n\tswitch {\n\tcase os.IsNotExist(err):\n\t\terr = os.Mkdir(toolDirPath, 0777)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"unable to create tooldir\")\n\t\t}\n\tcase err != nil:\n\t\treturn errors.Wrap(err, \"unable to stat tool directory\")\n\tcase !stat.IsDir():\n\t\treturn errors.New(\"tool directory already exists, but it is not a directory; you can use -tool-dir to change where tools are saved\")\n\t}\n\n\terr = ioutil.WriteFile(path.Join(toolDirPath, \".gitignore\"), gitignore, 0664)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to update .gitignore\")\n\t}\n\n\treturn nil\n}\n\nvar gitignore = []byte(strings.TrimLeft(`\n/bin/\n/pkg/\n/manifest.json\n`, \"\\n\"))\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/upgrade.go",
    "content": "package main\n\nfunc (s spec) upgrade(t *tool) {\n\tidx := s.find(t)\n\tif idx == -1 {\n\t\tlog(t.Repository + \" is not yet installed (did you mean retool add?)\")\n\t\treturn\n\t}\n\n\ts.Tools[idx] = t\n\n\ts.sync()\n\n\terr := s.write()\n\tif err != nil {\n\t\tfatal(\"unable to remove \"+t.Repository, err)\n\t}\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/vendor/github.com/Masterminds/semver/LICENSE.txt",
    "content": "The Masterminds\nCopyright (C) 2014-2015, Matt Butcher and Matt Farina\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/vendor/github.com/Masterminds/semver/README.md",
    "content": "# SemVer\n\nThe `semver` package provides the ability to work with [Semantic Versions](http://semver.org) in Go. Specifically it provides the ability to:\n\n* Parse semantic versions\n* Sort semantic versions\n* Check if a semantic version fits within a set of constraints\n* Optionally work with a `v` prefix\n\n[![Build Status](https://travis-ci.org/Masterminds/semver.svg)](https://travis-ci.org/Masterminds/semver) [![Build status](https://ci.appveyor.com/api/projects/status/jfk66lib7hb985k8/branch/master?svg=true&passingText=windows%20build%20passing&failingText=windows%20build%20failing)](https://ci.appveyor.com/project/mattfarina/semver/branch/master) [![GoDoc](https://godoc.org/github.com/Masterminds/semver?status.png)](https://godoc.org/github.com/Masterminds/semver) [![Go Report Card](https://goreportcard.com/badge/github.com/Masterminds/semver)](https://goreportcard.com/report/github.com/Masterminds/semver)\n\n## Parsing Semantic Versions\n\nTo parse a semantic version use the `NewVersion` function. For example,\n\n```go\n    v, err := semver.NewVersion(\"1.2.3-beta.1+build345\")\n```\n\nIf there is an error the version wasn't parseable. The version object has methods\nto get the parts of the version, compare it to other versions, convert the\nversion back into a string, and get the original string. For more details\nplease see the [documentation](https://godoc.org/github.com/Masterminds/semver).\n\n## Sorting Semantic Versions\n\nA set of versions can be sorted using the [`sort`](https://golang.org/pkg/sort/)\npackage from the standard library. For example,\n\n```go\n    raw := []string{\"1.2.3\", \"1.0\", \"1.3\", \"2\", \"0.4.2\",}\n    vs := make([]*semver.Version, len(raw))\n\tfor i, r := range raw {\n\t\tv, err := semver.NewVersion(r)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Error parsing version: %s\", err)\n\t\t}\n\n\t\tvs[i] = v\n\t}\n\n\tsort.Sort(semver.Collection(vs))\n```\n\n## Checking Version Constraints\n\nChecking a version against version constraints is one of the most featureful\nparts of the package.\n\n```go\n    c, err := semver.NewConstraint(\">= 1.2.3\")\n    if err != nil {\n        // Handle constraint not being parseable.\n    }\n\n    v, _ := semver.NewVersion(\"1.3\")\n    if err != nil {\n        // Handle version not being parseable.\n    }\n    // Check if the version meets the constraints. The a variable will be true.\n    a := c.Check(v)\n```\n\n## Basic Comparisons\n\nThere are two elements to the comparisons. First, a comparison string is a list\nof comma separated and comparisons. These are then separated by || separated or\ncomparisons. For example, `\">= 1.2, < 3.0.0 || >= 4.2.3\"` is looking for a\ncomparison that's greater than or equal to 1.2 and less than 3.0.0 or is\ngreater than or equal to 4.2.3.\n\nThe basic comparisons are:\n\n* `=`: equal (aliased to no operator)\n* `!=`: not equal\n* `>`: greater than\n* `<`: less than\n* `>=`: greater than or equal to\n* `<=`: less than or equal to\n\n_Note, according to the Semantic Version specification pre-releases may not be\nAPI compliant with their release counterpart. It says,_\n\n> _A pre-release version indicates that the version is unstable and might not satisfy the intended compatibility requirements as denoted by its associated normal version._\n\n_SemVer comparisons without a pre-release value will skip pre-release versions.\nFor example, `>1.2.3` will skip pre-releases when looking at a list of values\nwhile `>1.2.3-alpha.1` will evaluate pre-releases._\n\n## Hyphen Range Comparisons\n\nThere are multiple methods to handle ranges and the first is hyphens ranges.\nThese look like:\n\n* `1.2 - 1.4.5` which is equivalent to `>= 1.2, <= 1.4.5`\n* `2.3.4 - 4.5` which is equivalent to `>= 2.3.4, <= 4.5`\n\n## Wildcards In Comparisons\n\nThe `x`, `X`, and `*` characters can be used as a wildcard character. This works\nfor all comparison operators. When used on the `=` operator it falls\nback to the pack level comparison (see tilde below). For example,\n\n* `1.2.x` is equivalent to `>= 1.2.0, < 1.3.0`\n* `>= 1.2.x` is equivalent to `>= 1.2.0`\n* `<= 2.x` is equivalent to `<= 3`\n* `*` is equivalent to `>= 0.0.0`\n\n## Tilde Range Comparisons (Patch)\n\nThe tilde (`~`) comparison operator is for patch level ranges when a minor\nversion is specified and major level changes when the minor number is missing.\nFor example,\n\n* `~1.2.3` is equivalent to `>= 1.2.3, < 1.3.0`\n* `~1` is equivalent to `>= 1, < 2`\n* `~2.3` is equivalent to `>= 2.3, < 2.4`\n* `~1.2.x` is equivalent to `>= 1.2.0, < 1.3.0`\n* `~1.x` is equivalent to `>= 1, < 2`\n\n## Caret Range Comparisons (Major)\n\nThe caret (`^`) comparison operator is for major level changes. This is useful\nwhen comparisons of API versions as a major change is API breaking. For example,\n\n* `^1.2.3` is equivalent to `>= 1.2.3, < 2.0.0`\n* `^1.2.x` is equivalent to `>= 1.2.0, < 2.0.0`\n* `^2.3` is equivalent to `>= 2.3, < 3`\n* `^2.x` is equivalent to `>= 2.0.0, < 3`\n\n# Validation\n\nIn addition to testing a version against a constraint, a version can be validated\nagainst a constraint. When validation fails a slice of errors containing why a\nversion didn't meet the constraint is returned. For example,\n\n```go\n    c, err := semver.NewConstraint(\"<= 1.2.3, >= 1.4\")\n    if err != nil {\n        // Handle constraint not being parseable.\n    }\n\n    v, _ := semver.NewVersion(\"1.3\")\n    if err != nil {\n        // Handle version not being parseable.\n    }\n\n    // Validate a version against a constraint.\n    a, msgs := c.Validate(v)\n    // a is false\n    for _, m := range msgs {\n        fmt.Println(m)\n\n        // Loops over the errors which would read\n        // \"1.3 is greater than 1.2.3\"\n        // \"1.3 is less than 1.4\"\n    }\n```\n\n# Contribute\n\nIf you find an issue or want to contribute please file an [issue](https://github.com/Masterminds/semver/issues)\nor [create a pull request](https://github.com/Masterminds/semver/pulls).\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/vendor/github.com/Masterminds/semver/collection.go",
    "content": "package semver\n\n// Collection is a collection of Version instances and implements the sort\n// interface. See the sort package for more details.\n// https://golang.org/pkg/sort/\ntype Collection []*Version\n\n// Len returns the length of a collection. The number of Version instances\n// on the slice.\nfunc (c Collection) Len() int {\n\treturn len(c)\n}\n\n// Less is needed for the sort interface to compare two Version objects on the\n// slice. If checks if one is less than the other.\nfunc (c Collection) Less(i, j int) bool {\n\treturn c[i].LessThan(c[j])\n}\n\n// Swap is needed for the sort interface to replace the Version objects\n// at two different positions in the slice.\nfunc (c Collection) Swap(i, j int) {\n\tc[i], c[j] = c[j], c[i]\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/vendor/github.com/Masterminds/semver/constraints.go",
    "content": "package semver\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"regexp\"\n\t\"strings\"\n)\n\n// Constraints is one or more constraint that a semantic version can be\n// checked against.\ntype Constraints struct {\n\tconstraints [][]*constraint\n}\n\n// NewConstraint returns a Constraints instance that a Version instance can\n// be checked against. If there is a parse error it will be returned.\nfunc NewConstraint(c string) (*Constraints, error) {\n\n\t// Rewrite - ranges into a comparison operation.\n\tc = rewriteRange(c)\n\n\tors := strings.Split(c, \"||\")\n\tor := make([][]*constraint, len(ors))\n\tfor k, v := range ors {\n\t\tcs := strings.Split(v, \",\")\n\t\tresult := make([]*constraint, len(cs))\n\t\tfor i, s := range cs {\n\t\t\tpc, err := parseConstraint(s)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tresult[i] = pc\n\t\t}\n\t\tor[k] = result\n\t}\n\n\to := &Constraints{constraints: or}\n\treturn o, nil\n}\n\n// Check tests if a version satisfies the constraints.\nfunc (cs Constraints) Check(v *Version) bool {\n\t// loop over the ORs and check the inner ANDs\n\tfor _, o := range cs.constraints {\n\t\tjoy := true\n\t\tfor _, c := range o {\n\t\t\tif !c.check(v) {\n\t\t\t\tjoy = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif joy {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n// Validate checks if a version satisfies a constraint. If not a slice of\n// reasons for the failure are returned in addition to a bool.\nfunc (cs Constraints) Validate(v *Version) (bool, []error) {\n\t// loop over the ORs and check the inner ANDs\n\tvar e []error\n\tfor _, o := range cs.constraints {\n\t\tjoy := true\n\t\tfor _, c := range o {\n\t\t\tif !c.check(v) {\n\t\t\t\tem := fmt.Errorf(c.msg, v, c.orig)\n\t\t\t\te = append(e, em)\n\t\t\t\tjoy = false\n\t\t\t}\n\t\t}\n\n\t\tif joy {\n\t\t\treturn true, []error{}\n\t\t}\n\t}\n\n\treturn false, e\n}\n\nvar constraintOps map[string]cfunc\nvar constraintMsg map[string]string\nvar constraintRegex *regexp.Regexp\n\nfunc init() {\n\tconstraintOps = map[string]cfunc{\n\t\t\"\":   constraintTildeOrEqual,\n\t\t\"=\":  constraintTildeOrEqual,\n\t\t\"!=\": constraintNotEqual,\n\t\t\">\":  constraintGreaterThan,\n\t\t\"<\":  constraintLessThan,\n\t\t\">=\": constraintGreaterThanEqual,\n\t\t\"=>\": constraintGreaterThanEqual,\n\t\t\"<=\": constraintLessThanEqual,\n\t\t\"=<\": constraintLessThanEqual,\n\t\t\"~\":  constraintTilde,\n\t\t\"~>\": constraintTilde,\n\t\t\"^\":  constraintCaret,\n\t}\n\n\tconstraintMsg = map[string]string{\n\t\t\"\":   \"%s is not equal to %s\",\n\t\t\"=\":  \"%s is not equal to %s\",\n\t\t\"!=\": \"%s is equal to %s\",\n\t\t\">\":  \"%s is less than or equal to %s\",\n\t\t\"<\":  \"%s is greater than or equal to %s\",\n\t\t\">=\": \"%s is less than %s\",\n\t\t\"=>\": \"%s is less than %s\",\n\t\t\"<=\": \"%s is greater than %s\",\n\t\t\"=<\": \"%s is greater than %s\",\n\t\t\"~\":  \"%s does not have same major and minor version as %s\",\n\t\t\"~>\": \"%s does not have same major and minor version as %s\",\n\t\t\"^\":  \"%s does not have same major version as %s\",\n\t}\n\n\tops := make([]string, 0, len(constraintOps))\n\tfor k := range constraintOps {\n\t\tops = append(ops, regexp.QuoteMeta(k))\n\t}\n\n\tconstraintRegex = regexp.MustCompile(fmt.Sprintf(\n\t\t`^\\s*(%s)\\s*(%s)\\s*$`,\n\t\tstrings.Join(ops, \"|\"),\n\t\tcvRegex))\n\n\tconstraintRangeRegex = regexp.MustCompile(fmt.Sprintf(\n\t\t`\\s*(%s)\\s+-\\s+(%s)\\s*`,\n\t\tcvRegex, cvRegex))\n}\n\n// An individual constraint\ntype constraint struct {\n\t// The callback function for the restraint. It performs the logic for\n\t// the constraint.\n\tfunction cfunc\n\n\tmsg string\n\n\t// The version used in the constraint check. For example, if a constraint\n\t// is '<= 2.0.0' the con a version instance representing 2.0.0.\n\tcon *Version\n\n\t// The original parsed version (e.g., 4.x from != 4.x)\n\torig string\n\n\t// When an x is used as part of the version (e.g., 1.x)\n\tminorDirty bool\n\tdirty      bool\n\tpatchDirty bool\n}\n\n// Check if a version meets the constraint\nfunc (c *constraint) check(v *Version) bool {\n\treturn c.function(v, c)\n}\n\ntype cfunc func(v *Version, c *constraint) bool\n\nfunc parseConstraint(c string) (*constraint, error) {\n\tm := constraintRegex.FindStringSubmatch(c)\n\tif m == nil {\n\t\treturn nil, fmt.Errorf(\"improper constraint: %s\", c)\n\t}\n\n\tver := m[2]\n\torig := ver\n\tminorDirty := false\n\tpatchDirty := false\n\tdirty := false\n\tif isX(m[3]) {\n\t\tver = \"0.0.0\"\n\t\tdirty = true\n\t} else if isX(strings.TrimPrefix(m[4], \".\")) {\n\t\tminorDirty = true\n\t\tdirty = true\n\t\tver = fmt.Sprintf(\"%s.0.0%s\", m[3], m[6])\n\t} else if isX(strings.TrimPrefix(m[5], \".\")) {\n\t\tdirty = true\n\t\tpatchDirty = true\n\t\tver = fmt.Sprintf(\"%s%s.0%s\", m[3], m[4], m[6])\n\t}\n\n\tcon, err := NewVersion(ver)\n\tif err != nil {\n\n\t\t// The constraintRegex should catch any regex parsing errors. So,\n\t\t// we should never get here.\n\t\treturn nil, errors.New(\"constraint Parser Error\")\n\t}\n\n\tcs := &constraint{\n\t\tfunction:   constraintOps[m[1]],\n\t\tmsg:        constraintMsg[m[1]],\n\t\tcon:        con,\n\t\torig:       orig,\n\t\tminorDirty: minorDirty,\n\t\tpatchDirty: patchDirty,\n\t\tdirty:      dirty,\n\t}\n\treturn cs, nil\n}\n\n// Constraint functions\nfunc constraintNotEqual(v *Version, c *constraint) bool {\n\tif c.dirty {\n\n\t\t// If there is a pre-release on the version but the constraint isn't looking\n\t\t// for them assume that pre-releases are not compatible. See issue 21 for\n\t\t// more details.\n\t\tif v.Prerelease() != \"\" && c.con.Prerelease() == \"\" {\n\t\t\treturn false\n\t\t}\n\n\t\tif c.con.Major() != v.Major() {\n\t\t\treturn true\n\t\t}\n\t\tif c.con.Minor() != v.Minor() && !c.minorDirty {\n\t\t\treturn true\n\t\t} else if c.minorDirty {\n\t\t\treturn false\n\t\t}\n\n\t\treturn false\n\t}\n\n\treturn !v.Equal(c.con)\n}\n\nfunc constraintGreaterThan(v *Version, c *constraint) bool {\n\n\t// An edge case the constraint is 0.0.0 and the version is 0.0.0-someprerelease\n\t// exists. This that case.\n\tif !isNonZero(c.con) && isNonZero(v) {\n\t\treturn true\n\t}\n\n\t// If there is a pre-release on the version but the constraint isn't looking\n\t// for them assume that pre-releases are not compatible. See issue 21 for\n\t// more details.\n\tif v.Prerelease() != \"\" && c.con.Prerelease() == \"\" {\n\t\treturn false\n\t}\n\n\treturn v.Compare(c.con) == 1\n}\n\nfunc constraintLessThan(v *Version, c *constraint) bool {\n\t// If there is a pre-release on the version but the constraint isn't looking\n\t// for them assume that pre-releases are not compatible. See issue 21 for\n\t// more details.\n\tif v.Prerelease() != \"\" && c.con.Prerelease() == \"\" {\n\t\treturn false\n\t}\n\n\tif !c.dirty {\n\t\treturn v.Compare(c.con) < 0\n\t}\n\n\tif v.Major() > c.con.Major() {\n\t\treturn false\n\t} else if v.Minor() > c.con.Minor() && !c.minorDirty {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\nfunc constraintGreaterThanEqual(v *Version, c *constraint) bool {\n\t// An edge case the constraint is 0.0.0 and the version is 0.0.0-someprerelease\n\t// exists. This that case.\n\tif !isNonZero(c.con) && isNonZero(v) {\n\t\treturn true\n\t}\n\n\t// If there is a pre-release on the version but the constraint isn't looking\n\t// for them assume that pre-releases are not compatible. See issue 21 for\n\t// more details.\n\tif v.Prerelease() != \"\" && c.con.Prerelease() == \"\" {\n\t\treturn false\n\t}\n\n\treturn v.Compare(c.con) >= 0\n}\n\nfunc constraintLessThanEqual(v *Version, c *constraint) bool {\n\t// If there is a pre-release on the version but the constraint isn't looking\n\t// for them assume that pre-releases are not compatible. See issue 21 for\n\t// more details.\n\tif v.Prerelease() != \"\" && c.con.Prerelease() == \"\" {\n\t\treturn false\n\t}\n\n\tif !c.dirty {\n\t\treturn v.Compare(c.con) <= 0\n\t}\n\n\tif v.Major() > c.con.Major() {\n\t\treturn false\n\t} else if v.Minor() > c.con.Minor() && !c.minorDirty {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\n// ~*, ~>* --> >= 0.0.0 (any)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0, <3.0.0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0, <2.1.0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0, <1.3.0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3, <1.3.0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0, <1.3.0\nfunc constraintTilde(v *Version, c *constraint) bool {\n\t// If there is a pre-release on the version but the constraint isn't looking\n\t// for them assume that pre-releases are not compatible. See issue 21 for\n\t// more details.\n\tif v.Prerelease() != \"\" && c.con.Prerelease() == \"\" {\n\t\treturn false\n\t}\n\n\tif v.LessThan(c.con) {\n\t\treturn false\n\t}\n\n\t// ~0.0.0 is a special case where all constraints are accepted. It's\n\t// equivalent to >= 0.0.0.\n\tif c.con.Major() == 0 && c.con.Minor() == 0 && c.con.Patch() == 0 &&\n\t\t!c.minorDirty && !c.patchDirty {\n\t\treturn true\n\t}\n\n\tif v.Major() != c.con.Major() {\n\t\treturn false\n\t}\n\n\tif v.Minor() != c.con.Minor() && !c.minorDirty {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\n// When there is a .x (dirty) status it automatically opts in to ~. Otherwise\n// it's a straight =\nfunc constraintTildeOrEqual(v *Version, c *constraint) bool {\n\t// If there is a pre-release on the version but the constraint isn't looking\n\t// for them assume that pre-releases are not compatible. See issue 21 for\n\t// more details.\n\tif v.Prerelease() != \"\" && c.con.Prerelease() == \"\" {\n\t\treturn false\n\t}\n\n\tif c.dirty {\n\t\tc.msg = constraintMsg[\"~\"]\n\t\treturn constraintTilde(v, c)\n\t}\n\n\treturn v.Equal(c.con)\n}\n\n// ^* --> (any)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0, <3.0.0\n// ^2.0, ^2.0.x --> >=2.0.0, <3.0.0\n// ^1.2, ^1.2.x --> >=1.2.0, <2.0.0\n// ^1.2.3 --> >=1.2.3, <2.0.0\n// ^1.2.0 --> >=1.2.0, <2.0.0\nfunc constraintCaret(v *Version, c *constraint) bool {\n\t// If there is a pre-release on the version but the constraint isn't looking\n\t// for them assume that pre-releases are not compatible. See issue 21 for\n\t// more details.\n\tif v.Prerelease() != \"\" && c.con.Prerelease() == \"\" {\n\t\treturn false\n\t}\n\n\tif v.LessThan(c.con) {\n\t\treturn false\n\t}\n\n\tif v.Major() != c.con.Major() {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\nvar constraintRangeRegex *regexp.Regexp\n\nconst cvRegex string = `v?([0-9|x|X|\\*]+)(\\.[0-9|x|X|\\*]+)?(\\.[0-9|x|X|\\*]+)?` +\n\t`(-([0-9A-Za-z\\-]+(\\.[0-9A-Za-z\\-]+)*))?` +\n\t`(\\+([0-9A-Za-z\\-]+(\\.[0-9A-Za-z\\-]+)*))?`\n\nfunc isX(x string) bool {\n\tswitch x {\n\tcase \"x\", \"*\", \"X\":\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\nfunc rewriteRange(i string) string {\n\tm := constraintRangeRegex.FindAllStringSubmatch(i, -1)\n\tif m == nil {\n\t\treturn i\n\t}\n\to := i\n\tfor _, v := range m {\n\t\tt := fmt.Sprintf(\">= %s, <= %s\", v[1], v[11])\n\t\to = strings.Replace(o, v[0], t, 1)\n\t}\n\n\treturn o\n}\n\n// Detect if a version is not zero (0.0.0)\nfunc isNonZero(v *Version) bool {\n\tif v.Major() != 0 || v.Minor() != 0 || v.Patch() != 0 || v.Prerelease() != \"\" {\n\t\treturn true\n\t}\n\n\treturn false\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/vendor/github.com/Masterminds/semver/doc.go",
    "content": "/*\nPackage semver provides the ability to work with Semantic Versions (http://semver.org) in Go.\n\nSpecifically it provides the ability to:\n\n    * Parse semantic versions\n    * Sort semantic versions\n    * Check if a semantic version fits within a set of constraints\n    * Optionally work with a `v` prefix\n\nParsing Semantic Versions\n\nTo parse a semantic version use the `NewVersion` function. For example,\n\n    v, err := semver.NewVersion(\"1.2.3-beta.1+build345\")\n\nIf there is an error the version wasn't parseable. The version object has methods\nto get the parts of the version, compare it to other versions, convert the\nversion back into a string, and get the original string. For more details\nplease see the documentation at https://godoc.org/github.com/Masterminds/semver.\n\nSorting Semantic Versions\n\nA set of versions can be sorted using the `sort` package from the standard library.\nFor example,\n\n    raw := []string{\"1.2.3\", \"1.0\", \"1.3\", \"2\", \"0.4.2\",}\n    vs := make([]*semver.Version, len(raw))\n\tfor i, r := range raw {\n\t\tv, err := semver.NewVersion(r)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Error parsing version: %s\", err)\n\t\t}\n\n\t\tvs[i] = v\n\t}\n\n\tsort.Sort(semver.Collection(vs))\n\nChecking Version Constraints\n\nChecking a version against version constraints is one of the most featureful\nparts of the package.\n\n    c, err := semver.NewConstraint(\">= 1.2.3\")\n    if err != nil {\n        // Handle constraint not being parseable.\n    }\n\n    v, _ := semver.NewVersion(\"1.3\")\n    if err != nil {\n        // Handle version not being parseable.\n    }\n    // Check if the version meets the constraints. The a variable will be true.\n    a := c.Check(v)\n\nBasic Comparisons\n\nThere are two elements to the comparisons. First, a comparison string is a list\nof comma separated and comparisons. These are then separated by || separated or\ncomparisons. For example, `\">= 1.2, < 3.0.0 || >= 4.2.3\"` is looking for a\ncomparison that's greater than or equal to 1.2 and less than 3.0.0 or is\ngreater than or equal to 4.2.3.\n\nThe basic comparisons are:\n\n    * `=`: equal (aliased to no operator)\n    * `!=`: not equal\n    * `>`: greater than\n    * `<`: less than\n    * `>=`: greater than or equal to\n    * `<=`: less than or equal to\n\nHyphen Range Comparisons\n\nThere are multiple methods to handle ranges and the first is hyphens ranges.\nThese look like:\n\n    * `1.2 - 1.4.5` which is equivalent to `>= 1.2, <= 1.4.5`\n    * `2.3.4 - 4.5` which is equivalent to `>= 2.3.4, <= 4.5`\n\nWildcards In Comparisons\n\nThe `x`, `X`, and `*` characters can be used as a wildcard character. This works\nfor all comparison operators. When used on the `=` operator it falls\nback to the pack level comparison (see tilde below). For example,\n\n    * `1.2.x` is equivalent to `>= 1.2.0, < 1.3.0`\n    * `>= 1.2.x` is equivalent to `>= 1.2.0`\n    * `<= 2.x` is equivalent to `<= 3`\n    * `*` is equivalent to `>= 0.0.0`\n\nTilde Range Comparisons (Patch)\n\nThe tilde (`~`) comparison operator is for patch level ranges when a minor\nversion is specified and major level changes when the minor number is missing.\nFor example,\n\n    * `~1.2.3` is equivalent to `>= 1.2.3, < 1.3.0`\n    * `~1` is equivalent to `>= 1, < 2`\n    * `~2.3` is equivalent to `>= 2.3, < 2.4`\n    * `~1.2.x` is equivalent to `>= 1.2.0, < 1.3.0`\n    * `~1.x` is equivalent to `>= 1, < 2`\n\nCaret Range Comparisons (Major)\n\nThe caret (`^`) comparison operator is for major level changes. This is useful\nwhen comparisons of API versions as a major change is API breaking. For example,\n\n    * `^1.2.3` is equivalent to `>= 1.2.3, < 2.0.0`\n    * `^1.2.x` is equivalent to `>= 1.2.0, < 2.0.0`\n    * `^2.3` is equivalent to `>= 2.3, < 3`\n    * `^2.x` is equivalent to `>= 2.0.0, < 3`\n*/\npackage semver\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/vendor/github.com/Masterminds/semver/version.go",
    "content": "package semver\n\nimport (\n\t\"bytes\"\n\t\"errors\"\n\t\"fmt\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// The compiled version of the regex created at init() is cached here so it\n// only needs to be created once.\nvar versionRegex *regexp.Regexp\nvar validPrereleaseRegex *regexp.Regexp\n\nvar (\n\t// ErrInvalidSemVer is returned a version is found to be invalid when\n\t// being parsed.\n\tErrInvalidSemVer = errors.New(\"Invalid Semantic Version\")\n\n\t// ErrInvalidMetadata is returned when the metadata is an invalid format\n\tErrInvalidMetadata = errors.New(\"Invalid Metadata string\")\n\n\t// ErrInvalidPrerelease is returned when the pre-release is an invalid format\n\tErrInvalidPrerelease = errors.New(\"Invalid Prerelease string\")\n)\n\n// SemVerRegex is the regular expression used to parse a semantic version.\nconst SemVerRegex string = `v?([0-9]+)(\\.[0-9]+)?(\\.[0-9]+)?` +\n\t`(-([0-9A-Za-z\\-]+(\\.[0-9A-Za-z\\-]+)*))?` +\n\t`(\\+([0-9A-Za-z\\-]+(\\.[0-9A-Za-z\\-]+)*))?`\n\n// ValidPrerelease is the regular expression which validates\n// both prerelease and metadata values.\nconst ValidPrerelease string = `^([0-9A-Za-z\\-]+(\\.[0-9A-Za-z\\-]+)*)`\n\n// Version represents a single semantic version.\ntype Version struct {\n\tmajor, minor, patch int64\n\tpre                 string\n\tmetadata            string\n\toriginal            string\n}\n\nfunc init() {\n\tversionRegex = regexp.MustCompile(\"^\" + SemVerRegex + \"$\")\n\tvalidPrereleaseRegex = regexp.MustCompile(ValidPrerelease)\n}\n\n// NewVersion parses a given version and returns an instance of Version or\n// an error if unable to parse the version.\nfunc NewVersion(v string) (*Version, error) {\n\tm := versionRegex.FindStringSubmatch(v)\n\tif m == nil {\n\t\treturn nil, ErrInvalidSemVer\n\t}\n\n\tsv := &Version{\n\t\tmetadata: m[8],\n\t\tpre:      m[5],\n\t\toriginal: v,\n\t}\n\n\tvar temp int64\n\ttemp, err := strconv.ParseInt(m[1], 10, 32)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error parsing version segment: %s\", err)\n\t}\n\tsv.major = temp\n\n\tif m[2] != \"\" {\n\t\ttemp, err = strconv.ParseInt(strings.TrimPrefix(m[2], \".\"), 10, 32)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error parsing version segment: %s\", err)\n\t\t}\n\t\tsv.minor = temp\n\t} else {\n\t\tsv.minor = 0\n\t}\n\n\tif m[3] != \"\" {\n\t\ttemp, err = strconv.ParseInt(strings.TrimPrefix(m[3], \".\"), 10, 32)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error parsing version segment: %s\", err)\n\t\t}\n\t\tsv.patch = temp\n\t} else {\n\t\tsv.patch = 0\n\t}\n\n\treturn sv, nil\n}\n\n// MustParse parses a given version and panics on error.\nfunc MustParse(v string) *Version {\n\tsv, err := NewVersion(v)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn sv\n}\n\n// String converts a Version object to a string.\n// Note, if the original version contained a leading v this version will not.\n// See the Original() method to retrieve the original value. Semantic Versions\n// don't contain a leading v per the spec. Instead it's optional on\n// impelementation.\nfunc (v *Version) String() string {\n\tvar buf bytes.Buffer\n\n\tfmt.Fprintf(&buf, \"%d.%d.%d\", v.major, v.minor, v.patch)\n\tif v.pre != \"\" {\n\t\tfmt.Fprintf(&buf, \"-%s\", v.pre)\n\t}\n\tif v.metadata != \"\" {\n\t\tfmt.Fprintf(&buf, \"+%s\", v.metadata)\n\t}\n\n\treturn buf.String()\n}\n\n// Original returns the original value passed in to be parsed.\nfunc (v *Version) Original() string {\n\treturn v.original\n}\n\n// Major returns the major version.\nfunc (v *Version) Major() int64 {\n\treturn v.major\n}\n\n// Minor returns the minor version.\nfunc (v *Version) Minor() int64 {\n\treturn v.minor\n}\n\n// Patch returns the patch version.\nfunc (v *Version) Patch() int64 {\n\treturn v.patch\n}\n\n// Prerelease returns the pre-release version.\nfunc (v *Version) Prerelease() string {\n\treturn v.pre\n}\n\n// Metadata returns the metadata on the version.\nfunc (v *Version) Metadata() string {\n\treturn v.metadata\n}\n\n// originalVPrefix returns the original 'v' prefix if any.\nfunc (v *Version) originalVPrefix() string {\n\n\t// Note, only lowercase v is supported as a prefix by the parser.\n\tif v.original != \"\" && v.original[:1] == \"v\" {\n\t\treturn v.original[:1]\n\t}\n\treturn \"\"\n}\n\n// IncPatch produces the next patch version.\n// If the current version does not have prerelease/metadata information,\n// it unsets metadata and prerelease values, increments patch number.\n// If the current version has any of prerelease or metadata information,\n// it unsets both values and keeps curent patch value\nfunc (v Version) IncPatch() Version {\n\tvNext := v\n\t// according to http://semver.org/#spec-item-9\n\t// Pre-release versions have a lower precedence than the associated normal version.\n\t// according to http://semver.org/#spec-item-10\n\t// Build metadata SHOULD be ignored when determining version precedence.\n\tif v.pre != \"\" {\n\t\tvNext.metadata = \"\"\n\t\tvNext.pre = \"\"\n\t} else {\n\t\tvNext.metadata = \"\"\n\t\tvNext.pre = \"\"\n\t\tvNext.patch = v.patch + 1\n\t}\n\tvNext.original = v.originalVPrefix() + \"\" + vNext.String()\n\treturn vNext\n}\n\n// IncMinor produces the next minor version.\n// Sets patch to 0.\n// Increments minor number.\n// Unsets metadata.\n// Unsets prerelease status.\nfunc (v Version) IncMinor() Version {\n\tvNext := v\n\tvNext.metadata = \"\"\n\tvNext.pre = \"\"\n\tvNext.patch = 0\n\tvNext.minor = v.minor + 1\n\tvNext.original = v.originalVPrefix() + \"\" + vNext.String()\n\treturn vNext\n}\n\n// IncMajor produces the next major version.\n// Sets patch to 0.\n// Sets minor to 0.\n// Increments major number.\n// Unsets metadata.\n// Unsets prerelease status.\nfunc (v Version) IncMajor() Version {\n\tvNext := v\n\tvNext.metadata = \"\"\n\tvNext.pre = \"\"\n\tvNext.patch = 0\n\tvNext.minor = 0\n\tvNext.major = v.major + 1\n\tvNext.original = v.originalVPrefix() + \"\" + vNext.String()\n\treturn vNext\n}\n\n// SetPrerelease defines the prerelease value.\n// Value must not include the required 'hypen' prefix.\nfunc (v Version) SetPrerelease(prerelease string) (Version, error) {\n\tvNext := v\n\tif len(prerelease) > 0 && !validPrereleaseRegex.MatchString(prerelease) {\n\t\treturn vNext, ErrInvalidPrerelease\n\t}\n\tvNext.pre = prerelease\n\tvNext.original = v.originalVPrefix() + \"\" + vNext.String()\n\treturn vNext, nil\n}\n\n// SetMetadata defines metadata value.\n// Value must not include the required 'plus' prefix.\nfunc (v Version) SetMetadata(metadata string) (Version, error) {\n\tvNext := v\n\tif len(metadata) > 0 && !validPrereleaseRegex.MatchString(metadata) {\n\t\treturn vNext, ErrInvalidMetadata\n\t}\n\tvNext.metadata = metadata\n\tvNext.original = v.originalVPrefix() + \"\" + vNext.String()\n\treturn vNext, nil\n}\n\n// LessThan tests if one version is less than another one.\nfunc (v *Version) LessThan(o *Version) bool {\n\treturn v.Compare(o) < 0\n}\n\n// GreaterThan tests if one version is greater than another one.\nfunc (v *Version) GreaterThan(o *Version) bool {\n\treturn v.Compare(o) > 0\n}\n\n// Equal tests if two versions are equal to each other.\n// Note, versions can be equal with different metadata since metadata\n// is not considered part of the comparable version.\nfunc (v *Version) Equal(o *Version) bool {\n\treturn v.Compare(o) == 0\n}\n\n// Compare compares this version to another one. It returns -1, 0, or 1 if\n// the version smaller, equal, or larger than the other version.\n//\n// Versions are compared by X.Y.Z. Build metadata is ignored. Prerelease is\n// lower than the version without a prerelease.\nfunc (v *Version) Compare(o *Version) int {\n\t// Compare the major, minor, and patch version for differences. If a\n\t// difference is found return the comparison.\n\tif d := compareSegment(v.Major(), o.Major()); d != 0 {\n\t\treturn d\n\t}\n\tif d := compareSegment(v.Minor(), o.Minor()); d != 0 {\n\t\treturn d\n\t}\n\tif d := compareSegment(v.Patch(), o.Patch()); d != 0 {\n\t\treturn d\n\t}\n\n\t// At this point the major, minor, and patch versions are the same.\n\tps := v.pre\n\tpo := o.Prerelease()\n\n\tif ps == \"\" && po == \"\" {\n\t\treturn 0\n\t}\n\tif ps == \"\" {\n\t\treturn 1\n\t}\n\tif po == \"\" {\n\t\treturn -1\n\t}\n\n\treturn comparePrerelease(ps, po)\n}\n\nfunc compareSegment(v, o int64) int {\n\tif v < o {\n\t\treturn -1\n\t}\n\tif v > o {\n\t\treturn 1\n\t}\n\n\treturn 0\n}\n\nfunc comparePrerelease(v, o string) int {\n\n\t// split the prelease versions by their part. The separator, per the spec,\n\t// is a .\n\tsparts := strings.Split(v, \".\")\n\toparts := strings.Split(o, \".\")\n\n\t// Find the longer length of the parts to know how many loop iterations to\n\t// go through.\n\tslen := len(sparts)\n\tolen := len(oparts)\n\n\tl := slen\n\tif olen > slen {\n\t\tl = olen\n\t}\n\n\t// Iterate over each part of the prereleases to compare the differences.\n\tfor i := 0; i < l; i++ {\n\t\t// Since the lentgh of the parts can be different we need to create\n\t\t// a placeholder. This is to avoid out of bounds issues.\n\t\tstemp := \"\"\n\t\tif i < slen {\n\t\t\tstemp = sparts[i]\n\t\t}\n\n\t\totemp := \"\"\n\t\tif i < olen {\n\t\t\totemp = oparts[i]\n\t\t}\n\n\t\td := comparePrePart(stemp, otemp)\n\t\tif d != 0 {\n\t\t\treturn d\n\t\t}\n\t}\n\n\t// Reaching here means two versions are of equal value but have different\n\t// metadata (the part following a +). They are not identical in string form\n\t// but the version comparison finds them to be equal.\n\treturn 0\n}\n\nfunc comparePrePart(s, o string) int {\n\t// Fastpath if they are equal\n\tif s == o {\n\t\treturn 0\n\t}\n\n\t// When s or o are empty we can use the other in an attempt to determine\n\t// the response.\n\tif o == \"\" {\n\t\t_, n := strconv.ParseInt(s, 10, 64)\n\t\tif n != nil {\n\t\t\treturn -1\n\t\t}\n\t\treturn 1\n\t}\n\tif s == \"\" {\n\t\t_, n := strconv.ParseInt(o, 10, 64)\n\t\tif n != nil {\n\t\t\treturn 1\n\t\t}\n\t\treturn -1\n\t}\n\n\tif s > o {\n\t\treturn 1\n\t}\n\treturn -1\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/vendor/github.com/pkg/errors/LICENSE",
    "content": "Copyright (c) 2015, Dave Cheney <dave@cheney.net>\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (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"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/vendor/github.com/pkg/errors/README.md",
    "content": "# errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors)\n\nPackage errors provides simple error handling primitives.\n\n`go get github.com/pkg/errors`\n\nThe traditional error handling idiom in Go is roughly akin to\n```go\nif err != nil {\n        return err\n}\n```\nwhich applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error.\n\n## Adding context to an error\n\nThe errors.Wrap function returns a new error that adds context to the original error. For example\n```go\n_, err := ioutil.ReadAll(r)\nif err != nil {\n        return errors.Wrap(err, \"read failed\")\n}\n```\n## Retrieving the cause of an error\n\nUsing `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`.\n```go\ntype causer interface {\n        Cause() error\n}\n```\n`errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example:\n```go\nswitch err := errors.Cause(err).(type) {\ncase *MyError:\n        // handle specifically\ndefault:\n        // unknown error\n}\n```\n\n[Read the package documentation for more information](https://godoc.org/github.com/pkg/errors).\n\n## Contributing\n\nWe welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high.\n\nBefore proposing a change, please discuss your change by raising an issue.\n\n## Licence\n\nBSD-2-Clause\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/vendor/github.com/pkg/errors/errors.go",
    "content": "// Package errors provides simple error handling primitives.\n//\n// The traditional error handling idiom in Go is roughly akin to\n//\n//     if err != nil {\n//             return err\n//     }\n//\n// which applied recursively up the call stack results in error reports\n// without context or debugging information. The errors package allows\n// programmers to add context to the failure path in their code in a way\n// that does not destroy the original value of the error.\n//\n// Adding context to an error\n//\n// The errors.Wrap function returns a new error that adds context to the\n// original error by recording a stack trace at the point Wrap is called,\n// and the supplied message. For example\n//\n//     _, err := ioutil.ReadAll(r)\n//     if err != nil {\n//             return errors.Wrap(err, \"read failed\")\n//     }\n//\n// If additional control is required the errors.WithStack and errors.WithMessage\n// functions destructure errors.Wrap into its component operations of annotating\n// an error with a stack trace and an a message, respectively.\n//\n// Retrieving the cause of an error\n//\n// Using errors.Wrap constructs a stack of errors, adding context to the\n// preceding error. Depending on the nature of the error it may be necessary\n// to reverse the operation of errors.Wrap to retrieve the original error\n// for inspection. Any error value which implements this interface\n//\n//     type causer interface {\n//             Cause() error\n//     }\n//\n// can be inspected by errors.Cause. errors.Cause will recursively retrieve\n// the topmost error which does not implement causer, which is assumed to be\n// the original cause. For example:\n//\n//     switch err := errors.Cause(err).(type) {\n//     case *MyError:\n//             // handle specifically\n//     default:\n//             // unknown error\n//     }\n//\n// causer interface is not exported by this package, but is considered a part\n// of stable public API.\n//\n// Formatted printing of errors\n//\n// All error values returned from this package implement fmt.Formatter and can\n// be formatted by the fmt package. The following verbs are supported\n//\n//     %s    print the error. If the error has a Cause it will be\n//           printed recursively\n//     %v    see %s\n//     %+v   extended format. Each Frame of the error's StackTrace will\n//           be printed in detail.\n//\n// Retrieving the stack trace of an error or wrapper\n//\n// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are\n// invoked. This information can be retrieved with the following interface.\n//\n//     type stackTracer interface {\n//             StackTrace() errors.StackTrace\n//     }\n//\n// Where errors.StackTrace is defined as\n//\n//     type StackTrace []Frame\n//\n// The Frame type represents a call site in the stack trace. Frame supports\n// the fmt.Formatter interface that can be used for printing information about\n// the stack trace of this error. For example:\n//\n//     if err, ok := err.(stackTracer); ok {\n//             for _, f := range err.StackTrace() {\n//                     fmt.Printf(\"%+s:%d\", f)\n//             }\n//     }\n//\n// stackTracer interface is not exported by this package, but is considered a part\n// of stable public API.\n//\n// See the documentation for Frame.Format for more details.\npackage errors\n\nimport (\n\t\"fmt\"\n\t\"io\"\n)\n\n// New returns an error with the supplied message.\n// New also records the stack trace at the point it was called.\nfunc New(message string) error {\n\treturn &fundamental{\n\t\tmsg:   message,\n\t\tstack: callers(),\n\t}\n}\n\n// Errorf formats according to a format specifier and returns the string\n// as a value that satisfies error.\n// Errorf also records the stack trace at the point it was called.\nfunc Errorf(format string, args ...interface{}) error {\n\treturn &fundamental{\n\t\tmsg:   fmt.Sprintf(format, args...),\n\t\tstack: callers(),\n\t}\n}\n\n// fundamental is an error that has a message and a stack, but no caller.\ntype fundamental struct {\n\tmsg string\n\t*stack\n}\n\nfunc (f *fundamental) Error() string { return f.msg }\n\nfunc (f *fundamental) Format(s fmt.State, verb rune) {\n\tswitch verb {\n\tcase 'v':\n\t\tif s.Flag('+') {\n\t\t\tio.WriteString(s, f.msg)\n\t\t\tf.stack.Format(s, verb)\n\t\t\treturn\n\t\t}\n\t\tfallthrough\n\tcase 's':\n\t\tio.WriteString(s, f.msg)\n\tcase 'q':\n\t\tfmt.Fprintf(s, \"%q\", f.msg)\n\t}\n}\n\n// WithStack annotates err with a stack trace at the point WithStack was called.\n// If err is nil, WithStack returns nil.\nfunc WithStack(err error) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\treturn &withStack{\n\t\terr,\n\t\tcallers(),\n\t}\n}\n\ntype withStack struct {\n\terror\n\t*stack\n}\n\nfunc (w *withStack) Cause() error { return w.error }\n\nfunc (w *withStack) Format(s fmt.State, verb rune) {\n\tswitch verb {\n\tcase 'v':\n\t\tif s.Flag('+') {\n\t\t\tfmt.Fprintf(s, \"%+v\", w.Cause())\n\t\t\tw.stack.Format(s, verb)\n\t\t\treturn\n\t\t}\n\t\tfallthrough\n\tcase 's':\n\t\tio.WriteString(s, w.Error())\n\tcase 'q':\n\t\tfmt.Fprintf(s, \"%q\", w.Error())\n\t}\n}\n\n// Wrap returns an error annotating err with a stack trace\n// at the point Wrap is called, and the supplied message.\n// If err is nil, Wrap returns nil.\nfunc Wrap(err error, message string) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\terr = &withMessage{\n\t\tcause: err,\n\t\tmsg:   message,\n\t}\n\treturn &withStack{\n\t\terr,\n\t\tcallers(),\n\t}\n}\n\n// Wrapf returns an error annotating err with a stack trace\n// at the point Wrapf is call, and the format specifier.\n// If err is nil, Wrapf returns nil.\nfunc Wrapf(err error, format string, args ...interface{}) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\terr = &withMessage{\n\t\tcause: err,\n\t\tmsg:   fmt.Sprintf(format, args...),\n\t}\n\treturn &withStack{\n\t\terr,\n\t\tcallers(),\n\t}\n}\n\n// WithMessage annotates err with a new message.\n// If err is nil, WithMessage returns nil.\nfunc WithMessage(err error, message string) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\treturn &withMessage{\n\t\tcause: err,\n\t\tmsg:   message,\n\t}\n}\n\ntype withMessage struct {\n\tcause error\n\tmsg   string\n}\n\nfunc (w *withMessage) Error() string { return w.msg + \": \" + w.cause.Error() }\nfunc (w *withMessage) Cause() error  { return w.cause }\n\nfunc (w *withMessage) Format(s fmt.State, verb rune) {\n\tswitch verb {\n\tcase 'v':\n\t\tif s.Flag('+') {\n\t\t\tfmt.Fprintf(s, \"%+v\\n\", w.Cause())\n\t\t\tio.WriteString(s, w.msg)\n\t\t\treturn\n\t\t}\n\t\tfallthrough\n\tcase 's', 'q':\n\t\tio.WriteString(s, w.Error())\n\t}\n}\n\n// Cause returns the underlying cause of the error, if possible.\n// An error value has a cause if it implements the following\n// interface:\n//\n//     type causer interface {\n//            Cause() error\n//     }\n//\n// If the error does not implement Cause, the original error will\n// be returned. If the error is nil, nil will be returned without further\n// investigation.\nfunc Cause(err error) error {\n\ttype causer interface {\n\t\tCause() error\n\t}\n\n\tfor err != nil {\n\t\tcause, ok := err.(causer)\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\terr = cause.Cause()\n\t}\n\treturn err\n}\n"
  },
  {
    "path": "_tools/src/github.com/twitchtv/retool/vendor/github.com/pkg/errors/stack.go",
    "content": "package errors\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"path\"\n\t\"runtime\"\n\t\"strings\"\n)\n\n// Frame represents a program counter inside a stack frame.\ntype Frame uintptr\n\n// pc returns the program counter for this frame;\n// multiple frames may have the same PC value.\nfunc (f Frame) pc() uintptr { return uintptr(f) - 1 }\n\n// file returns the full path to the file that contains the\n// function for this Frame's pc.\nfunc (f Frame) file() string {\n\tfn := runtime.FuncForPC(f.pc())\n\tif fn == nil {\n\t\treturn \"unknown\"\n\t}\n\tfile, _ := fn.FileLine(f.pc())\n\treturn file\n}\n\n// line returns the line number of source code of the\n// function for this Frame's pc.\nfunc (f Frame) line() int {\n\tfn := runtime.FuncForPC(f.pc())\n\tif fn == nil {\n\t\treturn 0\n\t}\n\t_, line := fn.FileLine(f.pc())\n\treturn line\n}\n\n// Format formats the frame according to the fmt.Formatter interface.\n//\n//    %s    source file\n//    %d    source line\n//    %n    function name\n//    %v    equivalent to %s:%d\n//\n// Format accepts flags that alter the printing of some verbs, as follows:\n//\n//    %+s   path of source file relative to the compile time GOPATH\n//    %+v   equivalent to %+s:%d\nfunc (f Frame) Format(s fmt.State, verb rune) {\n\tswitch verb {\n\tcase 's':\n\t\tswitch {\n\t\tcase s.Flag('+'):\n\t\t\tpc := f.pc()\n\t\t\tfn := runtime.FuncForPC(pc)\n\t\t\tif fn == nil {\n\t\t\t\tio.WriteString(s, \"unknown\")\n\t\t\t} else {\n\t\t\t\tfile, _ := fn.FileLine(pc)\n\t\t\t\tfmt.Fprintf(s, \"%s\\n\\t%s\", fn.Name(), file)\n\t\t\t}\n\t\tdefault:\n\t\t\tio.WriteString(s, path.Base(f.file()))\n\t\t}\n\tcase 'd':\n\t\tfmt.Fprintf(s, \"%d\", f.line())\n\tcase 'n':\n\t\tname := runtime.FuncForPC(f.pc()).Name()\n\t\tio.WriteString(s, funcname(name))\n\tcase 'v':\n\t\tf.Format(s, 's')\n\t\tio.WriteString(s, \":\")\n\t\tf.Format(s, 'd')\n\t}\n}\n\n// StackTrace is stack of Frames from innermost (newest) to outermost (oldest).\ntype StackTrace []Frame\n\nfunc (st StackTrace) Format(s fmt.State, verb rune) {\n\tswitch verb {\n\tcase 'v':\n\t\tswitch {\n\t\tcase s.Flag('+'):\n\t\t\tfor _, f := range st {\n\t\t\t\tfmt.Fprintf(s, \"\\n%+v\", f)\n\t\t\t}\n\t\tcase s.Flag('#'):\n\t\t\tfmt.Fprintf(s, \"%#v\", []Frame(st))\n\t\tdefault:\n\t\t\tfmt.Fprintf(s, \"%v\", []Frame(st))\n\t\t}\n\tcase 's':\n\t\tfmt.Fprintf(s, \"%s\", []Frame(st))\n\t}\n}\n\n// stack represents a stack of program counters.\ntype stack []uintptr\n\nfunc (s *stack) Format(st fmt.State, verb rune) {\n\tswitch verb {\n\tcase 'v':\n\t\tswitch {\n\t\tcase st.Flag('+'):\n\t\t\tfor _, pc := range *s {\n\t\t\t\tf := Frame(pc)\n\t\t\t\tfmt.Fprintf(st, \"\\n%+v\", f)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc (s *stack) StackTrace() StackTrace {\n\tf := make([]Frame, len(*s))\n\tfor i := 0; i < len(f); i++ {\n\t\tf[i] = Frame((*s)[i])\n\t}\n\treturn f\n}\n\nfunc callers() *stack {\n\tconst depth = 32\n\tvar pcs [depth]uintptr\n\tn := runtime.Callers(3, pcs[:])\n\tvar st stack = pcs[0:n]\n\treturn &st\n}\n\n// funcname removes the path prefix component of a function's name reported by func.Name().\nfunc funcname(name string) string {\n\ti := strings.LastIndex(name, \"/\")\n\tname = name[i+1:]\n\ti = strings.Index(name, \".\")\n\treturn name[i+1:]\n}\n\nfunc trimGOPATH(name, file string) string {\n\t// Here we want to get the source file path relative to the compile time\n\t// GOPATH. As of Go 1.6.x there is no direct way to know the compiled\n\t// GOPATH at runtime, but we can infer the number of path segments in the\n\t// GOPATH. We note that fn.Name() returns the function name qualified by\n\t// the import path, which does not include the GOPATH. Thus we can trim\n\t// segments from the beginning of the file path until the number of path\n\t// separators remaining is one more than the number of path separators in\n\t// the function name. For example, given:\n\t//\n\t//    GOPATH     /home/user\n\t//    file       /home/user/src/pkg/sub/file.go\n\t//    fn.Name()  pkg/sub.Type.Method\n\t//\n\t// We want to produce:\n\t//\n\t//    pkg/sub/file.go\n\t//\n\t// From this we can easily see that fn.Name() has one less path separator\n\t// than our desired output. We count separators from the end of the file\n\t// path until it finds two more than in the function name and then move\n\t// one character forward to preserve the initial path segment without a\n\t// leading separator.\n\tconst sep = \"/\"\n\tgoal := strings.Count(name, sep) + 2\n\ti := len(file)\n\tfor n := 0; n < goal; n++ {\n\t\ti = strings.LastIndex(file[:i], sep)\n\t\tif i == -1 {\n\t\t\t// not enough separators found, set i so that the slice expression\n\t\t\t// below leaves file unmodified\n\t\t\ti = -len(sep)\n\t\t\tbreak\n\t\t}\n\t}\n\t// get back to 0 or trim the leading separator\n\tfile = file[i+len(sep):]\n\treturn file\n}\n"
  },
  {
    "path": "_tools/src/golang.org/x/sys/execabs/execabs.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\n// Package execabs is a drop-in replacement for os/exec\n// that requires PATH lookups to find absolute paths.\n// That is, execabs.Command(\"cmd\") runs the same PATH lookup\n// as exec.Command(\"cmd\"), but if the result is a path\n// which is relative, the Run and Start methods will report\n// an error instead of running the executable.\n//\n// See https://blog.golang.org/path-security for more information\n// about when it may be necessary or appropriate to use this package.\npackage execabs\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os/exec\"\n\t\"path/filepath\"\n\t\"reflect\"\n\t\"unsafe\"\n)\n\n// ErrNotFound is the error resulting if a path search failed to find an executable file.\n// It is an alias for exec.ErrNotFound.\nvar ErrNotFound = exec.ErrNotFound\n\n// Cmd represents an external command being prepared or run.\n// It is an alias for exec.Cmd.\ntype Cmd = exec.Cmd\n\n// Error is returned by LookPath when it fails to classify a file as an executable.\n// It is an alias for exec.Error.\ntype Error = exec.Error\n\n// An ExitError reports an unsuccessful exit by a command.\n// It is an alias for exec.ExitError.\ntype ExitError = exec.ExitError\n\nfunc relError(file, path string) error {\n\treturn fmt.Errorf(\"%s resolves to executable in current directory (.%c%s)\", file, filepath.Separator, path)\n}\n\n// LookPath searches for an executable named file in the directories\n// named by the PATH environment variable. If file contains a slash,\n// it is tried directly and the PATH is not consulted. The result will be\n// an absolute path.\n//\n// LookPath differs from exec.LookPath in its handling of PATH lookups,\n// which are used for file names without slashes. If exec.LookPath's\n// PATH lookup would have returned an executable from the current directory,\n// LookPath instead returns an error.\nfunc LookPath(file string) (string, error) {\n\tpath, err := exec.LookPath(file)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif filepath.Base(file) == file && !filepath.IsAbs(path) {\n\t\treturn \"\", relError(file, path)\n\t}\n\treturn path, nil\n}\n\nfunc fixCmd(name string, cmd *exec.Cmd) {\n\tif filepath.Base(name) == name && !filepath.IsAbs(cmd.Path) {\n\t\t// exec.Command was called with a bare binary name and\n\t\t// exec.LookPath returned a path which is not absolute.\n\t\t// Set cmd.lookPathErr and clear cmd.Path so that it\n\t\t// cannot be run.\n\t\tlookPathErr := (*error)(unsafe.Pointer(reflect.ValueOf(cmd).Elem().FieldByName(\"lookPathErr\").Addr().Pointer()))\n\t\tif *lookPathErr == nil {\n\t\t\t*lookPathErr = relError(name, cmd.Path)\n\t\t}\n\t\tcmd.Path = \"\"\n\t}\n}\n\n// CommandContext is like Command but includes a context.\n//\n// The provided context is used to kill the process (by calling os.Process.Kill)\n// if the context becomes done before the command completes on its own.\nfunc CommandContext(ctx context.Context, name string, arg ...string) *exec.Cmd {\n\tcmd := exec.CommandContext(ctx, name, arg...)\n\tfixCmd(name, cmd)\n\treturn cmd\n\n}\n\n// Command returns the Cmd struct to execute the named program with the given arguments.\n// See exec.Command for most details.\n//\n// Command differs from exec.Command in its handling of PATH lookups,\n// which are used when the program name contains no slashes.\n// If exec.Command would have returned an exec.Cmd configured to run an\n// executable from the current directory, Command instead\n// returns an exec.Cmd that will return an error from Start or Run.\nfunc Command(name string, arg ...string) *exec.Cmd {\n\tcmd := exec.Command(name, arg...)\n\tfixCmd(name, cmd)\n\treturn cmd\n}\n"
  },
  {
    "path": "_tools/src/golang.org/x/tools/go/ast/astutil/enclosing.go",
    "content": "// Copyright 2013 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 astutil\n\n// This file defines utilities for working with source positions.\n\nimport (\n\t\"fmt\"\n\t\"go/ast\"\n\t\"go/token\"\n\t\"sort\"\n)\n\n// PathEnclosingInterval returns the node that encloses the source\n// interval [start, end), and all its ancestors up to the AST root.\n//\n// The definition of \"enclosing\" used by this function considers\n// additional whitespace abutting a node to be enclosed by it.\n// In this example:\n//\n//              z := x + y // add them\n//                   <-A->\n//                  <----B----->\n//\n// the ast.BinaryExpr(+) node is considered to enclose interval B\n// even though its [Pos()..End()) is actually only interval A.\n// This behaviour makes user interfaces more tolerant of imperfect\n// input.\n//\n// This function treats tokens as nodes, though they are not included\n// in the result. e.g. PathEnclosingInterval(\"+\") returns the\n// enclosing ast.BinaryExpr(\"x + y\").\n//\n// If start==end, the 1-char interval following start is used instead.\n//\n// The 'exact' result is true if the interval contains only path[0]\n// and perhaps some adjacent whitespace.  It is false if the interval\n// overlaps multiple children of path[0], or if it contains only\n// interior whitespace of path[0].\n// In this example:\n//\n//              z := x + y // add them\n//                <--C-->     <---E-->\n//                  ^\n//                  D\n//\n// intervals C, D and E are inexact.  C is contained by the\n// z-assignment statement, because it spans three of its children (:=,\n// x, +).  So too is the 1-char interval D, because it contains only\n// interior whitespace of the assignment.  E is considered interior\n// whitespace of the BlockStmt containing the assignment.\n//\n// Precondition: [start, end) both lie within the same file as root.\n// TODO(adonovan): return (nil, false) in this case and remove precond.\n// Requires FileSet; see loader.tokenFileContainsPos.\n//\n// Postcondition: path is never nil; it always contains at least 'root'.\n//\nfunc PathEnclosingInterval(root *ast.File, start, end token.Pos) (path []ast.Node, exact bool) {\n\t// fmt.Printf(\"EnclosingInterval %d %d\\n\", start, end) // debugging\n\n\t// Precondition: node.[Pos..End) and adjoining whitespace contain [start, end).\n\tvar visit func(node ast.Node) bool\n\tvisit = func(node ast.Node) bool {\n\t\tpath = append(path, node)\n\n\t\tnodePos := node.Pos()\n\t\tnodeEnd := node.End()\n\n\t\t// fmt.Printf(\"visit(%T, %d, %d)\\n\", node, nodePos, nodeEnd) // debugging\n\n\t\t// Intersect [start, end) with interval of node.\n\t\tif start < nodePos {\n\t\t\tstart = nodePos\n\t\t}\n\t\tif end > nodeEnd {\n\t\t\tend = nodeEnd\n\t\t}\n\n\t\t// Find sole child that contains [start, end).\n\t\tchildren := childrenOf(node)\n\t\tl := len(children)\n\t\tfor i, child := range children {\n\t\t\t// [childPos, childEnd) is unaugmented interval of child.\n\t\t\tchildPos := child.Pos()\n\t\t\tchildEnd := child.End()\n\n\t\t\t// [augPos, augEnd) is whitespace-augmented interval of child.\n\t\t\taugPos := childPos\n\t\t\taugEnd := childEnd\n\t\t\tif i > 0 {\n\t\t\t\taugPos = children[i-1].End() // start of preceding whitespace\n\t\t\t}\n\t\t\tif i < l-1 {\n\t\t\t\tnextChildPos := children[i+1].Pos()\n\t\t\t\t// Does [start, end) lie between child and next child?\n\t\t\t\tif start >= augEnd && end <= nextChildPos {\n\t\t\t\t\treturn false // inexact match\n\t\t\t\t}\n\t\t\t\taugEnd = nextChildPos // end of following whitespace\n\t\t\t}\n\n\t\t\t// fmt.Printf(\"\\tchild %d: [%d..%d)\\tcontains interval [%d..%d)?\\n\",\n\t\t\t// \ti, augPos, augEnd, start, end) // debugging\n\n\t\t\t// Does augmented child strictly contain [start, end)?\n\t\t\tif augPos <= start && end <= augEnd {\n\t\t\t\t_, isToken := child.(tokenNode)\n\t\t\t\treturn isToken || visit(child)\n\t\t\t}\n\n\t\t\t// Does [start, end) overlap multiple children?\n\t\t\t// i.e. left-augmented child contains start\n\t\t\t// but LR-augmented child does not contain end.\n\t\t\tif start < childEnd && end > augEnd {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// No single child contained [start, end),\n\t\t// so node is the result.  Is it exact?\n\n\t\t// (It's tempting to put this condition before the\n\t\t// child loop, but it gives the wrong result in the\n\t\t// case where a node (e.g. ExprStmt) and its sole\n\t\t// child have equal intervals.)\n\t\tif start == nodePos && end == nodeEnd {\n\t\t\treturn true // exact match\n\t\t}\n\n\t\treturn false // inexact: overlaps multiple children\n\t}\n\n\tif start > end {\n\t\tstart, end = end, start\n\t}\n\n\tif start < root.End() && end > root.Pos() {\n\t\tif start == end {\n\t\t\tend = start + 1 // empty interval => interval of size 1\n\t\t}\n\t\texact = visit(root)\n\n\t\t// Reverse the path:\n\t\tfor i, l := 0, len(path); i < l/2; i++ {\n\t\t\tpath[i], path[l-1-i] = path[l-1-i], path[i]\n\t\t}\n\t} else {\n\t\t// Selection lies within whitespace preceding the\n\t\t// first (or following the last) declaration in the file.\n\t\t// The result nonetheless always includes the ast.File.\n\t\tpath = append(path, root)\n\t}\n\n\treturn\n}\n\n// tokenNode is a dummy implementation of ast.Node for a single token.\n// They are used transiently by PathEnclosingInterval but never escape\n// this package.\n//\ntype tokenNode struct {\n\tpos token.Pos\n\tend token.Pos\n}\n\nfunc (n tokenNode) Pos() token.Pos {\n\treturn n.pos\n}\n\nfunc (n tokenNode) End() token.Pos {\n\treturn n.end\n}\n\nfunc tok(pos token.Pos, len int) ast.Node {\n\treturn tokenNode{pos, pos + token.Pos(len)}\n}\n\n// childrenOf returns the direct non-nil children of ast.Node n.\n// It may include fake ast.Node implementations for bare tokens.\n// it is not safe to call (e.g.) ast.Walk on such nodes.\n//\nfunc childrenOf(n ast.Node) []ast.Node {\n\tvar children []ast.Node\n\n\t// First add nodes for all true subtrees.\n\tast.Inspect(n, func(node ast.Node) bool {\n\t\tif node == n { // push n\n\t\t\treturn true // recur\n\t\t}\n\t\tif node != nil { // push child\n\t\t\tchildren = append(children, node)\n\t\t}\n\t\treturn false // no recursion\n\t})\n\n\t// Then add fake Nodes for bare tokens.\n\tswitch n := n.(type) {\n\tcase *ast.ArrayType:\n\t\tchildren = append(children,\n\t\t\ttok(n.Lbrack, len(\"[\")),\n\t\t\ttok(n.Elt.End(), len(\"]\")))\n\n\tcase *ast.AssignStmt:\n\t\tchildren = append(children,\n\t\t\ttok(n.TokPos, len(n.Tok.String())))\n\n\tcase *ast.BasicLit:\n\t\tchildren = append(children,\n\t\t\ttok(n.ValuePos, len(n.Value)))\n\n\tcase *ast.BinaryExpr:\n\t\tchildren = append(children, tok(n.OpPos, len(n.Op.String())))\n\n\tcase *ast.BlockStmt:\n\t\tchildren = append(children,\n\t\t\ttok(n.Lbrace, len(\"{\")),\n\t\t\ttok(n.Rbrace, len(\"}\")))\n\n\tcase *ast.BranchStmt:\n\t\tchildren = append(children,\n\t\t\ttok(n.TokPos, len(n.Tok.String())))\n\n\tcase *ast.CallExpr:\n\t\tchildren = append(children,\n\t\t\ttok(n.Lparen, len(\"(\")),\n\t\t\ttok(n.Rparen, len(\")\")))\n\t\tif n.Ellipsis != 0 {\n\t\t\tchildren = append(children, tok(n.Ellipsis, len(\"...\")))\n\t\t}\n\n\tcase *ast.CaseClause:\n\t\tif n.List == nil {\n\t\t\tchildren = append(children,\n\t\t\t\ttok(n.Case, len(\"default\")))\n\t\t} else {\n\t\t\tchildren = append(children,\n\t\t\t\ttok(n.Case, len(\"case\")))\n\t\t}\n\t\tchildren = append(children, tok(n.Colon, len(\":\")))\n\n\tcase *ast.ChanType:\n\t\tswitch n.Dir {\n\t\tcase ast.RECV:\n\t\t\tchildren = append(children, tok(n.Begin, len(\"<-chan\")))\n\t\tcase ast.SEND:\n\t\t\tchildren = append(children, tok(n.Begin, len(\"chan<-\")))\n\t\tcase ast.RECV | ast.SEND:\n\t\t\tchildren = append(children, tok(n.Begin, len(\"chan\")))\n\t\t}\n\n\tcase *ast.CommClause:\n\t\tif n.Comm == nil {\n\t\t\tchildren = append(children,\n\t\t\t\ttok(n.Case, len(\"default\")))\n\t\t} else {\n\t\t\tchildren = append(children,\n\t\t\t\ttok(n.Case, len(\"case\")))\n\t\t}\n\t\tchildren = append(children, tok(n.Colon, len(\":\")))\n\n\tcase *ast.Comment:\n\t\t// nop\n\n\tcase *ast.CommentGroup:\n\t\t// nop\n\n\tcase *ast.CompositeLit:\n\t\tchildren = append(children,\n\t\t\ttok(n.Lbrace, len(\"{\")),\n\t\t\ttok(n.Rbrace, len(\"{\")))\n\n\tcase *ast.DeclStmt:\n\t\t// nop\n\n\tcase *ast.DeferStmt:\n\t\tchildren = append(children,\n\t\t\ttok(n.Defer, len(\"defer\")))\n\n\tcase *ast.Ellipsis:\n\t\tchildren = append(children,\n\t\t\ttok(n.Ellipsis, len(\"...\")))\n\n\tcase *ast.EmptyStmt:\n\t\t// nop\n\n\tcase *ast.ExprStmt:\n\t\t// nop\n\n\tcase *ast.Field:\n\t\t// TODO(adonovan): Field.{Doc,Comment,Tag}?\n\n\tcase *ast.FieldList:\n\t\tchildren = append(children,\n\t\t\ttok(n.Opening, len(\"(\")),\n\t\t\ttok(n.Closing, len(\")\")))\n\n\tcase *ast.File:\n\t\t// TODO test: Doc\n\t\tchildren = append(children,\n\t\t\ttok(n.Package, len(\"package\")))\n\n\tcase *ast.ForStmt:\n\t\tchildren = append(children,\n\t\t\ttok(n.For, len(\"for\")))\n\n\tcase *ast.FuncDecl:\n\t\t// TODO(adonovan): FuncDecl.Comment?\n\n\t\t// Uniquely, FuncDecl breaks the invariant that\n\t\t// preorder traversal yields tokens in lexical order:\n\t\t// in fact, FuncDecl.Recv precedes FuncDecl.Type.Func.\n\t\t//\n\t\t// As a workaround, we inline the case for FuncType\n\t\t// here and order things correctly.\n\t\t//\n\t\tchildren = nil // discard ast.Walk(FuncDecl) info subtrees\n\t\tchildren = append(children, tok(n.Type.Func, len(\"func\")))\n\t\tif n.Recv != nil {\n\t\t\tchildren = append(children, n.Recv)\n\t\t}\n\t\tchildren = append(children, n.Name)\n\t\tif n.Type.Params != nil {\n\t\t\tchildren = append(children, n.Type.Params)\n\t\t}\n\t\tif n.Type.Results != nil {\n\t\t\tchildren = append(children, n.Type.Results)\n\t\t}\n\t\tif n.Body != nil {\n\t\t\tchildren = append(children, n.Body)\n\t\t}\n\n\tcase *ast.FuncLit:\n\t\t// nop\n\n\tcase *ast.FuncType:\n\t\tif n.Func != 0 {\n\t\t\tchildren = append(children,\n\t\t\t\ttok(n.Func, len(\"func\")))\n\t\t}\n\n\tcase *ast.GenDecl:\n\t\tchildren = append(children,\n\t\t\ttok(n.TokPos, len(n.Tok.String())))\n\t\tif n.Lparen != 0 {\n\t\t\tchildren = append(children,\n\t\t\t\ttok(n.Lparen, len(\"(\")),\n\t\t\t\ttok(n.Rparen, len(\")\")))\n\t\t}\n\n\tcase *ast.GoStmt:\n\t\tchildren = append(children,\n\t\t\ttok(n.Go, len(\"go\")))\n\n\tcase *ast.Ident:\n\t\tchildren = append(children,\n\t\t\ttok(n.NamePos, len(n.Name)))\n\n\tcase *ast.IfStmt:\n\t\tchildren = append(children,\n\t\t\ttok(n.If, len(\"if\")))\n\n\tcase *ast.ImportSpec:\n\t\t// TODO(adonovan): ImportSpec.{Doc,EndPos}?\n\n\tcase *ast.IncDecStmt:\n\t\tchildren = append(children,\n\t\t\ttok(n.TokPos, len(n.Tok.String())))\n\n\tcase *ast.IndexExpr:\n\t\tchildren = append(children,\n\t\t\ttok(n.Lbrack, len(\"{\")),\n\t\t\ttok(n.Rbrack, len(\"}\")))\n\n\tcase *ast.InterfaceType:\n\t\tchildren = append(children,\n\t\t\ttok(n.Interface, len(\"interface\")))\n\n\tcase *ast.KeyValueExpr:\n\t\tchildren = append(children,\n\t\t\ttok(n.Colon, len(\":\")))\n\n\tcase *ast.LabeledStmt:\n\t\tchildren = append(children,\n\t\t\ttok(n.Colon, len(\":\")))\n\n\tcase *ast.MapType:\n\t\tchildren = append(children,\n\t\t\ttok(n.Map, len(\"map\")))\n\n\tcase *ast.ParenExpr:\n\t\tchildren = append(children,\n\t\t\ttok(n.Lparen, len(\"(\")),\n\t\t\ttok(n.Rparen, len(\")\")))\n\n\tcase *ast.RangeStmt:\n\t\tchildren = append(children,\n\t\t\ttok(n.For, len(\"for\")),\n\t\t\ttok(n.TokPos, len(n.Tok.String())))\n\n\tcase *ast.ReturnStmt:\n\t\tchildren = append(children,\n\t\t\ttok(n.Return, len(\"return\")))\n\n\tcase *ast.SelectStmt:\n\t\tchildren = append(children,\n\t\t\ttok(n.Select, len(\"select\")))\n\n\tcase *ast.SelectorExpr:\n\t\t// nop\n\n\tcase *ast.SendStmt:\n\t\tchildren = append(children,\n\t\t\ttok(n.Arrow, len(\"<-\")))\n\n\tcase *ast.SliceExpr:\n\t\tchildren = append(children,\n\t\t\ttok(n.Lbrack, len(\"[\")),\n\t\t\ttok(n.Rbrack, len(\"]\")))\n\n\tcase *ast.StarExpr:\n\t\tchildren = append(children, tok(n.Star, len(\"*\")))\n\n\tcase *ast.StructType:\n\t\tchildren = append(children, tok(n.Struct, len(\"struct\")))\n\n\tcase *ast.SwitchStmt:\n\t\tchildren = append(children, tok(n.Switch, len(\"switch\")))\n\n\tcase *ast.TypeAssertExpr:\n\t\tchildren = append(children,\n\t\t\ttok(n.Lparen-1, len(\".\")),\n\t\t\ttok(n.Lparen, len(\"(\")),\n\t\t\ttok(n.Rparen, len(\")\")))\n\n\tcase *ast.TypeSpec:\n\t\t// TODO(adonovan): TypeSpec.{Doc,Comment}?\n\n\tcase *ast.TypeSwitchStmt:\n\t\tchildren = append(children, tok(n.Switch, len(\"switch\")))\n\n\tcase *ast.UnaryExpr:\n\t\tchildren = append(children, tok(n.OpPos, len(n.Op.String())))\n\n\tcase *ast.ValueSpec:\n\t\t// TODO(adonovan): ValueSpec.{Doc,Comment}?\n\n\tcase *ast.BadDecl, *ast.BadExpr, *ast.BadStmt:\n\t\t// nop\n\t}\n\n\t// TODO(adonovan): opt: merge the logic of ast.Inspect() into\n\t// the switch above so we can make interleaved callbacks for\n\t// both Nodes and Tokens in the right order and avoid the need\n\t// to sort.\n\tsort.Sort(byPos(children))\n\n\treturn children\n}\n\ntype byPos []ast.Node\n\nfunc (sl byPos) Len() int {\n\treturn len(sl)\n}\nfunc (sl byPos) Less(i, j int) bool {\n\treturn sl[i].Pos() < sl[j].Pos()\n}\nfunc (sl byPos) Swap(i, j int) {\n\tsl[i], sl[j] = sl[j], sl[i]\n}\n\n// NodeDescription returns a description of the concrete type of n suitable\n// for a user interface.\n//\n// TODO(adonovan): in some cases (e.g. Field, FieldList, Ident,\n// StarExpr) we could be much more specific given the path to the AST\n// root.  Perhaps we should do that.\n//\nfunc NodeDescription(n ast.Node) string {\n\tswitch n := n.(type) {\n\tcase *ast.ArrayType:\n\t\treturn \"array type\"\n\tcase *ast.AssignStmt:\n\t\treturn \"assignment\"\n\tcase *ast.BadDecl:\n\t\treturn \"bad declaration\"\n\tcase *ast.BadExpr:\n\t\treturn \"bad expression\"\n\tcase *ast.BadStmt:\n\t\treturn \"bad statement\"\n\tcase *ast.BasicLit:\n\t\treturn \"basic literal\"\n\tcase *ast.BinaryExpr:\n\t\treturn fmt.Sprintf(\"binary %s operation\", n.Op)\n\tcase *ast.BlockStmt:\n\t\treturn \"block\"\n\tcase *ast.BranchStmt:\n\t\tswitch n.Tok {\n\t\tcase token.BREAK:\n\t\t\treturn \"break statement\"\n\t\tcase token.CONTINUE:\n\t\t\treturn \"continue statement\"\n\t\tcase token.GOTO:\n\t\t\treturn \"goto statement\"\n\t\tcase token.FALLTHROUGH:\n\t\t\treturn \"fall-through statement\"\n\t\t}\n\tcase *ast.CallExpr:\n\t\tif len(n.Args) == 1 && !n.Ellipsis.IsValid() {\n\t\t\treturn \"function call (or conversion)\"\n\t\t}\n\t\treturn \"function call\"\n\tcase *ast.CaseClause:\n\t\treturn \"case clause\"\n\tcase *ast.ChanType:\n\t\treturn \"channel type\"\n\tcase *ast.CommClause:\n\t\treturn \"communication clause\"\n\tcase *ast.Comment:\n\t\treturn \"comment\"\n\tcase *ast.CommentGroup:\n\t\treturn \"comment group\"\n\tcase *ast.CompositeLit:\n\t\treturn \"composite literal\"\n\tcase *ast.DeclStmt:\n\t\treturn NodeDescription(n.Decl) + \" statement\"\n\tcase *ast.DeferStmt:\n\t\treturn \"defer statement\"\n\tcase *ast.Ellipsis:\n\t\treturn \"ellipsis\"\n\tcase *ast.EmptyStmt:\n\t\treturn \"empty statement\"\n\tcase *ast.ExprStmt:\n\t\treturn \"expression statement\"\n\tcase *ast.Field:\n\t\t// Can be any of these:\n\t\t// struct {x, y int}  -- struct field(s)\n\t\t// struct {T}         -- anon struct field\n\t\t// interface {I}      -- interface embedding\n\t\t// interface {f()}    -- interface method\n\t\t// func (A) func(B) C -- receiver, param(s), result(s)\n\t\treturn \"field/method/parameter\"\n\tcase *ast.FieldList:\n\t\treturn \"field/method/parameter list\"\n\tcase *ast.File:\n\t\treturn \"source file\"\n\tcase *ast.ForStmt:\n\t\treturn \"for loop\"\n\tcase *ast.FuncDecl:\n\t\treturn \"function declaration\"\n\tcase *ast.FuncLit:\n\t\treturn \"function literal\"\n\tcase *ast.FuncType:\n\t\treturn \"function type\"\n\tcase *ast.GenDecl:\n\t\tswitch n.Tok {\n\t\tcase token.IMPORT:\n\t\t\treturn \"import declaration\"\n\t\tcase token.CONST:\n\t\t\treturn \"constant declaration\"\n\t\tcase token.TYPE:\n\t\t\treturn \"type declaration\"\n\t\tcase token.VAR:\n\t\t\treturn \"variable declaration\"\n\t\t}\n\tcase *ast.GoStmt:\n\t\treturn \"go statement\"\n\tcase *ast.Ident:\n\t\treturn \"identifier\"\n\tcase *ast.IfStmt:\n\t\treturn \"if statement\"\n\tcase *ast.ImportSpec:\n\t\treturn \"import specification\"\n\tcase *ast.IncDecStmt:\n\t\tif n.Tok == token.INC {\n\t\t\treturn \"increment statement\"\n\t\t}\n\t\treturn \"decrement statement\"\n\tcase *ast.IndexExpr:\n\t\treturn \"index expression\"\n\tcase *ast.InterfaceType:\n\t\treturn \"interface type\"\n\tcase *ast.KeyValueExpr:\n\t\treturn \"key/value association\"\n\tcase *ast.LabeledStmt:\n\t\treturn \"statement label\"\n\tcase *ast.MapType:\n\t\treturn \"map type\"\n\tcase *ast.Package:\n\t\treturn \"package\"\n\tcase *ast.ParenExpr:\n\t\treturn \"parenthesized \" + NodeDescription(n.X)\n\tcase *ast.RangeStmt:\n\t\treturn \"range loop\"\n\tcase *ast.ReturnStmt:\n\t\treturn \"return statement\"\n\tcase *ast.SelectStmt:\n\t\treturn \"select statement\"\n\tcase *ast.SelectorExpr:\n\t\treturn \"selector\"\n\tcase *ast.SendStmt:\n\t\treturn \"channel send\"\n\tcase *ast.SliceExpr:\n\t\treturn \"slice expression\"\n\tcase *ast.StarExpr:\n\t\treturn \"*-operation\" // load/store expr or pointer type\n\tcase *ast.StructType:\n\t\treturn \"struct type\"\n\tcase *ast.SwitchStmt:\n\t\treturn \"switch statement\"\n\tcase *ast.TypeAssertExpr:\n\t\treturn \"type assertion\"\n\tcase *ast.TypeSpec:\n\t\treturn \"type specification\"\n\tcase *ast.TypeSwitchStmt:\n\t\treturn \"type switch\"\n\tcase *ast.UnaryExpr:\n\t\treturn fmt.Sprintf(\"unary %s operation\", n.Op)\n\tcase *ast.ValueSpec:\n\t\treturn \"value specification\"\n\n\t}\n\tpanic(fmt.Sprintf(\"unexpected node type: %T\", n))\n}\n"
  },
  {
    "path": "_tools/src/golang.org/x/tools/go/ast/astutil/imports.go",
    "content": "// Copyright 2013 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 astutil contains common utilities for working with the Go AST.\npackage astutil // import \"golang.org/x/tools/go/ast/astutil\"\n\nimport (\n\t\"fmt\"\n\t\"go/ast\"\n\t\"go/token\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// AddImport adds the import path to the file f, if absent.\nfunc AddImport(fset *token.FileSet, f *ast.File, path string) (added bool) {\n\treturn AddNamedImport(fset, f, \"\", path)\n}\n\n// AddNamedImport adds the import with the given name and path to the file f, if absent.\n// If name is not empty, it is used to rename the import.\n//\n// For example, calling\n//\tAddNamedImport(fset, f, \"pathpkg\", \"path\")\n// adds\n//\timport pathpkg \"path\"\nfunc AddNamedImport(fset *token.FileSet, f *ast.File, name, path string) (added bool) {\n\tif imports(f, name, path) {\n\t\treturn false\n\t}\n\n\tnewImport := &ast.ImportSpec{\n\t\tPath: &ast.BasicLit{\n\t\t\tKind:  token.STRING,\n\t\t\tValue: strconv.Quote(path),\n\t\t},\n\t}\n\tif name != \"\" {\n\t\tnewImport.Name = &ast.Ident{Name: name}\n\t}\n\n\t// Find an import decl to add to.\n\t// The goal is to find an existing import\n\t// whose import path has the longest shared\n\t// prefix with path.\n\tvar (\n\t\tbestMatch  = -1         // length of longest shared prefix\n\t\tlastImport = -1         // index in f.Decls of the file's final import decl\n\t\timpDecl    *ast.GenDecl // import decl containing the best match\n\t\timpIndex   = -1         // spec index in impDecl containing the best match\n\n\t\tisThirdPartyPath = isThirdParty(path)\n\t)\n\tfor i, decl := range f.Decls {\n\t\tgen, ok := decl.(*ast.GenDecl)\n\t\tif ok && gen.Tok == token.IMPORT {\n\t\t\tlastImport = i\n\t\t\t// Do not add to import \"C\", to avoid disrupting the\n\t\t\t// association with its doc comment, breaking cgo.\n\t\t\tif declImports(gen, \"C\") {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Match an empty import decl if that's all that is available.\n\t\t\tif len(gen.Specs) == 0 && bestMatch == -1 {\n\t\t\t\timpDecl = gen\n\t\t\t}\n\n\t\t\t// Compute longest shared prefix with imports in this group and find best\n\t\t\t// matched import spec.\n\t\t\t// 1. Always prefer import spec with longest shared prefix.\n\t\t\t// 2. While match length is 0,\n\t\t\t// - for stdlib package: prefer first import spec.\n\t\t\t// - for third party package: prefer first third party import spec.\n\t\t\t// We cannot use last import spec as best match for third party package\n\t\t\t// because grouped imports are usually placed last by goimports -local\n\t\t\t// flag.\n\t\t\t// See issue #19190.\n\t\t\tseenAnyThirdParty := false\n\t\t\tfor j, spec := range gen.Specs {\n\t\t\t\timpspec := spec.(*ast.ImportSpec)\n\t\t\t\tp := importPath(impspec)\n\t\t\t\tn := matchLen(p, path)\n\t\t\t\tif n > bestMatch || (bestMatch == 0 && !seenAnyThirdParty && isThirdPartyPath) {\n\t\t\t\t\tbestMatch = n\n\t\t\t\t\timpDecl = gen\n\t\t\t\t\timpIndex = j\n\t\t\t\t}\n\t\t\t\tseenAnyThirdParty = seenAnyThirdParty || isThirdParty(p)\n\t\t\t}\n\t\t}\n\t}\n\n\t// If no import decl found, add one after the last import.\n\tif impDecl == nil {\n\t\timpDecl = &ast.GenDecl{\n\t\t\tTok: token.IMPORT,\n\t\t}\n\t\tif lastImport >= 0 {\n\t\t\timpDecl.TokPos = f.Decls[lastImport].End()\n\t\t} else {\n\t\t\t// There are no existing imports.\n\t\t\t// Our new import, preceded by a blank line,  goes after the package declaration\n\t\t\t// and after the comment, if any, that starts on the same line as the\n\t\t\t// package declaration.\n\t\t\timpDecl.TokPos = f.Package\n\n\t\t\tfile := fset.File(f.Package)\n\t\t\tpkgLine := file.Line(f.Package)\n\t\t\tfor _, c := range f.Comments {\n\t\t\t\tif file.Line(c.Pos()) > pkgLine {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\t// +2 for a blank line\n\t\t\t\timpDecl.TokPos = c.End() + 2\n\t\t\t}\n\t\t}\n\t\tf.Decls = append(f.Decls, nil)\n\t\tcopy(f.Decls[lastImport+2:], f.Decls[lastImport+1:])\n\t\tf.Decls[lastImport+1] = impDecl\n\t}\n\n\t// Insert new import at insertAt.\n\tinsertAt := 0\n\tif impIndex >= 0 {\n\t\t// insert after the found import\n\t\tinsertAt = impIndex + 1\n\t}\n\timpDecl.Specs = append(impDecl.Specs, nil)\n\tcopy(impDecl.Specs[insertAt+1:], impDecl.Specs[insertAt:])\n\timpDecl.Specs[insertAt] = newImport\n\tpos := impDecl.Pos()\n\tif insertAt > 0 {\n\t\t// If there is a comment after an existing import, preserve the comment\n\t\t// position by adding the new import after the comment.\n\t\tif spec, ok := impDecl.Specs[insertAt-1].(*ast.ImportSpec); ok && spec.Comment != nil {\n\t\t\tpos = spec.Comment.End()\n\t\t} else {\n\t\t\t// Assign same position as the previous import,\n\t\t\t// so that the sorter sees it as being in the same block.\n\t\t\tpos = impDecl.Specs[insertAt-1].Pos()\n\t\t}\n\t}\n\tif newImport.Name != nil {\n\t\tnewImport.Name.NamePos = pos\n\t}\n\tnewImport.Path.ValuePos = pos\n\tnewImport.EndPos = pos\n\n\t// Clean up parens. impDecl contains at least one spec.\n\tif len(impDecl.Specs) == 1 {\n\t\t// Remove unneeded parens.\n\t\timpDecl.Lparen = token.NoPos\n\t} else if !impDecl.Lparen.IsValid() {\n\t\t// impDecl needs parens added.\n\t\timpDecl.Lparen = impDecl.Specs[0].Pos()\n\t}\n\n\tf.Imports = append(f.Imports, newImport)\n\n\tif len(f.Decls) <= 1 {\n\t\treturn true\n\t}\n\n\t// Merge all the import declarations into the first one.\n\tvar first *ast.GenDecl\n\tfor i := 0; i < len(f.Decls); i++ {\n\t\tdecl := f.Decls[i]\n\t\tgen, ok := decl.(*ast.GenDecl)\n\t\tif !ok || gen.Tok != token.IMPORT || declImports(gen, \"C\") {\n\t\t\tcontinue\n\t\t}\n\t\tif first == nil {\n\t\t\tfirst = gen\n\t\t\tcontinue // Don't touch the first one.\n\t\t}\n\t\t// We now know there is more than one package in this import\n\t\t// declaration. Ensure that it ends up parenthesized.\n\t\tfirst.Lparen = first.Pos()\n\t\t// Move the imports of the other import declaration to the first one.\n\t\tfor _, spec := range gen.Specs {\n\t\t\tspec.(*ast.ImportSpec).Path.ValuePos = first.Pos()\n\t\t\tfirst.Specs = append(first.Specs, spec)\n\t\t}\n\t\tf.Decls = append(f.Decls[:i], f.Decls[i+1:]...)\n\t\ti--\n\t}\n\n\treturn true\n}\n\nfunc isThirdParty(importPath string) bool {\n\t// Third party package import path usually contains \".\" (\".com\", \".org\", ...)\n\t// This logic is taken from golang.org/x/tools/imports package.\n\treturn strings.Contains(importPath, \".\")\n}\n\n// DeleteImport deletes the import path from the file f, if present.\n// If there are duplicate import declarations, all matching ones are deleted.\nfunc DeleteImport(fset *token.FileSet, f *ast.File, path string) (deleted bool) {\n\treturn DeleteNamedImport(fset, f, \"\", path)\n}\n\n// DeleteNamedImport deletes the import with the given name and path from the file f, if present.\n// If there are duplicate import declarations, all matching ones are deleted.\nfunc DeleteNamedImport(fset *token.FileSet, f *ast.File, name, path string) (deleted bool) {\n\tvar delspecs []*ast.ImportSpec\n\tvar delcomments []*ast.CommentGroup\n\n\t// Find the import nodes that import path, if any.\n\tfor i := 0; i < len(f.Decls); i++ {\n\t\tdecl := f.Decls[i]\n\t\tgen, ok := decl.(*ast.GenDecl)\n\t\tif !ok || gen.Tok != token.IMPORT {\n\t\t\tcontinue\n\t\t}\n\t\tfor j := 0; j < len(gen.Specs); j++ {\n\t\t\tspec := gen.Specs[j]\n\t\t\timpspec := spec.(*ast.ImportSpec)\n\t\t\tif importName(impspec) != name || importPath(impspec) != path {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// We found an import spec that imports path.\n\t\t\t// Delete it.\n\t\t\tdelspecs = append(delspecs, impspec)\n\t\t\tdeleted = true\n\t\t\tcopy(gen.Specs[j:], gen.Specs[j+1:])\n\t\t\tgen.Specs = gen.Specs[:len(gen.Specs)-1]\n\n\t\t\t// If this was the last import spec in this decl,\n\t\t\t// delete the decl, too.\n\t\t\tif len(gen.Specs) == 0 {\n\t\t\t\tcopy(f.Decls[i:], f.Decls[i+1:])\n\t\t\t\tf.Decls = f.Decls[:len(f.Decls)-1]\n\t\t\t\ti--\n\t\t\t\tbreak\n\t\t\t} else if len(gen.Specs) == 1 {\n\t\t\t\tif impspec.Doc != nil {\n\t\t\t\t\tdelcomments = append(delcomments, impspec.Doc)\n\t\t\t\t}\n\t\t\t\tif impspec.Comment != nil {\n\t\t\t\t\tdelcomments = append(delcomments, impspec.Comment)\n\t\t\t\t}\n\t\t\t\tfor _, cg := range f.Comments {\n\t\t\t\t\t// Found comment on the same line as the import spec.\n\t\t\t\t\tif cg.End() < impspec.Pos() && fset.Position(cg.End()).Line == fset.Position(impspec.Pos()).Line {\n\t\t\t\t\t\tdelcomments = append(delcomments, cg)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tspec := gen.Specs[0].(*ast.ImportSpec)\n\n\t\t\t\t// Move the documentation right after the import decl.\n\t\t\t\tif spec.Doc != nil {\n\t\t\t\t\tfor fset.Position(gen.TokPos).Line+1 < fset.Position(spec.Doc.Pos()).Line {\n\t\t\t\t\t\tfset.File(gen.TokPos).MergeLine(fset.Position(gen.TokPos).Line)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, cg := range f.Comments {\n\t\t\t\t\tif cg.End() < spec.Pos() && fset.Position(cg.End()).Line == fset.Position(spec.Pos()).Line {\n\t\t\t\t\t\tfor fset.Position(gen.TokPos).Line+1 < fset.Position(spec.Pos()).Line {\n\t\t\t\t\t\t\tfset.File(gen.TokPos).MergeLine(fset.Position(gen.TokPos).Line)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif j > 0 {\n\t\t\t\tlastImpspec := gen.Specs[j-1].(*ast.ImportSpec)\n\t\t\t\tlastLine := fset.Position(lastImpspec.Path.ValuePos).Line\n\t\t\t\tline := fset.Position(impspec.Path.ValuePos).Line\n\n\t\t\t\t// We deleted an entry but now there may be\n\t\t\t\t// a blank line-sized hole where the import was.\n\t\t\t\tif line-lastLine > 1 || !gen.Rparen.IsValid() {\n\t\t\t\t\t// There was a blank line immediately preceding the deleted import,\n\t\t\t\t\t// so there's no need to close the hole. The right parenthesis is\n\t\t\t\t\t// invalid after AddImport to an import statement without parenthesis.\n\t\t\t\t\t// Do nothing.\n\t\t\t\t} else if line != fset.File(gen.Rparen).LineCount() {\n\t\t\t\t\t// There was no blank line. Close the hole.\n\t\t\t\t\tfset.File(gen.Rparen).MergeLine(line)\n\t\t\t\t}\n\t\t\t}\n\t\t\tj--\n\t\t}\n\t}\n\n\t// Delete imports from f.Imports.\n\tfor i := 0; i < len(f.Imports); i++ {\n\t\timp := f.Imports[i]\n\t\tfor j, del := range delspecs {\n\t\t\tif imp == del {\n\t\t\t\tcopy(f.Imports[i:], f.Imports[i+1:])\n\t\t\t\tf.Imports = f.Imports[:len(f.Imports)-1]\n\t\t\t\tcopy(delspecs[j:], delspecs[j+1:])\n\t\t\t\tdelspecs = delspecs[:len(delspecs)-1]\n\t\t\t\ti--\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t// Delete comments from f.Comments.\n\tfor i := 0; i < len(f.Comments); i++ {\n\t\tcg := f.Comments[i]\n\t\tfor j, del := range delcomments {\n\t\t\tif cg == del {\n\t\t\t\tcopy(f.Comments[i:], f.Comments[i+1:])\n\t\t\t\tf.Comments = f.Comments[:len(f.Comments)-1]\n\t\t\t\tcopy(delcomments[j:], delcomments[j+1:])\n\t\t\t\tdelcomments = delcomments[:len(delcomments)-1]\n\t\t\t\ti--\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(delspecs) > 0 {\n\t\tpanic(fmt.Sprintf(\"deleted specs from Decls but not Imports: %v\", delspecs))\n\t}\n\n\treturn\n}\n\n// RewriteImport rewrites any import of path oldPath to path newPath.\nfunc RewriteImport(fset *token.FileSet, f *ast.File, oldPath, newPath string) (rewrote bool) {\n\tfor _, imp := range f.Imports {\n\t\tif importPath(imp) == oldPath {\n\t\t\trewrote = true\n\t\t\t// record old End, because the default is to compute\n\t\t\t// it using the length of imp.Path.Value.\n\t\t\timp.EndPos = imp.End()\n\t\t\timp.Path.Value = strconv.Quote(newPath)\n\t\t}\n\t}\n\treturn\n}\n\n// UsesImport reports whether a given import is used.\nfunc UsesImport(f *ast.File, path string) (used bool) {\n\tspec := importSpec(f, path)\n\tif spec == nil {\n\t\treturn\n\t}\n\n\tname := spec.Name.String()\n\tswitch name {\n\tcase \"<nil>\":\n\t\t// If the package name is not explicitly specified,\n\t\t// make an educated guess. This is not guaranteed to be correct.\n\t\tlastSlash := strings.LastIndex(path, \"/\")\n\t\tif lastSlash == -1 {\n\t\t\tname = path\n\t\t} else {\n\t\t\tname = path[lastSlash+1:]\n\t\t}\n\tcase \"_\", \".\":\n\t\t// Not sure if this import is used - err on the side of caution.\n\t\treturn true\n\t}\n\n\tast.Walk(visitFn(func(n ast.Node) {\n\t\tsel, ok := n.(*ast.SelectorExpr)\n\t\tif ok && isTopName(sel.X, name) {\n\t\t\tused = true\n\t\t}\n\t}), f)\n\n\treturn\n}\n\ntype visitFn func(node ast.Node)\n\nfunc (fn visitFn) Visit(node ast.Node) ast.Visitor {\n\tfn(node)\n\treturn fn\n}\n\n// imports reports whether f has an import with the specified name and path.\nfunc imports(f *ast.File, name, path string) bool {\n\tfor _, s := range f.Imports {\n\t\tif importName(s) == name && importPath(s) == path {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n// importSpec returns the import spec if f imports path,\n// or nil otherwise.\nfunc importSpec(f *ast.File, path string) *ast.ImportSpec {\n\tfor _, s := range f.Imports {\n\t\tif importPath(s) == path {\n\t\t\treturn s\n\t\t}\n\t}\n\treturn nil\n}\n\n// importName returns the name of s,\n// or \"\" if the import is not named.\nfunc importName(s *ast.ImportSpec) string {\n\tif s.Name == nil {\n\t\treturn \"\"\n\t}\n\treturn s.Name.Name\n}\n\n// importPath returns the unquoted import path of s,\n// or \"\" if the path is not properly quoted.\nfunc importPath(s *ast.ImportSpec) string {\n\tt, err := strconv.Unquote(s.Path.Value)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn t\n}\n\n// declImports reports whether gen contains an import of path.\nfunc declImports(gen *ast.GenDecl, path string) bool {\n\tif gen.Tok != token.IMPORT {\n\t\treturn false\n\t}\n\tfor _, spec := range gen.Specs {\n\t\timpspec := spec.(*ast.ImportSpec)\n\t\tif importPath(impspec) == path {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n// matchLen returns the length of the longest path segment prefix shared by x and y.\nfunc matchLen(x, y string) int {\n\tn := 0\n\tfor i := 0; i < len(x) && i < len(y) && x[i] == y[i]; i++ {\n\t\tif x[i] == '/' {\n\t\t\tn++\n\t\t}\n\t}\n\treturn n\n}\n\n// isTopName returns true if n is a top-level unresolved identifier with the given name.\nfunc isTopName(n ast.Expr, name string) bool {\n\tid, ok := n.(*ast.Ident)\n\treturn ok && id.Name == name && id.Obj == nil\n}\n\n// Imports returns the file imports grouped by paragraph.\nfunc Imports(fset *token.FileSet, f *ast.File) [][]*ast.ImportSpec {\n\tvar groups [][]*ast.ImportSpec\n\n\tfor _, decl := range f.Decls {\n\t\tgenDecl, ok := decl.(*ast.GenDecl)\n\t\tif !ok || genDecl.Tok != token.IMPORT {\n\t\t\tbreak\n\t\t}\n\n\t\tgroup := []*ast.ImportSpec{}\n\n\t\tvar lastLine int\n\t\tfor _, spec := range genDecl.Specs {\n\t\t\timportSpec := spec.(*ast.ImportSpec)\n\t\t\tpos := importSpec.Path.ValuePos\n\t\t\tline := fset.Position(pos).Line\n\t\t\tif lastLine > 0 && pos > 0 && line-lastLine > 1 {\n\t\t\t\tgroups = append(groups, group)\n\t\t\t\tgroup = []*ast.ImportSpec{}\n\t\t\t}\n\t\t\tgroup = append(group, importSpec)\n\t\t\tlastLine = line\n\t\t}\n\t\tgroups = append(groups, group)\n\t}\n\n\treturn groups\n}\n"
  },
  {
    "path": "_tools/src/golang.org/x/tools/go/ast/astutil/rewrite.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 astutil\n\nimport (\n\t\"fmt\"\n\t\"go/ast\"\n\t\"reflect\"\n\t\"sort\"\n)\n\n// An ApplyFunc is invoked by Apply for each node n, even if n is nil,\n// before and/or after the node's children, using a Cursor describing\n// the current node and providing operations on it.\n//\n// The return value of ApplyFunc controls the syntax tree traversal.\n// See Apply for details.\ntype ApplyFunc func(*Cursor) bool\n\n// Apply traverses a syntax tree recursively, starting with root,\n// and calling pre and post for each node as described below.\n// Apply returns the syntax tree, possibly modified.\n//\n// If pre is not nil, it is called for each node before the node's\n// children are traversed (pre-order). If pre returns false, no\n// children are traversed, and post is not called for that node.\n//\n// If post is not nil, and a prior call of pre didn't return false,\n// post is called for each node after its children are traversed\n// (post-order). If post returns false, traversal is terminated and\n// Apply returns immediately.\n//\n// Only fields that refer to AST nodes are considered children;\n// i.e., token.Pos, Scopes, Objects, and fields of basic types\n// (strings, etc.) are ignored.\n//\n// Children are traversed in the order in which they appear in the\n// respective node's struct definition. A package's files are\n// traversed in the filenames' alphabetical order.\n//\nfunc Apply(root ast.Node, pre, post ApplyFunc) (result ast.Node) {\n\tparent := &struct{ ast.Node }{root}\n\tdefer func() {\n\t\tif r := recover(); r != nil && r != abort {\n\t\t\tpanic(r)\n\t\t}\n\t\tresult = parent.Node\n\t}()\n\ta := &application{pre: pre, post: post}\n\ta.apply(parent, \"Node\", nil, root)\n\treturn\n}\n\nvar abort = new(int) // singleton, to signal termination of Apply\n\n// A Cursor describes a node encountered during Apply.\n// Information about the node and its parent is available\n// from the Node, Parent, Name, and Index methods.\n//\n// If p is a variable of type and value of the current parent node\n// c.Parent(), and f is the field identifier with name c.Name(),\n// the following invariants hold:\n//\n//   p.f            == c.Node()  if c.Index() <  0\n//   p.f[c.Index()] == c.Node()  if c.Index() >= 0\n//\n// The methods Replace, Delete, InsertBefore, and InsertAfter\n// can be used to change the AST without disrupting Apply.\ntype Cursor struct {\n\tparent ast.Node\n\tname   string\n\titer   *iterator // valid if non-nil\n\tnode   ast.Node\n}\n\n// Node returns the current Node.\nfunc (c *Cursor) Node() ast.Node { return c.node }\n\n// Parent returns the parent of the current Node.\nfunc (c *Cursor) Parent() ast.Node { return c.parent }\n\n// Name returns the name of the parent Node field that contains the current Node.\n// If the parent is a *ast.Package and the current Node is a *ast.File, Name returns\n// the filename for the current Node.\nfunc (c *Cursor) Name() string { return c.name }\n\n// Index reports the index >= 0 of the current Node in the slice of Nodes that\n// contains it, or a value < 0 if the current Node is not part of a slice.\n// The index of the current node changes if InsertBefore is called while\n// processing the current node.\nfunc (c *Cursor) Index() int {\n\tif c.iter != nil {\n\t\treturn c.iter.index\n\t}\n\treturn -1\n}\n\n// field returns the current node's parent field value.\nfunc (c *Cursor) field() reflect.Value {\n\treturn reflect.Indirect(reflect.ValueOf(c.parent)).FieldByName(c.name)\n}\n\n// Replace replaces the current Node with n.\n// The replacement node is not walked by Apply.\nfunc (c *Cursor) Replace(n ast.Node) {\n\tif _, ok := c.node.(*ast.File); ok {\n\t\tfile, ok := n.(*ast.File)\n\t\tif !ok {\n\t\t\tpanic(\"attempt to replace *ast.File with non-*ast.File\")\n\t\t}\n\t\tc.parent.(*ast.Package).Files[c.name] = file\n\t\treturn\n\t}\n\n\tv := c.field()\n\tif i := c.Index(); i >= 0 {\n\t\tv = v.Index(i)\n\t}\n\tv.Set(reflect.ValueOf(n))\n}\n\n// Delete deletes the current Node from its containing slice.\n// If the current Node is not part of a slice, Delete panics.\n// As a special case, if the current node is a package file,\n// Delete removes it from the package's Files map.\nfunc (c *Cursor) Delete() {\n\tif _, ok := c.node.(*ast.File); ok {\n\t\tdelete(c.parent.(*ast.Package).Files, c.name)\n\t\treturn\n\t}\n\n\ti := c.Index()\n\tif i < 0 {\n\t\tpanic(\"Delete node not contained in slice\")\n\t}\n\tv := c.field()\n\tl := v.Len()\n\treflect.Copy(v.Slice(i, l), v.Slice(i+1, l))\n\tv.Index(l - 1).Set(reflect.Zero(v.Type().Elem()))\n\tv.SetLen(l - 1)\n\tc.iter.step--\n}\n\n// InsertAfter inserts n after the current Node in its containing slice.\n// If the current Node is not part of a slice, InsertAfter panics.\n// Apply does not walk n.\nfunc (c *Cursor) InsertAfter(n ast.Node) {\n\ti := c.Index()\n\tif i < 0 {\n\t\tpanic(\"InsertAfter node not contained in slice\")\n\t}\n\tv := c.field()\n\tv.Set(reflect.Append(v, reflect.Zero(v.Type().Elem())))\n\tl := v.Len()\n\treflect.Copy(v.Slice(i+2, l), v.Slice(i+1, l))\n\tv.Index(i + 1).Set(reflect.ValueOf(n))\n\tc.iter.step++\n}\n\n// InsertBefore inserts n before the current Node in its containing slice.\n// If the current Node is not part of a slice, InsertBefore panics.\n// Apply will not walk n.\nfunc (c *Cursor) InsertBefore(n ast.Node) {\n\ti := c.Index()\n\tif i < 0 {\n\t\tpanic(\"InsertBefore node not contained in slice\")\n\t}\n\tv := c.field()\n\tv.Set(reflect.Append(v, reflect.Zero(v.Type().Elem())))\n\tl := v.Len()\n\treflect.Copy(v.Slice(i+1, l), v.Slice(i, l))\n\tv.Index(i).Set(reflect.ValueOf(n))\n\tc.iter.index++\n}\n\n// application carries all the shared data so we can pass it around cheaply.\ntype application struct {\n\tpre, post ApplyFunc\n\tcursor    Cursor\n\titer      iterator\n}\n\nfunc (a *application) apply(parent ast.Node, name string, iter *iterator, n ast.Node) {\n\t// convert typed nil into untyped nil\n\tif v := reflect.ValueOf(n); v.Kind() == reflect.Ptr && v.IsNil() {\n\t\tn = nil\n\t}\n\n\t// avoid heap-allocating a new cursor for each apply call; reuse a.cursor instead\n\tsaved := a.cursor\n\ta.cursor.parent = parent\n\ta.cursor.name = name\n\ta.cursor.iter = iter\n\ta.cursor.node = n\n\n\tif a.pre != nil && !a.pre(&a.cursor) {\n\t\ta.cursor = saved\n\t\treturn\n\t}\n\n\t// walk children\n\t// (the order of the cases matches the order of the corresponding node types in go/ast)\n\tswitch n := n.(type) {\n\tcase nil:\n\t\t// nothing to do\n\n\t// Comments and fields\n\tcase *ast.Comment:\n\t\t// nothing to do\n\n\tcase *ast.CommentGroup:\n\t\tif n != nil {\n\t\t\ta.applyList(n, \"List\")\n\t\t}\n\n\tcase *ast.Field:\n\t\ta.apply(n, \"Doc\", nil, n.Doc)\n\t\ta.applyList(n, \"Names\")\n\t\ta.apply(n, \"Type\", nil, n.Type)\n\t\ta.apply(n, \"Tag\", nil, n.Tag)\n\t\ta.apply(n, \"Comment\", nil, n.Comment)\n\n\tcase *ast.FieldList:\n\t\ta.applyList(n, \"List\")\n\n\t// Expressions\n\tcase *ast.BadExpr, *ast.Ident, *ast.BasicLit:\n\t\t// nothing to do\n\n\tcase *ast.Ellipsis:\n\t\ta.apply(n, \"Elt\", nil, n.Elt)\n\n\tcase *ast.FuncLit:\n\t\ta.apply(n, \"Type\", nil, n.Type)\n\t\ta.apply(n, \"Body\", nil, n.Body)\n\n\tcase *ast.CompositeLit:\n\t\ta.apply(n, \"Type\", nil, n.Type)\n\t\ta.applyList(n, \"Elts\")\n\n\tcase *ast.ParenExpr:\n\t\ta.apply(n, \"X\", nil, n.X)\n\n\tcase *ast.SelectorExpr:\n\t\ta.apply(n, \"X\", nil, n.X)\n\t\ta.apply(n, \"Sel\", nil, n.Sel)\n\n\tcase *ast.IndexExpr:\n\t\ta.apply(n, \"X\", nil, n.X)\n\t\ta.apply(n, \"Index\", nil, n.Index)\n\n\tcase *ast.SliceExpr:\n\t\ta.apply(n, \"X\", nil, n.X)\n\t\ta.apply(n, \"Low\", nil, n.Low)\n\t\ta.apply(n, \"High\", nil, n.High)\n\t\ta.apply(n, \"Max\", nil, n.Max)\n\n\tcase *ast.TypeAssertExpr:\n\t\ta.apply(n, \"X\", nil, n.X)\n\t\ta.apply(n, \"Type\", nil, n.Type)\n\n\tcase *ast.CallExpr:\n\t\ta.apply(n, \"Fun\", nil, n.Fun)\n\t\ta.applyList(n, \"Args\")\n\n\tcase *ast.StarExpr:\n\t\ta.apply(n, \"X\", nil, n.X)\n\n\tcase *ast.UnaryExpr:\n\t\ta.apply(n, \"X\", nil, n.X)\n\n\tcase *ast.BinaryExpr:\n\t\ta.apply(n, \"X\", nil, n.X)\n\t\ta.apply(n, \"Y\", nil, n.Y)\n\n\tcase *ast.KeyValueExpr:\n\t\ta.apply(n, \"Key\", nil, n.Key)\n\t\ta.apply(n, \"Value\", nil, n.Value)\n\n\t// Types\n\tcase *ast.ArrayType:\n\t\ta.apply(n, \"Len\", nil, n.Len)\n\t\ta.apply(n, \"Elt\", nil, n.Elt)\n\n\tcase *ast.StructType:\n\t\ta.apply(n, \"Fields\", nil, n.Fields)\n\n\tcase *ast.FuncType:\n\t\ta.apply(n, \"Params\", nil, n.Params)\n\t\ta.apply(n, \"Results\", nil, n.Results)\n\n\tcase *ast.InterfaceType:\n\t\ta.apply(n, \"Methods\", nil, n.Methods)\n\n\tcase *ast.MapType:\n\t\ta.apply(n, \"Key\", nil, n.Key)\n\t\ta.apply(n, \"Value\", nil, n.Value)\n\n\tcase *ast.ChanType:\n\t\ta.apply(n, \"Value\", nil, n.Value)\n\n\t// Statements\n\tcase *ast.BadStmt:\n\t\t// nothing to do\n\n\tcase *ast.DeclStmt:\n\t\ta.apply(n, \"Decl\", nil, n.Decl)\n\n\tcase *ast.EmptyStmt:\n\t\t// nothing to do\n\n\tcase *ast.LabeledStmt:\n\t\ta.apply(n, \"Label\", nil, n.Label)\n\t\ta.apply(n, \"Stmt\", nil, n.Stmt)\n\n\tcase *ast.ExprStmt:\n\t\ta.apply(n, \"X\", nil, n.X)\n\n\tcase *ast.SendStmt:\n\t\ta.apply(n, \"Chan\", nil, n.Chan)\n\t\ta.apply(n, \"Value\", nil, n.Value)\n\n\tcase *ast.IncDecStmt:\n\t\ta.apply(n, \"X\", nil, n.X)\n\n\tcase *ast.AssignStmt:\n\t\ta.applyList(n, \"Lhs\")\n\t\ta.applyList(n, \"Rhs\")\n\n\tcase *ast.GoStmt:\n\t\ta.apply(n, \"Call\", nil, n.Call)\n\n\tcase *ast.DeferStmt:\n\t\ta.apply(n, \"Call\", nil, n.Call)\n\n\tcase *ast.ReturnStmt:\n\t\ta.applyList(n, \"Results\")\n\n\tcase *ast.BranchStmt:\n\t\ta.apply(n, \"Label\", nil, n.Label)\n\n\tcase *ast.BlockStmt:\n\t\ta.applyList(n, \"List\")\n\n\tcase *ast.IfStmt:\n\t\ta.apply(n, \"Init\", nil, n.Init)\n\t\ta.apply(n, \"Cond\", nil, n.Cond)\n\t\ta.apply(n, \"Body\", nil, n.Body)\n\t\ta.apply(n, \"Else\", nil, n.Else)\n\n\tcase *ast.CaseClause:\n\t\ta.applyList(n, \"List\")\n\t\ta.applyList(n, \"Body\")\n\n\tcase *ast.SwitchStmt:\n\t\ta.apply(n, \"Init\", nil, n.Init)\n\t\ta.apply(n, \"Tag\", nil, n.Tag)\n\t\ta.apply(n, \"Body\", nil, n.Body)\n\n\tcase *ast.TypeSwitchStmt:\n\t\ta.apply(n, \"Init\", nil, n.Init)\n\t\ta.apply(n, \"Assign\", nil, n.Assign)\n\t\ta.apply(n, \"Body\", nil, n.Body)\n\n\tcase *ast.CommClause:\n\t\ta.apply(n, \"Comm\", nil, n.Comm)\n\t\ta.applyList(n, \"Body\")\n\n\tcase *ast.SelectStmt:\n\t\ta.apply(n, \"Body\", nil, n.Body)\n\n\tcase *ast.ForStmt:\n\t\ta.apply(n, \"Init\", nil, n.Init)\n\t\ta.apply(n, \"Cond\", nil, n.Cond)\n\t\ta.apply(n, \"Post\", nil, n.Post)\n\t\ta.apply(n, \"Body\", nil, n.Body)\n\n\tcase *ast.RangeStmt:\n\t\ta.apply(n, \"Key\", nil, n.Key)\n\t\ta.apply(n, \"Value\", nil, n.Value)\n\t\ta.apply(n, \"X\", nil, n.X)\n\t\ta.apply(n, \"Body\", nil, n.Body)\n\n\t// Declarations\n\tcase *ast.ImportSpec:\n\t\ta.apply(n, \"Doc\", nil, n.Doc)\n\t\ta.apply(n, \"Name\", nil, n.Name)\n\t\ta.apply(n, \"Path\", nil, n.Path)\n\t\ta.apply(n, \"Comment\", nil, n.Comment)\n\n\tcase *ast.ValueSpec:\n\t\ta.apply(n, \"Doc\", nil, n.Doc)\n\t\ta.applyList(n, \"Names\")\n\t\ta.apply(n, \"Type\", nil, n.Type)\n\t\ta.applyList(n, \"Values\")\n\t\ta.apply(n, \"Comment\", nil, n.Comment)\n\n\tcase *ast.TypeSpec:\n\t\ta.apply(n, \"Doc\", nil, n.Doc)\n\t\ta.apply(n, \"Name\", nil, n.Name)\n\t\ta.apply(n, \"Type\", nil, n.Type)\n\t\ta.apply(n, \"Comment\", nil, n.Comment)\n\n\tcase *ast.BadDecl:\n\t\t// nothing to do\n\n\tcase *ast.GenDecl:\n\t\ta.apply(n, \"Doc\", nil, n.Doc)\n\t\ta.applyList(n, \"Specs\")\n\n\tcase *ast.FuncDecl:\n\t\ta.apply(n, \"Doc\", nil, n.Doc)\n\t\ta.apply(n, \"Recv\", nil, n.Recv)\n\t\ta.apply(n, \"Name\", nil, n.Name)\n\t\ta.apply(n, \"Type\", nil, n.Type)\n\t\ta.apply(n, \"Body\", nil, n.Body)\n\n\t// Files and packages\n\tcase *ast.File:\n\t\ta.apply(n, \"Doc\", nil, n.Doc)\n\t\ta.apply(n, \"Name\", nil, n.Name)\n\t\ta.applyList(n, \"Decls\")\n\t\t// Don't walk n.Comments; they have either been walked already if\n\t\t// they are Doc comments, or they can be easily walked explicitly.\n\n\tcase *ast.Package:\n\t\t// collect and sort names for reproducible behavior\n\t\tvar names []string\n\t\tfor name := range n.Files {\n\t\t\tnames = append(names, name)\n\t\t}\n\t\tsort.Strings(names)\n\t\tfor _, name := range names {\n\t\t\ta.apply(n, name, nil, n.Files[name])\n\t\t}\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Apply: unexpected node type %T\", n))\n\t}\n\n\tif a.post != nil && !a.post(&a.cursor) {\n\t\tpanic(abort)\n\t}\n\n\ta.cursor = saved\n}\n\n// An iterator controls iteration over a slice of nodes.\ntype iterator struct {\n\tindex, step int\n}\n\nfunc (a *application) applyList(parent ast.Node, name string) {\n\t// avoid heap-allocating a new iterator for each applyList call; reuse a.iter instead\n\tsaved := a.iter\n\ta.iter.index = 0\n\tfor {\n\t\t// must reload parent.name each time, since cursor modifications might change it\n\t\tv := reflect.Indirect(reflect.ValueOf(parent)).FieldByName(name)\n\t\tif a.iter.index >= v.Len() {\n\t\t\tbreak\n\t\t}\n\n\t\t// element x may be nil in a bad AST - be cautious\n\t\tvar x ast.Node\n\t\tif e := v.Index(a.iter.index); e.IsValid() {\n\t\t\tx = e.Interface().(ast.Node)\n\t\t}\n\n\t\ta.iter.step = 1\n\t\ta.apply(parent, name, &a.iter, x)\n\t\ta.iter.index += a.iter.step\n\t}\n\ta.iter = saved\n}\n"
  },
  {
    "path": "_tools/src/golang.org/x/tools/go/ast/astutil/util.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 astutil\n\nimport \"go/ast\"\n\n// Unparen returns e with any enclosing parentheses stripped.\nfunc Unparen(e ast.Expr) ast.Expr {\n\tfor {\n\t\tp, ok := e.(*ast.ParenExpr)\n\t\tif !ok {\n\t\t\treturn e\n\t\t}\n\t\te = p.X\n\t}\n}\n"
  },
  {
    "path": "_tools/src/golang.org/x/tools/go/buildutil/allpackages.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\n// Package buildutil provides utilities related to the go/build\n// package in the standard library.\n//\n// All I/O is done via the build.Context file system interface, which must\n// be concurrency-safe.\npackage buildutil // import \"golang.org/x/tools/go/buildutil\"\n\nimport (\n\t\"go/build\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"sort\"\n\t\"strings\"\n\t\"sync\"\n)\n\n// AllPackages returns the package path of each Go package in any source\n// directory of the specified build context (e.g. $GOROOT or an element\n// of $GOPATH).  Errors are ignored.  The results are sorted.\n// All package paths are canonical, and thus may contain \"/vendor/\".\n//\n// The result may include import paths for directories that contain no\n// *.go files, such as \"archive\" (in $GOROOT/src).\n//\n// All I/O is done via the build.Context file system interface,\n// which must be concurrency-safe.\n//\nfunc AllPackages(ctxt *build.Context) []string {\n\tvar list []string\n\tForEachPackage(ctxt, func(pkg string, _ error) {\n\t\tlist = append(list, pkg)\n\t})\n\tsort.Strings(list)\n\treturn list\n}\n\n// ForEachPackage calls the found function with the package path of\n// each Go package it finds in any source directory of the specified\n// build context (e.g. $GOROOT or an element of $GOPATH).\n// All package paths are canonical, and thus may contain \"/vendor/\".\n//\n// If the package directory exists but could not be read, the second\n// argument to the found function provides the error.\n//\n// All I/O is done via the build.Context file system interface,\n// which must be concurrency-safe.\n//\nfunc ForEachPackage(ctxt *build.Context, found func(importPath string, err error)) {\n\tch := make(chan item)\n\n\tvar wg sync.WaitGroup\n\tfor _, root := range ctxt.SrcDirs() {\n\t\troot := root\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tallPackages(ctxt, root, ch)\n\t\t\twg.Done()\n\t\t}()\n\t}\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(ch)\n\t}()\n\n\t// All calls to found occur in the caller's goroutine.\n\tfor i := range ch {\n\t\tfound(i.importPath, i.err)\n\t}\n}\n\ntype item struct {\n\timportPath string\n\terr        error // (optional)\n}\n\n// We use a process-wide counting semaphore to limit\n// the number of parallel calls to ReadDir.\nvar ioLimit = make(chan bool, 20)\n\nfunc allPackages(ctxt *build.Context, root string, ch chan<- item) {\n\troot = filepath.Clean(root) + string(os.PathSeparator)\n\n\tvar wg sync.WaitGroup\n\n\tvar walkDir func(dir string)\n\twalkDir = func(dir string) {\n\t\t// Avoid .foo, _foo, and testdata directory trees.\n\t\tbase := filepath.Base(dir)\n\t\tif base == \"\" || base[0] == '.' || base[0] == '_' || base == \"testdata\" {\n\t\t\treturn\n\t\t}\n\n\t\tpkg := filepath.ToSlash(strings.TrimPrefix(dir, root))\n\n\t\t// Prune search if we encounter any of these import paths.\n\t\tswitch pkg {\n\t\tcase \"builtin\":\n\t\t\treturn\n\t\t}\n\n\t\tioLimit <- true\n\t\tfiles, err := ReadDir(ctxt, dir)\n\t\t<-ioLimit\n\t\tif pkg != \"\" || err != nil {\n\t\t\tch <- item{pkg, err}\n\t\t}\n\t\tfor _, fi := range files {\n\t\t\tfi := fi\n\t\t\tif fi.IsDir() {\n\t\t\t\twg.Add(1)\n\t\t\t\tgo func() {\n\t\t\t\t\twalkDir(filepath.Join(dir, fi.Name()))\n\t\t\t\t\twg.Done()\n\t\t\t\t}()\n\t\t\t}\n\t\t}\n\t}\n\n\twalkDir(root)\n\twg.Wait()\n}\n\n// ExpandPatterns returns the set of packages matched by patterns,\n// which may have the following forms:\n//\n//\t\tgolang.org/x/tools/cmd/guru     # a single package\n//\t\tgolang.org/x/tools/...          # all packages beneath dir\n//\t\t...                             # the entire workspace.\n//\n// Order is significant: a pattern preceded by '-' removes matching\n// packages from the set.  For example, these patterns match all encoding\n// packages except encoding/xml:\n//\n// \tencoding/... -encoding/xml\n//\n// A trailing slash in a pattern is ignored.  (Path components of Go\n// package names are separated by slash, not the platform's path separator.)\n//\nfunc ExpandPatterns(ctxt *build.Context, patterns []string) map[string]bool {\n\t// TODO(adonovan): support other features of 'go list':\n\t// - \"std\"/\"cmd\"/\"all\" meta-packages\n\t// - \"...\" not at the end of a pattern\n\t// - relative patterns using \"./\" or \"../\" prefix\n\n\tpkgs := make(map[string]bool)\n\tdoPkg := func(pkg string, neg bool) {\n\t\tif neg {\n\t\t\tdelete(pkgs, pkg)\n\t\t} else {\n\t\t\tpkgs[pkg] = true\n\t\t}\n\t}\n\n\t// Scan entire workspace if wildcards are present.\n\t// TODO(adonovan): opt: scan only the necessary subtrees of the workspace.\n\tvar all []string\n\tfor _, arg := range patterns {\n\t\tif strings.HasSuffix(arg, \"...\") {\n\t\t\tall = AllPackages(ctxt)\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, arg := range patterns {\n\t\tif arg == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tneg := arg[0] == '-'\n\t\tif neg {\n\t\t\targ = arg[1:]\n\t\t}\n\n\t\tif arg == \"...\" {\n\t\t\t// ... matches all packages\n\t\t\tfor _, pkg := range all {\n\t\t\t\tdoPkg(pkg, neg)\n\t\t\t}\n\t\t} else if dir := strings.TrimSuffix(arg, \"/...\"); dir != arg {\n\t\t\t// dir/... matches all packages beneath dir\n\t\t\tfor _, pkg := range all {\n\t\t\t\tif strings.HasPrefix(pkg, dir) &&\n\t\t\t\t\t(len(pkg) == len(dir) || pkg[len(dir)] == '/') {\n\t\t\t\t\tdoPkg(pkg, neg)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// single package\n\t\t\tdoPkg(strings.TrimSuffix(arg, \"/\"), neg)\n\t\t}\n\t}\n\n\treturn pkgs\n}\n"
  },
  {
    "path": "_tools/src/golang.org/x/tools/go/buildutil/fakecontext.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 buildutil\n\nimport (\n\t\"fmt\"\n\t\"go/build\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"path\"\n\t\"path/filepath\"\n\t\"sort\"\n\t\"strings\"\n\t\"time\"\n)\n\n// FakeContext returns a build.Context for the fake file tree specified\n// by pkgs, which maps package import paths to a mapping from file base\n// names to contents.\n//\n// The fake Context has a GOROOT of \"/go\" and no GOPATH, and overrides\n// the necessary file access methods to read from memory instead of the\n// real file system.\n//\n// Unlike a real file tree, the fake one has only two levels---packages\n// and files---so ReadDir(\"/go/src/\") returns all packages under\n// /go/src/ including, for instance, \"math\" and \"math/big\".\n// ReadDir(\"/go/src/math/big\") would return all the files in the\n// \"math/big\" package.\n//\nfunc FakeContext(pkgs map[string]map[string]string) *build.Context {\n\tclean := func(filename string) string {\n\t\tf := path.Clean(filepath.ToSlash(filename))\n\t\t// Removing \"/go/src\" while respecting segment\n\t\t// boundaries has this unfortunate corner case:\n\t\tif f == \"/go/src\" {\n\t\t\treturn \"\"\n\t\t}\n\t\treturn strings.TrimPrefix(f, \"/go/src/\")\n\t}\n\n\tctxt := build.Default // copy\n\tctxt.GOROOT = \"/go\"\n\tctxt.GOPATH = \"\"\n\tctxt.Compiler = \"gc\"\n\tctxt.IsDir = func(dir string) bool {\n\t\tdir = clean(dir)\n\t\tif dir == \"\" {\n\t\t\treturn true // needed by (*build.Context).SrcDirs\n\t\t}\n\t\treturn pkgs[dir] != nil\n\t}\n\tctxt.ReadDir = func(dir string) ([]os.FileInfo, error) {\n\t\tdir = clean(dir)\n\t\tvar fis []os.FileInfo\n\t\tif dir == \"\" {\n\t\t\t// enumerate packages\n\t\t\tfor importPath := range pkgs {\n\t\t\t\tfis = append(fis, fakeDirInfo(importPath))\n\t\t\t}\n\t\t} else {\n\t\t\t// enumerate files of package\n\t\t\tfor basename := range pkgs[dir] {\n\t\t\t\tfis = append(fis, fakeFileInfo(basename))\n\t\t\t}\n\t\t}\n\t\tsort.Sort(byName(fis))\n\t\treturn fis, nil\n\t}\n\tctxt.OpenFile = func(filename string) (io.ReadCloser, error) {\n\t\tfilename = clean(filename)\n\t\tdir, base := path.Split(filename)\n\t\tcontent, ok := pkgs[path.Clean(dir)][base]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"file not found: %s\", filename)\n\t\t}\n\t\treturn ioutil.NopCloser(strings.NewReader(content)), nil\n\t}\n\tctxt.IsAbsPath = func(path string) bool {\n\t\tpath = filepath.ToSlash(path)\n\t\t// Don't rely on the default (filepath.Path) since on\n\t\t// Windows, it reports virtual paths as non-absolute.\n\t\treturn strings.HasPrefix(path, \"/\")\n\t}\n\treturn &ctxt\n}\n\ntype byName []os.FileInfo\n\nfunc (s byName) Len() int           { return len(s) }\nfunc (s byName) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }\nfunc (s byName) Less(i, j int) bool { return s[i].Name() < s[j].Name() }\n\ntype fakeFileInfo string\n\nfunc (fi fakeFileInfo) Name() string    { return string(fi) }\nfunc (fakeFileInfo) Sys() interface{}   { return nil }\nfunc (fakeFileInfo) ModTime() time.Time { return time.Time{} }\nfunc (fakeFileInfo) IsDir() bool        { return false }\nfunc (fakeFileInfo) Size() int64        { return 0 }\nfunc (fakeFileInfo) Mode() os.FileMode  { return 0644 }\n\ntype fakeDirInfo string\n\nfunc (fd fakeDirInfo) Name() string    { return string(fd) }\nfunc (fakeDirInfo) Sys() interface{}   { return nil }\nfunc (fakeDirInfo) ModTime() time.Time { return time.Time{} }\nfunc (fakeDirInfo) IsDir() bool        { return true }\nfunc (fakeDirInfo) Size() int64        { return 0 }\nfunc (fakeDirInfo) Mode() os.FileMode  { return 0755 }\n"
  },
  {
    "path": "_tools/src/golang.org/x/tools/go/buildutil/overlay.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 buildutil\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"fmt\"\n\t\"go/build\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"path/filepath\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// OverlayContext overlays a build.Context with additional files from\n// a map. Files in the map take precedence over other files.\n//\n// In addition to plain string comparison, two file names are\n// considered equal if their base names match and their directory\n// components point at the same directory on the file system. That is,\n// symbolic links are followed for directories, but not files.\n//\n// A common use case for OverlayContext is to allow editors to pass in\n// a set of unsaved, modified files.\n//\n// Currently, only the Context.OpenFile function will respect the\n// overlay. This may change in the future.\nfunc OverlayContext(orig *build.Context, overlay map[string][]byte) *build.Context {\n\t// TODO(dominikh): Implement IsDir, HasSubdir and ReadDir\n\n\trc := func(data []byte) (io.ReadCloser, error) {\n\t\treturn ioutil.NopCloser(bytes.NewBuffer(data)), nil\n\t}\n\n\tcopy := *orig // make a copy\n\tctxt := &copy\n\tctxt.OpenFile = func(path string) (io.ReadCloser, error) {\n\t\t// Fast path: names match exactly.\n\t\tif content, ok := overlay[path]; ok {\n\t\t\treturn rc(content)\n\t\t}\n\n\t\t// Slow path: check for same file under a different\n\t\t// alias, perhaps due to a symbolic link.\n\t\tfor filename, content := range overlay {\n\t\t\tif sameFile(path, filename) {\n\t\t\t\treturn rc(content)\n\t\t\t}\n\t\t}\n\n\t\treturn OpenFile(orig, path)\n\t}\n\treturn ctxt\n}\n\n// ParseOverlayArchive parses an archive containing Go files and their\n// contents. The result is intended to be used with OverlayContext.\n//\n//\n// Archive format\n//\n// The archive consists of a series of files. Each file consists of a\n// name, a decimal file size and the file contents, separated by\n// newlines. No newline follows after the file contents.\nfunc ParseOverlayArchive(archive io.Reader) (map[string][]byte, error) {\n\toverlay := make(map[string][]byte)\n\tr := bufio.NewReader(archive)\n\tfor {\n\t\t// Read file name.\n\t\tfilename, err := r.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak // OK\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"reading archive file name: %v\", err)\n\t\t}\n\t\tfilename = filepath.Clean(strings.TrimSpace(filename))\n\n\t\t// Read file size.\n\t\tsz, err := r.ReadString('\\n')\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"reading size of archive file %s: %v\", filename, err)\n\t\t}\n\t\tsz = strings.TrimSpace(sz)\n\t\tsize, err := strconv.ParseUint(sz, 10, 32)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"parsing size of archive file %s: %v\", filename, err)\n\t\t}\n\n\t\t// Read file content.\n\t\tcontent := make([]byte, size)\n\t\tif _, err := io.ReadFull(r, content); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"reading archive file %s: %v\", filename, err)\n\t\t}\n\t\toverlay[filename] = content\n\t}\n\n\treturn overlay, nil\n}\n"
  },
  {
    "path": "_tools/src/golang.org/x/tools/go/buildutil/tags.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 buildutil\n\n// This logic was copied from stringsFlag from $GOROOT/src/cmd/go/build.go.\n\nimport \"fmt\"\n\nconst TagsFlagDoc = \"a list of `build tags` to consider satisfied during the build. \" +\n\t\"For more information about build tags, see the description of \" +\n\t\"build constraints in the documentation for the go/build package\"\n\n// TagsFlag is an implementation of the flag.Value and flag.Getter interfaces that parses\n// a flag value in the same manner as go build's -tags flag and\n// populates a []string slice.\n//\n// See $GOROOT/src/go/build/doc.go for description of build tags.\n// See $GOROOT/src/cmd/go/doc.go for description of 'go build -tags' flag.\n//\n// Example:\n// \tflag.Var((*buildutil.TagsFlag)(&build.Default.BuildTags), \"tags\", buildutil.TagsFlagDoc)\ntype TagsFlag []string\n\nfunc (v *TagsFlag) Set(s string) error {\n\tvar err error\n\t*v, err = splitQuotedFields(s)\n\tif *v == nil {\n\t\t*v = []string{}\n\t}\n\treturn err\n}\n\nfunc (v *TagsFlag) Get() interface{} { return *v }\n\nfunc splitQuotedFields(s string) ([]string, error) {\n\t// Split fields allowing '' or \"\" around elements.\n\t// Quotes further inside the string do not count.\n\tvar f []string\n\tfor len(s) > 0 {\n\t\tfor len(s) > 0 && isSpaceByte(s[0]) {\n\t\t\ts = s[1:]\n\t\t}\n\t\tif len(s) == 0 {\n\t\t\tbreak\n\t\t}\n\t\t// Accepted quoted string. No unescaping inside.\n\t\tif s[0] == '\"' || s[0] == '\\'' {\n\t\t\tquote := s[0]\n\t\t\ts = s[1:]\n\t\t\ti := 0\n\t\t\tfor i < len(s) && s[i] != quote {\n\t\t\t\ti++\n\t\t\t}\n\t\t\tif i >= len(s) {\n\t\t\t\treturn nil, fmt.Errorf(\"unterminated %c string\", quote)\n\t\t\t}\n\t\t\tf = append(f, s[:i])\n\t\t\ts = s[i+1:]\n\t\t\tcontinue\n\t\t}\n\t\ti := 0\n\t\tfor i < len(s) && !isSpaceByte(s[i]) {\n\t\t\ti++\n\t\t}\n\t\tf = append(f, s[:i])\n\t\ts = s[i:]\n\t}\n\treturn f, nil\n}\n\nfunc (v *TagsFlag) String() string {\n\treturn \"<tagsFlag>\"\n}\n\nfunc isSpaceByte(c byte) bool {\n\treturn c == ' ' || c == '\\t' || c == '\\n' || c == '\\r'\n}\n"
  },
  {
    "path": "_tools/src/golang.org/x/tools/go/buildutil/util.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 buildutil\n\nimport (\n\t\"fmt\"\n\t\"go/ast\"\n\t\"go/build\"\n\t\"go/parser\"\n\t\"go/token\"\n\t\"io\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"path\"\n\t\"path/filepath\"\n\t\"strings\"\n)\n\n// ParseFile behaves like parser.ParseFile,\n// but uses the build context's file system interface, if any.\n//\n// If file is not absolute (as defined by IsAbsPath), the (dir, file)\n// components are joined using JoinPath; dir must be absolute.\n//\n// The displayPath function, if provided, is used to transform the\n// filename that will be attached to the ASTs.\n//\n// TODO(adonovan): call this from go/loader.parseFiles when the tree thaws.\n//\nfunc ParseFile(fset *token.FileSet, ctxt *build.Context, displayPath func(string) string, dir string, file string, mode parser.Mode) (*ast.File, error) {\n\tif !IsAbsPath(ctxt, file) {\n\t\tfile = JoinPath(ctxt, dir, file)\n\t}\n\trd, err := OpenFile(ctxt, file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rd.Close() // ignore error\n\tif displayPath != nil {\n\t\tfile = displayPath(file)\n\t}\n\treturn parser.ParseFile(fset, file, rd, mode)\n}\n\n// ContainingPackage returns the package containing filename.\n//\n// If filename is not absolute, it is interpreted relative to working directory dir.\n// All I/O is via the build context's file system interface, if any.\n//\n// The '...Files []string' fields of the resulting build.Package are not\n// populated (build.FindOnly mode).\n//\nfunc ContainingPackage(ctxt *build.Context, dir, filename string) (*build.Package, error) {\n\tif !IsAbsPath(ctxt, filename) {\n\t\tfilename = JoinPath(ctxt, dir, filename)\n\t}\n\n\t// We must not assume the file tree uses\n\t// \"/\" always,\n\t// `\\` always,\n\t// or os.PathSeparator (which varies by platform),\n\t// but to make any progress, we are forced to assume that\n\t// paths will not use `\\` unless the PathSeparator\n\t// is also `\\`, thus we can rely on filepath.ToSlash for some sanity.\n\n\tdirSlash := path.Dir(filepath.ToSlash(filename)) + \"/\"\n\n\t// We assume that no source root (GOPATH[i] or GOROOT) contains any other.\n\tfor _, srcdir := range ctxt.SrcDirs() {\n\t\tsrcdirSlash := filepath.ToSlash(srcdir) + \"/\"\n\t\tif importPath, ok := HasSubdir(ctxt, srcdirSlash, dirSlash); ok {\n\t\t\treturn ctxt.Import(importPath, dir, build.FindOnly)\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"can't find package containing %s\", filename)\n}\n\n// -- Effective methods of file system interface -------------------------\n\n// (go/build.Context defines these as methods, but does not export them.)\n\n// hasSubdir calls ctxt.HasSubdir (if not nil) or else uses\n// the local file system to answer the question.\nfunc HasSubdir(ctxt *build.Context, root, dir string) (rel string, ok bool) {\n\tif f := ctxt.HasSubdir; f != nil {\n\t\treturn f(root, dir)\n\t}\n\n\t// Try using paths we received.\n\tif rel, ok = hasSubdir(root, dir); ok {\n\t\treturn\n\t}\n\n\t// Try expanding symlinks and comparing\n\t// expanded against unexpanded and\n\t// expanded against expanded.\n\trootSym, _ := filepath.EvalSymlinks(root)\n\tdirSym, _ := filepath.EvalSymlinks(dir)\n\n\tif rel, ok = hasSubdir(rootSym, dir); ok {\n\t\treturn\n\t}\n\tif rel, ok = hasSubdir(root, dirSym); ok {\n\t\treturn\n\t}\n\treturn hasSubdir(rootSym, dirSym)\n}\n\nfunc hasSubdir(root, dir string) (rel string, ok bool) {\n\tconst sep = string(filepath.Separator)\n\troot = filepath.Clean(root)\n\tif !strings.HasSuffix(root, sep) {\n\t\troot += sep\n\t}\n\n\tdir = filepath.Clean(dir)\n\tif !strings.HasPrefix(dir, root) {\n\t\treturn \"\", false\n\t}\n\n\treturn filepath.ToSlash(dir[len(root):]), true\n}\n\n// FileExists returns true if the specified file exists,\n// using the build context's file system interface.\nfunc FileExists(ctxt *build.Context, path string) bool {\n\tif ctxt.OpenFile != nil {\n\t\tr, err := ctxt.OpenFile(path)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tr.Close() // ignore error\n\t\treturn true\n\t}\n\t_, err := os.Stat(path)\n\treturn err == nil\n}\n\n// OpenFile behaves like os.Open,\n// but uses the build context's file system interface, if any.\nfunc OpenFile(ctxt *build.Context, path string) (io.ReadCloser, error) {\n\tif ctxt.OpenFile != nil {\n\t\treturn ctxt.OpenFile(path)\n\t}\n\treturn os.Open(path)\n}\n\n// IsAbsPath behaves like filepath.IsAbs,\n// but uses the build context's file system interface, if any.\nfunc IsAbsPath(ctxt *build.Context, path string) bool {\n\tif ctxt.IsAbsPath != nil {\n\t\treturn ctxt.IsAbsPath(path)\n\t}\n\treturn filepath.IsAbs(path)\n}\n\n// JoinPath behaves like filepath.Join,\n// but uses the build context's file system interface, if any.\nfunc JoinPath(ctxt *build.Context, path ...string) string {\n\tif ctxt.JoinPath != nil {\n\t\treturn ctxt.JoinPath(path...)\n\t}\n\treturn filepath.Join(path...)\n}\n\n// IsDir behaves like os.Stat plus IsDir,\n// but uses the build context's file system interface, if any.\nfunc IsDir(ctxt *build.Context, path string) bool {\n\tif ctxt.IsDir != nil {\n\t\treturn ctxt.IsDir(path)\n\t}\n\tfi, err := os.Stat(path)\n\treturn err == nil && fi.IsDir()\n}\n\n// ReadDir behaves like ioutil.ReadDir,\n// but uses the build context's file system interface, if any.\nfunc ReadDir(ctxt *build.Context, path string) ([]os.FileInfo, error) {\n\tif ctxt.ReadDir != nil {\n\t\treturn ctxt.ReadDir(path)\n\t}\n\treturn ioutil.ReadDir(path)\n}\n\n// SplitPathList behaves like filepath.SplitList,\n// but uses the build context's file system interface, if any.\nfunc SplitPathList(ctxt *build.Context, s string) []string {\n\tif ctxt.SplitPathList != nil {\n\t\treturn ctxt.SplitPathList(s)\n\t}\n\treturn filepath.SplitList(s)\n}\n\n// sameFile returns true if x and y have the same basename and denote\n// the same file.\n//\nfunc sameFile(x, y string) bool {\n\tif path.Clean(x) == path.Clean(y) {\n\t\treturn true\n\t}\n\tif filepath.Base(x) == filepath.Base(y) { // (optimisation)\n\t\tif xi, err := os.Stat(x); err == nil {\n\t\t\tif yi, err := os.Stat(y); err == nil {\n\t\t\t\treturn os.SameFile(xi, yi)\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}\n"
  },
  {
    "path": "_tools/src/golang.org/x/tools/go/internal/cgo/cgo.go",
    "content": "// Copyright 2013 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 cgo handles cgo preprocessing of files containing `import \"C\"`.\n//\n// DESIGN\n//\n// The approach taken is to run the cgo processor on the package's\n// CgoFiles and parse the output, faking the filenames of the\n// resulting ASTs so that the synthetic file containing the C types is\n// called \"C\" (e.g. \"~/go/src/net/C\") and the preprocessed files\n// have their original names (e.g. \"~/go/src/net/cgo_unix.go\"),\n// not the names of the actual temporary files.\n//\n// The advantage of this approach is its fidelity to 'go build'.  The\n// downside is that the token.Position.Offset for each AST node is\n// incorrect, being an offset within the temporary file.  Line numbers\n// should still be correct because of the //line comments.\n//\n// The logic of this file is mostly plundered from the 'go build'\n// tool, which also invokes the cgo preprocessor.\n//\n//\n// REJECTED ALTERNATIVE\n//\n// An alternative approach that we explored is to extend go/types'\n// Importer mechanism to provide the identity of the importing package\n// so that each time `import \"C\"` appears it resolves to a different\n// synthetic package containing just the objects needed in that case.\n// The loader would invoke cgo but parse only the cgo_types.go file\n// defining the package-level objects, discarding the other files\n// resulting from preprocessing.\n//\n// The benefit of this approach would have been that source-level\n// syntax information would correspond exactly to the original cgo\n// file, with no preprocessing involved, making source tools like\n// godoc, guru, and eg happy.  However, the approach was rejected\n// due to the additional complexity it would impose on go/types.  (It\n// made for a beautiful demo, though.)\n//\n// cgo files, despite their *.go extension, are not legal Go source\n// files per the specification since they may refer to unexported\n// members of package \"C\" such as C.int.  Also, a function such as\n// C.getpwent has in effect two types, one matching its C type and one\n// which additionally returns (errno C.int).  The cgo preprocessor\n// uses name mangling to distinguish these two functions in the\n// processed code, but go/types would need to duplicate this logic in\n// its handling of function calls, analogous to the treatment of map\n// lookups in which y=m[k] and y,ok=m[k] are both legal.\n\npackage cgo\n\nimport (\n\t\"fmt\"\n\t\"go/ast\"\n\t\"go/build\"\n\t\"go/parser\"\n\t\"go/token\"\n\t\"io/ioutil\"\n\t\"log\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"regexp\"\n\t\"strings\"\n\n\texec \"golang.org/x/sys/execabs\"\n)\n\n// ProcessFiles invokes the cgo preprocessor on bp.CgoFiles, parses\n// the output and returns the resulting ASTs.\n//\nfunc ProcessFiles(bp *build.Package, fset *token.FileSet, DisplayPath func(path string) string, mode parser.Mode) ([]*ast.File, error) {\n\ttmpdir, err := ioutil.TempDir(\"\", strings.Replace(bp.ImportPath, \"/\", \"_\", -1)+\"_C\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer os.RemoveAll(tmpdir)\n\n\tpkgdir := bp.Dir\n\tif DisplayPath != nil {\n\t\tpkgdir = DisplayPath(pkgdir)\n\t}\n\n\tcgoFiles, cgoDisplayFiles, err := Run(bp, pkgdir, tmpdir, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar files []*ast.File\n\tfor i := range cgoFiles {\n\t\trd, err := os.Open(cgoFiles[i])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdisplay := filepath.Join(bp.Dir, cgoDisplayFiles[i])\n\t\tf, err := parser.ParseFile(fset, display, rd, mode)\n\t\trd.Close()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfiles = append(files, f)\n\t}\n\treturn files, nil\n}\n\nvar cgoRe = regexp.MustCompile(`[/\\\\:]`)\n\n// Run invokes the cgo preprocessor on bp.CgoFiles and returns two\n// lists of files: the resulting processed files (in temporary\n// directory tmpdir) and the corresponding names of the unprocessed files.\n//\n// Run is adapted from (*builder).cgo in\n// $GOROOT/src/cmd/go/build.go, but these features are unsupported:\n// Objective C, CGOPKGPATH, CGO_FLAGS.\n//\n// If useabs is set to true, absolute paths of the bp.CgoFiles will be passed in\n// to the cgo preprocessor. This in turn will set the // line comments\n// referring to those files to use absolute paths. This is needed for\n// go/packages using the legacy go list support so it is able to find\n// the original files.\nfunc Run(bp *build.Package, pkgdir, tmpdir string, useabs bool) (files, displayFiles []string, err error) {\n\tcgoCPPFLAGS, _, _, _ := cflags(bp, true)\n\t_, cgoexeCFLAGS, _, _ := cflags(bp, false)\n\n\tif len(bp.CgoPkgConfig) > 0 {\n\t\tpcCFLAGS, err := pkgConfigFlags(bp)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tcgoCPPFLAGS = append(cgoCPPFLAGS, pcCFLAGS...)\n\t}\n\n\t// Allows including _cgo_export.h from .[ch] files in the package.\n\tcgoCPPFLAGS = append(cgoCPPFLAGS, \"-I\", tmpdir)\n\n\t// _cgo_gotypes.go (displayed \"C\") contains the type definitions.\n\tfiles = append(files, filepath.Join(tmpdir, \"_cgo_gotypes.go\"))\n\tdisplayFiles = append(displayFiles, \"C\")\n\tfor _, fn := range bp.CgoFiles {\n\t\t// \"foo.cgo1.go\" (displayed \"foo.go\") is the processed Go source.\n\t\tf := cgoRe.ReplaceAllString(fn[:len(fn)-len(\"go\")], \"_\")\n\t\tfiles = append(files, filepath.Join(tmpdir, f+\"cgo1.go\"))\n\t\tdisplayFiles = append(displayFiles, fn)\n\t}\n\n\tvar cgoflags []string\n\tif bp.Goroot && bp.ImportPath == \"runtime/cgo\" {\n\t\tcgoflags = append(cgoflags, \"-import_runtime_cgo=false\")\n\t}\n\tif bp.Goroot && bp.ImportPath == \"runtime/race\" || bp.ImportPath == \"runtime/cgo\" {\n\t\tcgoflags = append(cgoflags, \"-import_syscall=false\")\n\t}\n\n\tvar cgoFiles []string = bp.CgoFiles\n\tif useabs {\n\t\tcgoFiles = make([]string, len(bp.CgoFiles))\n\t\tfor i := range cgoFiles {\n\t\t\tcgoFiles[i] = filepath.Join(pkgdir, bp.CgoFiles[i])\n\t\t}\n\t}\n\n\targs := stringList(\n\t\t\"go\", \"tool\", \"cgo\", \"-srcdir\", pkgdir, \"-objdir\", tmpdir, cgoflags, \"--\",\n\t\tcgoCPPFLAGS, cgoexeCFLAGS, cgoFiles,\n\t)\n\tif false {\n\t\tlog.Printf(\"Running cgo for package %q: %s\", bp.ImportPath, args)\n\t}\n\tcmd := exec.Command(args[0], args[1:]...)\n\tcmd.Stdout = os.Stderr\n\tcmd.Stderr = os.Stderr\n\tif err := cmd.Run(); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"cgo failed: %s: %s\", args, err)\n\t}\n\n\treturn files, displayFiles, nil\n}\n\n// -- unmodified from 'go build' ---------------------------------------\n\n// Return the flags to use when invoking the C or C++ compilers, or cgo.\nfunc cflags(p *build.Package, def bool) (cppflags, cflags, cxxflags, ldflags []string) {\n\tvar defaults string\n\tif def {\n\t\tdefaults = \"-g -O2\"\n\t}\n\n\tcppflags = stringList(envList(\"CGO_CPPFLAGS\", \"\"), p.CgoCPPFLAGS)\n\tcflags = stringList(envList(\"CGO_CFLAGS\", defaults), p.CgoCFLAGS)\n\tcxxflags = stringList(envList(\"CGO_CXXFLAGS\", defaults), p.CgoCXXFLAGS)\n\tldflags = stringList(envList(\"CGO_LDFLAGS\", defaults), p.CgoLDFLAGS)\n\treturn\n}\n\n// envList returns the value of the given environment variable broken\n// into fields, using the default value when the variable is empty.\nfunc envList(key, def string) []string {\n\tv := os.Getenv(key)\n\tif v == \"\" {\n\t\tv = def\n\t}\n\treturn strings.Fields(v)\n}\n\n// stringList's arguments should be a sequence of string or []string values.\n// stringList flattens them into a single []string.\nfunc stringList(args ...interface{}) []string {\n\tvar x []string\n\tfor _, arg := range args {\n\t\tswitch arg := arg.(type) {\n\t\tcase []string:\n\t\t\tx = append(x, arg...)\n\t\tcase string:\n\t\t\tx = append(x, arg)\n\t\tdefault:\n\t\t\tpanic(\"stringList: invalid argument\")\n\t\t}\n\t}\n\treturn x\n}\n"
  },
  {
    "path": "_tools/src/golang.org/x/tools/go/internal/cgo/cgo_pkgconfig.go",
    "content": "// Copyright 2013 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 cgo\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"go/build\"\n\texec \"golang.org/x/sys/execabs\"\n\t\"strings\"\n)\n\n// pkgConfig runs pkg-config with the specified arguments and returns the flags it prints.\nfunc pkgConfig(mode string, pkgs []string) (flags []string, err error) {\n\tcmd := exec.Command(\"pkg-config\", append([]string{mode}, pkgs...)...)\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\ts := fmt.Sprintf(\"%s failed: %v\", strings.Join(cmd.Args, \" \"), err)\n\t\tif len(out) > 0 {\n\t\t\ts = fmt.Sprintf(\"%s: %s\", s, out)\n\t\t}\n\t\treturn nil, errors.New(s)\n\t}\n\tif len(out) > 0 {\n\t\tflags = strings.Fields(string(out))\n\t}\n\treturn\n}\n\n// pkgConfigFlags calls pkg-config if needed and returns the cflags\n// needed to build the package.\nfunc pkgConfigFlags(p *build.Package) (cflags []string, err error) {\n\tif len(p.CgoPkgConfig) == 0 {\n\t\treturn nil, nil\n\t}\n\treturn pkgConfig(\"--cflags\", p.CgoPkgConfig)\n}\n"
  },
  {
    "path": "_tools/src/golang.org/x/tools/go/loader/doc.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 loader loads a complete Go program from source code, parsing\n// and type-checking the initial packages plus their transitive closure\n// of dependencies.  The ASTs and the derived facts are retained for\n// later use.\n//\n// Deprecated: This is an older API and does not have support\n// for modules. Use golang.org/x/tools/go/packages instead.\n//\n// The package defines two primary types: Config, which specifies a\n// set of initial packages to load and various other options; and\n// Program, which is the result of successfully loading the packages\n// specified by a configuration.\n//\n// The configuration can be set directly, but *Config provides various\n// convenience methods to simplify the common cases, each of which can\n// be called any number of times.  Finally, these are followed by a\n// call to Load() to actually load and type-check the program.\n//\n//      var conf loader.Config\n//\n//      // Use the command-line arguments to specify\n//      // a set of initial packages to load from source.\n//      // See FromArgsUsage for help.\n//      rest, err := conf.FromArgs(os.Args[1:], wantTests)\n//\n//      // Parse the specified files and create an ad hoc package with path \"foo\".\n//      // All files must have the same 'package' declaration.\n//      conf.CreateFromFilenames(\"foo\", \"foo.go\", \"bar.go\")\n//\n//      // Create an ad hoc package with path \"foo\" from\n//      // the specified already-parsed files.\n//      // All ASTs must have the same 'package' declaration.\n//      conf.CreateFromFiles(\"foo\", parsedFiles)\n//\n//      // Add \"runtime\" to the set of packages to be loaded.\n//      conf.Import(\"runtime\")\n//\n//      // Adds \"fmt\" and \"fmt_test\" to the set of packages\n//      // to be loaded.  \"fmt\" will include *_test.go files.\n//      conf.ImportWithTests(\"fmt\")\n//\n//      // Finally, load all the packages specified by the configuration.\n//      prog, err := conf.Load()\n//\n// See examples_test.go for examples of API usage.\n//\n//\n// CONCEPTS AND TERMINOLOGY\n//\n// The WORKSPACE is the set of packages accessible to the loader.  The\n// workspace is defined by Config.Build, a *build.Context.  The\n// default context treats subdirectories of $GOROOT and $GOPATH as\n// packages, but this behavior may be overridden.\n//\n// An AD HOC package is one specified as a set of source files on the\n// command line.  In the simplest case, it may consist of a single file\n// such as $GOROOT/src/net/http/triv.go.\n//\n// EXTERNAL TEST packages are those comprised of a set of *_test.go\n// files all with the same 'package foo_test' declaration, all in the\n// same directory.  (go/build.Package calls these files XTestFiles.)\n//\n// An IMPORTABLE package is one that can be referred to by some import\n// spec.  Every importable package is uniquely identified by its\n// PACKAGE PATH or just PATH, a string such as \"fmt\", \"encoding/json\",\n// or \"cmd/vendor/golang.org/x/arch/x86/x86asm\".  A package path\n// typically denotes a subdirectory of the workspace.\n//\n// An import declaration uses an IMPORT PATH to refer to a package.\n// Most import declarations use the package path as the import path.\n//\n// Due to VENDORING (https://golang.org/s/go15vendor), the\n// interpretation of an import path may depend on the directory in which\n// it appears.  To resolve an import path to a package path, go/build\n// must search the enclosing directories for a subdirectory named\n// \"vendor\".\n//\n// ad hoc packages and external test packages are NON-IMPORTABLE.  The\n// path of an ad hoc package is inferred from the package\n// declarations of its files and is therefore not a unique package key.\n// For example, Config.CreatePkgs may specify two initial ad hoc\n// packages, both with path \"main\".\n//\n// An AUGMENTED package is an importable package P plus all the\n// *_test.go files with same 'package foo' declaration as P.\n// (go/build.Package calls these files TestFiles.)\n//\n// The INITIAL packages are those specified in the configuration.  A\n// DEPENDENCY is a package loaded to satisfy an import in an initial\n// package or another dependency.\n//\npackage loader\n\n// IMPLEMENTATION NOTES\n//\n// 'go test', in-package test files, and import cycles\n// ---------------------------------------------------\n//\n// An external test package may depend upon members of the augmented\n// package that are not in the unaugmented package, such as functions\n// that expose internals.  (See bufio/export_test.go for an example.)\n// So, the loader must ensure that for each external test package\n// it loads, it also augments the corresponding non-test package.\n//\n// The import graph over n unaugmented packages must be acyclic; the\n// import graph over n-1 unaugmented packages plus one augmented\n// package must also be acyclic.  ('go test' relies on this.)  But the\n// import graph over n augmented packages may contain cycles.\n//\n// First, all the (unaugmented) non-test packages and their\n// dependencies are imported in the usual way; the loader reports an\n// error if it detects an import cycle.\n//\n// Then, each package P for which testing is desired is augmented by\n// the list P' of its in-package test files, by calling\n// (*types.Checker).Files.  This arrangement ensures that P' may\n// reference definitions within P, but P may not reference definitions\n// within P'.  Furthermore, P' may import any other package, including\n// ones that depend upon P, without an import cycle error.\n//\n// Consider two packages A and B, both of which have lists of\n// in-package test files we'll call A' and B', and which have the\n// following import graph edges:\n//    B  imports A\n//    B' imports A\n//    A' imports B\n// This last edge would be expected to create an error were it not\n// for the special type-checking discipline above.\n// Cycles of size greater than two are possible.  For example:\n//   compress/bzip2/bzip2_test.go (package bzip2)  imports \"io/ioutil\"\n//   io/ioutil/tempfile_test.go   (package ioutil) imports \"regexp\"\n//   regexp/exec_test.go          (package regexp) imports \"compress/bzip2\"\n//\n//\n// Concurrency\n// -----------\n//\n// Let us define the import dependency graph as follows.  Each node is a\n// list of files passed to (Checker).Files at once.  Many of these lists\n// are the production code of an importable Go package, so those nodes\n// are labelled by the package's path.  The remaining nodes are\n// ad hoc packages and lists of in-package *_test.go files that augment\n// an importable package; those nodes have no label.\n//\n// The edges of the graph represent import statements appearing within a\n// file.  An edge connects a node (a list of files) to the node it\n// imports, which is importable and thus always labelled.\n//\n// Loading is controlled by this dependency graph.\n//\n// To reduce I/O latency, we start loading a package's dependencies\n// asynchronously as soon as we've parsed its files and enumerated its\n// imports (scanImports).  This performs a preorder traversal of the\n// import dependency graph.\n//\n// To exploit hardware parallelism, we type-check unrelated packages in\n// parallel, where \"unrelated\" means not ordered by the partial order of\n// the import dependency graph.\n//\n// We use a concurrency-safe non-blocking cache (importer.imported) to\n// record the results of type-checking, whether success or failure.  An\n// entry is created in this cache by startLoad the first time the\n// package is imported.  The first goroutine to request an entry becomes\n// responsible for completing the task and broadcasting completion to\n// subsequent requestors, which block until then.\n//\n// Type checking occurs in (parallel) postorder: we cannot type-check a\n// set of files until we have loaded and type-checked all of their\n// immediate dependencies (and thus all of their transitive\n// dependencies). If the input were guaranteed free of import cycles,\n// this would be trivial: we could simply wait for completion of the\n// dependencies and then invoke the typechecker.\n//\n// But as we saw in the 'go test' section above, some cycles in the\n// import graph over packages are actually legal, so long as the\n// cycle-forming edge originates in the in-package test files that\n// augment the package.  This explains why the nodes of the import\n// dependency graph are not packages, but lists of files: the unlabelled\n// nodes avoid the cycles.  Consider packages A and B where B imports A\n// and A's in-package tests AT import B.  The naively constructed import\n// graph over packages would contain a cycle (A+AT) --> B --> (A+AT) but\n// the graph over lists of files is AT --> B --> A, where AT is an\n// unlabelled node.\n//\n// Awaiting completion of the dependencies in a cyclic graph would\n// deadlock, so we must materialize the import dependency graph (as\n// importer.graph) and check whether each import edge forms a cycle.  If\n// x imports y, and the graph already contains a path from y to x, then\n// there is an import cycle, in which case the processing of x must not\n// wait for the completion of processing of y.\n//\n// When the type-checker makes a callback (doImport) to the loader for a\n// given import edge, there are two possible cases.  In the normal case,\n// the dependency has already been completely type-checked; doImport\n// does a cache lookup and returns it.  In the cyclic case, the entry in\n// the cache is still necessarily incomplete, indicating a cycle.  We\n// perform the cycle check again to obtain the error message, and return\n// the error.\n//\n// The result of using concurrency is about a 2.5x speedup for stdlib_test.\n"
  },
  {
    "path": "_tools/src/golang.org/x/tools/go/loader/loader.go",
    "content": "// Copyright 2013 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 loader\n\n// See doc.go for package documentation and implementation notes.\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"go/ast\"\n\t\"go/build\"\n\t\"go/parser\"\n\t\"go/token\"\n\t\"go/types\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"sort\"\n\t\"strings\"\n\t\"sync\"\n\t\"time\"\n\n\t\"golang.org/x/tools/go/ast/astutil\"\n\t\"golang.org/x/tools/go/internal/cgo\"\n)\n\nvar ignoreVendor build.ImportMode\n\nconst trace = false // show timing info for type-checking\n\n// Config specifies the configuration for loading a whole program from\n// Go source code.\n// The zero value for Config is a ready-to-use default configuration.\ntype Config struct {\n\t// Fset is the file set for the parser to use when loading the\n\t// program.  If nil, it may be lazily initialized by any\n\t// method of Config.\n\tFset *token.FileSet\n\n\t// ParserMode specifies the mode to be used by the parser when\n\t// loading source packages.\n\tParserMode parser.Mode\n\n\t// TypeChecker contains options relating to the type checker.\n\t//\n\t// The supplied IgnoreFuncBodies is not used; the effective\n\t// value comes from the TypeCheckFuncBodies func below.\n\t// The supplied Import function is not used either.\n\tTypeChecker types.Config\n\n\t// TypeCheckFuncBodies is a predicate over package paths.\n\t// A package for which the predicate is false will\n\t// have its package-level declarations type checked, but not\n\t// its function bodies; this can be used to quickly load\n\t// dependencies from source.  If nil, all func bodies are type\n\t// checked.\n\tTypeCheckFuncBodies func(path string) bool\n\n\t// If Build is non-nil, it is used to locate source packages.\n\t// Otherwise &build.Default is used.\n\t//\n\t// By default, cgo is invoked to preprocess Go files that\n\t// import the fake package \"C\".  This behaviour can be\n\t// disabled by setting CGO_ENABLED=0 in the environment prior\n\t// to startup, or by setting Build.CgoEnabled=false.\n\tBuild *build.Context\n\n\t// The current directory, used for resolving relative package\n\t// references such as \"./go/loader\".  If empty, os.Getwd will be\n\t// used instead.\n\tCwd string\n\n\t// If DisplayPath is non-nil, it is used to transform each\n\t// file name obtained from Build.Import().  This can be used\n\t// to prevent a virtualized build.Config's file names from\n\t// leaking into the user interface.\n\tDisplayPath func(path string) string\n\n\t// If AllowErrors is true, Load will return a Program even\n\t// if some of the its packages contained I/O, parser or type\n\t// errors; such errors are accessible via PackageInfo.Errors.  If\n\t// false, Load will fail if any package had an error.\n\tAllowErrors bool\n\n\t// CreatePkgs specifies a list of non-importable initial\n\t// packages to create.  The resulting packages will appear in\n\t// the corresponding elements of the Program.Created slice.\n\tCreatePkgs []PkgSpec\n\n\t// ImportPkgs specifies a set of initial packages to load.\n\t// The map keys are package paths.\n\t//\n\t// The map value indicates whether to load tests.  If true, Load\n\t// will add and type-check two lists of files to the package:\n\t// non-test files followed by in-package *_test.go files.  In\n\t// addition, it will append the external test package (if any)\n\t// to Program.Created.\n\tImportPkgs map[string]bool\n\n\t// FindPackage is called during Load to create the build.Package\n\t// for a given import path from a given directory.\n\t// If FindPackage is nil, (*build.Context).Import is used.\n\t// A client may use this hook to adapt to a proprietary build\n\t// system that does not follow the \"go build\" layout\n\t// conventions, for example.\n\t//\n\t// It must be safe to call concurrently from multiple goroutines.\n\tFindPackage func(ctxt *build.Context, importPath, fromDir string, mode build.ImportMode) (*build.Package, error)\n\n\t// AfterTypeCheck is called immediately after a list of files\n\t// has been type-checked and appended to info.Files.\n\t//\n\t// This optional hook function is the earliest opportunity for\n\t// the client to observe the output of the type checker,\n\t// which may be useful to reduce analysis latency when loading\n\t// a large program.\n\t//\n\t// The function is permitted to modify info.Info, for instance\n\t// to clear data structures that are no longer needed, which can\n\t// dramatically reduce peak memory consumption.\n\t//\n\t// The function may be called twice for the same PackageInfo:\n\t// once for the files of the package and again for the\n\t// in-package test files.\n\t//\n\t// It must be safe to call concurrently from multiple goroutines.\n\tAfterTypeCheck func(info *PackageInfo, files []*ast.File)\n}\n\n// A PkgSpec specifies a non-importable package to be created by Load.\n// Files are processed first, but typically only one of Files and\n// Filenames is provided.  The path needn't be globally unique.\n//\n// For vendoring purposes, the package's directory is the one that\n// contains the first file.\ntype PkgSpec struct {\n\tPath      string      // package path (\"\" => use package declaration)\n\tFiles     []*ast.File // ASTs of already-parsed files\n\tFilenames []string    // names of files to be parsed\n}\n\n// A Program is a Go program loaded from source as specified by a Config.\ntype Program struct {\n\tFset *token.FileSet // the file set for this program\n\n\t// Created[i] contains the initial package whose ASTs or\n\t// filenames were supplied by Config.CreatePkgs[i], followed by\n\t// the external test package, if any, of each package in\n\t// Config.ImportPkgs ordered by ImportPath.\n\t//\n\t// NOTE: these files must not import \"C\".  Cgo preprocessing is\n\t// only performed on imported packages, not ad hoc packages.\n\t//\n\t// TODO(adonovan): we need to copy and adapt the logic of\n\t// goFilesPackage (from $GOROOT/src/cmd/go/build.go) and make\n\t// Config.Import and Config.Create methods return the same kind\n\t// of entity, essentially a build.Package.\n\t// Perhaps we can even reuse that type directly.\n\tCreated []*PackageInfo\n\n\t// Imported contains the initially imported packages,\n\t// as specified by Config.ImportPkgs.\n\tImported map[string]*PackageInfo\n\n\t// AllPackages contains the PackageInfo of every package\n\t// encountered by Load: all initial packages and all\n\t// dependencies, including incomplete ones.\n\tAllPackages map[*types.Package]*PackageInfo\n\n\t// importMap is the canonical mapping of package paths to\n\t// packages.  It contains all Imported initial packages, but not\n\t// Created ones, and all imported dependencies.\n\timportMap map[string]*types.Package\n}\n\n// PackageInfo holds the ASTs and facts derived by the type-checker\n// for a single package.\n//\n// Not mutated once exposed via the API.\n//\ntype PackageInfo struct {\n\tPkg                   *types.Package\n\tImportable            bool        // true if 'import \"Pkg.Path()\"' would resolve to this\n\tTransitivelyErrorFree bool        // true if Pkg and all its dependencies are free of errors\n\tFiles                 []*ast.File // syntax trees for the package's files\n\tErrors                []error     // non-nil if the package had errors\n\ttypes.Info                        // type-checker deductions.\n\tdir                   string      // package directory\n\n\tchecker   *types.Checker // transient type-checker state\n\terrorFunc func(error)\n}\n\nfunc (info *PackageInfo) String() string { return info.Pkg.Path() }\n\nfunc (info *PackageInfo) appendError(err error) {\n\tif info.errorFunc != nil {\n\t\tinfo.errorFunc(err)\n\t} else {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t}\n\tinfo.Errors = append(info.Errors, err)\n}\n\nfunc (conf *Config) fset() *token.FileSet {\n\tif conf.Fset == nil {\n\t\tconf.Fset = token.NewFileSet()\n\t}\n\treturn conf.Fset\n}\n\n// ParseFile is a convenience function (intended for testing) that invokes\n// the parser using the Config's FileSet, which is initialized if nil.\n//\n// src specifies the parser input as a string, []byte, or io.Reader, and\n// filename is its apparent name.  If src is nil, the contents of\n// filename are read from the file system.\n//\nfunc (conf *Config) ParseFile(filename string, src interface{}) (*ast.File, error) {\n\t// TODO(adonovan): use conf.build() etc like parseFiles does.\n\treturn parser.ParseFile(conf.fset(), filename, src, conf.ParserMode)\n}\n\n// FromArgsUsage is a partial usage message that applications calling\n// FromArgs may wish to include in their -help output.\nconst FromArgsUsage = `\n<args> is a list of arguments denoting a set of initial packages.\nIt may take one of two forms:\n\n1. A list of *.go source files.\n\n   All of the specified files are loaded, parsed and type-checked\n   as a single package.  All the files must belong to the same directory.\n\n2. A list of import paths, each denoting a package.\n\n   The package's directory is found relative to the $GOROOT and\n   $GOPATH using similar logic to 'go build', and the *.go files in\n   that directory are loaded, parsed and type-checked as a single\n   package.\n\n   In addition, all *_test.go files in the directory are then loaded\n   and parsed.  Those files whose package declaration equals that of\n   the non-*_test.go files are included in the primary package.  Test\n   files whose package declaration ends with \"_test\" are type-checked\n   as another package, the 'external' test package, so that a single\n   import path may denote two packages.  (Whether this behaviour is\n   enabled is tool-specific, and may depend on additional flags.)\n\nA '--' argument terminates the list of packages.\n`\n\n// FromArgs interprets args as a set of initial packages to load from\n// source and updates the configuration.  It returns the list of\n// unconsumed arguments.\n//\n// It is intended for use in command-line interfaces that require a\n// set of initial packages to be specified; see FromArgsUsage message\n// for details.\n//\n// Only superficial errors are reported at this stage; errors dependent\n// on I/O are detected during Load.\n//\nfunc (conf *Config) FromArgs(args []string, xtest bool) ([]string, error) {\n\tvar rest []string\n\tfor i, arg := range args {\n\t\tif arg == \"--\" {\n\t\t\trest = args[i+1:]\n\t\t\targs = args[:i]\n\t\t\tbreak // consume \"--\" and return the remaining args\n\t\t}\n\t}\n\n\tif len(args) > 0 && strings.HasSuffix(args[0], \".go\") {\n\t\t// Assume args is a list of a *.go files\n\t\t// denoting a single ad hoc package.\n\t\tfor _, arg := range args {\n\t\t\tif !strings.HasSuffix(arg, \".go\") {\n\t\t\t\treturn nil, fmt.Errorf(\"named files must be .go files: %s\", arg)\n\t\t\t}\n\t\t}\n\t\tconf.CreateFromFilenames(\"\", args...)\n\t} else {\n\t\t// Assume args are directories each denoting a\n\t\t// package and (perhaps) an external test, iff xtest.\n\t\tfor _, arg := range args {\n\t\t\tif xtest {\n\t\t\t\tconf.ImportWithTests(arg)\n\t\t\t} else {\n\t\t\t\tconf.Import(arg)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rest, nil\n}\n\n// CreateFromFilenames is a convenience function that adds\n// a conf.CreatePkgs entry to create a package of the specified *.go\n// files.\n//\nfunc (conf *Config) CreateFromFilenames(path string, filenames ...string) {\n\tconf.CreatePkgs = append(conf.CreatePkgs, PkgSpec{Path: path, Filenames: filenames})\n}\n\n// CreateFromFiles is a convenience function that adds a conf.CreatePkgs\n// entry to create package of the specified path and parsed files.\n//\nfunc (conf *Config) CreateFromFiles(path string, files ...*ast.File) {\n\tconf.CreatePkgs = append(conf.CreatePkgs, PkgSpec{Path: path, Files: files})\n}\n\n// ImportWithTests is a convenience function that adds path to\n// ImportPkgs, the set of initial source packages located relative to\n// $GOPATH.  The package will be augmented by any *_test.go files in\n// its directory that contain a \"package x\" (not \"package x_test\")\n// declaration.\n//\n// In addition, if any *_test.go files contain a \"package x_test\"\n// declaration, an additional package comprising just those files will\n// be added to CreatePkgs.\n//\nfunc (conf *Config) ImportWithTests(path string) { conf.addImport(path, true) }\n\n// Import is a convenience function that adds path to ImportPkgs, the\n// set of initial packages that will be imported from source.\n//\nfunc (conf *Config) Import(path string) { conf.addImport(path, false) }\n\nfunc (conf *Config) addImport(path string, tests bool) {\n\tif path == \"C\" {\n\t\treturn // ignore; not a real package\n\t}\n\tif conf.ImportPkgs == nil {\n\t\tconf.ImportPkgs = make(map[string]bool)\n\t}\n\tconf.ImportPkgs[path] = conf.ImportPkgs[path] || tests\n}\n\n// PathEnclosingInterval returns the PackageInfo and ast.Node that\n// contain source interval [start, end), and all the node's ancestors\n// up to the AST root.  It searches all ast.Files of all packages in prog.\n// exact is defined as for astutil.PathEnclosingInterval.\n//\n// The zero value is returned if not found.\n//\nfunc (prog *Program) PathEnclosingInterval(start, end token.Pos) (pkg *PackageInfo, path []ast.Node, exact bool) {\n\tfor _, info := range prog.AllPackages {\n\t\tfor _, f := range info.Files {\n\t\t\tif f.Pos() == token.NoPos {\n\t\t\t\t// This can happen if the parser saw\n\t\t\t\t// too many errors and bailed out.\n\t\t\t\t// (Use parser.AllErrors to prevent that.)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !tokenFileContainsPos(prog.Fset.File(f.Pos()), start) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif path, exact := astutil.PathEnclosingInterval(f, start, end); path != nil {\n\t\t\t\treturn info, path, exact\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, nil, false\n}\n\n// InitialPackages returns a new slice containing the set of initial\n// packages (Created + Imported) in unspecified order.\n//\nfunc (prog *Program) InitialPackages() []*PackageInfo {\n\tinfos := make([]*PackageInfo, 0, len(prog.Created)+len(prog.Imported))\n\tinfos = append(infos, prog.Created...)\n\tfor _, info := range prog.Imported {\n\t\tinfos = append(infos, info)\n\t}\n\treturn infos\n}\n\n// Package returns the ASTs and results of type checking for the\n// specified package.\nfunc (prog *Program) Package(path string) *PackageInfo {\n\tif info, ok := prog.AllPackages[prog.importMap[path]]; ok {\n\t\treturn info\n\t}\n\tfor _, info := range prog.Created {\n\t\tif path == info.Pkg.Path() {\n\t\t\treturn info\n\t\t}\n\t}\n\treturn nil\n}\n\n// ---------- Implementation ----------\n\n// importer holds the working state of the algorithm.\ntype importer struct {\n\tconf  *Config   // the client configuration\n\tstart time.Time // for logging\n\n\tprogMu sync.Mutex // guards prog\n\tprog   *Program   // the resulting program\n\n\t// findpkg is a memoization of FindPackage.\n\tfindpkgMu sync.Mutex // guards findpkg\n\tfindpkg   map[findpkgKey]*findpkgValue\n\n\timportedMu sync.Mutex             // guards imported\n\timported   map[string]*importInfo // all imported packages (incl. failures) by import path\n\n\t// import dependency graph: graph[x][y] => x imports y\n\t//\n\t// Since non-importable packages cannot be cyclic, we ignore\n\t// their imports, thus we only need the subgraph over importable\n\t// packages.  Nodes are identified by their import paths.\n\tgraphMu sync.Mutex\n\tgraph   map[string]map[string]bool\n}\n\ntype findpkgKey struct {\n\timportPath string\n\tfromDir    string\n\tmode       build.ImportMode\n}\n\ntype findpkgValue struct {\n\tready chan struct{} // closed to broadcast readiness\n\tbp    *build.Package\n\terr   error\n}\n\n// importInfo tracks the success or failure of a single import.\n//\n// Upon completion, exactly one of info and err is non-nil:\n// info on successful creation of a package, err otherwise.\n// A successful package may still contain type errors.\n//\ntype importInfo struct {\n\tpath     string        // import path\n\tinfo     *PackageInfo  // results of typechecking (including errors)\n\tcomplete chan struct{} // closed to broadcast that info is set.\n}\n\n// awaitCompletion blocks until ii is complete,\n// i.e. the info field is safe to inspect.\nfunc (ii *importInfo) awaitCompletion() {\n\t<-ii.complete // wait for close\n}\n\n// Complete marks ii as complete.\n// Its info and err fields will not be subsequently updated.\nfunc (ii *importInfo) Complete(info *PackageInfo) {\n\tif info == nil {\n\t\tpanic(\"info == nil\")\n\t}\n\tii.info = info\n\tclose(ii.complete)\n}\n\ntype importError struct {\n\tpath string // import path\n\terr  error  // reason for failure to create a package\n}\n\n// Load creates the initial packages specified by conf.{Create,Import}Pkgs,\n// loading their dependencies packages as needed.\n//\n// On success, Load returns a Program containing a PackageInfo for\n// each package.  On failure, it returns an error.\n//\n// If AllowErrors is true, Load will return a Program even if some\n// packages contained I/O, parser or type errors, or if dependencies\n// were missing.  (Such errors are accessible via PackageInfo.Errors.  If\n// false, Load will fail if any package had an error.\n//\n// It is an error if no packages were loaded.\n//\nfunc (conf *Config) Load() (*Program, error) {\n\t// Create a simple default error handler for parse/type errors.\n\tif conf.TypeChecker.Error == nil {\n\t\tconf.TypeChecker.Error = func(e error) { fmt.Fprintln(os.Stderr, e) }\n\t}\n\n\t// Set default working directory for relative package references.\n\tif conf.Cwd == \"\" {\n\t\tvar err error\n\t\tconf.Cwd, err = os.Getwd()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Install default FindPackage hook using go/build logic.\n\tif conf.FindPackage == nil {\n\t\tconf.FindPackage = (*build.Context).Import\n\t}\n\n\tprog := &Program{\n\t\tFset:        conf.fset(),\n\t\tImported:    make(map[string]*PackageInfo),\n\t\timportMap:   make(map[string]*types.Package),\n\t\tAllPackages: make(map[*types.Package]*PackageInfo),\n\t}\n\n\timp := importer{\n\t\tconf:     conf,\n\t\tprog:     prog,\n\t\tfindpkg:  make(map[findpkgKey]*findpkgValue),\n\t\timported: make(map[string]*importInfo),\n\t\tstart:    time.Now(),\n\t\tgraph:    make(map[string]map[string]bool),\n\t}\n\n\t// -- loading proper (concurrent phase) --------------------------------\n\n\tvar errpkgs []string // packages that contained errors\n\n\t// Load the initially imported packages and their dependencies,\n\t// in parallel.\n\t// No vendor check on packages imported from the command line.\n\tinfos, importErrors := imp.importAll(\"\", conf.Cwd, conf.ImportPkgs, ignoreVendor)\n\tfor _, ie := range importErrors {\n\t\tconf.TypeChecker.Error(ie.err) // failed to create package\n\t\terrpkgs = append(errpkgs, ie.path)\n\t}\n\tfor _, info := range infos {\n\t\tprog.Imported[info.Pkg.Path()] = info\n\t}\n\n\t// Augment the designated initial packages by their tests.\n\t// Dependencies are loaded in parallel.\n\tvar xtestPkgs []*build.Package\n\tfor importPath, augment := range conf.ImportPkgs {\n\t\tif !augment {\n\t\t\tcontinue\n\t\t}\n\n\t\t// No vendor check on packages imported from command line.\n\t\tbp, err := imp.findPackage(importPath, conf.Cwd, ignoreVendor)\n\t\tif err != nil {\n\t\t\t// Package not found, or can't even parse package declaration.\n\t\t\t// Already reported by previous loop; ignore it.\n\t\t\tcontinue\n\t\t}\n\n\t\t// Needs external test package?\n\t\tif len(bp.XTestGoFiles) > 0 {\n\t\t\txtestPkgs = append(xtestPkgs, bp)\n\t\t}\n\n\t\t// Consult the cache using the canonical package path.\n\t\tpath := bp.ImportPath\n\t\timp.importedMu.Lock() // (unnecessary, we're sequential here)\n\t\tii, ok := imp.imported[path]\n\t\t// Paranoid checks added due to issue #11012.\n\t\tif !ok {\n\t\t\t// Unreachable.\n\t\t\t// The previous loop called importAll and thus\n\t\t\t// startLoad for each path in ImportPkgs, which\n\t\t\t// populates imp.imported[path] with a non-zero value.\n\t\t\tpanic(fmt.Sprintf(\"imported[%q] not found\", path))\n\t\t}\n\t\tif ii == nil {\n\t\t\t// Unreachable.\n\t\t\t// The ii values in this loop are the same as in\n\t\t\t// the previous loop, which enforced the invariant\n\t\t\t// that at least one of ii.err and ii.info is non-nil.\n\t\t\tpanic(fmt.Sprintf(\"imported[%q] == nil\", path))\n\t\t}\n\t\tif ii.info == nil {\n\t\t\t// Unreachable.\n\t\t\t// awaitCompletion has the postcondition\n\t\t\t// ii.info != nil.\n\t\t\tpanic(fmt.Sprintf(\"imported[%q].info = nil\", path))\n\t\t}\n\t\tinfo := ii.info\n\t\timp.importedMu.Unlock()\n\n\t\t// Parse the in-package test files.\n\t\tfiles, errs := imp.conf.parsePackageFiles(bp, 't')\n\t\tfor _, err := range errs {\n\t\t\tinfo.appendError(err)\n\t\t}\n\n\t\t// The test files augmenting package P cannot be imported,\n\t\t// but may import packages that import P,\n\t\t// so we must disable the cycle check.\n\t\timp.addFiles(info, files, false)\n\t}\n\n\tcreatePkg := func(path, dir string, files []*ast.File, errs []error) {\n\t\tinfo := imp.newPackageInfo(path, dir)\n\t\tfor _, err := range errs {\n\t\t\tinfo.appendError(err)\n\t\t}\n\n\t\t// Ad hoc packages are non-importable,\n\t\t// so no cycle check is needed.\n\t\t// addFiles loads dependencies in parallel.\n\t\timp.addFiles(info, files, false)\n\t\tprog.Created = append(prog.Created, info)\n\t}\n\n\t// Create packages specified by conf.CreatePkgs.\n\tfor _, cp := range conf.CreatePkgs {\n\t\tfiles, errs := parseFiles(conf.fset(), conf.build(), nil, conf.Cwd, cp.Filenames, conf.ParserMode)\n\t\tfiles = append(files, cp.Files...)\n\n\t\tpath := cp.Path\n\t\tif path == \"\" {\n\t\t\tif len(files) > 0 {\n\t\t\t\tpath = files[0].Name.Name\n\t\t\t} else {\n\t\t\t\tpath = \"(unnamed)\"\n\t\t\t}\n\t\t}\n\n\t\tdir := conf.Cwd\n\t\tif len(files) > 0 && files[0].Pos().IsValid() {\n\t\t\tdir = filepath.Dir(conf.fset().File(files[0].Pos()).Name())\n\t\t}\n\t\tcreatePkg(path, dir, files, errs)\n\t}\n\n\t// Create external test packages.\n\tsort.Sort(byImportPath(xtestPkgs))\n\tfor _, bp := range xtestPkgs {\n\t\tfiles, errs := imp.conf.parsePackageFiles(bp, 'x')\n\t\tcreatePkg(bp.ImportPath+\"_test\", bp.Dir, files, errs)\n\t}\n\n\t// -- finishing up (sequential) ----------------------------------------\n\n\tif len(prog.Imported)+len(prog.Created) == 0 {\n\t\treturn nil, errors.New(\"no initial packages were loaded\")\n\t}\n\n\t// Create infos for indirectly imported packages.\n\t// e.g. incomplete packages without syntax, loaded from export data.\n\tfor _, obj := range prog.importMap {\n\t\tinfo := prog.AllPackages[obj]\n\t\tif info == nil {\n\t\t\tprog.AllPackages[obj] = &PackageInfo{Pkg: obj, Importable: true}\n\t\t} else {\n\t\t\t// finished\n\t\t\tinfo.checker = nil\n\t\t\tinfo.errorFunc = nil\n\t\t}\n\t}\n\n\tif !conf.AllowErrors {\n\t\t// Report errors in indirectly imported packages.\n\t\tfor _, info := range prog.AllPackages {\n\t\t\tif len(info.Errors) > 0 {\n\t\t\t\terrpkgs = append(errpkgs, info.Pkg.Path())\n\t\t\t}\n\t\t}\n\t\tif errpkgs != nil {\n\t\t\tvar more string\n\t\t\tif len(errpkgs) > 3 {\n\t\t\t\tmore = fmt.Sprintf(\" and %d more\", len(errpkgs)-3)\n\t\t\t\terrpkgs = errpkgs[:3]\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"couldn't load packages due to errors: %s%s\",\n\t\t\t\tstrings.Join(errpkgs, \", \"), more)\n\t\t}\n\t}\n\n\tmarkErrorFreePackages(prog.AllPackages)\n\n\treturn prog, nil\n}\n\ntype byImportPath []*build.Package\n\nfunc (b byImportPath) Len() int           { return len(b) }\nfunc (b byImportPath) Less(i, j int) bool { return b[i].ImportPath < b[j].ImportPath }\nfunc (b byImportPath) Swap(i, j int)      { b[i], b[j] = b[j], b[i] }\n\n// markErrorFreePackages sets the TransitivelyErrorFree flag on all\n// applicable packages.\nfunc markErrorFreePackages(allPackages map[*types.Package]*PackageInfo) {\n\t// Build the transpose of the import graph.\n\timportedBy := make(map[*types.Package]map[*types.Package]bool)\n\tfor P := range allPackages {\n\t\tfor _, Q := range P.Imports() {\n\t\t\tclients, ok := importedBy[Q]\n\t\t\tif !ok {\n\t\t\t\tclients = make(map[*types.Package]bool)\n\t\t\t\timportedBy[Q] = clients\n\t\t\t}\n\t\t\tclients[P] = true\n\t\t}\n\t}\n\n\t// Find all packages reachable from some error package.\n\treachable := make(map[*types.Package]bool)\n\tvar visit func(*types.Package)\n\tvisit = func(p *types.Package) {\n\t\tif !reachable[p] {\n\t\t\treachable[p] = true\n\t\t\tfor q := range importedBy[p] {\n\t\t\t\tvisit(q)\n\t\t\t}\n\t\t}\n\t}\n\tfor _, info := range allPackages {\n\t\tif len(info.Errors) > 0 {\n\t\t\tvisit(info.Pkg)\n\t\t}\n\t}\n\n\t// Mark the others as \"transitively error-free\".\n\tfor _, info := range allPackages {\n\t\tif !reachable[info.Pkg] {\n\t\t\tinfo.TransitivelyErrorFree = true\n\t\t}\n\t}\n}\n\n// build returns the effective build context.\nfunc (conf *Config) build() *build.Context {\n\tif conf.Build != nil {\n\t\treturn conf.Build\n\t}\n\treturn &build.Default\n}\n\n// parsePackageFiles enumerates the files belonging to package path,\n// then loads, parses and returns them, plus a list of I/O or parse\n// errors that were encountered.\n//\n// 'which' indicates which files to include:\n//    'g': include non-test *.go source files (GoFiles + processed CgoFiles)\n//    't': include in-package *_test.go source files (TestGoFiles)\n//    'x': include external *_test.go source files. (XTestGoFiles)\n//\nfunc (conf *Config) parsePackageFiles(bp *build.Package, which rune) ([]*ast.File, []error) {\n\tif bp.ImportPath == \"unsafe\" {\n\t\treturn nil, nil\n\t}\n\tvar filenames []string\n\tswitch which {\n\tcase 'g':\n\t\tfilenames = bp.GoFiles\n\tcase 't':\n\t\tfilenames = bp.TestGoFiles\n\tcase 'x':\n\t\tfilenames = bp.XTestGoFiles\n\tdefault:\n\t\tpanic(which)\n\t}\n\n\tfiles, errs := parseFiles(conf.fset(), conf.build(), conf.DisplayPath, bp.Dir, filenames, conf.ParserMode)\n\n\t// Preprocess CgoFiles and parse the outputs (sequentially).\n\tif which == 'g' && bp.CgoFiles != nil {\n\t\tcgofiles, err := cgo.ProcessFiles(bp, conf.fset(), conf.DisplayPath, conf.ParserMode)\n\t\tif err != nil {\n\t\t\terrs = append(errs, err)\n\t\t} else {\n\t\t\tfiles = append(files, cgofiles...)\n\t\t}\n\t}\n\n\treturn files, errs\n}\n\n// doImport imports the package denoted by path.\n// It implements the types.Importer signature.\n//\n// It returns an error if a package could not be created\n// (e.g. go/build or parse error), but type errors are reported via\n// the types.Config.Error callback (the first of which is also saved\n// in the package's PackageInfo).\n//\n// Idempotent.\n//\nfunc (imp *importer) doImport(from *PackageInfo, to string) (*types.Package, error) {\n\tif to == \"C\" {\n\t\t// This should be unreachable, but ad hoc packages are\n\t\t// not currently subject to cgo preprocessing.\n\t\t// See https://golang.org/issue/11627.\n\t\treturn nil, fmt.Errorf(`the loader doesn't cgo-process ad hoc packages like %q; see Go issue 11627`,\n\t\t\tfrom.Pkg.Path())\n\t}\n\n\tbp, err := imp.findPackage(to, from.dir, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The standard unsafe package is handled specially,\n\t// and has no PackageInfo.\n\tif bp.ImportPath == \"unsafe\" {\n\t\treturn types.Unsafe, nil\n\t}\n\n\t// Look for the package in the cache using its canonical path.\n\tpath := bp.ImportPath\n\timp.importedMu.Lock()\n\tii := imp.imported[path]\n\timp.importedMu.Unlock()\n\tif ii == nil {\n\t\tpanic(\"internal error: unexpected import: \" + path)\n\t}\n\tif ii.info != nil {\n\t\treturn ii.info.Pkg, nil\n\t}\n\n\t// Import of incomplete package: this indicates a cycle.\n\tfromPath := from.Pkg.Path()\n\tif cycle := imp.findPath(path, fromPath); cycle != nil {\n\t\t// Normalize cycle: start from alphabetically largest node.\n\t\tpos, start := -1, \"\"\n\t\tfor i, s := range cycle {\n\t\t\tif pos < 0 || s > start {\n\t\t\t\tpos, start = i, s\n\t\t\t}\n\t\t}\n\t\tcycle = append(cycle, cycle[:pos]...)[pos:] // rotate cycle to start from largest\n\t\tcycle = append(cycle, cycle[0])             // add start node to end to show cycliness\n\t\treturn nil, fmt.Errorf(\"import cycle: %s\", strings.Join(cycle, \" -> \"))\n\t}\n\n\tpanic(\"internal error: import of incomplete (yet acyclic) package: \" + fromPath)\n}\n\n// findPackage locates the package denoted by the importPath in the\n// specified directory.\nfunc (imp *importer) findPackage(importPath, fromDir string, mode build.ImportMode) (*build.Package, error) {\n\t// We use a non-blocking duplicate-suppressing cache (gopl.io §9.7)\n\t// to avoid holding the lock around FindPackage.\n\tkey := findpkgKey{importPath, fromDir, mode}\n\timp.findpkgMu.Lock()\n\tv, ok := imp.findpkg[key]\n\tif ok {\n\t\t// cache hit\n\t\timp.findpkgMu.Unlock()\n\n\t\t<-v.ready // wait for entry to become ready\n\t} else {\n\t\t// Cache miss: this goroutine becomes responsible for\n\t\t// populating the map entry and broadcasting its readiness.\n\t\tv = &findpkgValue{ready: make(chan struct{})}\n\t\timp.findpkg[key] = v\n\t\timp.findpkgMu.Unlock()\n\n\t\tioLimit <- true\n\t\tv.bp, v.err = imp.conf.FindPackage(imp.conf.build(), importPath, fromDir, mode)\n\t\t<-ioLimit\n\n\t\tif _, ok := v.err.(*build.NoGoError); ok {\n\t\t\tv.err = nil // empty directory is not an error\n\t\t}\n\n\t\tclose(v.ready) // broadcast ready condition\n\t}\n\treturn v.bp, v.err\n}\n\n// importAll loads, parses, and type-checks the specified packages in\n// parallel and returns their completed importInfos in unspecified order.\n//\n// fromPath is the package path of the importing package, if it is\n// importable, \"\" otherwise.  It is used for cycle detection.\n//\n// fromDir is the directory containing the import declaration that\n// caused these imports.\n//\nfunc (imp *importer) importAll(fromPath, fromDir string, imports map[string]bool, mode build.ImportMode) (infos []*PackageInfo, errors []importError) {\n\tif fromPath != \"\" {\n\t\t// We're loading a set of imports.\n\t\t//\n\t\t// We must record graph edges from the importing package\n\t\t// to its dependencies, and check for cycles.\n\t\timp.graphMu.Lock()\n\t\tdeps, ok := imp.graph[fromPath]\n\t\tif !ok {\n\t\t\tdeps = make(map[string]bool)\n\t\t\timp.graph[fromPath] = deps\n\t\t}\n\t\tfor importPath := range imports {\n\t\t\tdeps[importPath] = true\n\t\t}\n\t\timp.graphMu.Unlock()\n\t}\n\n\tvar pending []*importInfo\n\tfor importPath := range imports {\n\t\tif fromPath != \"\" {\n\t\t\tif cycle := imp.findPath(importPath, fromPath); cycle != nil {\n\t\t\t\t// Cycle-forming import: we must not check it\n\t\t\t\t// since it would deadlock.\n\t\t\t\tif trace {\n\t\t\t\t\tfmt.Fprintf(os.Stderr, \"import cycle: %q\\n\", cycle)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tbp, err := imp.findPackage(importPath, fromDir, mode)\n\t\tif err != nil {\n\t\t\terrors = append(errors, importError{\n\t\t\t\tpath: importPath,\n\t\t\t\terr:  err,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tpending = append(pending, imp.startLoad(bp))\n\t}\n\n\tfor _, ii := range pending {\n\t\tii.awaitCompletion()\n\t\tinfos = append(infos, ii.info)\n\t}\n\n\treturn infos, errors\n}\n\n// findPath returns an arbitrary path from 'from' to 'to' in the import\n// graph, or nil if there was none.\nfunc (imp *importer) findPath(from, to string) []string {\n\timp.graphMu.Lock()\n\tdefer imp.graphMu.Unlock()\n\n\tseen := make(map[string]bool)\n\tvar search func(stack []string, importPath string) []string\n\tsearch = func(stack []string, importPath string) []string {\n\t\tif !seen[importPath] {\n\t\t\tseen[importPath] = true\n\t\t\tstack = append(stack, importPath)\n\t\t\tif importPath == to {\n\t\t\t\treturn stack\n\t\t\t}\n\t\t\tfor x := range imp.graph[importPath] {\n\t\t\t\tif p := search(stack, x); p != nil {\n\t\t\t\t\treturn p\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\treturn search(make([]string, 0, 20), from)\n}\n\n// startLoad initiates the loading, parsing and type-checking of the\n// specified package and its dependencies, if it has not already begun.\n//\n// It returns an importInfo, not necessarily in a completed state.  The\n// caller must call awaitCompletion() before accessing its info field.\n//\n// startLoad is concurrency-safe and idempotent.\n//\nfunc (imp *importer) startLoad(bp *build.Package) *importInfo {\n\tpath := bp.ImportPath\n\timp.importedMu.Lock()\n\tii, ok := imp.imported[path]\n\tif !ok {\n\t\tii = &importInfo{path: path, complete: make(chan struct{})}\n\t\timp.imported[path] = ii\n\t\tgo func() {\n\t\t\tinfo := imp.load(bp)\n\t\t\tii.Complete(info)\n\t\t}()\n\t}\n\timp.importedMu.Unlock()\n\n\treturn ii\n}\n\n// load implements package loading by parsing Go source files\n// located by go/build.\nfunc (imp *importer) load(bp *build.Package) *PackageInfo {\n\tinfo := imp.newPackageInfo(bp.ImportPath, bp.Dir)\n\tinfo.Importable = true\n\tfiles, errs := imp.conf.parsePackageFiles(bp, 'g')\n\tfor _, err := range errs {\n\t\tinfo.appendError(err)\n\t}\n\n\timp.addFiles(info, files, true)\n\n\timp.progMu.Lock()\n\timp.prog.importMap[bp.ImportPath] = info.Pkg\n\timp.progMu.Unlock()\n\n\treturn info\n}\n\n// addFiles adds and type-checks the specified files to info, loading\n// their dependencies if needed.  The order of files determines the\n// package initialization order.  It may be called multiple times on the\n// same package.  Errors are appended to the info.Errors field.\n//\n// cycleCheck determines whether the imports within files create\n// dependency edges that should be checked for potential cycles.\n//\nfunc (imp *importer) addFiles(info *PackageInfo, files []*ast.File, cycleCheck bool) {\n\t// Ensure the dependencies are loaded, in parallel.\n\tvar fromPath string\n\tif cycleCheck {\n\t\tfromPath = info.Pkg.Path()\n\t}\n\t// TODO(adonovan): opt: make the caller do scanImports.\n\t// Callers with a build.Package can skip it.\n\timp.importAll(fromPath, info.dir, scanImports(files), 0)\n\n\tif trace {\n\t\tfmt.Fprintf(os.Stderr, \"%s: start %q (%d)\\n\",\n\t\t\ttime.Since(imp.start), info.Pkg.Path(), len(files))\n\t}\n\n\t// Don't call checker.Files on Unsafe, even with zero files,\n\t// because it would mutate the package, which is a global.\n\tif info.Pkg == types.Unsafe {\n\t\tif len(files) > 0 {\n\t\t\tpanic(`\"unsafe\" package contains unexpected files`)\n\t\t}\n\t} else {\n\t\t// Ignore the returned (first) error since we\n\t\t// already collect them all in the PackageInfo.\n\t\tinfo.checker.Files(files)\n\t\tinfo.Files = append(info.Files, files...)\n\t}\n\n\tif imp.conf.AfterTypeCheck != nil {\n\t\timp.conf.AfterTypeCheck(info, files)\n\t}\n\n\tif trace {\n\t\tfmt.Fprintf(os.Stderr, \"%s: stop %q\\n\",\n\t\t\ttime.Since(imp.start), info.Pkg.Path())\n\t}\n}\n\nfunc (imp *importer) newPackageInfo(path, dir string) *PackageInfo {\n\tvar pkg *types.Package\n\tif path == \"unsafe\" {\n\t\tpkg = types.Unsafe\n\t} else {\n\t\tpkg = types.NewPackage(path, \"\")\n\t}\n\tinfo := &PackageInfo{\n\t\tPkg: pkg,\n\t\tInfo: types.Info{\n\t\t\tTypes:      make(map[ast.Expr]types.TypeAndValue),\n\t\t\tDefs:       make(map[*ast.Ident]types.Object),\n\t\t\tUses:       make(map[*ast.Ident]types.Object),\n\t\t\tImplicits:  make(map[ast.Node]types.Object),\n\t\t\tScopes:     make(map[ast.Node]*types.Scope),\n\t\t\tSelections: make(map[*ast.SelectorExpr]*types.Selection),\n\t\t},\n\t\terrorFunc: imp.conf.TypeChecker.Error,\n\t\tdir:       dir,\n\t}\n\n\t// Copy the types.Config so we can vary it across PackageInfos.\n\ttc := imp.conf.TypeChecker\n\ttc.IgnoreFuncBodies = false\n\tif f := imp.conf.TypeCheckFuncBodies; f != nil {\n\t\ttc.IgnoreFuncBodies = !f(path)\n\t}\n\ttc.Importer = closure{imp, info}\n\ttc.Error = info.appendError // appendError wraps the user's Error function\n\n\tinfo.checker = types.NewChecker(&tc, imp.conf.fset(), pkg, &info.Info)\n\timp.progMu.Lock()\n\timp.prog.AllPackages[pkg] = info\n\timp.progMu.Unlock()\n\treturn info\n}\n\ntype closure struct {\n\timp  *importer\n\tinfo *PackageInfo\n}\n\nfunc (c closure) Import(to string) (*types.Package, error) { return c.imp.doImport(c.info, to) }\n"
  },
  {
    "path": "_tools/src/golang.org/x/tools/go/loader/util.go",
    "content": "// Copyright 2013 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 loader\n\nimport (\n\t\"go/ast\"\n\t\"go/build\"\n\t\"go/parser\"\n\t\"go/token\"\n\t\"io\"\n\t\"os\"\n\t\"strconv\"\n\t\"sync\"\n\n\t\"golang.org/x/tools/go/buildutil\"\n)\n\n// We use a counting semaphore to limit\n// the number of parallel I/O calls per process.\nvar ioLimit = make(chan bool, 10)\n\n// parseFiles parses the Go source files within directory dir and\n// returns the ASTs of the ones that could be at least partially parsed,\n// along with a list of I/O and parse errors encountered.\n//\n// I/O is done via ctxt, which may specify a virtual file system.\n// displayPath is used to transform the filenames attached to the ASTs.\n//\nfunc parseFiles(fset *token.FileSet, ctxt *build.Context, displayPath func(string) string, dir string, files []string, mode parser.Mode) ([]*ast.File, []error) {\n\tif displayPath == nil {\n\t\tdisplayPath = func(path string) string { return path }\n\t}\n\tvar wg sync.WaitGroup\n\tn := len(files)\n\tparsed := make([]*ast.File, n)\n\terrors := make([]error, n)\n\tfor i, file := range files {\n\t\tif !buildutil.IsAbsPath(ctxt, file) {\n\t\t\tfile = buildutil.JoinPath(ctxt, dir, file)\n\t\t}\n\t\twg.Add(1)\n\t\tgo func(i int, file string) {\n\t\t\tioLimit <- true // wait\n\t\t\tdefer func() {\n\t\t\t\twg.Done()\n\t\t\t\t<-ioLimit // signal\n\t\t\t}()\n\t\t\tvar rd io.ReadCloser\n\t\t\tvar err error\n\t\t\tif ctxt.OpenFile != nil {\n\t\t\t\trd, err = ctxt.OpenFile(file)\n\t\t\t} else {\n\t\t\t\trd, err = os.Open(file)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\terrors[i] = err // open failed\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// ParseFile may return both an AST and an error.\n\t\t\tparsed[i], errors[i] = parser.ParseFile(fset, displayPath(file), rd, mode)\n\t\t\trd.Close()\n\t\t}(i, file)\n\t}\n\twg.Wait()\n\n\t// Eliminate nils, preserving order.\n\tvar o int\n\tfor _, f := range parsed {\n\t\tif f != nil {\n\t\t\tparsed[o] = f\n\t\t\to++\n\t\t}\n\t}\n\tparsed = parsed[:o]\n\n\to = 0\n\tfor _, err := range errors {\n\t\tif err != nil {\n\t\t\terrors[o] = err\n\t\t\to++\n\t\t}\n\t}\n\terrors = errors[:o]\n\n\treturn parsed, errors\n}\n\n// scanImports returns the set of all import paths from all\n// import specs in the specified files.\nfunc scanImports(files []*ast.File) map[string]bool {\n\timports := make(map[string]bool)\n\tfor _, f := range files {\n\t\tfor _, decl := range f.Decls {\n\t\t\tif decl, ok := decl.(*ast.GenDecl); ok && decl.Tok == token.IMPORT {\n\t\t\t\tfor _, spec := range decl.Specs {\n\t\t\t\t\tspec := spec.(*ast.ImportSpec)\n\n\t\t\t\t\t// NB: do not assume the program is well-formed!\n\t\t\t\t\tpath, err := strconv.Unquote(spec.Path.Value)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tcontinue // quietly ignore the error\n\t\t\t\t\t}\n\t\t\t\t\tif path == \"C\" {\n\t\t\t\t\t\tcontinue // skip pseudopackage\n\t\t\t\t\t}\n\t\t\t\t\timports[path] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn imports\n}\n\n// ---------- Internal helpers ----------\n\n// TODO(adonovan): make this a method: func (*token.File) Contains(token.Pos)\nfunc tokenFileContainsPos(f *token.File, pos token.Pos) bool {\n\tp := int(pos)\n\tbase := f.Base()\n\treturn base <= p && p < base+f.Size()\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo/init.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 internal_gengo\n\nimport (\n\t\"unicode\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/compiler/protogen\"\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\n\t\"google.golang.org/protobuf/types/descriptorpb\"\n)\n\ntype fileInfo struct {\n\t*protogen.File\n\n\tallEnums      []*enumInfo\n\tallMessages   []*messageInfo\n\tallExtensions []*extensionInfo\n\n\tallEnumsByPtr         map[*enumInfo]int    // value is index into allEnums\n\tallMessagesByPtr      map[*messageInfo]int // value is index into allMessages\n\tallMessageFieldsByPtr map[*messageInfo]*structFields\n\n\t// needRawDesc specifies whether the generator should emit logic to provide\n\t// the legacy raw descriptor in GZIP'd form.\n\t// This is updated by enum and message generation logic as necessary,\n\t// and checked at the end of file generation.\n\tneedRawDesc bool\n}\n\ntype structFields struct {\n\tcount      int\n\tunexported map[int]string\n}\n\nfunc (sf *structFields) append(name string) {\n\tif r, _ := utf8.DecodeRuneInString(name); !unicode.IsUpper(r) {\n\t\tif sf.unexported == nil {\n\t\t\tsf.unexported = make(map[int]string)\n\t\t}\n\t\tsf.unexported[sf.count] = name\n\t}\n\tsf.count++\n}\n\nfunc newFileInfo(file *protogen.File) *fileInfo {\n\tf := &fileInfo{File: file}\n\n\t// Collect all enums, messages, and extensions in \"flattened ordering\".\n\t// See filetype.TypeBuilder.\n\tvar walkMessages func([]*protogen.Message, func(*protogen.Message))\n\twalkMessages = func(messages []*protogen.Message, f func(*protogen.Message)) {\n\t\tfor _, m := range messages {\n\t\t\tf(m)\n\t\t\twalkMessages(m.Messages, f)\n\t\t}\n\t}\n\tinitEnumInfos := func(enums []*protogen.Enum) {\n\t\tfor _, enum := range enums {\n\t\t\tf.allEnums = append(f.allEnums, newEnumInfo(f, enum))\n\t\t}\n\t}\n\tinitMessageInfos := func(messages []*protogen.Message) {\n\t\tfor _, message := range messages {\n\t\t\tf.allMessages = append(f.allMessages, newMessageInfo(f, message))\n\t\t}\n\t}\n\tinitExtensionInfos := func(extensions []*protogen.Extension) {\n\t\tfor _, extension := range extensions {\n\t\t\tf.allExtensions = append(f.allExtensions, newExtensionInfo(f, extension))\n\t\t}\n\t}\n\tinitEnumInfos(f.Enums)\n\tinitMessageInfos(f.Messages)\n\tinitExtensionInfos(f.Extensions)\n\twalkMessages(f.Messages, func(m *protogen.Message) {\n\t\tinitEnumInfos(m.Enums)\n\t\tinitMessageInfos(m.Messages)\n\t\tinitExtensionInfos(m.Extensions)\n\t})\n\n\t// Derive a reverse mapping of enum and message pointers to their index\n\t// in allEnums and allMessages.\n\tif len(f.allEnums) > 0 {\n\t\tf.allEnumsByPtr = make(map[*enumInfo]int)\n\t\tfor i, e := range f.allEnums {\n\t\t\tf.allEnumsByPtr[e] = i\n\t\t}\n\t}\n\tif len(f.allMessages) > 0 {\n\t\tf.allMessagesByPtr = make(map[*messageInfo]int)\n\t\tf.allMessageFieldsByPtr = make(map[*messageInfo]*structFields)\n\t\tfor i, m := range f.allMessages {\n\t\t\tf.allMessagesByPtr[m] = i\n\t\t\tf.allMessageFieldsByPtr[m] = new(structFields)\n\t\t}\n\t}\n\n\treturn f\n}\n\ntype enumInfo struct {\n\t*protogen.Enum\n\n\tgenJSONMethod    bool\n\tgenRawDescMethod bool\n}\n\nfunc newEnumInfo(f *fileInfo, enum *protogen.Enum) *enumInfo {\n\te := &enumInfo{Enum: enum}\n\te.genJSONMethod = true\n\te.genRawDescMethod = true\n\treturn e\n}\n\ntype messageInfo struct {\n\t*protogen.Message\n\n\tgenRawDescMethod  bool\n\tgenExtRangeMethod bool\n\n\tisTracked bool\n\thasWeak   bool\n}\n\nfunc newMessageInfo(f *fileInfo, message *protogen.Message) *messageInfo {\n\tm := &messageInfo{Message: message}\n\tm.genRawDescMethod = true\n\tm.genExtRangeMethod = true\n\tm.isTracked = isTrackedMessage(m)\n\tfor _, field := range m.Fields {\n\t\tm.hasWeak = m.hasWeak || field.Desc.IsWeak()\n\t}\n\treturn m\n}\n\n// isTrackedMessage reports whether field tracking is enabled on the message.\nfunc isTrackedMessage(m *messageInfo) (tracked bool) {\n\tconst trackFieldUse_fieldNumber = 37383685\n\n\t// Decode the option from unknown fields to avoid a dependency on the\n\t// annotation proto from protoc-gen-go.\n\tb := m.Desc.Options().(*descriptorpb.MessageOptions).ProtoReflect().GetUnknown()\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tif num == trackFieldUse_fieldNumber && typ == protowire.VarintType {\n\t\t\tv, _ := protowire.ConsumeVarint(b)\n\t\t\ttracked = protowire.DecodeBool(v)\n\t\t}\n\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\tb = b[m:]\n\t}\n\treturn tracked\n}\n\ntype extensionInfo struct {\n\t*protogen.Extension\n}\n\nfunc newExtensionInfo(f *fileInfo, extension *protogen.Extension) *extensionInfo {\n\tx := &extensionInfo{Extension: extension}\n\treturn x\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo/main.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 internal_gengo is internal to the protobuf module.\npackage internal_gengo\n\nimport (\n\t\"fmt\"\n\t\"go/ast\"\n\t\"go/parser\"\n\t\"go/token\"\n\t\"math\"\n\t\"strconv\"\n\t\"strings\"\n\t\"unicode\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/compiler/protogen\"\n\t\"google.golang.org/protobuf/internal/encoding/tag\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/version\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoimpl\"\n\n\t\"google.golang.org/protobuf/types/descriptorpb\"\n\t\"google.golang.org/protobuf/types/pluginpb\"\n)\n\n// SupportedFeatures reports the set of supported protobuf language features.\nvar SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)\n\n// GenerateVersionMarkers specifies whether to generate version markers.\nvar GenerateVersionMarkers = true\n\n// Standard library dependencies.\nconst (\n\tbase64Package  = protogen.GoImportPath(\"encoding/base64\")\n\tmathPackage    = protogen.GoImportPath(\"math\")\n\treflectPackage = protogen.GoImportPath(\"reflect\")\n\tsortPackage    = protogen.GoImportPath(\"sort\")\n\tstringsPackage = protogen.GoImportPath(\"strings\")\n\tsyncPackage    = protogen.GoImportPath(\"sync\")\n\ttimePackage    = protogen.GoImportPath(\"time\")\n\tutf8Package    = protogen.GoImportPath(\"unicode/utf8\")\n)\n\n// Protobuf library dependencies.\n//\n// These are declared as an interface type so that they can be more easily\n// patched to support unique build environments that impose restrictions\n// on the dependencies of generated source code.\nvar (\n\tprotoPackage         goImportPath = protogen.GoImportPath(\"google.golang.org/protobuf/proto\")\n\tprotoifacePackage    goImportPath = protogen.GoImportPath(\"google.golang.org/protobuf/runtime/protoiface\")\n\tprotoimplPackage     goImportPath = protogen.GoImportPath(\"google.golang.org/protobuf/runtime/protoimpl\")\n\tprotojsonPackage     goImportPath = protogen.GoImportPath(\"google.golang.org/protobuf/encoding/protojson\")\n\tprotoreflectPackage  goImportPath = protogen.GoImportPath(\"google.golang.org/protobuf/reflect/protoreflect\")\n\tprotoregistryPackage goImportPath = protogen.GoImportPath(\"google.golang.org/protobuf/reflect/protoregistry\")\n)\n\ntype goImportPath interface {\n\tString() string\n\tIdent(string) protogen.GoIdent\n}\n\n// GenerateFile generates the contents of a .pb.go file.\nfunc GenerateFile(gen *protogen.Plugin, file *protogen.File) *protogen.GeneratedFile {\n\tfilename := file.GeneratedFilenamePrefix + \".pb.go\"\n\tg := gen.NewGeneratedFile(filename, file.GoImportPath)\n\tf := newFileInfo(file)\n\n\tgenStandaloneComments(g, f, int32(genid.FileDescriptorProto_Syntax_field_number))\n\tgenGeneratedHeader(gen, g, f)\n\tgenStandaloneComments(g, f, int32(genid.FileDescriptorProto_Package_field_number))\n\n\tpackageDoc := genPackageKnownComment(f)\n\tg.P(packageDoc, \"package \", f.GoPackageName)\n\tg.P()\n\n\t// Emit a static check that enforces a minimum version of the proto package.\n\tif GenerateVersionMarkers {\n\t\tg.P(\"const (\")\n\t\tg.P(\"// Verify that this generated code is sufficiently up-to-date.\")\n\t\tg.P(\"_ = \", protoimplPackage.Ident(\"EnforceVersion\"), \"(\", protoimpl.GenVersion, \" - \", protoimplPackage.Ident(\"MinVersion\"), \")\")\n\t\tg.P(\"// Verify that runtime/protoimpl is sufficiently up-to-date.\")\n\t\tg.P(\"_ = \", protoimplPackage.Ident(\"EnforceVersion\"), \"(\", protoimplPackage.Ident(\"MaxVersion\"), \" - \", protoimpl.GenVersion, \")\")\n\t\tg.P(\")\")\n\t\tg.P()\n\t}\n\n\tfor i, imps := 0, f.Desc.Imports(); i < imps.Len(); i++ {\n\t\tgenImport(gen, g, f, imps.Get(i))\n\t}\n\tfor _, enum := range f.allEnums {\n\t\tgenEnum(g, f, enum)\n\t}\n\tfor _, message := range f.allMessages {\n\t\tgenMessage(g, f, message)\n\t}\n\tgenExtensions(g, f)\n\n\tgenReflectFileDescriptor(gen, g, f)\n\n\treturn g\n}\n\n// genStandaloneComments prints all leading comments for a FileDescriptorProto\n// location identified by the field number n.\nfunc genStandaloneComments(g *protogen.GeneratedFile, f *fileInfo, n int32) {\n\tloc := f.Desc.SourceLocations().ByPath(protoreflect.SourcePath{n})\n\tfor _, s := range loc.LeadingDetachedComments {\n\t\tg.P(protogen.Comments(s))\n\t\tg.P()\n\t}\n\tif s := loc.LeadingComments; s != \"\" {\n\t\tg.P(protogen.Comments(s))\n\t\tg.P()\n\t}\n}\n\nfunc genGeneratedHeader(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo) {\n\tg.P(\"// Code generated by protoc-gen-go. DO NOT EDIT.\")\n\n\tif GenerateVersionMarkers {\n\t\tg.P(\"// versions:\")\n\t\tprotocGenGoVersion := version.String()\n\t\tprotocVersion := \"(unknown)\"\n\t\tif v := gen.Request.GetCompilerVersion(); v != nil {\n\t\t\tprotocVersion = fmt.Sprintf(\"v%v.%v.%v\", v.GetMajor(), v.GetMinor(), v.GetPatch())\n\t\t\tif s := v.GetSuffix(); s != \"\" {\n\t\t\t\tprotocVersion += \"-\" + s\n\t\t\t}\n\t\t}\n\t\tg.P(\"// \\tprotoc-gen-go \", protocGenGoVersion)\n\t\tg.P(\"// \\tprotoc        \", protocVersion)\n\t}\n\n\tif f.Proto.GetOptions().GetDeprecated() {\n\t\tg.P(\"// \", f.Desc.Path(), \" is a deprecated file.\")\n\t} else {\n\t\tg.P(\"// source: \", f.Desc.Path())\n\t}\n\tg.P()\n}\n\nfunc genImport(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, imp protoreflect.FileImport) {\n\timpFile, ok := gen.FilesByPath[imp.Path()]\n\tif !ok {\n\t\treturn\n\t}\n\tif impFile.GoImportPath == f.GoImportPath {\n\t\t// Don't generate imports or aliases for types in the same Go package.\n\t\treturn\n\t}\n\t// Generate imports for all non-weak dependencies, even if they are not\n\t// referenced, because other code and tools depend on having the\n\t// full transitive closure of protocol buffer types in the binary.\n\tif !imp.IsWeak {\n\t\tg.Import(impFile.GoImportPath)\n\t}\n\tif !imp.IsPublic {\n\t\treturn\n\t}\n\n\t// Generate public imports by generating the imported file, parsing it,\n\t// and extracting every symbol that should receive a forwarding declaration.\n\timpGen := GenerateFile(gen, impFile)\n\timpGen.Skip()\n\tb, err := impGen.Content()\n\tif err != nil {\n\t\tgen.Error(err)\n\t\treturn\n\t}\n\tfset := token.NewFileSet()\n\tastFile, err := parser.ParseFile(fset, \"\", b, parser.ParseComments)\n\tif err != nil {\n\t\tgen.Error(err)\n\t\treturn\n\t}\n\tgenForward := func(tok token.Token, name string, expr ast.Expr) {\n\t\t// Don't import unexported symbols.\n\t\tr, _ := utf8.DecodeRuneInString(name)\n\t\tif !unicode.IsUpper(r) {\n\t\t\treturn\n\t\t}\n\t\t// Don't import the FileDescriptor.\n\t\tif name == impFile.GoDescriptorIdent.GoName {\n\t\t\treturn\n\t\t}\n\t\t// Don't import decls referencing a symbol defined in another package.\n\t\t// i.e., don't import decls which are themselves public imports:\n\t\t//\n\t\t//\ttype T = somepackage.T\n\t\tif _, ok := expr.(*ast.SelectorExpr); ok {\n\t\t\treturn\n\t\t}\n\t\tg.P(tok, \" \", name, \" = \", impFile.GoImportPath.Ident(name))\n\t}\n\tg.P(\"// Symbols defined in public import of \", imp.Path(), \".\")\n\tg.P()\n\tfor _, decl := range astFile.Decls {\n\t\tswitch decl := decl.(type) {\n\t\tcase *ast.GenDecl:\n\t\t\tfor _, spec := range decl.Specs {\n\t\t\t\tswitch spec := spec.(type) {\n\t\t\t\tcase *ast.TypeSpec:\n\t\t\t\t\tgenForward(decl.Tok, spec.Name.Name, spec.Type)\n\t\t\t\tcase *ast.ValueSpec:\n\t\t\t\t\tfor i, name := range spec.Names {\n\t\t\t\t\t\tvar expr ast.Expr\n\t\t\t\t\t\tif i < len(spec.Values) {\n\t\t\t\t\t\t\texpr = spec.Values[i]\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgenForward(decl.Tok, name.Name, expr)\n\t\t\t\t\t}\n\t\t\t\tcase *ast.ImportSpec:\n\t\t\t\tdefault:\n\t\t\t\t\tpanic(fmt.Sprintf(\"can't generate forward for spec type %T\", spec))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tg.P()\n}\n\nfunc genEnum(g *protogen.GeneratedFile, f *fileInfo, e *enumInfo) {\n\t// Enum type declaration.\n\tg.Annotate(e.GoIdent.GoName, e.Location)\n\tleadingComments := appendDeprecationSuffix(e.Comments.Leading,\n\t\te.Desc.Options().(*descriptorpb.EnumOptions).GetDeprecated())\n\tg.P(leadingComments,\n\t\t\"type \", e.GoIdent, \" int32\")\n\n\t// Enum value constants.\n\tg.P(\"const (\")\n\tfor _, value := range e.Values {\n\t\tg.Annotate(value.GoIdent.GoName, value.Location)\n\t\tleadingComments := appendDeprecationSuffix(value.Comments.Leading,\n\t\t\tvalue.Desc.Options().(*descriptorpb.EnumValueOptions).GetDeprecated())\n\t\tg.P(leadingComments,\n\t\t\tvalue.GoIdent, \" \", e.GoIdent, \" = \", value.Desc.Number(),\n\t\t\ttrailingComment(value.Comments.Trailing))\n\t}\n\tg.P(\")\")\n\tg.P()\n\n\t// Enum value maps.\n\tg.P(\"// Enum value maps for \", e.GoIdent, \".\")\n\tg.P(\"var (\")\n\tg.P(e.GoIdent.GoName+\"_name\", \" = map[int32]string{\")\n\tfor _, value := range e.Values {\n\t\tduplicate := \"\"\n\t\tif value.Desc != e.Desc.Values().ByNumber(value.Desc.Number()) {\n\t\t\tduplicate = \"// Duplicate value: \"\n\t\t}\n\t\tg.P(duplicate, value.Desc.Number(), \": \", strconv.Quote(string(value.Desc.Name())), \",\")\n\t}\n\tg.P(\"}\")\n\tg.P(e.GoIdent.GoName+\"_value\", \" = map[string]int32{\")\n\tfor _, value := range e.Values {\n\t\tg.P(strconv.Quote(string(value.Desc.Name())), \": \", value.Desc.Number(), \",\")\n\t}\n\tg.P(\"}\")\n\tg.P(\")\")\n\tg.P()\n\n\t// Enum method.\n\t//\n\t// NOTE: A pointer value is needed to represent presence in proto2.\n\t// Since a proto2 message can reference a proto3 enum, it is useful to\n\t// always generate this method (even on proto3 enums) to support that case.\n\tg.P(\"func (x \", e.GoIdent, \") Enum() *\", e.GoIdent, \" {\")\n\tg.P(\"p := new(\", e.GoIdent, \")\")\n\tg.P(\"*p = x\")\n\tg.P(\"return p\")\n\tg.P(\"}\")\n\tg.P()\n\n\t// String method.\n\tg.P(\"func (x \", e.GoIdent, \") String() string {\")\n\tg.P(\"return \", protoimplPackage.Ident(\"X\"), \".EnumStringOf(x.Descriptor(), \", protoreflectPackage.Ident(\"EnumNumber\"), \"(x))\")\n\tg.P(\"}\")\n\tg.P()\n\n\tgenEnumReflectMethods(g, f, e)\n\n\t// UnmarshalJSON method.\n\tif e.genJSONMethod && e.Desc.Syntax() == protoreflect.Proto2 {\n\t\tg.P(\"// Deprecated: Do not use.\")\n\t\tg.P(\"func (x *\", e.GoIdent, \") UnmarshalJSON(b []byte) error {\")\n\t\tg.P(\"num, err := \", protoimplPackage.Ident(\"X\"), \".UnmarshalJSONEnum(x.Descriptor(), b)\")\n\t\tg.P(\"if err != nil {\")\n\t\tg.P(\"return err\")\n\t\tg.P(\"}\")\n\t\tg.P(\"*x = \", e.GoIdent, \"(num)\")\n\t\tg.P(\"return nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n\n\t// EnumDescriptor method.\n\tif e.genRawDescMethod {\n\t\tvar indexes []string\n\t\tfor i := 1; i < len(e.Location.Path); i += 2 {\n\t\t\tindexes = append(indexes, strconv.Itoa(int(e.Location.Path[i])))\n\t\t}\n\t\tg.P(\"// Deprecated: Use \", e.GoIdent, \".Descriptor instead.\")\n\t\tg.P(\"func (\", e.GoIdent, \") EnumDescriptor() ([]byte, []int) {\")\n\t\tg.P(\"return \", rawDescVarName(f), \"GZIP(), []int{\", strings.Join(indexes, \",\"), \"}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t\tf.needRawDesc = true\n\t}\n}\n\nfunc genMessage(g *protogen.GeneratedFile, f *fileInfo, m *messageInfo) {\n\tif m.Desc.IsMapEntry() {\n\t\treturn\n\t}\n\n\t// Message type declaration.\n\tg.Annotate(m.GoIdent.GoName, m.Location)\n\tleadingComments := appendDeprecationSuffix(m.Comments.Leading,\n\t\tm.Desc.Options().(*descriptorpb.MessageOptions).GetDeprecated())\n\tg.P(leadingComments,\n\t\t\"type \", m.GoIdent, \" struct {\")\n\tgenMessageFields(g, f, m)\n\tg.P(\"}\")\n\tg.P()\n\n\tgenMessageKnownFunctions(g, f, m)\n\tgenMessageDefaultDecls(g, f, m)\n\tgenMessageMethods(g, f, m)\n\tgenMessageOneofWrapperTypes(g, f, m)\n}\n\nfunc genMessageFields(g *protogen.GeneratedFile, f *fileInfo, m *messageInfo) {\n\tsf := f.allMessageFieldsByPtr[m]\n\tgenMessageInternalFields(g, f, m, sf)\n\tfor _, field := range m.Fields {\n\t\tgenMessageField(g, f, m, field, sf)\n\t}\n}\n\nfunc genMessageInternalFields(g *protogen.GeneratedFile, f *fileInfo, m *messageInfo, sf *structFields) {\n\tg.P(genid.State_goname, \" \", protoimplPackage.Ident(\"MessageState\"))\n\tsf.append(genid.State_goname)\n\tg.P(genid.SizeCache_goname, \" \", protoimplPackage.Ident(\"SizeCache\"))\n\tsf.append(genid.SizeCache_goname)\n\tif m.hasWeak {\n\t\tg.P(genid.WeakFields_goname, \" \", protoimplPackage.Ident(\"WeakFields\"))\n\t\tsf.append(genid.WeakFields_goname)\n\t}\n\tg.P(genid.UnknownFields_goname, \" \", protoimplPackage.Ident(\"UnknownFields\"))\n\tsf.append(genid.UnknownFields_goname)\n\tif m.Desc.ExtensionRanges().Len() > 0 {\n\t\tg.P(genid.ExtensionFields_goname, \" \", protoimplPackage.Ident(\"ExtensionFields\"))\n\t\tsf.append(genid.ExtensionFields_goname)\n\t}\n\tif sf.count > 0 {\n\t\tg.P()\n\t}\n}\n\nfunc genMessageField(g *protogen.GeneratedFile, f *fileInfo, m *messageInfo, field *protogen.Field, sf *structFields) {\n\tif oneof := field.Oneof; oneof != nil && !oneof.Desc.IsSynthetic() {\n\t\t// It would be a bit simpler to iterate over the oneofs below,\n\t\t// but generating the field here keeps the contents of the Go\n\t\t// struct in the same order as the contents of the source\n\t\t// .proto file.\n\t\tif oneof.Fields[0] != field {\n\t\t\treturn // only generate for first appearance\n\t\t}\n\n\t\ttags := structTags{\n\t\t\t{\"protobuf_oneof\", string(oneof.Desc.Name())},\n\t\t}\n\t\tif m.isTracked {\n\t\t\ttags = append(tags, gotrackTags...)\n\t\t}\n\n\t\tg.Annotate(m.GoIdent.GoName+\".\"+oneof.GoName, oneof.Location)\n\t\tleadingComments := oneof.Comments.Leading\n\t\tif leadingComments != \"\" {\n\t\t\tleadingComments += \"\\n\"\n\t\t}\n\t\tss := []string{fmt.Sprintf(\" Types that are assignable to %s:\\n\", oneof.GoName)}\n\t\tfor _, field := range oneof.Fields {\n\t\t\tss = append(ss, \"\\t*\"+field.GoIdent.GoName+\"\\n\")\n\t\t}\n\t\tleadingComments += protogen.Comments(strings.Join(ss, \"\"))\n\t\tg.P(leadingComments,\n\t\t\toneof.GoName, \" \", oneofInterfaceName(oneof), tags)\n\t\tsf.append(oneof.GoName)\n\t\treturn\n\t}\n\tgoType, pointer := fieldGoType(g, f, field)\n\tif pointer {\n\t\tgoType = \"*\" + goType\n\t}\n\ttags := structTags{\n\t\t{\"protobuf\", fieldProtobufTagValue(field)},\n\t\t{\"json\", fieldJSONTagValue(field)},\n\t}\n\tif field.Desc.IsMap() {\n\t\tkey := field.Message.Fields[0]\n\t\tval := field.Message.Fields[1]\n\t\ttags = append(tags, structTags{\n\t\t\t{\"protobuf_key\", fieldProtobufTagValue(key)},\n\t\t\t{\"protobuf_val\", fieldProtobufTagValue(val)},\n\t\t}...)\n\t}\n\tif m.isTracked {\n\t\ttags = append(tags, gotrackTags...)\n\t}\n\n\tname := field.GoName\n\tif field.Desc.IsWeak() {\n\t\tname = genid.WeakFieldPrefix_goname + name\n\t}\n\tg.Annotate(m.GoIdent.GoName+\".\"+name, field.Location)\n\tleadingComments := appendDeprecationSuffix(field.Comments.Leading,\n\t\tfield.Desc.Options().(*descriptorpb.FieldOptions).GetDeprecated())\n\tg.P(leadingComments,\n\t\tname, \" \", goType, tags,\n\t\ttrailingComment(field.Comments.Trailing))\n\tsf.append(field.GoName)\n}\n\n// genMessageDefaultDecls generates consts and vars holding the default\n// values of fields.\nfunc genMessageDefaultDecls(g *protogen.GeneratedFile, f *fileInfo, m *messageInfo) {\n\tvar consts, vars []string\n\tfor _, field := range m.Fields {\n\t\tif !field.Desc.HasDefault() {\n\t\t\tcontinue\n\t\t}\n\t\tname := \"Default_\" + m.GoIdent.GoName + \"_\" + field.GoName\n\t\tgoType, _ := fieldGoType(g, f, field)\n\t\tdefVal := field.Desc.Default()\n\t\tswitch field.Desc.Kind() {\n\t\tcase protoreflect.StringKind:\n\t\t\tconsts = append(consts, fmt.Sprintf(\"%s = %s(%q)\", name, goType, defVal.String()))\n\t\tcase protoreflect.BytesKind:\n\t\t\tvars = append(vars, fmt.Sprintf(\"%s = %s(%q)\", name, goType, defVal.Bytes()))\n\t\tcase protoreflect.EnumKind:\n\t\t\tidx := field.Desc.DefaultEnumValue().Index()\n\t\t\tval := field.Enum.Values[idx]\n\t\t\tconsts = append(consts, fmt.Sprintf(\"%s = %s\", name, g.QualifiedGoIdent(val.GoIdent)))\n\t\tcase protoreflect.FloatKind, protoreflect.DoubleKind:\n\t\t\tif f := defVal.Float(); math.IsNaN(f) || math.IsInf(f, 0) {\n\t\t\t\tvar fn, arg string\n\t\t\t\tswitch f := defVal.Float(); {\n\t\t\t\tcase math.IsInf(f, -1):\n\t\t\t\t\tfn, arg = g.QualifiedGoIdent(mathPackage.Ident(\"Inf\")), \"-1\"\n\t\t\t\tcase math.IsInf(f, +1):\n\t\t\t\t\tfn, arg = g.QualifiedGoIdent(mathPackage.Ident(\"Inf\")), \"+1\"\n\t\t\t\tcase math.IsNaN(f):\n\t\t\t\t\tfn, arg = g.QualifiedGoIdent(mathPackage.Ident(\"NaN\")), \"\"\n\t\t\t\t}\n\t\t\t\tvars = append(vars, fmt.Sprintf(\"%s = %s(%s(%s))\", name, goType, fn, arg))\n\t\t\t} else {\n\t\t\t\tconsts = append(consts, fmt.Sprintf(\"%s = %s(%v)\", name, goType, f))\n\t\t\t}\n\t\tdefault:\n\t\t\tconsts = append(consts, fmt.Sprintf(\"%s = %s(%v)\", name, goType, defVal.Interface()))\n\t\t}\n\t}\n\tif len(consts) > 0 {\n\t\tg.P(\"// Default values for \", m.GoIdent, \" fields.\")\n\t\tg.P(\"const (\")\n\t\tfor _, s := range consts {\n\t\t\tg.P(s)\n\t\t}\n\t\tg.P(\")\")\n\t}\n\tif len(vars) > 0 {\n\t\tg.P(\"// Default values for \", m.GoIdent, \" fields.\")\n\t\tg.P(\"var (\")\n\t\tfor _, s := range vars {\n\t\t\tg.P(s)\n\t\t}\n\t\tg.P(\")\")\n\t}\n\tg.P()\n}\n\nfunc genMessageMethods(g *protogen.GeneratedFile, f *fileInfo, m *messageInfo) {\n\tgenMessageBaseMethods(g, f, m)\n\tgenMessageGetterMethods(g, f, m)\n\tgenMessageSetterMethods(g, f, m)\n}\n\nfunc genMessageBaseMethods(g *protogen.GeneratedFile, f *fileInfo, m *messageInfo) {\n\t// Reset method.\n\tg.P(\"func (x *\", m.GoIdent, \") Reset() {\")\n\tg.P(\"*x = \", m.GoIdent, \"{}\")\n\tg.P(\"if \", protoimplPackage.Ident(\"UnsafeEnabled\"), \" {\")\n\tg.P(\"mi := &\", messageTypesVarName(f), \"[\", f.allMessagesByPtr[m], \"]\")\n\tg.P(\"ms := \", protoimplPackage.Ident(\"X\"), \".MessageStateOf(\", protoimplPackage.Ident(\"Pointer\"), \"(x))\")\n\tg.P(\"ms.StoreMessageInfo(mi)\")\n\tg.P(\"}\")\n\tg.P(\"}\")\n\tg.P()\n\n\t// String method.\n\tg.P(\"func (x *\", m.GoIdent, \") String() string {\")\n\tg.P(\"return \", protoimplPackage.Ident(\"X\"), \".MessageStringOf(x)\")\n\tg.P(\"}\")\n\tg.P()\n\n\t// ProtoMessage method.\n\tg.P(\"func (*\", m.GoIdent, \") ProtoMessage() {}\")\n\tg.P()\n\n\t// ProtoReflect method.\n\tgenMessageReflectMethods(g, f, m)\n\n\t// Descriptor method.\n\tif m.genRawDescMethod {\n\t\tvar indexes []string\n\t\tfor i := 1; i < len(m.Location.Path); i += 2 {\n\t\t\tindexes = append(indexes, strconv.Itoa(int(m.Location.Path[i])))\n\t\t}\n\t\tg.P(\"// Deprecated: Use \", m.GoIdent, \".ProtoReflect.Descriptor instead.\")\n\t\tg.P(\"func (*\", m.GoIdent, \") Descriptor() ([]byte, []int) {\")\n\t\tg.P(\"return \", rawDescVarName(f), \"GZIP(), []int{\", strings.Join(indexes, \",\"), \"}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t\tf.needRawDesc = true\n\t}\n}\n\nfunc genMessageGetterMethods(g *protogen.GeneratedFile, f *fileInfo, m *messageInfo) {\n\tfor _, field := range m.Fields {\n\t\tgenNoInterfacePragma(g, m.isTracked)\n\n\t\t// Getter for parent oneof.\n\t\tif oneof := field.Oneof; oneof != nil && oneof.Fields[0] == field && !oneof.Desc.IsSynthetic() {\n\t\t\tg.Annotate(m.GoIdent.GoName+\".Get\"+oneof.GoName, oneof.Location)\n\t\t\tg.P(\"func (m *\", m.GoIdent.GoName, \") Get\", oneof.GoName, \"() \", oneofInterfaceName(oneof), \" {\")\n\t\t\tg.P(\"if m != nil {\")\n\t\t\tg.P(\"return m.\", oneof.GoName)\n\t\t\tg.P(\"}\")\n\t\t\tg.P(\"return nil\")\n\t\t\tg.P(\"}\")\n\t\t\tg.P()\n\t\t}\n\n\t\t// Getter for message field.\n\t\tgoType, pointer := fieldGoType(g, f, field)\n\t\tdefaultValue := fieldDefaultValue(g, m, field)\n\t\tg.Annotate(m.GoIdent.GoName+\".Get\"+field.GoName, field.Location)\n\t\tleadingComments := appendDeprecationSuffix(\"\",\n\t\t\tfield.Desc.Options().(*descriptorpb.FieldOptions).GetDeprecated())\n\t\tswitch {\n\t\tcase field.Desc.IsWeak():\n\t\t\tg.P(leadingComments, \"func (x *\", m.GoIdent, \") Get\", field.GoName, \"() \", protoPackage.Ident(\"Message\"), \"{\")\n\t\t\tg.P(\"var w \", protoimplPackage.Ident(\"WeakFields\"))\n\t\t\tg.P(\"if x != nil {\")\n\t\t\tg.P(\"w = x.\", genid.WeakFields_goname)\n\t\t\tif m.isTracked {\n\t\t\t\tg.P(\"_ = x.\", genid.WeakFieldPrefix_goname+field.GoName)\n\t\t\t}\n\t\t\tg.P(\"}\")\n\t\t\tg.P(\"return \", protoimplPackage.Ident(\"X\"), \".GetWeak(w, \", field.Desc.Number(), \", \", strconv.Quote(string(field.Message.Desc.FullName())), \")\")\n\t\t\tg.P(\"}\")\n\t\tcase field.Oneof != nil && !field.Oneof.Desc.IsSynthetic():\n\t\t\tg.P(leadingComments, \"func (x *\", m.GoIdent, \") Get\", field.GoName, \"() \", goType, \" {\")\n\t\t\tg.P(\"if x, ok := x.Get\", field.Oneof.GoName, \"().(*\", field.GoIdent, \"); ok {\")\n\t\t\tg.P(\"return x.\", field.GoName)\n\t\t\tg.P(\"}\")\n\t\t\tg.P(\"return \", defaultValue)\n\t\t\tg.P(\"}\")\n\t\tdefault:\n\t\t\tg.P(leadingComments, \"func (x *\", m.GoIdent, \") Get\", field.GoName, \"() \", goType, \" {\")\n\t\t\tif !field.Desc.HasPresence() || defaultValue == \"nil\" {\n\t\t\t\tg.P(\"if x != nil {\")\n\t\t\t} else {\n\t\t\t\tg.P(\"if x != nil && x.\", field.GoName, \" != nil {\")\n\t\t\t}\n\t\t\tstar := \"\"\n\t\t\tif pointer {\n\t\t\t\tstar = \"*\"\n\t\t\t}\n\t\t\tg.P(\"return \", star, \" x.\", field.GoName)\n\t\t\tg.P(\"}\")\n\t\t\tg.P(\"return \", defaultValue)\n\t\t\tg.P(\"}\")\n\t\t}\n\t\tg.P()\n\t}\n}\n\nfunc genMessageSetterMethods(g *protogen.GeneratedFile, f *fileInfo, m *messageInfo) {\n\tfor _, field := range m.Fields {\n\t\tif !field.Desc.IsWeak() {\n\t\t\tcontinue\n\t\t}\n\n\t\tgenNoInterfacePragma(g, m.isTracked)\n\n\t\tg.Annotate(m.GoIdent.GoName+\".Set\"+field.GoName, field.Location)\n\t\tleadingComments := appendDeprecationSuffix(\"\",\n\t\t\tfield.Desc.Options().(*descriptorpb.FieldOptions).GetDeprecated())\n\t\tg.P(leadingComments, \"func (x *\", m.GoIdent, \") Set\", field.GoName, \"(v \", protoPackage.Ident(\"Message\"), \") {\")\n\t\tg.P(\"var w *\", protoimplPackage.Ident(\"WeakFields\"))\n\t\tg.P(\"if x != nil {\")\n\t\tg.P(\"w = &x.\", genid.WeakFields_goname)\n\t\tif m.isTracked {\n\t\t\tg.P(\"_ = x.\", genid.WeakFieldPrefix_goname+field.GoName)\n\t\t}\n\t\tg.P(\"}\")\n\t\tg.P(protoimplPackage.Ident(\"X\"), \".SetWeak(w, \", field.Desc.Number(), \", \", strconv.Quote(string(field.Message.Desc.FullName())), \", v)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n}\n\n// fieldGoType returns the Go type used for a field.\n//\n// If it returns pointer=true, the struct field is a pointer to the type.\nfunc fieldGoType(g *protogen.GeneratedFile, f *fileInfo, field *protogen.Field) (goType string, pointer bool) {\n\tif field.Desc.IsWeak() {\n\t\treturn \"struct{}\", false\n\t}\n\n\tpointer = field.Desc.HasPresence()\n\tswitch field.Desc.Kind() {\n\tcase protoreflect.BoolKind:\n\t\tgoType = \"bool\"\n\tcase protoreflect.EnumKind:\n\t\tgoType = g.QualifiedGoIdent(field.Enum.GoIdent)\n\tcase protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:\n\t\tgoType = \"int32\"\n\tcase protoreflect.Uint32Kind, protoreflect.Fixed32Kind:\n\t\tgoType = \"uint32\"\n\tcase protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:\n\t\tgoType = \"int64\"\n\tcase protoreflect.Uint64Kind, protoreflect.Fixed64Kind:\n\t\tgoType = \"uint64\"\n\tcase protoreflect.FloatKind:\n\t\tgoType = \"float32\"\n\tcase protoreflect.DoubleKind:\n\t\tgoType = \"float64\"\n\tcase protoreflect.StringKind:\n\t\tgoType = \"string\"\n\tcase protoreflect.BytesKind:\n\t\tgoType = \"[]byte\"\n\t\tpointer = false // rely on nullability of slices for presence\n\tcase protoreflect.MessageKind, protoreflect.GroupKind:\n\t\tgoType = \"*\" + g.QualifiedGoIdent(field.Message.GoIdent)\n\t\tpointer = false // pointer captured as part of the type\n\t}\n\tswitch {\n\tcase field.Desc.IsList():\n\t\treturn \"[]\" + goType, false\n\tcase field.Desc.IsMap():\n\t\tkeyType, _ := fieldGoType(g, f, field.Message.Fields[0])\n\t\tvalType, _ := fieldGoType(g, f, field.Message.Fields[1])\n\t\treturn fmt.Sprintf(\"map[%v]%v\", keyType, valType), false\n\t}\n\treturn goType, pointer\n}\n\nfunc fieldProtobufTagValue(field *protogen.Field) string {\n\tvar enumName string\n\tif field.Desc.Kind() == protoreflect.EnumKind {\n\t\tenumName = protoimpl.X.LegacyEnumName(field.Enum.Desc)\n\t}\n\treturn tag.Marshal(field.Desc, enumName)\n}\n\nfunc fieldDefaultValue(g *protogen.GeneratedFile, m *messageInfo, field *protogen.Field) string {\n\tif field.Desc.IsList() {\n\t\treturn \"nil\"\n\t}\n\tif field.Desc.HasDefault() {\n\t\tdefVarName := \"Default_\" + m.GoIdent.GoName + \"_\" + field.GoName\n\t\tif field.Desc.Kind() == protoreflect.BytesKind {\n\t\t\treturn \"append([]byte(nil), \" + defVarName + \"...)\"\n\t\t}\n\t\treturn defVarName\n\t}\n\tswitch field.Desc.Kind() {\n\tcase protoreflect.BoolKind:\n\t\treturn \"false\"\n\tcase protoreflect.StringKind:\n\t\treturn `\"\"`\n\tcase protoreflect.MessageKind, protoreflect.GroupKind, protoreflect.BytesKind:\n\t\treturn \"nil\"\n\tcase protoreflect.EnumKind:\n\t\treturn g.QualifiedGoIdent(field.Enum.Values[0].GoIdent)\n\tdefault:\n\t\treturn \"0\"\n\t}\n}\n\nfunc fieldJSONTagValue(field *protogen.Field) string {\n\treturn string(field.Desc.Name()) + \",omitempty\"\n}\n\nfunc genExtensions(g *protogen.GeneratedFile, f *fileInfo) {\n\tif len(f.allExtensions) == 0 {\n\t\treturn\n\t}\n\n\tg.P(\"var \", extensionTypesVarName(f), \" = []\", protoimplPackage.Ident(\"ExtensionInfo\"), \"{\")\n\tfor _, x := range f.allExtensions {\n\t\tg.P(\"{\")\n\t\tg.P(\"ExtendedType: (*\", x.Extendee.GoIdent, \")(nil),\")\n\t\tgoType, pointer := fieldGoType(g, f, x.Extension)\n\t\tif pointer {\n\t\t\tgoType = \"*\" + goType\n\t\t}\n\t\tg.P(\"ExtensionType: (\", goType, \")(nil),\")\n\t\tg.P(\"Field: \", x.Desc.Number(), \",\")\n\t\tg.P(\"Name: \", strconv.Quote(string(x.Desc.FullName())), \",\")\n\t\tg.P(\"Tag: \", strconv.Quote(fieldProtobufTagValue(x.Extension)), \",\")\n\t\tg.P(\"Filename: \", strconv.Quote(f.Desc.Path()), \",\")\n\t\tg.P(\"},\")\n\t}\n\tg.P(\"}\")\n\tg.P()\n\n\t// Group extensions by the target message.\n\tvar orderedTargets []protogen.GoIdent\n\tallExtensionsByTarget := make(map[protogen.GoIdent][]*extensionInfo)\n\tallExtensionsByPtr := make(map[*extensionInfo]int)\n\tfor i, x := range f.allExtensions {\n\t\ttarget := x.Extendee.GoIdent\n\t\tif len(allExtensionsByTarget[target]) == 0 {\n\t\t\torderedTargets = append(orderedTargets, target)\n\t\t}\n\t\tallExtensionsByTarget[target] = append(allExtensionsByTarget[target], x)\n\t\tallExtensionsByPtr[x] = i\n\t}\n\tfor _, target := range orderedTargets {\n\t\tg.P(\"// Extension fields to \", target, \".\")\n\t\tg.P(\"var (\")\n\t\tfor _, x := range allExtensionsByTarget[target] {\n\t\t\txd := x.Desc\n\t\t\ttypeName := xd.Kind().String()\n\t\t\tswitch xd.Kind() {\n\t\t\tcase protoreflect.EnumKind:\n\t\t\t\ttypeName = string(xd.Enum().FullName())\n\t\t\tcase protoreflect.MessageKind, protoreflect.GroupKind:\n\t\t\t\ttypeName = string(xd.Message().FullName())\n\t\t\t}\n\t\t\tfieldName := string(xd.Name())\n\n\t\t\tleadingComments := x.Comments.Leading\n\t\t\tif leadingComments != \"\" {\n\t\t\t\tleadingComments += \"\\n\"\n\t\t\t}\n\t\t\tleadingComments += protogen.Comments(fmt.Sprintf(\" %v %v %v = %v;\\n\",\n\t\t\t\txd.Cardinality(), typeName, fieldName, xd.Number()))\n\t\t\tleadingComments = appendDeprecationSuffix(leadingComments,\n\t\t\t\tx.Desc.Options().(*descriptorpb.FieldOptions).GetDeprecated())\n\t\t\tg.P(leadingComments,\n\t\t\t\t\"E_\", x.GoIdent, \" = &\", extensionTypesVarName(f), \"[\", allExtensionsByPtr[x], \"]\",\n\t\t\t\ttrailingComment(x.Comments.Trailing))\n\t\t}\n\t\tg.P(\")\")\n\t\tg.P()\n\t}\n}\n\n// genMessageOneofWrapperTypes generates the oneof wrapper types and\n// associates the types with the parent message type.\nfunc genMessageOneofWrapperTypes(g *protogen.GeneratedFile, f *fileInfo, m *messageInfo) {\n\tfor _, oneof := range m.Oneofs {\n\t\tif oneof.Desc.IsSynthetic() {\n\t\t\tcontinue\n\t\t}\n\t\tifName := oneofInterfaceName(oneof)\n\t\tg.P(\"type \", ifName, \" interface {\")\n\t\tg.P(ifName, \"()\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t\tfor _, field := range oneof.Fields {\n\t\t\tg.Annotate(field.GoIdent.GoName, field.Location)\n\t\t\tg.Annotate(field.GoIdent.GoName+\".\"+field.GoName, field.Location)\n\t\t\tg.P(\"type \", field.GoIdent, \" struct {\")\n\t\t\tgoType, _ := fieldGoType(g, f, field)\n\t\t\ttags := structTags{\n\t\t\t\t{\"protobuf\", fieldProtobufTagValue(field)},\n\t\t\t}\n\t\t\tif m.isTracked {\n\t\t\t\ttags = append(tags, gotrackTags...)\n\t\t\t}\n\t\t\tleadingComments := appendDeprecationSuffix(field.Comments.Leading,\n\t\t\t\tfield.Desc.Options().(*descriptorpb.FieldOptions).GetDeprecated())\n\t\t\tg.P(leadingComments,\n\t\t\t\tfield.GoName, \" \", goType, tags,\n\t\t\t\ttrailingComment(field.Comments.Trailing))\n\t\t\tg.P(\"}\")\n\t\t\tg.P()\n\t\t}\n\t\tfor _, field := range oneof.Fields {\n\t\t\tg.P(\"func (*\", field.GoIdent, \") \", ifName, \"() {}\")\n\t\t\tg.P()\n\t\t}\n\t}\n}\n\n// oneofInterfaceName returns the name of the interface type implemented by\n// the oneof field value types.\nfunc oneofInterfaceName(oneof *protogen.Oneof) string {\n\treturn \"is\" + oneof.GoIdent.GoName\n}\n\n// genNoInterfacePragma generates a standalone \"nointerface\" pragma to\n// decorate methods with field-tracking support.\nfunc genNoInterfacePragma(g *protogen.GeneratedFile, tracked bool) {\n\tif tracked {\n\t\tg.P(\"//go:nointerface\")\n\t\tg.P()\n\t}\n}\n\nvar gotrackTags = structTags{{\"go\", \"track\"}}\n\n// structTags is a data structure for build idiomatic Go struct tags.\n// Each [2]string is a key-value pair, where value is the unescaped string.\n//\n// Example: structTags{{\"key\", \"value\"}}.String() -> `key:\"value\"`\ntype structTags [][2]string\n\nfunc (tags structTags) String() string {\n\tif len(tags) == 0 {\n\t\treturn \"\"\n\t}\n\tvar ss []string\n\tfor _, tag := range tags {\n\t\t// NOTE: When quoting the value, we need to make sure the backtick\n\t\t// character does not appear. Convert all cases to the escaped hex form.\n\t\tkey := tag[0]\n\t\tval := strings.Replace(strconv.Quote(tag[1]), \"`\", `\\x60`, -1)\n\t\tss = append(ss, fmt.Sprintf(\"%s:%s\", key, val))\n\t}\n\treturn \"`\" + strings.Join(ss, \" \") + \"`\"\n}\n\n// appendDeprecationSuffix optionally appends a deprecation notice as a suffix.\nfunc appendDeprecationSuffix(prefix protogen.Comments, deprecated bool) protogen.Comments {\n\tif !deprecated {\n\t\treturn prefix\n\t}\n\tif prefix != \"\" {\n\t\tprefix += \"\\n\"\n\t}\n\treturn prefix + \" Deprecated: Do not use.\\n\"\n}\n\n// trailingComment is like protogen.Comments, but lacks a trailing newline.\ntype trailingComment protogen.Comments\n\nfunc (c trailingComment) String() string {\n\ts := strings.TrimSuffix(protogen.Comments(c).String(), \"\\n\")\n\tif strings.Contains(s, \"\\n\") {\n\t\t// We don't support multi-lined trailing comments as it is unclear\n\t\t// how to best render them in the generated code.\n\t\treturn \"\"\n\t}\n\treturn s\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo/reflect.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 internal_gengo\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\t\"strings\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/compiler/protogen\"\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\n\t\"google.golang.org/protobuf/types/descriptorpb\"\n)\n\nfunc genReflectFileDescriptor(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo) {\n\tg.P(\"var \", f.GoDescriptorIdent, \" \", protoreflectPackage.Ident(\"FileDescriptor\"))\n\tg.P()\n\n\tgenFileDescriptor(gen, g, f)\n\tif len(f.allEnums) > 0 {\n\t\tg.P(\"var \", enumTypesVarName(f), \" = make([]\", protoimplPackage.Ident(\"EnumInfo\"), \",\", len(f.allEnums), \")\")\n\t}\n\tif len(f.allMessages) > 0 {\n\t\tg.P(\"var \", messageTypesVarName(f), \" = make([]\", protoimplPackage.Ident(\"MessageInfo\"), \",\", len(f.allMessages), \")\")\n\t}\n\n\t// Generate a unique list of Go types for all declarations and dependencies,\n\t// and the associated index into the type list for all dependencies.\n\tvar goTypes []string\n\tvar depIdxs []string\n\tseen := map[protoreflect.FullName]int{}\n\tgenDep := func(name protoreflect.FullName, depSource string) {\n\t\tif depSource != \"\" {\n\t\t\tline := fmt.Sprintf(\"%d, // %d: %s -> %s\", seen[name], len(depIdxs), depSource, name)\n\t\t\tdepIdxs = append(depIdxs, line)\n\t\t}\n\t}\n\tgenEnum := func(e *protogen.Enum, depSource string) {\n\t\tif e != nil {\n\t\t\tname := e.Desc.FullName()\n\t\t\tif _, ok := seen[name]; !ok {\n\t\t\t\tline := fmt.Sprintf(\"(%s)(0), // %d: %s\", g.QualifiedGoIdent(e.GoIdent), len(goTypes), name)\n\t\t\t\tgoTypes = append(goTypes, line)\n\t\t\t\tseen[name] = len(seen)\n\t\t\t}\n\t\t\tif depSource != \"\" {\n\t\t\t\tgenDep(name, depSource)\n\t\t\t}\n\t\t}\n\t}\n\tgenMessage := func(m *protogen.Message, depSource string) {\n\t\tif m != nil {\n\t\t\tname := m.Desc.FullName()\n\t\t\tif _, ok := seen[name]; !ok {\n\t\t\t\tline := fmt.Sprintf(\"(*%s)(nil), // %d: %s\", g.QualifiedGoIdent(m.GoIdent), len(goTypes), name)\n\t\t\t\tif m.Desc.IsMapEntry() {\n\t\t\t\t\t// Map entry messages have no associated Go type.\n\t\t\t\t\tline = fmt.Sprintf(\"nil, // %d: %s\", len(goTypes), name)\n\t\t\t\t}\n\t\t\t\tgoTypes = append(goTypes, line)\n\t\t\t\tseen[name] = len(seen)\n\t\t\t}\n\t\t\tif depSource != \"\" {\n\t\t\t\tgenDep(name, depSource)\n\t\t\t}\n\t\t}\n\t}\n\n\t// This ordering is significant.\n\t// See filetype.TypeBuilder.DependencyIndexes.\n\ttype offsetEntry struct {\n\t\tstart int\n\t\tname  string\n\t}\n\tvar depOffsets []offsetEntry\n\tfor _, enum := range f.allEnums {\n\t\tgenEnum(enum.Enum, \"\")\n\t}\n\tfor _, message := range f.allMessages {\n\t\tgenMessage(message.Message, \"\")\n\t}\n\tdepOffsets = append(depOffsets, offsetEntry{len(depIdxs), \"field type_name\"})\n\tfor _, message := range f.allMessages {\n\t\tfor _, field := range message.Fields {\n\t\t\tif field.Desc.IsWeak() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tsource := string(field.Desc.FullName())\n\t\t\tgenEnum(field.Enum, source+\":type_name\")\n\t\t\tgenMessage(field.Message, source+\":type_name\")\n\t\t}\n\t}\n\tdepOffsets = append(depOffsets, offsetEntry{len(depIdxs), \"extension extendee\"})\n\tfor _, extension := range f.allExtensions {\n\t\tsource := string(extension.Desc.FullName())\n\t\tgenMessage(extension.Extendee, source+\":extendee\")\n\t}\n\tdepOffsets = append(depOffsets, offsetEntry{len(depIdxs), \"extension type_name\"})\n\tfor _, extension := range f.allExtensions {\n\t\tsource := string(extension.Desc.FullName())\n\t\tgenEnum(extension.Enum, source+\":type_name\")\n\t\tgenMessage(extension.Message, source+\":type_name\")\n\t}\n\tdepOffsets = append(depOffsets, offsetEntry{len(depIdxs), \"method input_type\"})\n\tfor _, service := range f.Services {\n\t\tfor _, method := range service.Methods {\n\t\t\tsource := string(method.Desc.FullName())\n\t\t\tgenMessage(method.Input, source+\":input_type\")\n\t\t}\n\t}\n\tdepOffsets = append(depOffsets, offsetEntry{len(depIdxs), \"method output_type\"})\n\tfor _, service := range f.Services {\n\t\tfor _, method := range service.Methods {\n\t\t\tsource := string(method.Desc.FullName())\n\t\t\tgenMessage(method.Output, source+\":output_type\")\n\t\t}\n\t}\n\tdepOffsets = append(depOffsets, offsetEntry{len(depIdxs), \"\"})\n\tfor i := len(depOffsets) - 2; i >= 0; i-- {\n\t\tcurr, next := depOffsets[i], depOffsets[i+1]\n\t\tdepIdxs = append(depIdxs, fmt.Sprintf(\"%d, // [%d:%d] is the sub-list for %s\",\n\t\t\tcurr.start, curr.start, next.start, curr.name))\n\t}\n\tif len(depIdxs) > math.MaxInt32 {\n\t\tpanic(\"too many dependencies\") // sanity check\n\t}\n\n\tg.P(\"var \", goTypesVarName(f), \" = []interface{}{\")\n\tfor _, s := range goTypes {\n\t\tg.P(s)\n\t}\n\tg.P(\"}\")\n\n\tg.P(\"var \", depIdxsVarName(f), \" = []int32{\")\n\tfor _, s := range depIdxs {\n\t\tg.P(s)\n\t}\n\tg.P(\"}\")\n\n\tg.P(\"func init() { \", initFuncName(f.File), \"() }\")\n\n\tg.P(\"func \", initFuncName(f.File), \"() {\")\n\tg.P(\"if \", f.GoDescriptorIdent, \" != nil {\")\n\tg.P(\"return\")\n\tg.P(\"}\")\n\n\t// Ensure that initialization functions for different files in the same Go\n\t// package run in the correct order: Call the init funcs for every .proto file\n\t// imported by this one that is in the same Go package.\n\tfor i, imps := 0, f.Desc.Imports(); i < imps.Len(); i++ {\n\t\timpFile := gen.FilesByPath[imps.Get(i).Path()]\n\t\tif impFile.GoImportPath != f.GoImportPath {\n\t\t\tcontinue\n\t\t}\n\t\tg.P(initFuncName(impFile), \"()\")\n\t}\n\n\tif len(f.allMessages) > 0 {\n\t\t// Populate MessageInfo.Exporters.\n\t\tg.P(\"if !\", protoimplPackage.Ident(\"UnsafeEnabled\"), \" {\")\n\t\tfor _, message := range f.allMessages {\n\t\t\tif sf := f.allMessageFieldsByPtr[message]; len(sf.unexported) > 0 {\n\t\t\t\tidx := f.allMessagesByPtr[message]\n\t\t\t\ttypesVar := messageTypesVarName(f)\n\n\t\t\t\tg.P(typesVar, \"[\", idx, \"].Exporter = func(v interface{}, i int) interface{} {\")\n\t\t\t\tg.P(\"switch v := v.(*\", message.GoIdent, \"); i {\")\n\t\t\t\tfor i := 0; i < sf.count; i++ {\n\t\t\t\t\tif name := sf.unexported[i]; name != \"\" {\n\t\t\t\t\t\tg.P(\"case \", i, \": return &v.\", name)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tg.P(\"default: return nil\")\n\t\t\t\tg.P(\"}\")\n\t\t\t\tg.P(\"}\")\n\t\t\t}\n\t\t}\n\t\tg.P(\"}\")\n\n\t\t// Populate MessageInfo.OneofWrappers.\n\t\tfor _, message := range f.allMessages {\n\t\t\tif len(message.Oneofs) > 0 {\n\t\t\t\tidx := f.allMessagesByPtr[message]\n\t\t\t\ttypesVar := messageTypesVarName(f)\n\n\t\t\t\t// Associate the wrapper types by directly passing them to the MessageInfo.\n\t\t\t\tg.P(typesVar, \"[\", idx, \"].OneofWrappers = []interface{} {\")\n\t\t\t\tfor _, oneof := range message.Oneofs {\n\t\t\t\t\tif !oneof.Desc.IsSynthetic() {\n\t\t\t\t\t\tfor _, field := range oneof.Fields {\n\t\t\t\t\t\t\tg.P(\"(*\", field.GoIdent, \")(nil),\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tg.P(\"}\")\n\t\t\t}\n\t\t}\n\t}\n\n\tg.P(\"type x struct{}\")\n\tg.P(\"out := \", protoimplPackage.Ident(\"TypeBuilder\"), \"{\")\n\tg.P(\"File: \", protoimplPackage.Ident(\"DescBuilder\"), \"{\")\n\tg.P(\"GoPackagePath: \", reflectPackage.Ident(\"TypeOf\"), \"(x{}).PkgPath(),\")\n\tg.P(\"RawDescriptor: \", rawDescVarName(f), \",\")\n\tg.P(\"NumEnums: \", len(f.allEnums), \",\")\n\tg.P(\"NumMessages: \", len(f.allMessages), \",\")\n\tg.P(\"NumExtensions: \", len(f.allExtensions), \",\")\n\tg.P(\"NumServices: \", len(f.Services), \",\")\n\tg.P(\"},\")\n\tg.P(\"GoTypes: \", goTypesVarName(f), \",\")\n\tg.P(\"DependencyIndexes: \", depIdxsVarName(f), \",\")\n\tif len(f.allEnums) > 0 {\n\t\tg.P(\"EnumInfos: \", enumTypesVarName(f), \",\")\n\t}\n\tif len(f.allMessages) > 0 {\n\t\tg.P(\"MessageInfos: \", messageTypesVarName(f), \",\")\n\t}\n\tif len(f.allExtensions) > 0 {\n\t\tg.P(\"ExtensionInfos: \", extensionTypesVarName(f), \",\")\n\t}\n\tg.P(\"}.Build()\")\n\tg.P(f.GoDescriptorIdent, \" = out.File\")\n\n\t// Set inputs to nil to allow GC to reclaim resources.\n\tg.P(rawDescVarName(f), \" = nil\")\n\tg.P(goTypesVarName(f), \" = nil\")\n\tg.P(depIdxsVarName(f), \" = nil\")\n\tg.P(\"}\")\n}\n\nfunc genFileDescriptor(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo) {\n\tdescProto := proto.Clone(f.Proto).(*descriptorpb.FileDescriptorProto)\n\tdescProto.SourceCodeInfo = nil // drop source code information\n\n\tb, err := proto.MarshalOptions{AllowPartial: true, Deterministic: true}.Marshal(descProto)\n\tif err != nil {\n\t\tgen.Error(err)\n\t\treturn\n\t}\n\n\tg.P(\"var \", rawDescVarName(f), \" = []byte{\")\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\tg.P()\n\n\tif f.needRawDesc {\n\t\tonceVar := rawDescVarName(f) + \"Once\"\n\t\tdataVar := rawDescVarName(f) + \"Data\"\n\t\tg.P(\"var (\")\n\t\tg.P(onceVar, \" \", syncPackage.Ident(\"Once\"))\n\t\tg.P(dataVar, \" = \", rawDescVarName(f))\n\t\tg.P(\")\")\n\t\tg.P()\n\n\t\tg.P(\"func \", rawDescVarName(f), \"GZIP() []byte {\")\n\t\tg.P(onceVar, \".Do(func() {\")\n\t\tg.P(dataVar, \" = \", protoimplPackage.Ident(\"X\"), \".CompressGZIP(\", dataVar, \")\")\n\t\tg.P(\"})\")\n\t\tg.P(\"return \", dataVar)\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n}\n\nfunc genEnumReflectMethods(g *protogen.GeneratedFile, f *fileInfo, e *enumInfo) {\n\tidx := f.allEnumsByPtr[e]\n\ttypesVar := enumTypesVarName(f)\n\n\t// Descriptor method.\n\tg.P(\"func (\", e.GoIdent, \") Descriptor() \", protoreflectPackage.Ident(\"EnumDescriptor\"), \" {\")\n\tg.P(\"return \", typesVar, \"[\", idx, \"].Descriptor()\")\n\tg.P(\"}\")\n\tg.P()\n\n\t// Type method.\n\tg.P(\"func (\", e.GoIdent, \") Type() \", protoreflectPackage.Ident(\"EnumType\"), \" {\")\n\tg.P(\"return &\", typesVar, \"[\", idx, \"]\")\n\tg.P(\"}\")\n\tg.P()\n\n\t// Number method.\n\tg.P(\"func (x \", e.GoIdent, \") Number() \", protoreflectPackage.Ident(\"EnumNumber\"), \" {\")\n\tg.P(\"return \", protoreflectPackage.Ident(\"EnumNumber\"), \"(x)\")\n\tg.P(\"}\")\n\tg.P()\n}\n\nfunc genMessageReflectMethods(g *protogen.GeneratedFile, f *fileInfo, m *messageInfo) {\n\tidx := f.allMessagesByPtr[m]\n\ttypesVar := messageTypesVarName(f)\n\n\t// ProtoReflect method.\n\tg.P(\"func (x *\", m.GoIdent, \") ProtoReflect() \", protoreflectPackage.Ident(\"Message\"), \" {\")\n\tg.P(\"mi := &\", typesVar, \"[\", idx, \"]\")\n\tg.P(\"if \", protoimplPackage.Ident(\"UnsafeEnabled\"), \" && x != nil {\")\n\tg.P(\"ms := \", protoimplPackage.Ident(\"X\"), \".MessageStateOf(\", protoimplPackage.Ident(\"Pointer\"), \"(x))\")\n\tg.P(\"if ms.LoadMessageInfo() == nil {\")\n\tg.P(\"ms.StoreMessageInfo(mi)\")\n\tg.P(\"}\")\n\tg.P(\"return ms\")\n\tg.P(\"}\")\n\tg.P(\"return mi.MessageOf(x)\")\n\tg.P(\"}\")\n\tg.P()\n}\n\nfunc fileVarName(f *protogen.File, suffix string) string {\n\tprefix := f.GoDescriptorIdent.GoName\n\t_, n := utf8.DecodeRuneInString(prefix)\n\tprefix = strings.ToLower(prefix[:n]) + prefix[n:]\n\treturn prefix + \"_\" + suffix\n}\nfunc rawDescVarName(f *fileInfo) string {\n\treturn fileVarName(f.File, \"rawDesc\")\n}\nfunc goTypesVarName(f *fileInfo) string {\n\treturn fileVarName(f.File, \"goTypes\")\n}\nfunc depIdxsVarName(f *fileInfo) string {\n\treturn fileVarName(f.File, \"depIdxs\")\n}\nfunc enumTypesVarName(f *fileInfo) string {\n\treturn fileVarName(f.File, \"enumTypes\")\n}\nfunc messageTypesVarName(f *fileInfo) string {\n\treturn fileVarName(f.File, \"msgTypes\")\n}\nfunc extensionTypesVarName(f *fileInfo) string {\n\treturn fileVarName(f.File, \"extTypes\")\n}\nfunc initFuncName(f *protogen.File) string {\n\treturn fileVarName(f, \"init\")\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo/well_known_types.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 internal_gengo\n\nimport (\n\t\"strings\"\n\n\t\"google.golang.org/protobuf/compiler/protogen\"\n\t\"google.golang.org/protobuf/internal/genid\"\n)\n\n// Specialized support for well-known types are hard-coded into the generator\n// as opposed to being injected in adjacent .go sources in the generated package\n// in order to support specialized build systems like Bazel that always generate\n// dynamically from the source .proto files.\n\nfunc genPackageKnownComment(f *fileInfo) protogen.Comments {\n\tswitch f.Desc.Path() {\n\tcase genid.File_google_protobuf_any_proto:\n\t\treturn ` Package anypb contains generated types for ` + genid.File_google_protobuf_any_proto + `.\n\n The Any message is a dynamic representation of any other message value.\n It is functionally a tuple of the full name of the remote message type and\n the serialized bytes of the remote message value.\n\n\n Constructing an Any\n\n An Any message containing another message value is constructed using New:\n\n\tany, err := anypb.New(m)\n\tif err != nil {\n\t\t... // handle error\n\t}\n\t... // make use of any\n\n\n Unmarshaling an Any\n\n With a populated Any message, the underlying message can be serialized into\n a remote concrete message value in a few ways.\n\n If the exact concrete type is known, then a new (or pre-existing) instance\n of that message can be passed to the UnmarshalTo method:\n\n\tm := new(foopb.MyMessage)\n\tif err := any.UnmarshalTo(m); err != nil {\n\t\t... // handle error\n\t}\n\t... // make use of m\n\n If the exact concrete type is not known, then the UnmarshalNew method can be\n used to unmarshal the contents into a new instance of the remote message type:\n\n\tm, err := any.UnmarshalNew()\n\tif err != nil {\n\t\t... // handle error\n\t}\n\t... // make use of m\n\n UnmarshalNew uses the global type registry to resolve the message type and\n construct a new instance of that message to unmarshal into. In order for a\n message type to appear in the global registry, the Go type representing that\n protobuf message type must be linked into the Go binary. For messages\n generated by protoc-gen-go, this is achieved through an import of the\n generated Go package representing a .proto file.\n\n A common pattern with UnmarshalNew is to use a type switch with the resulting\n proto.Message value:\n\n\tswitch m := m.(type) {\n\tcase *foopb.MyMessage:\n\t\t... // make use of m as a *foopb.MyMessage\n\tcase *barpb.OtherMessage:\n\t\t... // make use of m as a *barpb.OtherMessage\n\tcase *bazpb.SomeMessage:\n\t\t... // make use of m as a *bazpb.SomeMessage\n\t}\n\n This pattern ensures that the generated packages containing the message types\n listed in the case clauses are linked into the Go binary and therefore also\n registered in the global registry.\n\n\n Type checking an Any\n\n In order to type check whether an Any message represents some other message,\n then use the MessageIs method:\n\n\tif any.MessageIs((*foopb.MyMessage)(nil)) {\n\t\t... // make use of any, knowing that it contains a foopb.MyMessage\n\t}\n\n The MessageIs method can also be used with an allocated instance of the target\n message type if the intention is to unmarshal into it if the type matches:\n\n\tm := new(foopb.MyMessage)\n\tif any.MessageIs(m) {\n\t\tif err := any.UnmarshalTo(m); err != nil {\n\t\t\t... // handle error\n\t\t}\n\t\t... // make use of m\n\t}\n\n`\n\tcase genid.File_google_protobuf_timestamp_proto:\n\t\treturn ` Package timestamppb contains generated types for ` + genid.File_google_protobuf_timestamp_proto + `.\n\n The Timestamp message represents a timestamp,\n an instant in time since the Unix epoch (January 1st, 1970).\n\n\n Conversion to a Go Time\n\n The AsTime method can be used to convert a Timestamp message to a\n standard Go time.Time value in UTC:\n\n\tt := ts.AsTime()\n\t... // make use of t as a time.Time\n\n Converting to a time.Time is a common operation so that the extensive\n set of time-based operations provided by the time package can be leveraged.\n See https://golang.org/pkg/time for more information.\n\n The AsTime method performs the conversion on a best-effort basis. Timestamps\n with denormal values (e.g., nanoseconds beyond 0 and 99999999, inclusive)\n are normalized during the conversion to a time.Time. To manually check for\n invalid Timestamps per the documented limitations in timestamp.proto,\n additionally call the CheckValid method:\n\n\tif err := ts.CheckValid(); err != nil {\n\t\t... // handle error\n\t}\n\n\n Conversion from a Go Time\n\n The timestamppb.New function can be used to construct a Timestamp message\n from a standard Go time.Time value:\n\n\tts := timestamppb.New(t)\n\t... // make use of ts as a *timestamppb.Timestamp\n\n In order to construct a Timestamp representing the current time, use Now:\n\n\tts := timestamppb.Now()\n\t... // make use of ts as a *timestamppb.Timestamp\n\n`\n\tcase genid.File_google_protobuf_duration_proto:\n\t\treturn ` Package durationpb contains generated types for ` + genid.File_google_protobuf_duration_proto + `.\n\n The Duration message represents a signed span of time.\n\n\n Conversion to a Go Duration\n\n The AsDuration method can be used to convert a Duration message to a\n standard Go time.Duration value:\n\n\td := dur.AsDuration()\n\t... // make use of d as a time.Duration\n\n Converting to a time.Duration is a common operation so that the extensive\n set of time-based operations provided by the time package can be leveraged.\n See https://golang.org/pkg/time for more information.\n\n The AsDuration method performs the conversion on a best-effort basis.\n Durations with denormal values (e.g., nanoseconds beyond -99999999 and\n +99999999, inclusive; or seconds and nanoseconds with opposite signs)\n are normalized during the conversion to a time.Duration. To manually check for\n invalid Duration per the documented limitations in duration.proto,\n additionally call the CheckValid method:\n\n\tif err := dur.CheckValid(); err != nil {\n\t\t... // handle error\n\t}\n\n Note that the documented limitations in duration.proto does not protect a\n Duration from overflowing the representable range of a time.Duration in Go.\n The AsDuration method uses saturation arithmetic such that an overflow clamps\n the resulting value to the closest representable value (e.g., math.MaxInt64\n for positive overflow and math.MinInt64 for negative overflow).\n\n\n Conversion from a Go Duration\n\n The durationpb.New function can be used to construct a Duration message\n from a standard Go time.Duration value:\n\n\tdur := durationpb.New(d)\n\t... // make use of d as a *durationpb.Duration\n\n`\n\tcase genid.File_google_protobuf_struct_proto:\n\t\treturn ` Package structpb contains generated types for ` + genid.File_google_protobuf_struct_proto + `.\n\n The messages (i.e., Value, Struct, and ListValue) defined in struct.proto are\n used to represent arbitrary JSON. The Value message represents a JSON value,\n the Struct message represents a JSON object, and the ListValue message\n represents a JSON array. See https://json.org for more information.\n\n The Value, Struct, and ListValue types have generated MarshalJSON and\n UnmarshalJSON methods such that they serialize JSON equivalent to what the\n messages themselves represent. Use of these types with the\n \"google.golang.org/protobuf/encoding/protojson\" package\n ensures that they will be serialized as their JSON equivalent.\n\n\n Conversion to and from a Go interface\n\n The standard Go \"encoding/json\" package has functionality to serialize\n arbitrary types to a large degree. The Value.AsInterface, Struct.AsMap, and\n ListValue.AsSlice methods can convert the protobuf message representation into\n a form represented by interface{}, map[string]interface{}, and []interface{}.\n This form can be used with other packages that operate on such data structures\n and also directly with the standard json package.\n\n In order to convert the interface{}, map[string]interface{}, and []interface{}\n forms back as Value, Struct, and ListValue messages, use the NewStruct,\n NewList, and NewValue constructor functions.\n\n\n Example usage\n\n Consider the following example JSON object:\n\n\t{\n\t\t\"firstName\": \"John\",\n\t\t\"lastName\": \"Smith\",\n\t\t\"isAlive\": true,\n\t\t\"age\": 27,\n\t\t\"address\": {\n\t\t\t\"streetAddress\": \"21 2nd Street\",\n\t\t\t\"city\": \"New York\",\n\t\t\t\"state\": \"NY\",\n\t\t\t\"postalCode\": \"10021-3100\"\n\t\t},\n\t\t\"phoneNumbers\": [\n\t\t\t{\n\t\t\t\t\"type\": \"home\",\n\t\t\t\t\"number\": \"212 555-1234\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"type\": \"office\",\n\t\t\t\t\"number\": \"646 555-4567\"\n\t\t\t}\n\t\t],\n\t\t\"children\": [],\n\t\t\"spouse\": null\n\t}\n\n To construct a Value message representing the above JSON object:\n\n\tm, err := structpb.NewValue(map[string]interface{}{\n\t\t\"firstName\": \"John\",\n\t\t\"lastName\":  \"Smith\",\n\t\t\"isAlive\":   true,\n\t\t\"age\":       27,\n\t\t\"address\": map[string]interface{}{\n\t\t\t\"streetAddress\": \"21 2nd Street\",\n\t\t\t\"city\":          \"New York\",\n\t\t\t\"state\":         \"NY\",\n\t\t\t\"postalCode\":    \"10021-3100\",\n\t\t},\n\t\t\"phoneNumbers\": []interface{}{\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"type\":   \"home\",\n\t\t\t\t\"number\": \"212 555-1234\",\n\t\t\t},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"type\":   \"office\",\n\t\t\t\t\"number\": \"646 555-4567\",\n\t\t\t},\n\t\t},\n\t\t\"children\": []interface{}{},\n\t\t\"spouse\":   nil,\n\t})\n\tif err != nil {\n\t\t... // handle error\n\t}\n\t... // make use of m as a *structpb.Value\n\n`\n\tcase genid.File_google_protobuf_field_mask_proto:\n\t\treturn ` Package fieldmaskpb contains generated types for ` + genid.File_google_protobuf_field_mask_proto + `.\n\n The FieldMask message represents a set of symbolic field paths.\n The paths are specific to some target message type,\n which is not stored within the FieldMask message itself.\n\n\n Constructing a FieldMask\n\n The New function is used construct a FieldMask:\n\n\tvar messageType *descriptorpb.DescriptorProto\n\tfm, err := fieldmaskpb.New(messageType, \"field.name\", \"field.number\")\n\tif err != nil {\n\t\t... // handle error\n\t}\n\t... // make use of fm\n\n The \"field.name\" and \"field.number\" paths are valid paths according to the\n google.protobuf.DescriptorProto message. Use of a path that does not correlate\n to valid fields reachable from DescriptorProto would result in an error.\n\n Once a FieldMask message has been constructed,\n the Append method can be used to insert additional paths to the path set:\n\n\tvar messageType *descriptorpb.DescriptorProto\n\tif err := fm.Append(messageType, \"options\"); err != nil {\n\t\t... // handle error\n\t}\n\n\n Type checking a FieldMask\n\n In order to verify that a FieldMask represents a set of fields that are\n reachable from some target message type, use the IsValid method:\n\n\tvar messageType *descriptorpb.DescriptorProto\n\tif fm.IsValid(messageType) {\n\t\t... // make use of fm\n\t}\n\n IsValid needs to be passed the target message type as an input since the\n FieldMask message itself does not store the message type that the set of paths\n are for.\n`\n\tdefault:\n\t\treturn \"\"\n\t}\n}\n\nfunc genMessageKnownFunctions(g *protogen.GeneratedFile, f *fileInfo, m *messageInfo) {\n\tswitch m.Desc.FullName() {\n\tcase genid.Any_message_fullname:\n\t\tg.P(\"// New marshals src into a new Any instance.\")\n\t\tg.P(\"func New(src \", protoPackage.Ident(\"Message\"), \") (*Any, error) {\")\n\t\tg.P(\"\tdst := new(Any)\")\n\t\tg.P(\"\tif err := dst.MarshalFrom(src); err != nil {\")\n\t\tg.P(\"\t\treturn nil, err\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn dst, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// MarshalFrom marshals src into dst as the underlying message\")\n\t\tg.P(\"// using the provided marshal options.\")\n\t\tg.P(\"//\")\n\t\tg.P(\"// If no options are specified, call dst.MarshalFrom instead.\")\n\t\tg.P(\"func MarshalFrom(dst *Any, src \", protoPackage.Ident(\"Message\"), \", opts \", protoPackage.Ident(\"MarshalOptions\"), \") error {\")\n\t\tg.P(\"\tconst urlPrefix = \\\"type.googleapis.com/\\\"\")\n\t\tg.P(\"\tif src == nil {\")\n\t\tg.P(\"\t\treturn \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"invalid nil source message\\\")\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\tb, err := opts.Marshal(src)\")\n\t\tg.P(\"\tif err != nil {\")\n\t\tg.P(\"\t\treturn err\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\tdst.TypeUrl = urlPrefix + string(src.ProtoReflect().Descriptor().FullName())\")\n\t\tg.P(\"\tdst.Value = b\")\n\t\tg.P(\"\treturn nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// UnmarshalTo unmarshals the underlying message from src into dst\")\n\t\tg.P(\"// using the provided unmarshal options.\")\n\t\tg.P(\"// It reports an error if dst is not of the right message type.\")\n\t\tg.P(\"//\")\n\t\tg.P(\"// If no options are specified, call src.UnmarshalTo instead.\")\n\t\tg.P(\"func UnmarshalTo(src *Any, dst \", protoPackage.Ident(\"Message\"), \", opts \", protoPackage.Ident(\"UnmarshalOptions\"), \") error {\")\n\t\tg.P(\"\tif src == nil {\")\n\t\tg.P(\"\t\treturn \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"invalid nil source message\\\")\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\tif !src.MessageIs(dst) {\")\n\t\tg.P(\"\t\tgot := dst.ProtoReflect().Descriptor().FullName()\")\n\t\tg.P(\"\t\twant := src.MessageName()\")\n\t\tg.P(\"\t\treturn \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"mismatched message type: got %q, want %q\\\", got, want)\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn opts.Unmarshal(src.GetValue(), dst)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// UnmarshalNew unmarshals the underlying message from src into dst,\")\n\t\tg.P(\"// which is newly created message using a type resolved from the type URL.\")\n\t\tg.P(\"// The message type is resolved according to opt.Resolver,\")\n\t\tg.P(\"// which should implement protoregistry.MessageTypeResolver.\")\n\t\tg.P(\"// It reports an error if the underlying message type could not be resolved.\")\n\t\tg.P(\"//\")\n\t\tg.P(\"// If no options are specified, call src.UnmarshalNew instead.\")\n\t\tg.P(\"func UnmarshalNew(src *Any, opts \", protoPackage.Ident(\"UnmarshalOptions\"), \") (dst \", protoPackage.Ident(\"Message\"), \", err error) {\")\n\t\tg.P(\"\tif src.GetTypeUrl() == \\\"\\\" {\")\n\t\tg.P(\"\t\treturn nil, \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"invalid empty type URL\\\")\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\tif opts.Resolver == nil {\")\n\t\tg.P(\"\t\topts.Resolver = \", protoregistryPackage.Ident(\"GlobalTypes\"))\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\tr, ok := opts.Resolver.(\", protoregistryPackage.Ident(\"MessageTypeResolver\"), \")\")\n\t\tg.P(\"\tif !ok {\")\n\t\tg.P(\"\t\treturn nil, \", protoregistryPackage.Ident(\"NotFound\"))\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\tmt, err := r.FindMessageByURL(src.GetTypeUrl())\")\n\t\tg.P(\"\tif err != nil {\")\n\t\tg.P(\"\t\tif err == \", protoregistryPackage.Ident(\"NotFound\"), \" {\")\n\t\tg.P(\"\t\t\treturn nil, err\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\t\treturn nil, \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"could not resolve %q: %v\\\", src.GetTypeUrl(), err)\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\tdst = mt.New().Interface()\")\n\t\tg.P(\"\treturn dst, opts.Unmarshal(src.GetValue(), dst)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// MessageIs reports whether the underlying message is of the same type as m.\")\n\t\tg.P(\"func (x *Any) MessageIs(m \", protoPackage.Ident(\"Message\"), \") bool {\")\n\t\tg.P(\"\tif m == nil {\")\n\t\tg.P(\"\t\treturn false\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\turl := x.GetTypeUrl()\")\n\t\tg.P(\"\tname := string(m.ProtoReflect().Descriptor().FullName())\")\n\t\tg.P(\"\tif !\", stringsPackage.Ident(\"HasSuffix\"), \"(url, name) {\")\n\t\tg.P(\"\t\treturn false\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn len(url) == len(name) || url[len(url)-len(name)-1] == '/'\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// MessageName reports the full name of the underlying message,\")\n\t\tg.P(\"// returning an empty string if invalid.\")\n\t\tg.P(\"func (x *Any) MessageName() \", protoreflectPackage.Ident(\"FullName\"), \" {\")\n\t\tg.P(\"\turl := x.GetTypeUrl()\")\n\t\tg.P(\"\tname := \", protoreflectPackage.Ident(\"FullName\"), \"(url)\")\n\t\tg.P(\"\tif i := \", stringsPackage.Ident(\"LastIndexByte\"), \"(url, '/'); i >= 0 {\")\n\t\tg.P(\"\t\tname = name[i+len(\\\"/\\\"):]\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\tif !name.IsValid() {\")\n\t\tg.P(\"\t\treturn \\\"\\\"\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn name\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// MarshalFrom marshals m into x as the underlying message.\")\n\t\tg.P(\"func (x *Any) MarshalFrom(m \", protoPackage.Ident(\"Message\"), \") error {\")\n\t\tg.P(\"\treturn MarshalFrom(x, m, \", protoPackage.Ident(\"MarshalOptions\"), \"{})\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// UnmarshalTo unmarshals the contents of the underlying message of x into m.\")\n\t\tg.P(\"// It resets m before performing the unmarshal operation.\")\n\t\tg.P(\"// It reports an error if m is not of the right message type.\")\n\t\tg.P(\"func (x *Any) UnmarshalTo(m \", protoPackage.Ident(\"Message\"), \") error {\")\n\t\tg.P(\"\treturn UnmarshalTo(x, m, \", protoPackage.Ident(\"UnmarshalOptions\"), \"{})\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// UnmarshalNew unmarshals the contents of the underlying message of x into\")\n\t\tg.P(\"// a newly allocated message of the specified type.\")\n\t\tg.P(\"// It reports an error if the underlying message type could not be resolved.\")\n\t\tg.P(\"func (x *Any) UnmarshalNew() (\", protoPackage.Ident(\"Message\"), \", error) {\")\n\t\tg.P(\"\treturn UnmarshalNew(x, \", protoPackage.Ident(\"UnmarshalOptions\"), \"{})\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\tcase genid.Timestamp_message_fullname:\n\t\tg.P(\"// Now constructs a new Timestamp from the current time.\")\n\t\tg.P(\"func Now() *Timestamp {\")\n\t\tg.P(\"\treturn New(\", timePackage.Ident(\"Now\"), \"())\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// New constructs a new Timestamp from the provided time.Time.\")\n\t\tg.P(\"func New(t \", timePackage.Ident(\"Time\"), \") *Timestamp {\")\n\t\tg.P(\"\treturn &Timestamp{Seconds: int64(t.Unix()), Nanos: int32(t.Nanosecond())}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// AsTime converts x to a time.Time.\")\n\t\tg.P(\"func (x *Timestamp) AsTime() \", timePackage.Ident(\"Time\"), \" {\")\n\t\tg.P(\"\treturn \", timePackage.Ident(\"Unix\"), \"(int64(x.GetSeconds()), int64(x.GetNanos())).UTC()\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// IsValid reports whether the timestamp is valid.\")\n\t\tg.P(\"// It is equivalent to CheckValid == nil.\")\n\t\tg.P(\"func (x *Timestamp) IsValid() bool {\")\n\t\tg.P(\"\treturn x.check() == 0\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// CheckValid returns an error if the timestamp is invalid.\")\n\t\tg.P(\"// In particular, it checks whether the value represents a date that is\")\n\t\tg.P(\"// in the range of 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.\")\n\t\tg.P(\"// An error is reported for a nil Timestamp.\")\n\t\tg.P(\"func (x *Timestamp) CheckValid() error {\")\n\t\tg.P(\"\tswitch x.check() {\")\n\t\tg.P(\"\tcase invalidNil:\")\n\t\tg.P(\"\t\treturn \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"invalid nil Timestamp\\\")\")\n\t\tg.P(\"\tcase invalidUnderflow:\")\n\t\tg.P(\"\t\treturn \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"timestamp (%v) before 0001-01-01\\\", x)\")\n\t\tg.P(\"\tcase invalidOverflow:\")\n\t\tg.P(\"\t\treturn \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"timestamp (%v) after 9999-12-31\\\", x)\")\n\t\tg.P(\"\tcase invalidNanos:\")\n\t\tg.P(\"\t\treturn \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"timestamp (%v) has out-of-range nanos\\\", x)\")\n\t\tg.P(\"\tdefault:\")\n\t\tg.P(\"\t\treturn nil\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"const (\")\n\t\tg.P(\"\t_ = iota\")\n\t\tg.P(\"\tinvalidNil\")\n\t\tg.P(\"\tinvalidUnderflow\")\n\t\tg.P(\"\tinvalidOverflow\")\n\t\tg.P(\"\tinvalidNanos\")\n\t\tg.P(\")\")\n\t\tg.P()\n\n\t\tg.P(\"func (x *Timestamp) check() uint {\")\n\t\tg.P(\"\tconst minTimestamp = -62135596800  // Seconds between 1970-01-01T00:00:00Z and 0001-01-01T00:00:00Z, inclusive\")\n\t\tg.P(\"\tconst maxTimestamp = +253402300799 // Seconds between 1970-01-01T00:00:00Z and 9999-12-31T23:59:59Z, inclusive\")\n\t\tg.P(\"\tsecs := x.GetSeconds()\")\n\t\tg.P(\"\tnanos := x.GetNanos()\")\n\t\tg.P(\"\tswitch {\")\n\t\tg.P(\"\tcase x == nil:\")\n\t\tg.P(\"\t\treturn invalidNil\")\n\t\tg.P(\"\tcase secs < minTimestamp:\")\n\t\tg.P(\"\t\treturn invalidUnderflow\")\n\t\tg.P(\"\tcase secs > maxTimestamp:\")\n\t\tg.P(\"\t\treturn invalidOverflow\")\n\t\tg.P(\"\tcase nanos < 0 || nanos >= 1e9:\")\n\t\tg.P(\"\t\treturn invalidNanos\")\n\t\tg.P(\"\tdefault:\")\n\t\tg.P(\"\t\treturn 0\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\tcase genid.Duration_message_fullname:\n\t\tg.P(\"// New constructs a new Duration from the provided time.Duration.\")\n\t\tg.P(\"func New(d \", timePackage.Ident(\"Duration\"), \") *Duration {\")\n\t\tg.P(\"\tnanos := d.Nanoseconds()\")\n\t\tg.P(\"\tsecs := nanos / 1e9\")\n\t\tg.P(\"\tnanos -= secs * 1e9\")\n\t\tg.P(\"\treturn &Duration{Seconds: int64(secs), Nanos: int32(nanos)}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// AsDuration converts x to a time.Duration,\")\n\t\tg.P(\"// returning the closest duration value in the event of overflow.\")\n\t\tg.P(\"func (x *Duration) AsDuration() \", timePackage.Ident(\"Duration\"), \" {\")\n\t\tg.P(\"\tsecs := x.GetSeconds()\")\n\t\tg.P(\"\tnanos := x.GetNanos()\")\n\t\tg.P(\"\td := \", timePackage.Ident(\"Duration\"), \"(secs) * \", timePackage.Ident(\"Second\"))\n\t\tg.P(\"\toverflow := d/\", timePackage.Ident(\"Second\"), \" != \", timePackage.Ident(\"Duration\"), \"(secs)\")\n\t\tg.P(\"\td += \", timePackage.Ident(\"Duration\"), \"(nanos) * \", timePackage.Ident(\"Nanosecond\"))\n\t\tg.P(\"\toverflow = overflow || (secs < 0 && nanos < 0 && d > 0)\")\n\t\tg.P(\"\toverflow = overflow || (secs > 0 && nanos > 0 && d < 0)\")\n\t\tg.P(\"\tif overflow {\")\n\t\tg.P(\"\t\tswitch {\")\n\t\tg.P(\"\t\tcase secs < 0:\")\n\t\tg.P(\"\t\t\treturn \", timePackage.Ident(\"Duration\"), \"(\", mathPackage.Ident(\"MinInt64\"), \")\")\n\t\tg.P(\"\t\tcase secs > 0:\")\n\t\tg.P(\"\t\t\treturn \", timePackage.Ident(\"Duration\"), \"(\", mathPackage.Ident(\"MaxInt64\"), \")\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn d\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// IsValid reports whether the duration is valid.\")\n\t\tg.P(\"// It is equivalent to CheckValid == nil.\")\n\t\tg.P(\"func (x *Duration) IsValid() bool {\")\n\t\tg.P(\"\treturn x.check() == 0\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// CheckValid returns an error if the duration is invalid.\")\n\t\tg.P(\"// In particular, it checks whether the value is within the range of\")\n\t\tg.P(\"// -10000 years to +10000 years inclusive.\")\n\t\tg.P(\"// An error is reported for a nil Duration.\")\n\t\tg.P(\"func (x *Duration) CheckValid() error {\")\n\t\tg.P(\"\tswitch x.check() {\")\n\t\tg.P(\"\tcase invalidNil:\")\n\t\tg.P(\"\t\treturn \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"invalid nil Duration\\\")\")\n\t\tg.P(\"\tcase invalidUnderflow:\")\n\t\tg.P(\"\t\treturn \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"duration (%v) exceeds -10000 years\\\", x)\")\n\t\tg.P(\"\tcase invalidOverflow:\")\n\t\tg.P(\"\t\treturn \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"duration (%v) exceeds +10000 years\\\", x)\")\n\t\tg.P(\"\tcase invalidNanosRange:\")\n\t\tg.P(\"\t\treturn \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"duration (%v) has out-of-range nanos\\\", x)\")\n\t\tg.P(\"\tcase invalidNanosSign:\")\n\t\tg.P(\"\t\treturn \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"duration (%v) has seconds and nanos with different signs\\\", x)\")\n\t\tg.P(\"\tdefault:\")\n\t\tg.P(\"\t\treturn nil\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"const (\")\n\t\tg.P(\"\t_ = iota\")\n\t\tg.P(\"\tinvalidNil\")\n\t\tg.P(\"\tinvalidUnderflow\")\n\t\tg.P(\"\tinvalidOverflow\")\n\t\tg.P(\"\tinvalidNanosRange\")\n\t\tg.P(\"\tinvalidNanosSign\")\n\t\tg.P(\")\")\n\t\tg.P()\n\n\t\tg.P(\"func (x *Duration) check() uint {\")\n\t\tg.P(\"\tconst absDuration = 315576000000 // 10000yr * 365.25day/yr * 24hr/day * 60min/hr * 60sec/min\")\n\t\tg.P(\"\tsecs := x.GetSeconds()\")\n\t\tg.P(\"\tnanos := x.GetNanos()\")\n\t\tg.P(\"\tswitch {\")\n\t\tg.P(\"\tcase x == nil:\")\n\t\tg.P(\"\t\treturn invalidNil\")\n\t\tg.P(\"\tcase secs < -absDuration:\")\n\t\tg.P(\"\t\treturn invalidUnderflow\")\n\t\tg.P(\"\tcase secs > +absDuration:\")\n\t\tg.P(\"\t\treturn invalidOverflow\")\n\t\tg.P(\"\tcase nanos <= -1e9 || nanos >= +1e9:\")\n\t\tg.P(\"\t\treturn invalidNanosRange\")\n\t\tg.P(\"\tcase (secs > 0 && nanos < 0) || (secs < 0 && nanos > 0):\")\n\t\tg.P(\"\t\treturn invalidNanosSign\")\n\t\tg.P(\"\tdefault:\")\n\t\tg.P(\"\t\treturn 0\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\tcase genid.Struct_message_fullname:\n\t\tg.P(\"// NewStruct constructs a Struct from a general-purpose Go map.\")\n\t\tg.P(\"// The map keys must be valid UTF-8.\")\n\t\tg.P(\"// The map values are converted using NewValue.\")\n\t\tg.P(\"func NewStruct(v map[string]interface{}) (*Struct, error) {\")\n\t\tg.P(\"\tx := &Struct{Fields: make(map[string]*Value, len(v))}\")\n\t\tg.P(\"\tfor k, v := range v {\")\n\t\tg.P(\"\t\tif !\", utf8Package.Ident(\"ValidString\"), \"(k) {\")\n\t\tg.P(\"\t\t\treturn nil, \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"invalid UTF-8 in string: %q\\\", k)\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\t\tvar err error\")\n\t\tg.P(\"\t\tx.Fields[k], err = NewValue(v)\")\n\t\tg.P(\"\t\tif err != nil {\")\n\t\tg.P(\"\t\t\treturn nil, err\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn x, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// AsMap converts x to a general-purpose Go map.\")\n\t\tg.P(\"// The map values are converted by calling Value.AsInterface.\")\n\t\tg.P(\"func (x *Struct) AsMap() map[string]interface{} {\")\n\t\tg.P(\"\tvs := make(map[string]interface{})\")\n\t\tg.P(\"\tfor k, v := range x.GetFields() {\")\n\t\tg.P(\"\t\tvs[k] = v.AsInterface()\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn vs\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"func (x *Struct) MarshalJSON() ([]byte, error) {\")\n\t\tg.P(\"\treturn \", protojsonPackage.Ident(\"Marshal\"), \"(x)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"func (x *Struct) UnmarshalJSON(b []byte) error {\")\n\t\tg.P(\"\treturn \", protojsonPackage.Ident(\"Unmarshal\"), \"(b, x)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\tcase genid.ListValue_message_fullname:\n\t\tg.P(\"// NewList constructs a ListValue from a general-purpose Go slice.\")\n\t\tg.P(\"// The slice elements are converted using NewValue.\")\n\t\tg.P(\"func NewList(v []interface{}) (*ListValue, error) {\")\n\t\tg.P(\"\tx := &ListValue{Values: make([]*Value, len(v))}\")\n\t\tg.P(\"\tfor i, v := range v {\")\n\t\tg.P(\"\t\tvar err error\")\n\t\tg.P(\"\t\tx.Values[i], err = NewValue(v)\")\n\t\tg.P(\"\t\tif err != nil {\")\n\t\tg.P(\"\t\t\treturn nil, err\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn x, nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// AsSlice converts x to a general-purpose Go slice.\")\n\t\tg.P(\"// The slice elements are converted by calling Value.AsInterface.\")\n\t\tg.P(\"func (x *ListValue) AsSlice() []interface{} {\")\n\t\tg.P(\"\tvs := make([]interface{}, len(x.GetValues()))\")\n\t\tg.P(\"\tfor i, v := range x.GetValues() {\")\n\t\tg.P(\"\t\tvs[i] = v.AsInterface()\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn vs\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"func (x *ListValue) MarshalJSON() ([]byte, error) {\")\n\t\tg.P(\"\treturn \", protojsonPackage.Ident(\"Marshal\"), \"(x)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"func (x *ListValue) UnmarshalJSON(b []byte) error {\")\n\t\tg.P(\"\treturn \", protojsonPackage.Ident(\"Unmarshal\"), \"(b, x)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\tcase genid.Value_message_fullname:\n\t\tg.P(\"// NewValue constructs a Value from a general-purpose Go interface.\")\n\t\tg.P(\"//\")\n\t\tg.P(\"//\t╔════════════════════════╤════════════════════════════════════════════╗\")\n\t\tg.P(\"//\t║ Go type                │ Conversion                                 ║\")\n\t\tg.P(\"//\t╠════════════════════════╪════════════════════════════════════════════╣\")\n\t\tg.P(\"//\t║ nil                    │ stored as NullValue                        ║\")\n\t\tg.P(\"//\t║ bool                   │ stored as BoolValue                        ║\")\n\t\tg.P(\"//\t║ int, int32, int64      │ stored as NumberValue                      ║\")\n\t\tg.P(\"//\t║ uint, uint32, uint64   │ stored as NumberValue                      ║\")\n\t\tg.P(\"//\t║ float32, float64       │ stored as NumberValue                      ║\")\n\t\tg.P(\"//\t║ string                 │ stored as StringValue; must be valid UTF-8 ║\")\n\t\tg.P(\"//\t║ []byte                 │ stored as StringValue; base64-encoded      ║\")\n\t\tg.P(\"//\t║ map[string]interface{} │ stored as StructValue                      ║\")\n\t\tg.P(\"//\t║ []interface{}          │ stored as ListValue                        ║\")\n\t\tg.P(\"//\t╚════════════════════════╧════════════════════════════════════════════╝\")\n\t\tg.P(\"//\")\n\t\tg.P(\"// When converting an int64 or uint64 to a NumberValue, numeric precision loss\")\n\t\tg.P(\"// is possible since they are stored as a float64.\")\n\t\tg.P(\"func NewValue(v interface{}) (*Value, error) {\")\n\t\tg.P(\"\tswitch v := v.(type) {\")\n\t\tg.P(\"\tcase nil:\")\n\t\tg.P(\"\t\treturn NewNullValue(), nil\")\n\t\tg.P(\"\tcase bool:\")\n\t\tg.P(\"\t\treturn NewBoolValue(v), nil\")\n\t\tg.P(\"\tcase int:\")\n\t\tg.P(\"\t\treturn NewNumberValue(float64(v)), nil\")\n\t\tg.P(\"\tcase int32:\")\n\t\tg.P(\"\t\treturn NewNumberValue(float64(v)), nil\")\n\t\tg.P(\"\tcase int64:\")\n\t\tg.P(\"\t\treturn NewNumberValue(float64(v)), nil\")\n\t\tg.P(\"\tcase uint:\")\n\t\tg.P(\"\t\treturn NewNumberValue(float64(v)), nil\")\n\t\tg.P(\"\tcase uint32:\")\n\t\tg.P(\"\t\treturn NewNumberValue(float64(v)), nil\")\n\t\tg.P(\"\tcase uint64:\")\n\t\tg.P(\"\t\treturn NewNumberValue(float64(v)), nil\")\n\t\tg.P(\"\tcase float32:\")\n\t\tg.P(\"\t\treturn NewNumberValue(float64(v)), nil\")\n\t\tg.P(\"\tcase float64:\")\n\t\tg.P(\"\t\treturn NewNumberValue(float64(v)), nil\")\n\t\tg.P(\"\tcase string:\")\n\t\tg.P(\"\t\tif !\", utf8Package.Ident(\"ValidString\"), \"(v) {\")\n\t\tg.P(\"\t\t\treturn nil, \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"invalid UTF-8 in string: %q\\\", v)\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\t\treturn NewStringValue(v), nil\")\n\t\tg.P(\"\tcase []byte:\")\n\t\tg.P(\"\t\ts := \", base64Package.Ident(\"StdEncoding\"), \".EncodeToString(v)\")\n\t\tg.P(\"\t\treturn NewStringValue(s), nil\")\n\t\tg.P(\"\tcase map[string]interface{}:\")\n\t\tg.P(\"\t\tv2, err := NewStruct(v)\")\n\t\tg.P(\"\t\tif err != nil {\")\n\t\tg.P(\"\t\t\treturn nil, err\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\t\treturn NewStructValue(v2), nil\")\n\t\tg.P(\"\tcase []interface{}:\")\n\t\tg.P(\"\t\tv2, err := NewList(v)\")\n\t\tg.P(\"\t\tif err != nil {\")\n\t\tg.P(\"\t\t\treturn nil, err\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\t\treturn NewListValue(v2), nil\")\n\t\tg.P(\"\tdefault:\")\n\t\tg.P(\"\t\treturn nil, \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"invalid type: %T\\\", v)\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// NewNullValue constructs a new null Value.\")\n\t\tg.P(\"func NewNullValue() *Value {\")\n\t\tg.P(\"\treturn &Value{Kind: &Value_NullValue{NullValue: NullValue_NULL_VALUE}}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// NewBoolValue constructs a new boolean Value.\")\n\t\tg.P(\"func NewBoolValue(v bool) *Value {\")\n\t\tg.P(\"\treturn &Value{Kind: &Value_BoolValue{BoolValue: v}}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// NewNumberValue constructs a new number Value.\")\n\t\tg.P(\"func NewNumberValue(v float64) *Value {\")\n\t\tg.P(\"\treturn &Value{Kind: &Value_NumberValue{NumberValue: v}}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// NewStringValue constructs a new string Value.\")\n\t\tg.P(\"func NewStringValue(v string) *Value {\")\n\t\tg.P(\"\treturn &Value{Kind: &Value_StringValue{StringValue: v}}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// NewStructValue constructs a new struct Value.\")\n\t\tg.P(\"func NewStructValue(v *Struct) *Value {\")\n\t\tg.P(\"\treturn &Value{Kind: &Value_StructValue{StructValue: v}}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// NewListValue constructs a new list Value.\")\n\t\tg.P(\"func NewListValue(v *ListValue) *Value {\")\n\t\tg.P(\"\treturn &Value{Kind: &Value_ListValue{ListValue: v}}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// AsInterface converts x to a general-purpose Go interface.\")\n\t\tg.P(\"//\")\n\t\tg.P(\"// Calling Value.MarshalJSON and \\\"encoding/json\\\".Marshal on this output produce\")\n\t\tg.P(\"// semantically equivalent JSON (assuming no errors occur).\")\n\t\tg.P(\"//\")\n\t\tg.P(\"// Floating-point values (i.e., \\\"NaN\\\", \\\"Infinity\\\", and \\\"-Infinity\\\") are\")\n\t\tg.P(\"// converted as strings to remain compatible with MarshalJSON.\")\n\t\tg.P(\"func (x *Value) AsInterface() interface{} {\")\n\t\tg.P(\"\tswitch v := x.GetKind().(type) {\")\n\t\tg.P(\"\tcase *Value_NumberValue:\")\n\t\tg.P(\"\t\tif v != nil {\")\n\t\tg.P(\"\t\t\tswitch {\")\n\t\tg.P(\"\t\t\tcase \", mathPackage.Ident(\"IsNaN\"), \"(v.NumberValue):\")\n\t\tg.P(\"\t\t\t\treturn \\\"NaN\\\"\")\n\t\tg.P(\"\t\t\tcase \", mathPackage.Ident(\"IsInf\"), \"(v.NumberValue, +1):\")\n\t\tg.P(\"\t\t\t\treturn \\\"Infinity\\\"\")\n\t\tg.P(\"\t\t\tcase \", mathPackage.Ident(\"IsInf\"), \"(v.NumberValue, -1):\")\n\t\tg.P(\"\t\t\t\treturn \\\"-Infinity\\\"\")\n\t\tg.P(\"\t\t\tdefault:\")\n\t\tg.P(\"\t\t\t\treturn v.NumberValue\")\n\t\tg.P(\"\t\t\t}\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\tcase *Value_StringValue:\")\n\t\tg.P(\"\t\tif v != nil {\")\n\t\tg.P(\"\t\t\treturn v.StringValue\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\tcase *Value_BoolValue:\")\n\t\tg.P(\"\t\tif v != nil {\")\n\t\tg.P(\"\t\t\treturn v.BoolValue\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\tcase *Value_StructValue:\")\n\t\tg.P(\"\t\tif v != nil {\")\n\t\tg.P(\"\t\t\treturn v.StructValue.AsMap()\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\tcase *Value_ListValue:\")\n\t\tg.P(\"\t\tif v != nil {\")\n\t\tg.P(\"\t\t\treturn v.ListValue.AsSlice()\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"func (x *Value) MarshalJSON() ([]byte, error) {\")\n\t\tg.P(\"\treturn \", protojsonPackage.Ident(\"Marshal\"), \"(x)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"func (x *Value) UnmarshalJSON(b []byte) error {\")\n\t\tg.P(\"\treturn \", protojsonPackage.Ident(\"Unmarshal\"), \"(b, x)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\tcase genid.FieldMask_message_fullname:\n\t\tg.P(\"// New constructs a field mask from a list of paths and verifies that\")\n\t\tg.P(\"// each one is valid according to the specified message type.\")\n\t\tg.P(\"func New(m \", protoPackage.Ident(\"Message\"), \", paths ...string) (*FieldMask, error) {\")\n\t\tg.P(\"\tx := new(FieldMask)\")\n\t\tg.P(\"\treturn x, x.Append(m, paths...)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// Union returns the union of all the paths in the input field masks.\")\n\t\tg.P(\"func Union(mx *FieldMask, my *FieldMask, ms ...*FieldMask) *FieldMask {\")\n\t\tg.P(\"\tvar out []string\")\n\t\tg.P(\"\tout = append(out, mx.GetPaths()...)\")\n\t\tg.P(\"\tout = append(out, my.GetPaths()...)\")\n\t\tg.P(\"\tfor _, m := range ms {\")\n\t\tg.P(\"\t\tout = append(out, m.GetPaths()...)\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn &FieldMask{Paths: normalizePaths(out)}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// Intersect returns the intersection of all the paths in the input field masks.\")\n\t\tg.P(\"func Intersect(mx *FieldMask, my *FieldMask, ms ...*FieldMask) *FieldMask {\")\n\t\tg.P(\"\tvar ss1, ss2 []string // reused buffers for performance\")\n\t\tg.P(\"\tintersect := func(out, in []string) []string {\")\n\t\tg.P(\"\t\tss1 = normalizePaths(append(ss1[:0], in...))\")\n\t\tg.P(\"\t\tss2 = normalizePaths(append(ss2[:0], out...))\")\n\t\tg.P(\"\t\tout = out[:0]\")\n\t\tg.P(\"\t\tfor i1, i2 := 0, 0; i1 < len(ss1) && i2 < len(ss2); {\")\n\t\tg.P(\"\t\t\tswitch s1, s2 := ss1[i1], ss2[i2]; {\")\n\t\tg.P(\"\t\t\tcase hasPathPrefix(s1, s2):\")\n\t\tg.P(\"\t\t\t\tout = append(out, s1)\")\n\t\tg.P(\"\t\t\t\ti1++\")\n\t\tg.P(\"\t\t\tcase hasPathPrefix(s2, s1):\")\n\t\tg.P(\"\t\t\t\tout = append(out, s2)\")\n\t\tg.P(\"\t\t\t\ti2++\")\n\t\tg.P(\"\t\t\tcase lessPath(s1, s2):\")\n\t\tg.P(\"\t\t\t\ti1++\")\n\t\tg.P(\"\t\t\tcase lessPath(s2, s1):\")\n\t\tg.P(\"\t\t\t\ti2++\")\n\t\tg.P(\"\t\t\t}\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\t\treturn out\")\n\t\tg.P(\"\t}\")\n\t\tg.P()\n\t\tg.P(\"\tout := Union(mx, my, ms...).GetPaths()\")\n\t\tg.P(\"\tout = intersect(out, mx.GetPaths())\")\n\t\tg.P(\"\tout = intersect(out, my.GetPaths())\")\n\t\tg.P(\"\tfor _, m := range ms {\")\n\t\tg.P(\"\t\tout = intersect(out, m.GetPaths())\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn &FieldMask{Paths: normalizePaths(out)}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// IsValid reports whether all the paths are syntactically valid and\")\n\t\tg.P(\"// refer to known fields in the specified message type.\")\n\t\tg.P(\"// It reports false for a nil FieldMask.\")\n\t\tg.P(\"func (x *FieldMask) IsValid(m \", protoPackage.Ident(\"Message\"), \") bool {\")\n\t\tg.P(\"\tpaths := x.GetPaths()\")\n\t\tg.P(\"\treturn x != nil && numValidPaths(m, paths) == len(paths)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// Append appends a list of paths to the mask and verifies that each one\")\n\t\tg.P(\"// is valid according to the specified message type.\")\n\t\tg.P(\"// An invalid path is not appended and breaks insertion of subsequent paths.\")\n\t\tg.P(\"func (x *FieldMask) Append(m \", protoPackage.Ident(\"Message\"), \", paths ...string) error {\")\n\t\tg.P(\"\tnumValid := numValidPaths(m, paths)\")\n\t\tg.P(\"\tx.Paths = append(x.Paths, paths[:numValid]...)\")\n\t\tg.P(\"\tpaths = paths[numValid:]\")\n\t\tg.P(\"\tif len(paths) > 0 {\")\n\t\tg.P(\"\t\tname := m.ProtoReflect().Descriptor().FullName()\")\n\t\tg.P(\"\t\treturn \", protoimplPackage.Ident(\"X\"), \".NewError(\\\"invalid path %q for message %q\\\", paths[0], name)\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn nil\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"func numValidPaths(m \", protoPackage.Ident(\"Message\"), \", paths []string) int {\")\n\t\tg.P(\"\tmd0 := m.ProtoReflect().Descriptor()\")\n\t\tg.P(\"\tfor i, path := range paths {\")\n\t\tg.P(\"\t\tmd := md0\")\n\t\tg.P(\"\t\tif !rangeFields(path, func(field string) bool {\")\n\t\tg.P(\"\t\t\t// Search the field within the message.\")\n\t\tg.P(\"\t\t\tif md == nil {\")\n\t\tg.P(\"\t\t\t\treturn false // not within a message\")\n\t\tg.P(\"\t\t\t}\")\n\t\tg.P(\"\t\t\tfd := md.Fields().ByName(\", protoreflectPackage.Ident(\"Name\"), \"(field))\")\n\t\tg.P(\"\t\t\t// The real field name of a group is the message name.\")\n\t\tg.P(\"\t\t\tif fd == nil {\")\n\t\tg.P(\"\t\t\t\tgd := md.Fields().ByName(\", protoreflectPackage.Ident(\"Name\"), \"(\", stringsPackage.Ident(\"ToLower\"), \"(field)))\")\n\t\tg.P(\"\t\t\t\tif gd != nil && gd.Kind() == \", protoreflectPackage.Ident(\"GroupKind\"), \" && string(gd.Message().Name()) == field {\")\n\t\tg.P(\"\t\t\t\t\tfd = gd\")\n\t\tg.P(\"\t\t\t\t}\")\n\t\tg.P(\"\t\t\t} else if fd.Kind() == \", protoreflectPackage.Ident(\"GroupKind\"), \" && string(fd.Message().Name()) != field {\")\n\t\tg.P(\"\t\t\t\tfd = nil\")\n\t\tg.P(\"\t\t\t}\")\n\t\tg.P(\"\t\t\tif fd == nil {\")\n\t\tg.P(\"\t\t\t\treturn false // message has does not have this field\")\n\t\tg.P(\"\t\t\t}\")\n\t\tg.P()\n\t\tg.P(\"\t\t\t// Identify the next message to search within.\")\n\t\tg.P(\"\t\t\tmd = fd.Message() // may be nil\")\n\t\tg.P()\n\t\tg.P(\"\t\t\t// Repeated fields are only allowed at the last postion.\")\n\t\tg.P(\"\t\t\tif fd.IsList() || fd.IsMap() {\")\n\t\tg.P(\"\t\t\t\tmd = nil\")\n\t\tg.P(\"\t\t\t}\")\n\t\tg.P()\n\t\tg.P(\"\t\t\treturn true\")\n\t\tg.P(\"\t\t}) {\")\n\t\tg.P(\"\t\t\treturn i\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn len(paths)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// Normalize converts the mask to its canonical form where all paths are sorted\")\n\t\tg.P(\"// and redundant paths are removed.\")\n\t\tg.P(\"func (x *FieldMask) Normalize() {\")\n\t\tg.P(\"\tx.Paths = normalizePaths(x.Paths)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t\tg.P(\"func normalizePaths(paths []string) []string {\")\n\t\tg.P(\"\t\", sortPackage.Ident(\"Slice\"), \"(paths, func(i, j int) bool {\")\n\t\tg.P(\"\t\treturn lessPath(paths[i], paths[j])\")\n\t\tg.P(\"\t})\")\n\t\tg.P()\n\t\tg.P(\"\t// Elide any path that is a prefix match on the previous.\")\n\t\tg.P(\"\tout := paths[:0]\")\n\t\tg.P(\"\tfor _, path := range paths {\")\n\t\tg.P(\"\t\tif len(out) > 0 && hasPathPrefix(path, out[len(out)-1]) {\")\n\t\tg.P(\"\t\t\tcontinue\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\t\tout = append(out, path)\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn out\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// hasPathPrefix is like strings.HasPrefix, but further checks for either\")\n\t\tg.P(\"// an exact matche or that the prefix is delimited by a dot.\")\n\t\tg.P(\"func hasPathPrefix(path, prefix string) bool {\")\n\t\tg.P(\"\treturn \", stringsPackage.Ident(\"HasPrefix\"), \"(path, prefix) && (len(path) == len(prefix) || path[len(prefix)] == '.')\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// lessPath is a lexicographical comparison where dot is specially treated\")\n\t\tg.P(\"// as the smallest symbol.\")\n\t\tg.P(\"func lessPath(x, y string) bool {\")\n\t\tg.P(\"\tfor i := 0; i < len(x) && i < len(y); i++ {\")\n\t\tg.P(\"\t\tif x[i] != y[i] {\")\n\t\tg.P(\"\t\t\treturn (x[i] - '.') < (y[i] - '.')\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"\treturn len(x) < len(y)\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\t\tg.P(\"// rangeFields is like strings.Split(path, \\\".\\\"), but avoids allocations by\")\n\t\tg.P(\"// iterating over each field in place and calling a iterator function.\")\n\t\tg.P(\"func rangeFields(path string, f func(field string) bool) bool {\")\n\t\tg.P(\"\tfor {\")\n\t\tg.P(\"\t\tvar field string\")\n\t\tg.P(\"\t\tif i := \", stringsPackage.Ident(\"IndexByte\"), \"(path, '.'); i >= 0 {\")\n\t\tg.P(\"\t\t\tfield, path = path[:i], path[i:]\")\n\t\tg.P(\"\t\t} else {\")\n\t\tg.P(\"\t\t\tfield, path = path, \\\"\\\"\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P()\n\t\tg.P(\"\t\tif !f(field) {\")\n\t\tg.P(\"\t\t\treturn false\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P()\n\t\tg.P(\"\t\tif len(path) == 0 {\")\n\t\tg.P(\"\t\t\treturn true\")\n\t\tg.P(\"\t\t}\")\n\t\tg.P(\"\t\tpath = \", stringsPackage.Ident(\"TrimPrefix\"), \"(path, \\\".\\\")\")\n\t\tg.P(\"\t}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\n\tcase genid.BoolValue_message_fullname,\n\t\tgenid.Int32Value_message_fullname,\n\t\tgenid.Int64Value_message_fullname,\n\t\tgenid.UInt32Value_message_fullname,\n\t\tgenid.UInt64Value_message_fullname,\n\t\tgenid.FloatValue_message_fullname,\n\t\tgenid.DoubleValue_message_fullname,\n\t\tgenid.StringValue_message_fullname,\n\t\tgenid.BytesValue_message_fullname:\n\t\tfuncName := strings.TrimSuffix(m.GoIdent.GoName, \"Value\")\n\t\ttypeName := strings.ToLower(funcName)\n\t\tswitch typeName {\n\t\tcase \"float\":\n\t\t\ttypeName = \"float32\"\n\t\tcase \"double\":\n\t\t\ttypeName = \"float64\"\n\t\tcase \"bytes\":\n\t\t\ttypeName = \"[]byte\"\n\t\t}\n\n\t\tg.P(\"// \", funcName, \" stores v in a new \", m.GoIdent, \" and returns a pointer to it.\")\n\t\tg.P(\"func \", funcName, \"(v \", typeName, \") *\", m.GoIdent, \" {\")\n\t\tg.P(\"\treturn &\", m.GoIdent, \"{Value: v}\")\n\t\tg.P(\"}\")\n\t\tg.P()\n\t}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/cmd/protoc-gen-go/main.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// The protoc-gen-go binary is a protoc plugin to generate Go code for\n// both proto2 and proto3 versions of the protocol buffer language.\n//\n// For more information about the usage of this plugin, see:\n//\thttps://developers.google.com/protocol-buffers/docs/reference/go-generated\npackage main\n\nimport (\n\t\"errors\"\n\t\"flag\"\n\t\"fmt\"\n\t\"os\"\n\t\"path/filepath\"\n\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/internal/version\"\n)\n\nconst genGoDocURL = \"https://developers.google.com/protocol-buffers/docs/reference/go-generated\"\nconst grpcDocURL = \"https://grpc.io/docs/languages/go/quickstart/#regenerate-grpc-code\"\n\nfunc main() {\n\tif len(os.Args) == 2 && os.Args[1] == \"--version\" {\n\t\tfmt.Fprintf(os.Stdout, \"%v %v\\n\", filepath.Base(os.Args[0]), version.String())\n\t\tos.Exit(0)\n\t}\n\tif len(os.Args) == 2 && os.Args[1] == \"--help\" {\n\t\tfmt.Fprintf(os.Stdout, \"See \"+genGoDocURL+\" for usage information.\\n\")\n\t\tos.Exit(0)\n\t}\n\n\tvar (\n\t\tflags   flag.FlagSet\n\t\tplugins = flags.String(\"plugins\", \"\", \"deprecated option\")\n\t)\n\tprotogen.Options{\n\t\tParamFunc: flags.Set,\n\t}.Run(func(gen *protogen.Plugin) error {\n\t\tif *plugins != \"\" {\n\t\t\treturn errors.New(\"protoc-gen-go: plugins are not supported; use 'protoc --go-grpc_out=...' to generate gRPC\\n\\n\" +\n\t\t\t\t\"See \" + grpcDocURL + \" for more information.\")\n\t\t}\n\t\tfor _, f := range gen.Files {\n\t\t\tif f.Generate {\n\t\t\t\tgengo.GenerateFile(gen, f)\n\t\t\t}\n\t\t}\n\t\tgen.SupportedFeatures = gengo.SupportedFeatures\n\t\treturn nil\n\t})\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/compiler/protogen/protogen.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 protogen provides support for writing protoc plugins.\n//\n// Plugins for protoc, the Protocol Buffer compiler,\n// are programs which read a CodeGeneratorRequest message from standard input\n// and write a CodeGeneratorResponse message to standard output.\n// This package provides support for writing plugins which generate Go code.\npackage protogen\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"fmt\"\n\t\"go/ast\"\n\t\"go/parser\"\n\t\"go/printer\"\n\t\"go/token\"\n\t\"go/types\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"path\"\n\t\"path/filepath\"\n\t\"sort\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"google.golang.org/protobuf/encoding/prototext\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/proto\"\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\n\t\"google.golang.org/protobuf/types/descriptorpb\"\n\t\"google.golang.org/protobuf/types/pluginpb\"\n)\n\nconst goPackageDocURL = \"https://developers.google.com/protocol-buffers/docs/reference/go-generated#package\"\n\n// Run executes a function as a protoc plugin.\n//\n// It reads a CodeGeneratorRequest message from os.Stdin, invokes the plugin\n// function, and writes a CodeGeneratorResponse message to os.Stdout.\n//\n// If a failure occurs while reading or writing, Run prints an error to\n// os.Stderr and calls os.Exit(1).\nfunc (opts Options) Run(f func(*Plugin) error) {\n\tif err := run(opts, f); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"%s: %v\\n\", filepath.Base(os.Args[0]), err)\n\t\tos.Exit(1)\n\t}\n}\n\nfunc run(opts Options, f func(*Plugin) error) error {\n\tif len(os.Args) > 1 {\n\t\treturn fmt.Errorf(\"unknown argument %q (this program should be run by protoc, not directly)\", os.Args[1])\n\t}\n\tin, err := ioutil.ReadAll(os.Stdin)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq := &pluginpb.CodeGeneratorRequest{}\n\tif err := proto.Unmarshal(in, req); err != nil {\n\t\treturn err\n\t}\n\tgen, err := opts.New(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := f(gen); err != nil {\n\t\t// Errors from the plugin function are reported by setting the\n\t\t// error field in the CodeGeneratorResponse.\n\t\t//\n\t\t// In contrast, errors that indicate a problem in protoc\n\t\t// itself (unparsable input, I/O errors, etc.) are reported\n\t\t// to stderr.\n\t\tgen.Error(err)\n\t}\n\tresp := gen.Response()\n\tout, err := proto.Marshal(resp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, err := os.Stdout.Write(out); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\n// A Plugin is a protoc plugin invocation.\ntype Plugin struct {\n\t// Request is the CodeGeneratorRequest provided by protoc.\n\tRequest *pluginpb.CodeGeneratorRequest\n\n\t// Files is the set of files to generate and everything they import.\n\t// Files appear in topological order, so each file appears before any\n\t// file that imports it.\n\tFiles       []*File\n\tFilesByPath map[string]*File\n\n\t// SupportedFeatures is the set of protobuf language features supported by\n\t// this generator plugin. See the documentation for\n\t// google.protobuf.CodeGeneratorResponse.supported_features for details.\n\tSupportedFeatures uint64\n\n\tfileReg        *protoregistry.Files\n\tenumsByName    map[protoreflect.FullName]*Enum\n\tmessagesByName map[protoreflect.FullName]*Message\n\tannotateCode   bool\n\tpathType       pathType\n\tmodule         string\n\tgenFiles       []*GeneratedFile\n\topts           Options\n\terr            error\n}\n\ntype Options struct {\n\t// If ParamFunc is non-nil, it will be called with each unknown\n\t// generator parameter.\n\t//\n\t// Plugins for protoc can accept parameters from the command line,\n\t// passed in the --<lang>_out protoc, separated from the output\n\t// directory with a colon; e.g.,\n\t//\n\t//   --go_out=<param1>=<value1>,<param2>=<value2>:<output_directory>\n\t//\n\t// Parameters passed in this fashion as a comma-separated list of\n\t// key=value pairs will be passed to the ParamFunc.\n\t//\n\t// The (flag.FlagSet).Set method matches this function signature,\n\t// so parameters can be converted into flags as in the following:\n\t//\n\t//   var flags flag.FlagSet\n\t//   value := flags.Bool(\"param\", false, \"\")\n\t//   opts := &protogen.Options{\n\t//     ParamFunc: flags.Set,\n\t//   }\n\t//   protogen.Run(opts, func(p *protogen.Plugin) error {\n\t//     if *value { ... }\n\t//   })\n\tParamFunc func(name, value string) error\n\n\t// ImportRewriteFunc is called with the import path of each package\n\t// imported by a generated file. It returns the import path to use\n\t// for this package.\n\tImportRewriteFunc func(GoImportPath) GoImportPath\n}\n\n// New returns a new Plugin.\nfunc (opts Options) New(req *pluginpb.CodeGeneratorRequest) (*Plugin, error) {\n\tgen := &Plugin{\n\t\tRequest:        req,\n\t\tFilesByPath:    make(map[string]*File),\n\t\tfileReg:        new(protoregistry.Files),\n\t\tenumsByName:    make(map[protoreflect.FullName]*Enum),\n\t\tmessagesByName: make(map[protoreflect.FullName]*Message),\n\t\topts:           opts,\n\t}\n\n\tpackageNames := make(map[string]GoPackageName) // filename -> package name\n\timportPaths := make(map[string]GoImportPath)   // filename -> import path\n\tfor _, param := range strings.Split(req.GetParameter(), \",\") {\n\t\tvar value string\n\t\tif i := strings.Index(param, \"=\"); i >= 0 {\n\t\t\tvalue = param[i+1:]\n\t\t\tparam = param[0:i]\n\t\t}\n\t\tswitch param {\n\t\tcase \"\":\n\t\t\t// Ignore.\n\t\tcase \"module\":\n\t\t\tgen.module = value\n\t\tcase \"paths\":\n\t\t\tswitch value {\n\t\t\tcase \"import\":\n\t\t\t\tgen.pathType = pathTypeImport\n\t\t\tcase \"source_relative\":\n\t\t\t\tgen.pathType = pathTypeSourceRelative\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(`unknown path type %q: want \"import\" or \"source_relative\"`, value)\n\t\t\t}\n\t\tcase \"annotate_code\":\n\t\t\tswitch value {\n\t\t\tcase \"true\", \"\":\n\t\t\t\tgen.annotateCode = true\n\t\t\tcase \"false\":\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(`bad value for parameter %q: want \"true\" or \"false\"`, param)\n\t\t\t}\n\t\tdefault:\n\t\t\tif param[0] == 'M' {\n\t\t\t\timpPath, pkgName := splitImportPathAndPackageName(value)\n\t\t\t\tif pkgName != \"\" {\n\t\t\t\t\tpackageNames[param[1:]] = pkgName\n\t\t\t\t}\n\t\t\t\tif impPath != \"\" {\n\t\t\t\t\timportPaths[param[1:]] = impPath\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif opts.ParamFunc != nil {\n\t\t\t\tif err := opts.ParamFunc(param, value); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// When the module= option is provided, we strip the module name\n\t// prefix from generated files. This only makes sense if generated\n\t// filenames are based on the import path.\n\tif gen.module != \"\" && gen.pathType == pathTypeSourceRelative {\n\t\treturn nil, fmt.Errorf(\"cannot use module= with paths=source_relative\")\n\t}\n\n\t// Figure out the import path and package name for each file.\n\t//\n\t// The rules here are complicated and have grown organically over time.\n\t// Interactions between different ways of specifying package information\n\t// may be surprising.\n\t//\n\t// The recommended approach is to include a go_package option in every\n\t// .proto source file specifying the full import path of the Go package\n\t// associated with this file.\n\t//\n\t//     option go_package = \"google.golang.org/protobuf/types/known/anypb\";\n\t//\n\t// Alternatively, build systems which want to exert full control over\n\t// import paths may specify M<filename>=<import_path> flags.\n\tfor _, fdesc := range gen.Request.ProtoFile {\n\t\t// The \"M\" command-line flags take precedence over\n\t\t// the \"go_package\" option in the .proto source file.\n\t\tfilename := fdesc.GetName()\n\t\timpPath, pkgName := splitImportPathAndPackageName(fdesc.GetOptions().GetGoPackage())\n\t\tif importPaths[filename] == \"\" && impPath != \"\" {\n\t\t\timportPaths[filename] = impPath\n\t\t}\n\t\tif packageNames[filename] == \"\" && pkgName != \"\" {\n\t\t\tpackageNames[filename] = pkgName\n\t\t}\n\t\tswitch {\n\t\tcase importPaths[filename] == \"\":\n\t\t\t// The import path must be specified one way or another.\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"unable to determine Go import path for %q\\n\\n\"+\n\t\t\t\t\t\"Please specify either:\\n\"+\n\t\t\t\t\t\"\\t• a \\\"go_package\\\" option in the .proto source file, or\\n\"+\n\t\t\t\t\t\"\\t• a \\\"M\\\" argument on the command line.\\n\\n\"+\n\t\t\t\t\t\"See %v for more information.\\n\",\n\t\t\t\tfdesc.GetName(), goPackageDocURL)\n\t\tcase !strings.Contains(string(importPaths[filename]), \"/\"):\n\t\t\t// Check that import paths contain at least one slash to avoid a\n\t\t\t// common mistake where import path is confused with package name.\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"invalid Go import path %q for %q\\n\\n\"+\n\t\t\t\t\t\"The import path must contain at least one forward slash ('/') character.\\n\\n\"+\n\t\t\t\t\t\"See %v for more information.\\n\",\n\t\t\t\tstring(importPaths[filename]), fdesc.GetName(), goPackageDocURL)\n\t\tcase packageNames[filename] == \"\":\n\t\t\t// If the package name is not explicitly specified,\n\t\t\t// then derive a reasonable package name from the import path.\n\t\t\t//\n\t\t\t// NOTE: The package name is derived first from the import path in\n\t\t\t// the \"go_package\" option (if present) before trying the \"M\" flag.\n\t\t\t// The inverted order for this is because the primary use of the \"M\"\n\t\t\t// flag is by build systems that have full control over the\n\t\t\t// import paths all packages, where it is generally expected that\n\t\t\t// the Go package name still be identical for the Go toolchain and\n\t\t\t// for custom build systems like Bazel.\n\t\t\tif impPath == \"\" {\n\t\t\t\timpPath = importPaths[filename]\n\t\t\t}\n\t\t\tpackageNames[filename] = cleanPackageName(path.Base(string(impPath)))\n\t\t}\n\t}\n\n\t// Consistency check: Every file with the same Go import path should have\n\t// the same Go package name.\n\tpackageFiles := make(map[GoImportPath][]string)\n\tfor filename, importPath := range importPaths {\n\t\tif _, ok := packageNames[filename]; !ok {\n\t\t\t// Skip files mentioned in a M<file>=<import_path> parameter\n\t\t\t// but which do not appear in the CodeGeneratorRequest.\n\t\t\tcontinue\n\t\t}\n\t\tpackageFiles[importPath] = append(packageFiles[importPath], filename)\n\t}\n\tfor importPath, filenames := range packageFiles {\n\t\tfor i := 1; i < len(filenames); i++ {\n\t\t\tif a, b := packageNames[filenames[0]], packageNames[filenames[i]]; a != b {\n\t\t\t\treturn nil, fmt.Errorf(\"Go package %v has inconsistent names %v (%v) and %v (%v)\",\n\t\t\t\t\timportPath, a, filenames[0], b, filenames[i])\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, fdesc := range gen.Request.ProtoFile {\n\t\tfilename := fdesc.GetName()\n\t\tif gen.FilesByPath[filename] != nil {\n\t\t\treturn nil, fmt.Errorf(\"duplicate file name: %q\", filename)\n\t\t}\n\t\tf, err := newFile(gen, fdesc, packageNames[filename], importPaths[filename])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tgen.Files = append(gen.Files, f)\n\t\tgen.FilesByPath[filename] = f\n\t}\n\tfor _, filename := range gen.Request.FileToGenerate {\n\t\tf, ok := gen.FilesByPath[filename]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"no descriptor for generated file: %v\", filename)\n\t\t}\n\t\tf.Generate = true\n\t}\n\treturn gen, nil\n}\n\n// Error records an error in code generation. The generator will report the\n// error back to protoc and will not produce output.\nfunc (gen *Plugin) Error(err error) {\n\tif gen.err == nil {\n\t\tgen.err = err\n\t}\n}\n\n// Response returns the generator output.\nfunc (gen *Plugin) Response() *pluginpb.CodeGeneratorResponse {\n\tresp := &pluginpb.CodeGeneratorResponse{}\n\tif gen.err != nil {\n\t\tresp.Error = proto.String(gen.err.Error())\n\t\treturn resp\n\t}\n\tfor _, g := range gen.genFiles {\n\t\tif g.skip {\n\t\t\tcontinue\n\t\t}\n\t\tcontent, err := g.Content()\n\t\tif err != nil {\n\t\t\treturn &pluginpb.CodeGeneratorResponse{\n\t\t\t\tError: proto.String(err.Error()),\n\t\t\t}\n\t\t}\n\t\tfilename := g.filename\n\t\tif gen.module != \"\" {\n\t\t\ttrim := gen.module + \"/\"\n\t\t\tif !strings.HasPrefix(filename, trim) {\n\t\t\t\treturn &pluginpb.CodeGeneratorResponse{\n\t\t\t\t\tError: proto.String(fmt.Sprintf(\"%v: generated file does not match prefix %q\", filename, gen.module)),\n\t\t\t\t}\n\t\t\t}\n\t\t\tfilename = strings.TrimPrefix(filename, trim)\n\t\t}\n\t\tresp.File = append(resp.File, &pluginpb.CodeGeneratorResponse_File{\n\t\t\tName:    proto.String(filename),\n\t\t\tContent: proto.String(string(content)),\n\t\t})\n\t\tif gen.annotateCode && strings.HasSuffix(g.filename, \".go\") {\n\t\t\tmeta, err := g.metaFile(content)\n\t\t\tif err != nil {\n\t\t\t\treturn &pluginpb.CodeGeneratorResponse{\n\t\t\t\t\tError: proto.String(err.Error()),\n\t\t\t\t}\n\t\t\t}\n\t\t\tresp.File = append(resp.File, &pluginpb.CodeGeneratorResponse_File{\n\t\t\t\tName:    proto.String(filename + \".meta\"),\n\t\t\t\tContent: proto.String(meta),\n\t\t\t})\n\t\t}\n\t}\n\tif gen.SupportedFeatures > 0 {\n\t\tresp.SupportedFeatures = proto.Uint64(gen.SupportedFeatures)\n\t}\n\treturn resp\n}\n\n// A File describes a .proto source file.\ntype File struct {\n\tDesc  protoreflect.FileDescriptor\n\tProto *descriptorpb.FileDescriptorProto\n\n\tGoDescriptorIdent GoIdent       // name of Go variable for the file descriptor\n\tGoPackageName     GoPackageName // name of this file's Go package\n\tGoImportPath      GoImportPath  // import path of this file's Go package\n\n\tEnums      []*Enum      // top-level enum declarations\n\tMessages   []*Message   // top-level message declarations\n\tExtensions []*Extension // top-level extension declarations\n\tServices   []*Service   // top-level service declarations\n\n\tGenerate bool // true if we should generate code for this file\n\n\t// GeneratedFilenamePrefix is used to construct filenames for generated\n\t// files associated with this source file.\n\t//\n\t// For example, the source file \"dir/foo.proto\" might have a filename prefix\n\t// of \"dir/foo\". Appending \".pb.go\" produces an output file of \"dir/foo.pb.go\".\n\tGeneratedFilenamePrefix string\n\n\tlocation Location\n}\n\nfunc newFile(gen *Plugin, p *descriptorpb.FileDescriptorProto, packageName GoPackageName, importPath GoImportPath) (*File, error) {\n\tdesc, err := protodesc.NewFile(p, gen.fileReg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid FileDescriptorProto %q: %v\", p.GetName(), err)\n\t}\n\tif err := gen.fileReg.RegisterFile(desc); err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot register descriptor %q: %v\", p.GetName(), err)\n\t}\n\tf := &File{\n\t\tDesc:          desc,\n\t\tProto:         p,\n\t\tGoPackageName: packageName,\n\t\tGoImportPath:  importPath,\n\t\tlocation:      Location{SourceFile: desc.Path()},\n\t}\n\n\t// Determine the prefix for generated Go files.\n\tprefix := p.GetName()\n\tif ext := path.Ext(prefix); ext == \".proto\" || ext == \".protodevel\" {\n\t\tprefix = prefix[:len(prefix)-len(ext)]\n\t}\n\tswitch gen.pathType {\n\tcase pathTypeImport:\n\t\t// If paths=import, the output filename is derived from the Go import path.\n\t\tprefix = path.Join(string(f.GoImportPath), path.Base(prefix))\n\tcase pathTypeSourceRelative:\n\t\t// If paths=source_relative, the output filename is derived from\n\t\t// the input filename.\n\t}\n\tf.GoDescriptorIdent = GoIdent{\n\t\tGoName:       \"File_\" + strs.GoSanitized(p.GetName()),\n\t\tGoImportPath: f.GoImportPath,\n\t}\n\tf.GeneratedFilenamePrefix = prefix\n\n\tfor i, eds := 0, desc.Enums(); i < eds.Len(); i++ {\n\t\tf.Enums = append(f.Enums, newEnum(gen, f, nil, eds.Get(i)))\n\t}\n\tfor i, mds := 0, desc.Messages(); i < mds.Len(); i++ {\n\t\tf.Messages = append(f.Messages, newMessage(gen, f, nil, mds.Get(i)))\n\t}\n\tfor i, xds := 0, desc.Extensions(); i < xds.Len(); i++ {\n\t\tf.Extensions = append(f.Extensions, newField(gen, f, nil, xds.Get(i)))\n\t}\n\tfor i, sds := 0, desc.Services(); i < sds.Len(); i++ {\n\t\tf.Services = append(f.Services, newService(gen, f, sds.Get(i)))\n\t}\n\tfor _, message := range f.Messages {\n\t\tif err := message.resolveDependencies(gen); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tfor _, extension := range f.Extensions {\n\t\tif err := extension.resolveDependencies(gen); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tfor _, service := range f.Services {\n\t\tfor _, method := range service.Methods {\n\t\t\tif err := method.resolveDependencies(gen); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\treturn f, nil\n}\n\n// splitImportPathAndPackageName splits off the optional Go package name\n// from the Go import path when seperated by a ';' delimiter.\nfunc splitImportPathAndPackageName(s string) (GoImportPath, GoPackageName) {\n\tif i := strings.Index(s, \";\"); i >= 0 {\n\t\treturn GoImportPath(s[:i]), GoPackageName(s[i+1:])\n\t}\n\treturn GoImportPath(s), \"\"\n}\n\n// An Enum describes an enum.\ntype Enum struct {\n\tDesc protoreflect.EnumDescriptor\n\n\tGoIdent GoIdent // name of the generated Go type\n\n\tValues []*EnumValue // enum value declarations\n\n\tLocation Location   // location of this enum\n\tComments CommentSet // comments associated with this enum\n}\n\nfunc newEnum(gen *Plugin, f *File, parent *Message, desc protoreflect.EnumDescriptor) *Enum {\n\tvar loc Location\n\tif parent != nil {\n\t\tloc = parent.Location.appendPath(genid.DescriptorProto_EnumType_field_number, desc.Index())\n\t} else {\n\t\tloc = f.location.appendPath(genid.FileDescriptorProto_EnumType_field_number, desc.Index())\n\t}\n\tenum := &Enum{\n\t\tDesc:     desc,\n\t\tGoIdent:  newGoIdent(f, desc),\n\t\tLocation: loc,\n\t\tComments: makeCommentSet(f.Desc.SourceLocations().ByDescriptor(desc)),\n\t}\n\tgen.enumsByName[desc.FullName()] = enum\n\tfor i, vds := 0, enum.Desc.Values(); i < vds.Len(); i++ {\n\t\tenum.Values = append(enum.Values, newEnumValue(gen, f, parent, enum, vds.Get(i)))\n\t}\n\treturn enum\n}\n\n// An EnumValue describes an enum value.\ntype EnumValue struct {\n\tDesc protoreflect.EnumValueDescriptor\n\n\tGoIdent GoIdent // name of the generated Go declaration\n\n\tParent *Enum // enum in which this value is declared\n\n\tLocation Location   // location of this enum value\n\tComments CommentSet // comments associated with this enum value\n}\n\nfunc newEnumValue(gen *Plugin, f *File, message *Message, enum *Enum, desc protoreflect.EnumValueDescriptor) *EnumValue {\n\t// A top-level enum value's name is: EnumName_ValueName\n\t// An enum value contained in a message is: MessageName_ValueName\n\t//\n\t// For historical reasons, enum value names are not camel-cased.\n\tparentIdent := enum.GoIdent\n\tif message != nil {\n\t\tparentIdent = message.GoIdent\n\t}\n\tname := parentIdent.GoName + \"_\" + string(desc.Name())\n\tloc := enum.Location.appendPath(genid.EnumDescriptorProto_Value_field_number, desc.Index())\n\treturn &EnumValue{\n\t\tDesc:     desc,\n\t\tGoIdent:  f.GoImportPath.Ident(name),\n\t\tParent:   enum,\n\t\tLocation: loc,\n\t\tComments: makeCommentSet(f.Desc.SourceLocations().ByDescriptor(desc)),\n\t}\n}\n\n// A Message describes a message.\ntype Message struct {\n\tDesc protoreflect.MessageDescriptor\n\n\tGoIdent GoIdent // name of the generated Go type\n\n\tFields []*Field // message field declarations\n\tOneofs []*Oneof // message oneof declarations\n\n\tEnums      []*Enum      // nested enum declarations\n\tMessages   []*Message   // nested message declarations\n\tExtensions []*Extension // nested extension declarations\n\n\tLocation Location   // location of this message\n\tComments CommentSet // comments associated with this message\n}\n\nfunc newMessage(gen *Plugin, f *File, parent *Message, desc protoreflect.MessageDescriptor) *Message {\n\tvar loc Location\n\tif parent != nil {\n\t\tloc = parent.Location.appendPath(genid.DescriptorProto_NestedType_field_number, desc.Index())\n\t} else {\n\t\tloc = f.location.appendPath(genid.FileDescriptorProto_MessageType_field_number, desc.Index())\n\t}\n\tmessage := &Message{\n\t\tDesc:     desc,\n\t\tGoIdent:  newGoIdent(f, desc),\n\t\tLocation: loc,\n\t\tComments: makeCommentSet(f.Desc.SourceLocations().ByDescriptor(desc)),\n\t}\n\tgen.messagesByName[desc.FullName()] = message\n\tfor i, eds := 0, desc.Enums(); i < eds.Len(); i++ {\n\t\tmessage.Enums = append(message.Enums, newEnum(gen, f, message, eds.Get(i)))\n\t}\n\tfor i, mds := 0, desc.Messages(); i < mds.Len(); i++ {\n\t\tmessage.Messages = append(message.Messages, newMessage(gen, f, message, mds.Get(i)))\n\t}\n\tfor i, fds := 0, desc.Fields(); i < fds.Len(); i++ {\n\t\tmessage.Fields = append(message.Fields, newField(gen, f, message, fds.Get(i)))\n\t}\n\tfor i, ods := 0, desc.Oneofs(); i < ods.Len(); i++ {\n\t\tmessage.Oneofs = append(message.Oneofs, newOneof(gen, f, message, ods.Get(i)))\n\t}\n\tfor i, xds := 0, desc.Extensions(); i < xds.Len(); i++ {\n\t\tmessage.Extensions = append(message.Extensions, newField(gen, f, message, xds.Get(i)))\n\t}\n\n\t// Resolve local references between fields and oneofs.\n\tfor _, field := range message.Fields {\n\t\tif od := field.Desc.ContainingOneof(); od != nil {\n\t\t\toneof := message.Oneofs[od.Index()]\n\t\t\tfield.Oneof = oneof\n\t\t\toneof.Fields = append(oneof.Fields, field)\n\t\t}\n\t}\n\n\t// Field name conflict resolution.\n\t//\n\t// We assume well-known method names that may be attached to a generated\n\t// message type, as well as a 'Get*' method for each field. For each\n\t// field in turn, we add _s to its name until there are no conflicts.\n\t//\n\t// Any change to the following set of method names is a potential\n\t// incompatible API change because it may change generated field names.\n\t//\n\t// TODO: If we ever support a 'go_name' option to set the Go name of a\n\t// field, we should consider dropping this entirely. The conflict\n\t// resolution algorithm is subtle and surprising (changing the order\n\t// in which fields appear in the .proto source file can change the\n\t// names of fields in generated code), and does not adapt well to\n\t// adding new per-field methods such as setters.\n\tusedNames := map[string]bool{\n\t\t\"Reset\":               true,\n\t\t\"String\":              true,\n\t\t\"ProtoMessage\":        true,\n\t\t\"Marshal\":             true,\n\t\t\"Unmarshal\":           true,\n\t\t\"ExtensionRangeArray\": true,\n\t\t\"ExtensionMap\":        true,\n\t\t\"Descriptor\":          true,\n\t}\n\tmakeNameUnique := func(name string, hasGetter bool) string {\n\t\tfor usedNames[name] || (hasGetter && usedNames[\"Get\"+name]) {\n\t\t\tname += \"_\"\n\t\t}\n\t\tusedNames[name] = true\n\t\tusedNames[\"Get\"+name] = hasGetter\n\t\treturn name\n\t}\n\tfor _, field := range message.Fields {\n\t\tfield.GoName = makeNameUnique(field.GoName, true)\n\t\tfield.GoIdent.GoName = message.GoIdent.GoName + \"_\" + field.GoName\n\t\tif field.Oneof != nil && field.Oneof.Fields[0] == field {\n\t\t\t// Make the name for a oneof unique as well. For historical reasons,\n\t\t\t// this assumes that a getter method is not generated for oneofs.\n\t\t\t// This is incorrect, but fixing it breaks existing code.\n\t\t\tfield.Oneof.GoName = makeNameUnique(field.Oneof.GoName, false)\n\t\t\tfield.Oneof.GoIdent.GoName = message.GoIdent.GoName + \"_\" + field.Oneof.GoName\n\t\t}\n\t}\n\n\t// Oneof field name conflict resolution.\n\t//\n\t// This conflict resolution is incomplete as it does not consider collisions\n\t// with other oneof field types, but fixing it breaks existing code.\n\tfor _, field := range message.Fields {\n\t\tif field.Oneof != nil {\n\t\tLoop:\n\t\t\tfor {\n\t\t\t\tfor _, nestedMessage := range message.Messages {\n\t\t\t\t\tif nestedMessage.GoIdent == field.GoIdent {\n\t\t\t\t\t\tfield.GoIdent.GoName += \"_\"\n\t\t\t\t\t\tcontinue Loop\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, nestedEnum := range message.Enums {\n\t\t\t\t\tif nestedEnum.GoIdent == field.GoIdent {\n\t\t\t\t\t\tfield.GoIdent.GoName += \"_\"\n\t\t\t\t\t\tcontinue Loop\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak Loop\n\t\t\t}\n\t\t}\n\t}\n\n\treturn message\n}\n\nfunc (message *Message) resolveDependencies(gen *Plugin) error {\n\tfor _, field := range message.Fields {\n\t\tif err := field.resolveDependencies(gen); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfor _, message := range message.Messages {\n\t\tif err := message.resolveDependencies(gen); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfor _, extension := range message.Extensions {\n\t\tif err := extension.resolveDependencies(gen); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// A Field describes a message field.\ntype Field struct {\n\tDesc protoreflect.FieldDescriptor\n\n\t// GoName is the base name of this field's Go field and methods.\n\t// For code generated by protoc-gen-go, this means a field named\n\t// '{{GoName}}' and a getter method named 'Get{{GoName}}'.\n\tGoName string // e.g., \"FieldName\"\n\n\t// GoIdent is the base name of a top-level declaration for this field.\n\t// For code generated by protoc-gen-go, this means a wrapper type named\n\t// '{{GoIdent}}' for members fields of a oneof, and a variable named\n\t// 'E_{{GoIdent}}' for extension fields.\n\tGoIdent GoIdent // e.g., \"MessageName_FieldName\"\n\n\tParent   *Message // message in which this field is declared; nil if top-level extension\n\tOneof    *Oneof   // containing oneof; nil if not part of a oneof\n\tExtendee *Message // extended message for extension fields; nil otherwise\n\n\tEnum    *Enum    // type for enum fields; nil otherwise\n\tMessage *Message // type for message or group fields; nil otherwise\n\n\tLocation Location   // location of this field\n\tComments CommentSet // comments associated with this field\n}\n\nfunc newField(gen *Plugin, f *File, message *Message, desc protoreflect.FieldDescriptor) *Field {\n\tvar loc Location\n\tswitch {\n\tcase desc.IsExtension() && message == nil:\n\t\tloc = f.location.appendPath(genid.FileDescriptorProto_Extension_field_number, desc.Index())\n\tcase desc.IsExtension() && message != nil:\n\t\tloc = message.Location.appendPath(genid.DescriptorProto_Extension_field_number, desc.Index())\n\tdefault:\n\t\tloc = message.Location.appendPath(genid.DescriptorProto_Field_field_number, desc.Index())\n\t}\n\tcamelCased := strs.GoCamelCase(string(desc.Name()))\n\tvar parentPrefix string\n\tif message != nil {\n\t\tparentPrefix = message.GoIdent.GoName + \"_\"\n\t}\n\tfield := &Field{\n\t\tDesc:   desc,\n\t\tGoName: camelCased,\n\t\tGoIdent: GoIdent{\n\t\t\tGoImportPath: f.GoImportPath,\n\t\t\tGoName:       parentPrefix + camelCased,\n\t\t},\n\t\tParent:   message,\n\t\tLocation: loc,\n\t\tComments: makeCommentSet(f.Desc.SourceLocations().ByDescriptor(desc)),\n\t}\n\treturn field\n}\n\nfunc (field *Field) resolveDependencies(gen *Plugin) error {\n\tdesc := field.Desc\n\tswitch desc.Kind() {\n\tcase protoreflect.EnumKind:\n\t\tname := field.Desc.Enum().FullName()\n\t\tenum, ok := gen.enumsByName[name]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"field %v: no descriptor for enum %v\", desc.FullName(), name)\n\t\t}\n\t\tfield.Enum = enum\n\tcase protoreflect.MessageKind, protoreflect.GroupKind:\n\t\tname := desc.Message().FullName()\n\t\tmessage, ok := gen.messagesByName[name]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"field %v: no descriptor for type %v\", desc.FullName(), name)\n\t\t}\n\t\tfield.Message = message\n\t}\n\tif desc.IsExtension() {\n\t\tname := desc.ContainingMessage().FullName()\n\t\tmessage, ok := gen.messagesByName[name]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"field %v: no descriptor for type %v\", desc.FullName(), name)\n\t\t}\n\t\tfield.Extendee = message\n\t}\n\treturn nil\n}\n\n// A Oneof describes a message oneof.\ntype Oneof struct {\n\tDesc protoreflect.OneofDescriptor\n\n\t// GoName is the base name of this oneof's Go field and methods.\n\t// For code generated by protoc-gen-go, this means a field named\n\t// '{{GoName}}' and a getter method named 'Get{{GoName}}'.\n\tGoName string // e.g., \"OneofName\"\n\n\t// GoIdent is the base name of a top-level declaration for this oneof.\n\tGoIdent GoIdent // e.g., \"MessageName_OneofName\"\n\n\tParent *Message // message in which this oneof is declared\n\n\tFields []*Field // fields that are part of this oneof\n\n\tLocation Location   // location of this oneof\n\tComments CommentSet // comments associated with this oneof\n}\n\nfunc newOneof(gen *Plugin, f *File, message *Message, desc protoreflect.OneofDescriptor) *Oneof {\n\tloc := message.Location.appendPath(genid.DescriptorProto_OneofDecl_field_number, desc.Index())\n\tcamelCased := strs.GoCamelCase(string(desc.Name()))\n\tparentPrefix := message.GoIdent.GoName + \"_\"\n\treturn &Oneof{\n\t\tDesc:   desc,\n\t\tParent: message,\n\t\tGoName: camelCased,\n\t\tGoIdent: GoIdent{\n\t\t\tGoImportPath: f.GoImportPath,\n\t\t\tGoName:       parentPrefix + camelCased,\n\t\t},\n\t\tLocation: loc,\n\t\tComments: makeCommentSet(f.Desc.SourceLocations().ByDescriptor(desc)),\n\t}\n}\n\n// Extension is an alias of Field for documentation.\ntype Extension = Field\n\n// A Service describes a service.\ntype Service struct {\n\tDesc protoreflect.ServiceDescriptor\n\n\tGoName string\n\n\tMethods []*Method // service method declarations\n\n\tLocation Location   // location of this service\n\tComments CommentSet // comments associated with this service\n}\n\nfunc newService(gen *Plugin, f *File, desc protoreflect.ServiceDescriptor) *Service {\n\tloc := f.location.appendPath(genid.FileDescriptorProto_Service_field_number, desc.Index())\n\tservice := &Service{\n\t\tDesc:     desc,\n\t\tGoName:   strs.GoCamelCase(string(desc.Name())),\n\t\tLocation: loc,\n\t\tComments: makeCommentSet(f.Desc.SourceLocations().ByDescriptor(desc)),\n\t}\n\tfor i, mds := 0, desc.Methods(); i < mds.Len(); i++ {\n\t\tservice.Methods = append(service.Methods, newMethod(gen, f, service, mds.Get(i)))\n\t}\n\treturn service\n}\n\n// A Method describes a method in a service.\ntype Method struct {\n\tDesc protoreflect.MethodDescriptor\n\n\tGoName string\n\n\tParent *Service // service in which this method is declared\n\n\tInput  *Message\n\tOutput *Message\n\n\tLocation Location   // location of this method\n\tComments CommentSet // comments associated with this method\n}\n\nfunc newMethod(gen *Plugin, f *File, service *Service, desc protoreflect.MethodDescriptor) *Method {\n\tloc := service.Location.appendPath(genid.ServiceDescriptorProto_Method_field_number, desc.Index())\n\tmethod := &Method{\n\t\tDesc:     desc,\n\t\tGoName:   strs.GoCamelCase(string(desc.Name())),\n\t\tParent:   service,\n\t\tLocation: loc,\n\t\tComments: makeCommentSet(f.Desc.SourceLocations().ByDescriptor(desc)),\n\t}\n\treturn method\n}\n\nfunc (method *Method) resolveDependencies(gen *Plugin) error {\n\tdesc := method.Desc\n\n\tinName := desc.Input().FullName()\n\tin, ok := gen.messagesByName[inName]\n\tif !ok {\n\t\treturn fmt.Errorf(\"method %v: no descriptor for type %v\", desc.FullName(), inName)\n\t}\n\tmethod.Input = in\n\n\toutName := desc.Output().FullName()\n\tout, ok := gen.messagesByName[outName]\n\tif !ok {\n\t\treturn fmt.Errorf(\"method %v: no descriptor for type %v\", desc.FullName(), outName)\n\t}\n\tmethod.Output = out\n\n\treturn nil\n}\n\n// A GeneratedFile is a generated file.\ntype GeneratedFile struct {\n\tgen              *Plugin\n\tskip             bool\n\tfilename         string\n\tgoImportPath     GoImportPath\n\tbuf              bytes.Buffer\n\tpackageNames     map[GoImportPath]GoPackageName\n\tusedPackageNames map[GoPackageName]bool\n\tmanualImports    map[GoImportPath]bool\n\tannotations      map[string][]Location\n}\n\n// NewGeneratedFile creates a new generated file with the given filename\n// and import path.\nfunc (gen *Plugin) NewGeneratedFile(filename string, goImportPath GoImportPath) *GeneratedFile {\n\tg := &GeneratedFile{\n\t\tgen:              gen,\n\t\tfilename:         filename,\n\t\tgoImportPath:     goImportPath,\n\t\tpackageNames:     make(map[GoImportPath]GoPackageName),\n\t\tusedPackageNames: make(map[GoPackageName]bool),\n\t\tmanualImports:    make(map[GoImportPath]bool),\n\t\tannotations:      make(map[string][]Location),\n\t}\n\n\t// All predeclared identifiers in Go are already used.\n\tfor _, s := range types.Universe.Names() {\n\t\tg.usedPackageNames[GoPackageName(s)] = true\n\t}\n\n\tgen.genFiles = append(gen.genFiles, g)\n\treturn g\n}\n\n// P prints a line to the generated output. It converts each parameter to a\n// string following the same rules as fmt.Print. It never inserts spaces\n// between parameters.\nfunc (g *GeneratedFile) P(v ...interface{}) {\n\tfor _, x := range v {\n\t\tswitch x := x.(type) {\n\t\tcase GoIdent:\n\t\t\tfmt.Fprint(&g.buf, g.QualifiedGoIdent(x))\n\t\tdefault:\n\t\t\tfmt.Fprint(&g.buf, x)\n\t\t}\n\t}\n\tfmt.Fprintln(&g.buf)\n}\n\n// QualifiedGoIdent returns the string to use for a Go identifier.\n//\n// If the identifier is from a different Go package than the generated file,\n// the returned name will be qualified (package.name) and an import statement\n// for the identifier's package will be included in the file.\nfunc (g *GeneratedFile) QualifiedGoIdent(ident GoIdent) string {\n\tif ident.GoImportPath == g.goImportPath {\n\t\treturn ident.GoName\n\t}\n\tif packageName, ok := g.packageNames[ident.GoImportPath]; ok {\n\t\treturn string(packageName) + \".\" + ident.GoName\n\t}\n\tpackageName := cleanPackageName(path.Base(string(ident.GoImportPath)))\n\tfor i, orig := 1, packageName; g.usedPackageNames[packageName]; i++ {\n\t\tpackageName = orig + GoPackageName(strconv.Itoa(i))\n\t}\n\tg.packageNames[ident.GoImportPath] = packageName\n\tg.usedPackageNames[packageName] = true\n\treturn string(packageName) + \".\" + ident.GoName\n}\n\n// Import ensures a package is imported by the generated file.\n//\n// Packages referenced by QualifiedGoIdent are automatically imported.\n// Explicitly importing a package with Import is generally only necessary\n// when the import will be blank (import _ \"package\").\nfunc (g *GeneratedFile) Import(importPath GoImportPath) {\n\tg.manualImports[importPath] = true\n}\n\n// Write implements io.Writer.\nfunc (g *GeneratedFile) Write(p []byte) (n int, err error) {\n\treturn g.buf.Write(p)\n}\n\n// Skip removes the generated file from the plugin output.\nfunc (g *GeneratedFile) Skip() {\n\tg.skip = true\n}\n\n// Unskip reverts a previous call to Skip, re-including the generated file in\n// the plugin output.\nfunc (g *GeneratedFile) Unskip() {\n\tg.skip = false\n}\n\n// Annotate associates a symbol in a generated Go file with a location in a\n// source .proto file.\n//\n// The symbol may refer to a type, constant, variable, function, method, or\n// struct field.  The \"T.sel\" syntax is used to identify the method or field\n// 'sel' on type 'T'.\nfunc (g *GeneratedFile) Annotate(symbol string, loc Location) {\n\tg.annotations[symbol] = append(g.annotations[symbol], loc)\n}\n\n// Content returns the contents of the generated file.\nfunc (g *GeneratedFile) Content() ([]byte, error) {\n\tif !strings.HasSuffix(g.filename, \".go\") {\n\t\treturn g.buf.Bytes(), nil\n\t}\n\n\t// Reformat generated code.\n\toriginal := g.buf.Bytes()\n\tfset := token.NewFileSet()\n\tfile, 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\treturn nil, fmt.Errorf(\"%v: unparsable Go source: %v\\n%v\", g.filename, err, src.String())\n\t}\n\n\t// Collect a sorted list of all imports.\n\tvar importPaths [][2]string\n\trewriteImport := func(importPath string) string {\n\t\tif f := g.gen.opts.ImportRewriteFunc; f != nil {\n\t\t\treturn string(f(GoImportPath(importPath)))\n\t\t}\n\t\treturn importPath\n\t}\n\tfor importPath := range g.packageNames {\n\t\tpkgName := string(g.packageNames[GoImportPath(importPath)])\n\t\tpkgPath := rewriteImport(string(importPath))\n\t\timportPaths = append(importPaths, [2]string{pkgName, pkgPath})\n\t}\n\tfor importPath := range g.manualImports {\n\t\tif _, ok := g.packageNames[importPath]; !ok {\n\t\t\tpkgPath := rewriteImport(string(importPath))\n\t\t\timportPaths = append(importPaths, [2]string{\"_\", pkgPath})\n\t\t}\n\t}\n\tsort.Slice(importPaths, func(i, j int) bool {\n\t\treturn importPaths[i][1] < importPaths[j][1]\n\t})\n\n\t// Modify the AST to include a new import block.\n\tif len(importPaths) > 0 {\n\t\t// Insert block after package statement or\n\t\t// possible comment attached to the end of the package statement.\n\t\tpos := file.Package\n\t\ttokFile := fset.File(file.Package)\n\t\tpkgLine := tokFile.Line(file.Package)\n\t\tfor _, c := range file.Comments {\n\t\t\tif tokFile.Line(c.Pos()) > pkgLine {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tpos = c.End()\n\t\t}\n\n\t\t// Construct the import block.\n\t\timpDecl := &ast.GenDecl{\n\t\t\tTok:    token.IMPORT,\n\t\t\tTokPos: pos,\n\t\t\tLparen: pos,\n\t\t\tRparen: pos,\n\t\t}\n\t\tfor _, importPath := range importPaths {\n\t\t\timpDecl.Specs = append(impDecl.Specs, &ast.ImportSpec{\n\t\t\t\tName: &ast.Ident{\n\t\t\t\t\tName:    importPath[0],\n\t\t\t\t\tNamePos: pos,\n\t\t\t\t},\n\t\t\t\tPath: &ast.BasicLit{\n\t\t\t\t\tKind:     token.STRING,\n\t\t\t\t\tValue:    strconv.Quote(importPath[1]),\n\t\t\t\t\tValuePos: pos,\n\t\t\t\t},\n\t\t\t\tEndPos: pos,\n\t\t\t})\n\t\t}\n\t\tfile.Decls = append([]ast.Decl{impDecl}, file.Decls...)\n\t}\n\n\tvar out bytes.Buffer\n\tif err = (&printer.Config{Mode: printer.TabIndent | printer.UseSpaces, Tabwidth: 8}).Fprint(&out, fset, file); err != nil {\n\t\treturn nil, fmt.Errorf(\"%v: can not reformat Go source: %v\", g.filename, err)\n\t}\n\treturn out.Bytes(), nil\n}\n\n// metaFile returns the contents of the file's metadata file, which is a\n// text formatted string of the google.protobuf.GeneratedCodeInfo.\nfunc (g *GeneratedFile) metaFile(content []byte) (string, error) {\n\tfset := token.NewFileSet()\n\tastFile, err := parser.ParseFile(fset, \"\", content, 0)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tinfo := &descriptorpb.GeneratedCodeInfo{}\n\n\tseenAnnotations := make(map[string]bool)\n\tannotate := func(s string, ident *ast.Ident) {\n\t\tseenAnnotations[s] = true\n\t\tfor _, loc := range g.annotations[s] {\n\t\t\tinfo.Annotation = append(info.Annotation, &descriptorpb.GeneratedCodeInfo_Annotation{\n\t\t\t\tSourceFile: proto.String(loc.SourceFile),\n\t\t\t\tPath:       loc.Path,\n\t\t\t\tBegin:      proto.Int32(int32(fset.Position(ident.Pos()).Offset)),\n\t\t\t\tEnd:        proto.Int32(int32(fset.Position(ident.End()).Offset)),\n\t\t\t})\n\t\t}\n\t}\n\tfor _, decl := range astFile.Decls {\n\t\tswitch decl := decl.(type) {\n\t\tcase *ast.GenDecl:\n\t\t\tfor _, spec := range decl.Specs {\n\t\t\t\tswitch spec := spec.(type) {\n\t\t\t\tcase *ast.TypeSpec:\n\t\t\t\t\tannotate(spec.Name.Name, spec.Name)\n\t\t\t\t\tswitch st := spec.Type.(type) {\n\t\t\t\t\tcase *ast.StructType:\n\t\t\t\t\t\tfor _, field := range st.Fields.List {\n\t\t\t\t\t\t\tfor _, name := range field.Names {\n\t\t\t\t\t\t\t\tannotate(spec.Name.Name+\".\"+name.Name, name)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tcase *ast.InterfaceType:\n\t\t\t\t\t\tfor _, field := range st.Methods.List {\n\t\t\t\t\t\t\tfor _, name := range field.Names {\n\t\t\t\t\t\t\t\tannotate(spec.Name.Name+\".\"+name.Name, name)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tcase *ast.ValueSpec:\n\t\t\t\t\tfor _, name := range spec.Names {\n\t\t\t\t\t\tannotate(name.Name, name)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase *ast.FuncDecl:\n\t\t\tif decl.Recv == nil {\n\t\t\t\tannotate(decl.Name.Name, decl.Name)\n\t\t\t} else {\n\t\t\t\trecv := decl.Recv.List[0].Type\n\t\t\t\tif s, ok := recv.(*ast.StarExpr); ok {\n\t\t\t\t\trecv = s.X\n\t\t\t\t}\n\t\t\t\tif id, ok := recv.(*ast.Ident); ok {\n\t\t\t\t\tannotate(id.Name+\".\"+decl.Name.Name, decl.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfor a := range g.annotations {\n\t\tif !seenAnnotations[a] {\n\t\t\treturn \"\", fmt.Errorf(\"%v: no symbol matching annotation %q\", g.filename, a)\n\t\t}\n\t}\n\n\tb, err := prototext.Marshal(info)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(b), nil\n}\n\n// A GoIdent is a Go identifier, consisting of a name and import path.\n// The name is a single identifier and may not be a dot-qualified selector.\ntype GoIdent struct {\n\tGoName       string\n\tGoImportPath GoImportPath\n}\n\nfunc (id GoIdent) String() string { return fmt.Sprintf(\"%q.%v\", id.GoImportPath, id.GoName) }\n\n// newGoIdent returns the Go identifier for a descriptor.\nfunc newGoIdent(f *File, d protoreflect.Descriptor) GoIdent {\n\tname := strings.TrimPrefix(string(d.FullName()), string(f.Desc.Package())+\".\")\n\treturn GoIdent{\n\t\tGoName:       strs.GoCamelCase(name),\n\t\tGoImportPath: f.GoImportPath,\n\t}\n}\n\n// A GoImportPath is the import path of a Go package.\n// For example: \"google.golang.org/protobuf/compiler/protogen\"\ntype GoImportPath string\n\nfunc (p GoImportPath) String() string { return strconv.Quote(string(p)) }\n\n// Ident returns a GoIdent with s as the GoName and p as the GoImportPath.\nfunc (p GoImportPath) Ident(s string) GoIdent {\n\treturn GoIdent{GoName: s, GoImportPath: p}\n}\n\n// A GoPackageName is the name of a Go package. e.g., \"protobuf\".\ntype GoPackageName string\n\n// cleanPackageName converts a string to a valid Go package name.\nfunc cleanPackageName(name string) GoPackageName {\n\treturn GoPackageName(strs.GoSanitized(name))\n}\n\ntype pathType int\n\nconst (\n\tpathTypeImport pathType = iota\n\tpathTypeSourceRelative\n)\n\n// A Location is a location in a .proto source file.\n//\n// See the google.protobuf.SourceCodeInfo documentation in descriptor.proto\n// for details.\ntype Location struct {\n\tSourceFile string\n\tPath       protoreflect.SourcePath\n}\n\n// appendPath add elements to a Location's path, returning a new Location.\nfunc (loc Location) appendPath(num protoreflect.FieldNumber, idx int) Location {\n\tloc.Path = append(protoreflect.SourcePath(nil), loc.Path...) // make copy\n\tloc.Path = append(loc.Path, int32(num), int32(idx))\n\treturn loc\n}\n\n// CommentSet is a set of leading and trailing comments associated\n// with a .proto descriptor declaration.\ntype CommentSet struct {\n\tLeadingDetached []Comments\n\tLeading         Comments\n\tTrailing        Comments\n}\n\nfunc makeCommentSet(loc protoreflect.SourceLocation) CommentSet {\n\tvar leadingDetached []Comments\n\tfor _, s := range loc.LeadingDetachedComments {\n\t\tleadingDetached = append(leadingDetached, Comments(s))\n\t}\n\treturn CommentSet{\n\t\tLeadingDetached: leadingDetached,\n\t\tLeading:         Comments(loc.LeadingComments),\n\t\tTrailing:        Comments(loc.TrailingComments),\n\t}\n}\n\n// Comments is a comments string as provided by protoc.\ntype Comments string\n\n// String formats the comments by inserting // to the start of each line,\n// ensuring that there is a trailing newline.\n// An empty comment is formatted as an empty string.\nfunc (c Comments) String() string {\n\tif c == \"\" {\n\t\treturn \"\"\n\t}\n\tvar b []byte\n\tfor _, line := range strings.Split(strings.TrimSuffix(string(c), \"\\n\"), \"\\n\") {\n\t\tb = append(b, \"//\"...)\n\t\tb = append(b, line...)\n\t\tb = append(b, \"\\n\"...)\n\t}\n\treturn string(b)\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/encoding/prototext/decode.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 prototext\n\nimport (\n\t\"fmt\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/encoding/text\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/internal/set\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/proto\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// Unmarshal reads the given []byte into the given proto.Message.\n// The provided message must be mutable (e.g., a non-nil pointer to a message).\nfunc Unmarshal(b []byte, m proto.Message) error {\n\treturn UnmarshalOptions{}.Unmarshal(b, m)\n}\n\n// UnmarshalOptions is a configurable textproto format unmarshaler.\ntype UnmarshalOptions struct {\n\tpragma.NoUnkeyedLiterals\n\n\t// AllowPartial accepts input for messages that will result in missing\n\t// required fields. If AllowPartial is false (the default), Unmarshal will\n\t// return error if there are any missing required fields.\n\tAllowPartial bool\n\n\t// DiscardUnknown specifies whether to ignore unknown fields when parsing.\n\t// An unknown field is any field whose field name or field number does not\n\t// resolve to any known or extension field in the message.\n\t// By default, unmarshal rejects unknown fields as an error.\n\tDiscardUnknown bool\n\n\t// Resolver is used for looking up types when unmarshaling\n\t// google.protobuf.Any messages or extension fields.\n\t// If nil, this defaults to using protoregistry.GlobalTypes.\n\tResolver interface {\n\t\tprotoregistry.MessageTypeResolver\n\t\tprotoregistry.ExtensionTypeResolver\n\t}\n}\n\n// Unmarshal reads the given []byte and populates the given proto.Message\n// using options in the UnmarshalOptions object.\n// The provided message must be mutable (e.g., a non-nil pointer to a message).\nfunc (o UnmarshalOptions) Unmarshal(b []byte, m proto.Message) error {\n\treturn o.unmarshal(b, m)\n}\n\n// unmarshal is a centralized function that all unmarshal operations go through.\n// For profiling purposes, avoid changing the name of this function or\n// introducing other code paths for unmarshal that do not go through this.\nfunc (o UnmarshalOptions) unmarshal(b []byte, m proto.Message) error {\n\tproto.Reset(m)\n\n\tif o.Resolver == nil {\n\t\to.Resolver = protoregistry.GlobalTypes\n\t}\n\n\tdec := decoder{text.NewDecoder(b), o}\n\tif err := dec.unmarshalMessage(m.ProtoReflect(), false); err != nil {\n\t\treturn err\n\t}\n\tif o.AllowPartial {\n\t\treturn nil\n\t}\n\treturn proto.CheckInitialized(m)\n}\n\ntype decoder struct {\n\t*text.Decoder\n\topts UnmarshalOptions\n}\n\n// newError returns an error object with position info.\nfunc (d decoder) newError(pos int, f string, x ...interface{}) error {\n\tline, column := d.Position(pos)\n\thead := fmt.Sprintf(\"(line %d:%d): \", line, column)\n\treturn errors.New(head+f, x...)\n}\n\n// unexpectedTokenError returns a syntax error for the given unexpected token.\nfunc (d decoder) unexpectedTokenError(tok text.Token) error {\n\treturn d.syntaxError(tok.Pos(), \"unexpected token: %s\", tok.RawString())\n}\n\n// syntaxError returns a syntax error for given position.\nfunc (d decoder) syntaxError(pos int, f string, x ...interface{}) error {\n\tline, column := d.Position(pos)\n\thead := fmt.Sprintf(\"syntax error (line %d:%d): \", line, column)\n\treturn errors.New(head+f, x...)\n}\n\n// unmarshalMessage unmarshals into the given protoreflect.Message.\nfunc (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error {\n\tmessageDesc := m.Descriptor()\n\tif !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {\n\t\treturn errors.New(\"no support for proto1 MessageSets\")\n\t}\n\n\tif messageDesc.FullName() == genid.Any_message_fullname {\n\t\treturn d.unmarshalAny(m, checkDelims)\n\t}\n\n\tif checkDelims {\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif tok.Kind() != text.MessageOpen {\n\t\t\treturn d.unexpectedTokenError(tok)\n\t\t}\n\t}\n\n\tvar seenNums set.Ints\n\tvar seenOneofs set.Ints\n\tfieldDescs := messageDesc.Fields()\n\n\tfor {\n\t\t// Read field name.\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch typ := tok.Kind(); typ {\n\t\tcase text.Name:\n\t\t\t// Continue below.\n\t\tcase text.EOF:\n\t\t\tif checkDelims {\n\t\t\t\treturn text.ErrUnexpectedEOF\n\t\t\t}\n\t\t\treturn nil\n\t\tdefault:\n\t\t\tif checkDelims && typ == text.MessageClose {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn d.unexpectedTokenError(tok)\n\t\t}\n\n\t\t// Resolve the field descriptor.\n\t\tvar name pref.Name\n\t\tvar fd pref.FieldDescriptor\n\t\tvar xt pref.ExtensionType\n\t\tvar xtErr error\n\t\tvar isFieldNumberName bool\n\n\t\tswitch tok.NameKind() {\n\t\tcase text.IdentName:\n\t\t\tname = pref.Name(tok.IdentName())\n\t\t\tfd = fieldDescs.ByTextName(string(name))\n\n\t\tcase text.TypeName:\n\t\t\t// Handle extensions only. This code path is not for Any.\n\t\t\txt, xtErr = d.opts.Resolver.FindExtensionByName(pref.FullName(tok.TypeName()))\n\n\t\tcase text.FieldNumber:\n\t\t\tisFieldNumberName = true\n\t\t\tnum := pref.FieldNumber(tok.FieldNumber())\n\t\t\tif !num.IsValid() {\n\t\t\t\treturn d.newError(tok.Pos(), \"invalid field number: %d\", num)\n\t\t\t}\n\t\t\tfd = fieldDescs.ByNumber(num)\n\t\t\tif fd == nil {\n\t\t\t\txt, xtErr = d.opts.Resolver.FindExtensionByNumber(messageDesc.FullName(), num)\n\t\t\t}\n\t\t}\n\n\t\tif xt != nil {\n\t\t\tfd = xt.TypeDescriptor()\n\t\t\tif !messageDesc.ExtensionRanges().Has(fd.Number()) || fd.ContainingMessage().FullName() != messageDesc.FullName() {\n\t\t\t\treturn d.newError(tok.Pos(), \"message %v cannot be extended by %v\", messageDesc.FullName(), fd.FullName())\n\t\t\t}\n\t\t} else if xtErr != nil && xtErr != protoregistry.NotFound {\n\t\t\treturn d.newError(tok.Pos(), \"unable to resolve [%s]: %v\", tok.RawString(), xtErr)\n\t\t}\n\t\tif flags.ProtoLegacy {\n\t\t\tif fd != nil && fd.IsWeak() && fd.Message().IsPlaceholder() {\n\t\t\t\tfd = nil // reset since the weak reference is not linked in\n\t\t\t}\n\t\t}\n\n\t\t// Handle unknown fields.\n\t\tif fd == nil {\n\t\t\tif d.opts.DiscardUnknown || messageDesc.ReservedNames().Has(name) {\n\t\t\t\td.skipValue()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn d.newError(tok.Pos(), \"unknown field: %v\", tok.RawString())\n\t\t}\n\n\t\t// Handle fields identified by field number.\n\t\tif isFieldNumberName {\n\t\t\t// TODO: Add an option to permit parsing field numbers.\n\t\t\t//\n\t\t\t// This requires careful thought as the MarshalOptions.EmitUnknown\n\t\t\t// option allows formatting unknown fields as the field number and the\n\t\t\t// best-effort textual representation of the field value.  In that case,\n\t\t\t// it may not be possible to unmarshal the value from a parser that does\n\t\t\t// have information about the unknown field.\n\t\t\treturn d.newError(tok.Pos(), \"cannot specify field by number: %v\", tok.RawString())\n\t\t}\n\n\t\tswitch {\n\t\tcase fd.IsList():\n\t\t\tkind := fd.Kind()\n\t\t\tif kind != pref.MessageKind && kind != pref.GroupKind && !tok.HasSeparator() {\n\t\t\t\treturn d.syntaxError(tok.Pos(), \"missing field separator :\")\n\t\t\t}\n\n\t\t\tlist := m.Mutable(fd).List()\n\t\t\tif err := d.unmarshalList(fd, list); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tcase fd.IsMap():\n\t\t\tmmap := m.Mutable(fd).Map()\n\t\t\tif err := d.unmarshalMap(fd, mmap); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tdefault:\n\t\t\tkind := fd.Kind()\n\t\t\tif kind != pref.MessageKind && kind != pref.GroupKind && !tok.HasSeparator() {\n\t\t\t\treturn d.syntaxError(tok.Pos(), \"missing field separator :\")\n\t\t\t}\n\n\t\t\t// If field is a oneof, check if it has already been set.\n\t\t\tif od := fd.ContainingOneof(); od != nil {\n\t\t\t\tidx := uint64(od.Index())\n\t\t\t\tif seenOneofs.Has(idx) {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"error parsing %q, oneof %v is already set\", tok.RawString(), od.FullName())\n\t\t\t\t}\n\t\t\t\tseenOneofs.Set(idx)\n\t\t\t}\n\n\t\t\tnum := uint64(fd.Number())\n\t\t\tif seenNums.Has(num) {\n\t\t\t\treturn d.newError(tok.Pos(), \"non-repeated field %q is repeated\", tok.RawString())\n\t\t\t}\n\n\t\t\tif err := d.unmarshalSingular(fd, m); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tseenNums.Set(num)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// unmarshalSingular unmarshals a non-repeated field value specified by the\n// given FieldDescriptor.\nfunc (d decoder) unmarshalSingular(fd pref.FieldDescriptor, m pref.Message) error {\n\tvar val pref.Value\n\tvar err error\n\tswitch fd.Kind() {\n\tcase pref.MessageKind, pref.GroupKind:\n\t\tval = m.NewField(fd)\n\t\terr = d.unmarshalMessage(val.Message(), true)\n\tdefault:\n\t\tval, err = d.unmarshalScalar(fd)\n\t}\n\tif err == nil {\n\t\tm.Set(fd, val)\n\t}\n\treturn err\n}\n\n// unmarshalScalar unmarshals a scalar/enum protoreflect.Value specified by the\n// given FieldDescriptor.\nfunc (d decoder) unmarshalScalar(fd pref.FieldDescriptor) (pref.Value, error) {\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn pref.Value{}, err\n\t}\n\n\tif tok.Kind() != text.Scalar {\n\t\treturn pref.Value{}, d.unexpectedTokenError(tok)\n\t}\n\n\tkind := fd.Kind()\n\tswitch kind {\n\tcase pref.BoolKind:\n\t\tif b, ok := tok.Bool(); ok {\n\t\t\treturn pref.ValueOfBool(b), nil\n\t\t}\n\n\tcase pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:\n\t\tif n, ok := tok.Int32(); ok {\n\t\t\treturn pref.ValueOfInt32(n), nil\n\t\t}\n\n\tcase pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:\n\t\tif n, ok := tok.Int64(); ok {\n\t\t\treturn pref.ValueOfInt64(n), nil\n\t\t}\n\n\tcase pref.Uint32Kind, pref.Fixed32Kind:\n\t\tif n, ok := tok.Uint32(); ok {\n\t\t\treturn pref.ValueOfUint32(n), nil\n\t\t}\n\n\tcase pref.Uint64Kind, pref.Fixed64Kind:\n\t\tif n, ok := tok.Uint64(); ok {\n\t\t\treturn pref.ValueOfUint64(n), nil\n\t\t}\n\n\tcase pref.FloatKind:\n\t\tif n, ok := tok.Float32(); ok {\n\t\t\treturn pref.ValueOfFloat32(n), nil\n\t\t}\n\n\tcase pref.DoubleKind:\n\t\tif n, ok := tok.Float64(); ok {\n\t\t\treturn pref.ValueOfFloat64(n), nil\n\t\t}\n\n\tcase pref.StringKind:\n\t\tif s, ok := tok.String(); ok {\n\t\t\tif strs.EnforceUTF8(fd) && !utf8.ValidString(s) {\n\t\t\t\treturn pref.Value{}, d.newError(tok.Pos(), \"contains invalid UTF-8\")\n\t\t\t}\n\t\t\treturn pref.ValueOfString(s), nil\n\t\t}\n\n\tcase pref.BytesKind:\n\t\tif b, ok := tok.String(); ok {\n\t\t\treturn pref.ValueOfBytes([]byte(b)), nil\n\t\t}\n\n\tcase pref.EnumKind:\n\t\tif lit, ok := tok.Enum(); ok {\n\t\t\t// Lookup EnumNumber based on name.\n\t\t\tif enumVal := fd.Enum().Values().ByName(pref.Name(lit)); enumVal != nil {\n\t\t\t\treturn pref.ValueOfEnum(enumVal.Number()), nil\n\t\t\t}\n\t\t}\n\t\tif num, ok := tok.Int32(); ok {\n\t\t\treturn pref.ValueOfEnum(pref.EnumNumber(num)), nil\n\t\t}\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"invalid scalar kind %v\", kind))\n\t}\n\n\treturn pref.Value{}, d.newError(tok.Pos(), \"invalid value for %v type: %v\", kind, tok.RawString())\n}\n\n// unmarshalList unmarshals into given protoreflect.List. A list value can\n// either be in [] syntax or simply just a single scalar/message value.\nfunc (d decoder) unmarshalList(fd pref.FieldDescriptor, list pref.List) error {\n\ttok, err := d.Peek()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch fd.Kind() {\n\tcase pref.MessageKind, pref.GroupKind:\n\t\tswitch tok.Kind() {\n\t\tcase text.ListOpen:\n\t\t\td.Read()\n\t\t\tfor {\n\t\t\t\ttok, err := d.Peek()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tswitch tok.Kind() {\n\t\t\t\tcase text.ListClose:\n\t\t\t\t\td.Read()\n\t\t\t\t\treturn nil\n\t\t\t\tcase text.MessageOpen:\n\t\t\t\t\tpval := list.NewElement()\n\t\t\t\t\tif err := d.unmarshalMessage(pval.Message(), true); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tlist.Append(pval)\n\t\t\t\tdefault:\n\t\t\t\t\treturn d.unexpectedTokenError(tok)\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase text.MessageOpen:\n\t\t\tpval := list.NewElement()\n\t\t\tif err := d.unmarshalMessage(pval.Message(), true); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlist.Append(pval)\n\t\t\treturn nil\n\t\t}\n\n\tdefault:\n\t\tswitch tok.Kind() {\n\t\tcase text.ListOpen:\n\t\t\td.Read()\n\t\t\tfor {\n\t\t\t\ttok, err := d.Peek()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tswitch tok.Kind() {\n\t\t\t\tcase text.ListClose:\n\t\t\t\t\td.Read()\n\t\t\t\t\treturn nil\n\t\t\t\tcase text.Scalar:\n\t\t\t\t\tpval, err := d.unmarshalScalar(fd)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tlist.Append(pval)\n\t\t\t\tdefault:\n\t\t\t\t\treturn d.unexpectedTokenError(tok)\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase text.Scalar:\n\t\t\tpval, err := d.unmarshalScalar(fd)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlist.Append(pval)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn d.unexpectedTokenError(tok)\n}\n\n// unmarshalMap unmarshals into given protoreflect.Map. A map value is a\n// textproto message containing {key: <kvalue>, value: <mvalue>}.\nfunc (d decoder) unmarshalMap(fd pref.FieldDescriptor, mmap pref.Map) error {\n\t// Determine ahead whether map entry is a scalar type or a message type in\n\t// order to call the appropriate unmarshalMapValue func inside\n\t// unmarshalMapEntry.\n\tvar unmarshalMapValue func() (pref.Value, error)\n\tswitch fd.MapValue().Kind() {\n\tcase pref.MessageKind, pref.GroupKind:\n\t\tunmarshalMapValue = func() (pref.Value, error) {\n\t\t\tpval := mmap.NewValue()\n\t\t\tif err := d.unmarshalMessage(pval.Message(), true); err != nil {\n\t\t\t\treturn pref.Value{}, err\n\t\t\t}\n\t\t\treturn pval, nil\n\t\t}\n\tdefault:\n\t\tunmarshalMapValue = func() (pref.Value, error) {\n\t\t\treturn d.unmarshalScalar(fd.MapValue())\n\t\t}\n\t}\n\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\tswitch tok.Kind() {\n\tcase text.MessageOpen:\n\t\treturn d.unmarshalMapEntry(fd, mmap, unmarshalMapValue)\n\n\tcase text.ListOpen:\n\t\tfor {\n\t\t\ttok, err := d.Read()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tswitch tok.Kind() {\n\t\t\tcase text.ListClose:\n\t\t\t\treturn nil\n\t\t\tcase text.MessageOpen:\n\t\t\t\tif err := d.unmarshalMapEntry(fd, mmap, unmarshalMapValue); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn d.unexpectedTokenError(tok)\n\t\t\t}\n\t\t}\n\n\tdefault:\n\t\treturn d.unexpectedTokenError(tok)\n\t}\n}\n\n// unmarshalMap unmarshals into given protoreflect.Map. A map value is a\n// textproto message containing {key: <kvalue>, value: <mvalue>}.\nfunc (d decoder) unmarshalMapEntry(fd pref.FieldDescriptor, mmap pref.Map, unmarshalMapValue func() (pref.Value, error)) error {\n\tvar key pref.MapKey\n\tvar pval pref.Value\nLoop:\n\tfor {\n\t\t// Read field name.\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch tok.Kind() {\n\t\tcase text.Name:\n\t\t\tif tok.NameKind() != text.IdentName {\n\t\t\t\tif !d.opts.DiscardUnknown {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"unknown map entry field %q\", tok.RawString())\n\t\t\t\t}\n\t\t\t\td.skipValue()\n\t\t\t\tcontinue Loop\n\t\t\t}\n\t\t\t// Continue below.\n\t\tcase text.MessageClose:\n\t\t\tbreak Loop\n\t\tdefault:\n\t\t\treturn d.unexpectedTokenError(tok)\n\t\t}\n\n\t\tswitch name := pref.Name(tok.IdentName()); name {\n\t\tcase genid.MapEntry_Key_field_name:\n\t\t\tif !tok.HasSeparator() {\n\t\t\t\treturn d.syntaxError(tok.Pos(), \"missing field separator :\")\n\t\t\t}\n\t\t\tif key.IsValid() {\n\t\t\t\treturn d.newError(tok.Pos(), \"map entry %q cannot be repeated\", name)\n\t\t\t}\n\t\t\tval, err := d.unmarshalScalar(fd.MapKey())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tkey = val.MapKey()\n\n\t\tcase genid.MapEntry_Value_field_name:\n\t\t\tif kind := fd.MapValue().Kind(); (kind != pref.MessageKind) && (kind != pref.GroupKind) {\n\t\t\t\tif !tok.HasSeparator() {\n\t\t\t\t\treturn d.syntaxError(tok.Pos(), \"missing field separator :\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tif pval.IsValid() {\n\t\t\t\treturn d.newError(tok.Pos(), \"map entry %q cannot be repeated\", name)\n\t\t\t}\n\t\t\tpval, err = unmarshalMapValue()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tdefault:\n\t\t\tif !d.opts.DiscardUnknown {\n\t\t\t\treturn d.newError(tok.Pos(), \"unknown map entry field %q\", name)\n\t\t\t}\n\t\t\td.skipValue()\n\t\t}\n\t}\n\n\tif !key.IsValid() {\n\t\tkey = fd.MapKey().Default().MapKey()\n\t}\n\tif !pval.IsValid() {\n\t\tswitch fd.MapValue().Kind() {\n\t\tcase pref.MessageKind, pref.GroupKind:\n\t\t\t// If value field is not set for message/group types, construct an\n\t\t\t// empty one as default.\n\t\t\tpval = mmap.NewValue()\n\t\tdefault:\n\t\t\tpval = fd.MapValue().Default()\n\t\t}\n\t}\n\tmmap.Set(key, pval)\n\treturn nil\n}\n\n// unmarshalAny unmarshals an Any textproto. It can either be in expanded form\n// or non-expanded form.\nfunc (d decoder) unmarshalAny(m pref.Message, checkDelims bool) error {\n\tvar typeURL string\n\tvar bValue []byte\n\tvar seenTypeUrl bool\n\tvar seenValue bool\n\tvar isExpanded bool\n\n\tif checkDelims {\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif tok.Kind() != text.MessageOpen {\n\t\t\treturn d.unexpectedTokenError(tok)\n\t\t}\n\t}\n\nLoop:\n\tfor {\n\t\t// Read field name. Can only have 3 possible field names, i.e. type_url,\n\t\t// value and type URL name inside [].\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif typ := tok.Kind(); typ != text.Name {\n\t\t\tif checkDelims {\n\t\t\t\tif typ == text.MessageClose {\n\t\t\t\t\tbreak Loop\n\t\t\t\t}\n\t\t\t} else if typ == text.EOF {\n\t\t\t\tbreak Loop\n\t\t\t}\n\t\t\treturn d.unexpectedTokenError(tok)\n\t\t}\n\n\t\tswitch tok.NameKind() {\n\t\tcase text.IdentName:\n\t\t\t// Both type_url and value fields require field separator :.\n\t\t\tif !tok.HasSeparator() {\n\t\t\t\treturn d.syntaxError(tok.Pos(), \"missing field separator :\")\n\t\t\t}\n\n\t\t\tswitch name := pref.Name(tok.IdentName()); name {\n\t\t\tcase genid.Any_TypeUrl_field_name:\n\t\t\t\tif seenTypeUrl {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"duplicate %v field\", genid.Any_TypeUrl_field_fullname)\n\t\t\t\t}\n\t\t\t\tif isExpanded {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"conflict with [%s] field\", typeURL)\n\t\t\t\t}\n\t\t\t\ttok, err := d.Read()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tvar ok bool\n\t\t\t\ttypeURL, ok = tok.String()\n\t\t\t\tif !ok {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"invalid %v field value: %v\", genid.Any_TypeUrl_field_fullname, tok.RawString())\n\t\t\t\t}\n\t\t\t\tseenTypeUrl = true\n\n\t\t\tcase genid.Any_Value_field_name:\n\t\t\t\tif seenValue {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"duplicate %v field\", genid.Any_Value_field_fullname)\n\t\t\t\t}\n\t\t\t\tif isExpanded {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"conflict with [%s] field\", typeURL)\n\t\t\t\t}\n\t\t\t\ttok, err := d.Read()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ts, ok := tok.String()\n\t\t\t\tif !ok {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"invalid %v field value: %v\", genid.Any_Value_field_fullname, tok.RawString())\n\t\t\t\t}\n\t\t\t\tbValue = []byte(s)\n\t\t\t\tseenValue = true\n\n\t\t\tdefault:\n\t\t\t\tif !d.opts.DiscardUnknown {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"invalid field name %q in %v message\", tok.RawString(), genid.Any_message_fullname)\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase text.TypeName:\n\t\t\tif isExpanded {\n\t\t\t\treturn d.newError(tok.Pos(), \"cannot have more than one type\")\n\t\t\t}\n\t\t\tif seenTypeUrl {\n\t\t\t\treturn d.newError(tok.Pos(), \"conflict with type_url field\")\n\t\t\t}\n\t\t\ttypeURL = tok.TypeName()\n\t\t\tvar err error\n\t\t\tbValue, err = d.unmarshalExpandedAny(typeURL, tok.Pos())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tisExpanded = true\n\n\t\tdefault:\n\t\t\tif !d.opts.DiscardUnknown {\n\t\t\t\treturn d.newError(tok.Pos(), \"invalid field name %q in %v message\", tok.RawString(), genid.Any_message_fullname)\n\t\t\t}\n\t\t}\n\t}\n\n\tfds := m.Descriptor().Fields()\n\tif len(typeURL) > 0 {\n\t\tm.Set(fds.ByNumber(genid.Any_TypeUrl_field_number), pref.ValueOfString(typeURL))\n\t}\n\tif len(bValue) > 0 {\n\t\tm.Set(fds.ByNumber(genid.Any_Value_field_number), pref.ValueOfBytes(bValue))\n\t}\n\treturn nil\n}\n\nfunc (d decoder) unmarshalExpandedAny(typeURL string, pos int) ([]byte, error) {\n\tmt, err := d.opts.Resolver.FindMessageByURL(typeURL)\n\tif err != nil {\n\t\treturn nil, d.newError(pos, \"unable to resolve message [%v]: %v\", typeURL, err)\n\t}\n\t// Create new message for the embedded message type and unmarshal the value\n\t// field into it.\n\tm := mt.New()\n\tif err := d.unmarshalMessage(m, true); err != nil {\n\t\treturn nil, err\n\t}\n\t// Serialize the embedded message and return the resulting bytes.\n\tb, err := proto.MarshalOptions{\n\t\tAllowPartial:  true, // Never check required fields inside an Any.\n\t\tDeterministic: true,\n\t}.Marshal(m.Interface())\n\tif err != nil {\n\t\treturn nil, d.newError(pos, \"error in marshaling message into Any.value: %v\", err)\n\t}\n\treturn b, nil\n}\n\n// skipValue makes the decoder parse a field value in order to advance the read\n// to the next field. It relies on Read returning an error if the types are not\n// in valid sequence.\nfunc (d decoder) skipValue() error {\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Only need to continue reading for messages and lists.\n\tswitch tok.Kind() {\n\tcase text.MessageOpen:\n\t\treturn d.skipMessageValue()\n\n\tcase text.ListOpen:\n\t\tfor {\n\t\t\ttok, err := d.Read()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tswitch tok.Kind() {\n\t\t\tcase text.ListClose:\n\t\t\t\treturn nil\n\t\t\tcase text.MessageOpen:\n\t\t\t\treturn d.skipMessageValue()\n\t\t\tdefault:\n\t\t\t\t// Skip items. This will not validate whether skipped values are\n\t\t\t\t// of the same type or not, same behavior as C++\n\t\t\t\t// TextFormat::Parser::AllowUnknownField(true) version 3.8.0.\n\t\t\t\tif err := d.skipValue(); 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\n// skipMessageValue makes the decoder parse and skip over all fields in a\n// message. It assumes that the previous read type is MessageOpen.\nfunc (d decoder) skipMessageValue() error {\n\tfor {\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch tok.Kind() {\n\t\tcase text.MessageClose:\n\t\t\treturn nil\n\t\tcase text.Name:\n\t\t\tif err := d.skipValue(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/encoding/prototext/doc.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 prototext marshals and unmarshals protocol buffer messages as the\n// textproto format.\npackage prototext\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/encoding/prototext/encode.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 prototext\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/encoding/text\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/order\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\nconst defaultIndent = \"  \"\n\n// Format formats the message as a multiline string.\n// This function is only intended for human consumption and ignores errors.\n// Do not depend on the output being stable. It may change over time across\n// different versions of the program.\nfunc Format(m proto.Message) string {\n\treturn MarshalOptions{Multiline: true}.Format(m)\n}\n\n// Marshal writes the given proto.Message in textproto format using default\n// options. Do not depend on the output being stable. It may change over time\n// across different versions of the program.\nfunc Marshal(m proto.Message) ([]byte, error) {\n\treturn MarshalOptions{}.Marshal(m)\n}\n\n// MarshalOptions is a configurable text format marshaler.\ntype MarshalOptions struct {\n\tpragma.NoUnkeyedLiterals\n\n\t// Multiline specifies whether the marshaler should format the output in\n\t// indented-form with every textual element on a new line.\n\t// If Indent is an empty string, then an arbitrary indent is chosen.\n\tMultiline bool\n\n\t// Indent specifies the set of indentation characters to use in a multiline\n\t// formatted output such that every entry is preceded by Indent and\n\t// terminated by a newline. If non-empty, then Multiline is treated as true.\n\t// Indent can only be composed of space or tab characters.\n\tIndent string\n\n\t// EmitASCII specifies whether to format strings and bytes as ASCII only\n\t// as opposed to using UTF-8 encoding when possible.\n\tEmitASCII bool\n\n\t// allowInvalidUTF8 specifies whether to permit the encoding of strings\n\t// with invalid UTF-8. This is unexported as it is intended to only\n\t// be specified by the Format method.\n\tallowInvalidUTF8 bool\n\n\t// AllowPartial allows messages that have missing required fields to marshal\n\t// without returning an error. If AllowPartial is false (the default),\n\t// Marshal will return error if there are any missing required fields.\n\tAllowPartial bool\n\n\t// EmitUnknown specifies whether to emit unknown fields in the output.\n\t// If specified, the unmarshaler may be unable to parse the output.\n\t// The default is to exclude unknown fields.\n\tEmitUnknown bool\n\n\t// Resolver is used for looking up types when expanding google.protobuf.Any\n\t// messages. If nil, this defaults to using protoregistry.GlobalTypes.\n\tResolver interface {\n\t\tprotoregistry.ExtensionTypeResolver\n\t\tprotoregistry.MessageTypeResolver\n\t}\n}\n\n// Format formats the message as a string.\n// This method is only intended for human consumption and ignores errors.\n// Do not depend on the output being stable. It may change over time across\n// different versions of the program.\nfunc (o MarshalOptions) Format(m proto.Message) string {\n\tif m == nil || !m.ProtoReflect().IsValid() {\n\t\treturn \"<nil>\" // invalid syntax, but okay since this is for debugging\n\t}\n\to.allowInvalidUTF8 = true\n\to.AllowPartial = true\n\to.EmitUnknown = true\n\tb, _ := o.Marshal(m)\n\treturn string(b)\n}\n\n// Marshal writes the given proto.Message in textproto format using options in\n// MarshalOptions object. Do not depend on the output being stable. It may\n// change over time across different versions of the program.\nfunc (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) {\n\treturn o.marshal(m)\n}\n\n// marshal is a centralized function that all marshal operations go through.\n// For profiling purposes, avoid changing the name of this function or\n// introducing other code paths for marshal that do not go through this.\nfunc (o MarshalOptions) marshal(m proto.Message) ([]byte, error) {\n\tvar delims = [2]byte{'{', '}'}\n\n\tif o.Multiline && o.Indent == \"\" {\n\t\to.Indent = defaultIndent\n\t}\n\tif o.Resolver == nil {\n\t\to.Resolver = protoregistry.GlobalTypes\n\t}\n\n\tinternalEnc, err := text.NewEncoder(o.Indent, delims, o.EmitASCII)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Treat nil message interface as an empty message,\n\t// in which case there is nothing to output.\n\tif m == nil {\n\t\treturn []byte{}, nil\n\t}\n\n\tenc := encoder{internalEnc, o}\n\terr = enc.marshalMessage(m.ProtoReflect(), false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout := enc.Bytes()\n\tif len(o.Indent) > 0 && len(out) > 0 {\n\t\tout = append(out, '\\n')\n\t}\n\tif o.AllowPartial {\n\t\treturn out, nil\n\t}\n\treturn out, proto.CheckInitialized(m)\n}\n\ntype encoder struct {\n\t*text.Encoder\n\topts MarshalOptions\n}\n\n// marshalMessage marshals the given protoreflect.Message.\nfunc (e encoder) marshalMessage(m pref.Message, inclDelims bool) error {\n\tmessageDesc := m.Descriptor()\n\tif !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {\n\t\treturn errors.New(\"no support for proto1 MessageSets\")\n\t}\n\n\tif inclDelims {\n\t\te.StartMessage()\n\t\tdefer e.EndMessage()\n\t}\n\n\t// Handle Any expansion.\n\tif messageDesc.FullName() == genid.Any_message_fullname {\n\t\tif e.marshalAny(m) {\n\t\t\treturn nil\n\t\t}\n\t\t// If unable to expand, continue on to marshal Any as a regular message.\n\t}\n\n\t// Marshal fields.\n\tvar err error\n\torder.RangeFields(m, order.IndexNameFieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tif err = e.marshalField(fd.TextName(), v, fd); err != nil {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Marshal unknown fields.\n\tif e.opts.EmitUnknown {\n\t\te.marshalUnknown(m.GetUnknown())\n\t}\n\n\treturn nil\n}\n\n// marshalField marshals the given field with protoreflect.Value.\nfunc (e encoder) marshalField(name string, val pref.Value, fd pref.FieldDescriptor) error {\n\tswitch {\n\tcase fd.IsList():\n\t\treturn e.marshalList(name, val.List(), fd)\n\tcase fd.IsMap():\n\t\treturn e.marshalMap(name, val.Map(), fd)\n\tdefault:\n\t\te.WriteName(name)\n\t\treturn e.marshalSingular(val, fd)\n\t}\n}\n\n// marshalSingular marshals the given non-repeated field value. This includes\n// all scalar types, enums, messages, and groups.\nfunc (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error {\n\tkind := fd.Kind()\n\tswitch kind {\n\tcase pref.BoolKind:\n\t\te.WriteBool(val.Bool())\n\n\tcase pref.StringKind:\n\t\ts := val.String()\n\t\tif !e.opts.allowInvalidUTF8 && strs.EnforceUTF8(fd) && !utf8.ValidString(s) {\n\t\t\treturn errors.InvalidUTF8(string(fd.FullName()))\n\t\t}\n\t\te.WriteString(s)\n\n\tcase pref.Int32Kind, pref.Int64Kind,\n\t\tpref.Sint32Kind, pref.Sint64Kind,\n\t\tpref.Sfixed32Kind, pref.Sfixed64Kind:\n\t\te.WriteInt(val.Int())\n\n\tcase pref.Uint32Kind, pref.Uint64Kind,\n\t\tpref.Fixed32Kind, pref.Fixed64Kind:\n\t\te.WriteUint(val.Uint())\n\n\tcase pref.FloatKind:\n\t\t// Encoder.WriteFloat handles the special numbers NaN and infinites.\n\t\te.WriteFloat(val.Float(), 32)\n\n\tcase pref.DoubleKind:\n\t\t// Encoder.WriteFloat handles the special numbers NaN and infinites.\n\t\te.WriteFloat(val.Float(), 64)\n\n\tcase pref.BytesKind:\n\t\te.WriteString(string(val.Bytes()))\n\n\tcase pref.EnumKind:\n\t\tnum := val.Enum()\n\t\tif desc := fd.Enum().Values().ByNumber(num); desc != nil {\n\t\t\te.WriteLiteral(string(desc.Name()))\n\t\t} else {\n\t\t\t// Use numeric value if there is no enum description.\n\t\t\te.WriteInt(int64(num))\n\t\t}\n\n\tcase pref.MessageKind, pref.GroupKind:\n\t\treturn e.marshalMessage(val.Message(), true)\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"%v has unknown kind: %v\", fd.FullName(), kind))\n\t}\n\treturn nil\n}\n\n// marshalList marshals the given protoreflect.List as multiple name-value fields.\nfunc (e encoder) marshalList(name string, list pref.List, fd pref.FieldDescriptor) error {\n\tsize := list.Len()\n\tfor i := 0; i < size; i++ {\n\t\te.WriteName(name)\n\t\tif err := e.marshalSingular(list.Get(i), fd); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// marshalMap marshals the given protoreflect.Map as multiple name-value fields.\nfunc (e encoder) marshalMap(name string, mmap pref.Map, fd pref.FieldDescriptor) error {\n\tvar err error\n\torder.RangeEntries(mmap, order.GenericKeyOrder, func(key pref.MapKey, val pref.Value) bool {\n\t\te.WriteName(name)\n\t\te.StartMessage()\n\t\tdefer e.EndMessage()\n\n\t\te.WriteName(string(genid.MapEntry_Key_field_name))\n\t\terr = e.marshalSingular(key.Value(), fd.MapKey())\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\n\t\te.WriteName(string(genid.MapEntry_Value_field_name))\n\t\terr = e.marshalSingular(val, fd.MapValue())\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t})\n\treturn err\n}\n\n// marshalUnknown parses the given []byte and marshals fields out.\n// This function assumes proper encoding in the given []byte.\nfunc (e encoder) marshalUnknown(b []byte) {\n\tconst dec = 10\n\tconst hex = 16\n\tfor len(b) > 0 {\n\t\tnum, wtype, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\te.WriteName(strconv.FormatInt(int64(num), dec))\n\n\t\tswitch wtype {\n\t\tcase protowire.VarintType:\n\t\t\tvar v uint64\n\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\te.WriteUint(v)\n\t\tcase protowire.Fixed32Type:\n\t\t\tvar v uint32\n\t\t\tv, n = protowire.ConsumeFixed32(b)\n\t\t\te.WriteLiteral(\"0x\" + strconv.FormatUint(uint64(v), hex))\n\t\tcase protowire.Fixed64Type:\n\t\t\tvar v uint64\n\t\t\tv, n = protowire.ConsumeFixed64(b)\n\t\t\te.WriteLiteral(\"0x\" + strconv.FormatUint(v, hex))\n\t\tcase protowire.BytesType:\n\t\t\tvar v []byte\n\t\t\tv, n = protowire.ConsumeBytes(b)\n\t\t\te.WriteString(string(v))\n\t\tcase protowire.StartGroupType:\n\t\t\te.StartMessage()\n\t\t\tvar v []byte\n\t\t\tv, n = protowire.ConsumeGroup(num, b)\n\t\t\te.marshalUnknown(v)\n\t\t\te.EndMessage()\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"prototext: error parsing unknown field wire type: %v\", wtype))\n\t\t}\n\n\t\tb = b[n:]\n\t}\n}\n\n// marshalAny marshals the given google.protobuf.Any message in expanded form.\n// It returns true if it was able to marshal, else false.\nfunc (e encoder) marshalAny(any pref.Message) bool {\n\t// Construct the embedded message.\n\tfds := any.Descriptor().Fields()\n\tfdType := fds.ByNumber(genid.Any_TypeUrl_field_number)\n\ttypeURL := any.Get(fdType).String()\n\tmt, err := e.opts.Resolver.FindMessageByURL(typeURL)\n\tif err != nil {\n\t\treturn false\n\t}\n\tm := mt.New().Interface()\n\n\t// Unmarshal bytes into embedded message.\n\tfdValue := fds.ByNumber(genid.Any_Value_field_number)\n\tvalue := any.Get(fdValue)\n\terr = proto.UnmarshalOptions{\n\t\tAllowPartial: true,\n\t\tResolver:     e.opts.Resolver,\n\t}.Unmarshal(value.Bytes(), m)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\t// Get current encoder position. If marshaling fails, reset encoder output\n\t// back to this position.\n\tpos := e.Snapshot()\n\n\t// Field name is the proto field name enclosed in [].\n\te.WriteName(\"[\" + typeURL + \"]\")\n\terr = e.marshalMessage(m.ProtoReflect(), true)\n\tif err != nil {\n\t\te.Reset(pos)\n\t\treturn false\n\t}\n\treturn true\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/encoding/protowire/wire.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 protowire parses and formats the raw wire encoding.\n// See https://developers.google.com/protocol-buffers/docs/encoding.\n//\n// For marshaling and unmarshaling entire protobuf messages,\n// use the \"google.golang.org/protobuf/proto\" package instead.\npackage protowire\n\nimport (\n\t\"io\"\n\t\"math\"\n\t\"math/bits\"\n\n\t\"google.golang.org/protobuf/internal/errors\"\n)\n\n// Number represents the field number.\ntype Number int32\n\nconst (\n\tMinValidNumber      Number = 1\n\tFirstReservedNumber Number = 19000\n\tLastReservedNumber  Number = 19999\n\tMaxValidNumber      Number = 1<<29 - 1\n)\n\n// IsValid reports whether the field number is semantically valid.\n//\n// Note that while numbers within the reserved range are semantically invalid,\n// they are syntactically valid in the wire format.\n// Implementations may treat records with reserved field numbers as unknown.\nfunc (n Number) IsValid() bool {\n\treturn MinValidNumber <= n && n < FirstReservedNumber || LastReservedNumber < n && n <= MaxValidNumber\n}\n\n// Type represents the wire type.\ntype Type int8\n\nconst (\n\tVarintType     Type = 0\n\tFixed32Type    Type = 5\n\tFixed64Type    Type = 1\n\tBytesType      Type = 2\n\tStartGroupType Type = 3\n\tEndGroupType   Type = 4\n)\n\nconst (\n\t_ = -iota\n\terrCodeTruncated\n\terrCodeFieldNumber\n\terrCodeOverflow\n\terrCodeReserved\n\terrCodeEndGroup\n)\n\nvar (\n\terrFieldNumber = errors.New(\"invalid field number\")\n\terrOverflow    = errors.New(\"variable length integer overflow\")\n\terrReserved    = errors.New(\"cannot parse reserved wire type\")\n\terrEndGroup    = errors.New(\"mismatching end group marker\")\n\terrParse       = errors.New(\"parse error\")\n)\n\n// ParseError converts an error code into an error value.\n// This returns nil if n is a non-negative number.\nfunc ParseError(n int) error {\n\tif n >= 0 {\n\t\treturn nil\n\t}\n\tswitch n {\n\tcase errCodeTruncated:\n\t\treturn io.ErrUnexpectedEOF\n\tcase errCodeFieldNumber:\n\t\treturn errFieldNumber\n\tcase errCodeOverflow:\n\t\treturn errOverflow\n\tcase errCodeReserved:\n\t\treturn errReserved\n\tcase errCodeEndGroup:\n\t\treturn errEndGroup\n\tdefault:\n\t\treturn errParse\n\t}\n}\n\n// ConsumeField parses an entire field record (both tag and value) and returns\n// the field number, the wire type, and the total length.\n// This returns a negative length upon an error (see ParseError).\n//\n// The total length includes the tag header and the end group marker (if the\n// field is a group).\nfunc ConsumeField(b []byte) (Number, Type, int) {\n\tnum, typ, n := ConsumeTag(b)\n\tif n < 0 {\n\t\treturn 0, 0, n // forward error code\n\t}\n\tm := ConsumeFieldValue(num, typ, b[n:])\n\tif m < 0 {\n\t\treturn 0, 0, m // forward error code\n\t}\n\treturn num, typ, n + m\n}\n\n// ConsumeFieldValue parses a field value and returns its length.\n// This assumes that the field Number and wire Type have already been parsed.\n// This returns a negative length upon an error (see ParseError).\n//\n// When parsing a group, the length includes the end group marker and\n// the end group is verified to match the starting field number.\nfunc ConsumeFieldValue(num Number, typ Type, b []byte) (n int) {\n\tswitch typ {\n\tcase VarintType:\n\t\t_, n = ConsumeVarint(b)\n\t\treturn n\n\tcase Fixed32Type:\n\t\t_, n = ConsumeFixed32(b)\n\t\treturn n\n\tcase Fixed64Type:\n\t\t_, n = ConsumeFixed64(b)\n\t\treturn n\n\tcase BytesType:\n\t\t_, n = ConsumeBytes(b)\n\t\treturn n\n\tcase StartGroupType:\n\t\tn0 := len(b)\n\t\tfor {\n\t\t\tnum2, typ2, n := ConsumeTag(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn n // forward error code\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t\tif typ2 == EndGroupType {\n\t\t\t\tif num != num2 {\n\t\t\t\t\treturn errCodeEndGroup\n\t\t\t\t}\n\t\t\t\treturn n0 - len(b)\n\t\t\t}\n\n\t\t\tn = ConsumeFieldValue(num2, typ2, b)\n\t\t\tif n < 0 {\n\t\t\t\treturn n // forward error code\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t}\n\tcase EndGroupType:\n\t\treturn errCodeEndGroup\n\tdefault:\n\t\treturn errCodeReserved\n\t}\n}\n\n// AppendTag encodes num and typ as a varint-encoded tag and appends it to b.\nfunc AppendTag(b []byte, num Number, typ Type) []byte {\n\treturn AppendVarint(b, EncodeTag(num, typ))\n}\n\n// ConsumeTag parses b as a varint-encoded tag, reporting its length.\n// This returns a negative length upon an error (see ParseError).\nfunc ConsumeTag(b []byte) (Number, Type, int) {\n\tv, n := ConsumeVarint(b)\n\tif n < 0 {\n\t\treturn 0, 0, n // forward error code\n\t}\n\tnum, typ := DecodeTag(v)\n\tif num < MinValidNumber {\n\t\treturn 0, 0, errCodeFieldNumber\n\t}\n\treturn num, typ, n\n}\n\nfunc SizeTag(num Number) int {\n\treturn SizeVarint(EncodeTag(num, 0)) // wire type has no effect on size\n}\n\n// AppendVarint appends v to b as a varint-encoded uint64.\nfunc AppendVarint(b []byte, v uint64) []byte {\n\tswitch {\n\tcase v < 1<<7:\n\t\tb = append(b, byte(v))\n\tcase v < 1<<14:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte(v>>7))\n\tcase v < 1<<21:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte(v>>14))\n\tcase v < 1<<28:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte((v>>14)&0x7f|0x80),\n\t\t\tbyte(v>>21))\n\tcase v < 1<<35:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte((v>>14)&0x7f|0x80),\n\t\t\tbyte((v>>21)&0x7f|0x80),\n\t\t\tbyte(v>>28))\n\tcase v < 1<<42:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte((v>>14)&0x7f|0x80),\n\t\t\tbyte((v>>21)&0x7f|0x80),\n\t\t\tbyte((v>>28)&0x7f|0x80),\n\t\t\tbyte(v>>35))\n\tcase v < 1<<49:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte((v>>14)&0x7f|0x80),\n\t\t\tbyte((v>>21)&0x7f|0x80),\n\t\t\tbyte((v>>28)&0x7f|0x80),\n\t\t\tbyte((v>>35)&0x7f|0x80),\n\t\t\tbyte(v>>42))\n\tcase v < 1<<56:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte((v>>14)&0x7f|0x80),\n\t\t\tbyte((v>>21)&0x7f|0x80),\n\t\t\tbyte((v>>28)&0x7f|0x80),\n\t\t\tbyte((v>>35)&0x7f|0x80),\n\t\t\tbyte((v>>42)&0x7f|0x80),\n\t\t\tbyte(v>>49))\n\tcase v < 1<<63:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte((v>>14)&0x7f|0x80),\n\t\t\tbyte((v>>21)&0x7f|0x80),\n\t\t\tbyte((v>>28)&0x7f|0x80),\n\t\t\tbyte((v>>35)&0x7f|0x80),\n\t\t\tbyte((v>>42)&0x7f|0x80),\n\t\t\tbyte((v>>49)&0x7f|0x80),\n\t\t\tbyte(v>>56))\n\tdefault:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte((v>>14)&0x7f|0x80),\n\t\t\tbyte((v>>21)&0x7f|0x80),\n\t\t\tbyte((v>>28)&0x7f|0x80),\n\t\t\tbyte((v>>35)&0x7f|0x80),\n\t\t\tbyte((v>>42)&0x7f|0x80),\n\t\t\tbyte((v>>49)&0x7f|0x80),\n\t\t\tbyte((v>>56)&0x7f|0x80),\n\t\t\t1)\n\t}\n\treturn b\n}\n\n// ConsumeVarint parses b as a varint-encoded uint64, reporting its length.\n// This returns a negative length upon an error (see ParseError).\nfunc ConsumeVarint(b []byte) (v uint64, n int) {\n\tvar y uint64\n\tif len(b) <= 0 {\n\t\treturn 0, errCodeTruncated\n\t}\n\tv = uint64(b[0])\n\tif v < 0x80 {\n\t\treturn v, 1\n\t}\n\tv -= 0x80\n\n\tif len(b) <= 1 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[1])\n\tv += y << 7\n\tif y < 0x80 {\n\t\treturn v, 2\n\t}\n\tv -= 0x80 << 7\n\n\tif len(b) <= 2 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[2])\n\tv += y << 14\n\tif y < 0x80 {\n\t\treturn v, 3\n\t}\n\tv -= 0x80 << 14\n\n\tif len(b) <= 3 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[3])\n\tv += y << 21\n\tif y < 0x80 {\n\t\treturn v, 4\n\t}\n\tv -= 0x80 << 21\n\n\tif len(b) <= 4 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[4])\n\tv += y << 28\n\tif y < 0x80 {\n\t\treturn v, 5\n\t}\n\tv -= 0x80 << 28\n\n\tif len(b) <= 5 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[5])\n\tv += y << 35\n\tif y < 0x80 {\n\t\treturn v, 6\n\t}\n\tv -= 0x80 << 35\n\n\tif len(b) <= 6 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[6])\n\tv += y << 42\n\tif y < 0x80 {\n\t\treturn v, 7\n\t}\n\tv -= 0x80 << 42\n\n\tif len(b) <= 7 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[7])\n\tv += y << 49\n\tif y < 0x80 {\n\t\treturn v, 8\n\t}\n\tv -= 0x80 << 49\n\n\tif len(b) <= 8 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[8])\n\tv += y << 56\n\tif y < 0x80 {\n\t\treturn v, 9\n\t}\n\tv -= 0x80 << 56\n\n\tif len(b) <= 9 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[9])\n\tv += y << 63\n\tif y < 2 {\n\t\treturn v, 10\n\t}\n\treturn 0, errCodeOverflow\n}\n\n// SizeVarint returns the encoded size of a varint.\n// The size is guaranteed to be within 1 and 10, inclusive.\nfunc SizeVarint(v uint64) int {\n\t// This computes 1 + (bits.Len64(v)-1)/7.\n\t// 9/64 is a good enough approximation of 1/7\n\treturn int(9*uint32(bits.Len64(v))+64) / 64\n}\n\n// AppendFixed32 appends v to b as a little-endian uint32.\nfunc AppendFixed32(b []byte, v uint32) []byte {\n\treturn append(b,\n\t\tbyte(v>>0),\n\t\tbyte(v>>8),\n\t\tbyte(v>>16),\n\t\tbyte(v>>24))\n}\n\n// ConsumeFixed32 parses b as a little-endian uint32, reporting its length.\n// This returns a negative length upon an error (see ParseError).\nfunc ConsumeFixed32(b []byte) (v uint32, n int) {\n\tif len(b) < 4 {\n\t\treturn 0, errCodeTruncated\n\t}\n\tv = uint32(b[0])<<0 | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24\n\treturn v, 4\n}\n\n// SizeFixed32 returns the encoded size of a fixed32; which is always 4.\nfunc SizeFixed32() int {\n\treturn 4\n}\n\n// AppendFixed64 appends v to b as a little-endian uint64.\nfunc AppendFixed64(b []byte, v uint64) []byte {\n\treturn append(b,\n\t\tbyte(v>>0),\n\t\tbyte(v>>8),\n\t\tbyte(v>>16),\n\t\tbyte(v>>24),\n\t\tbyte(v>>32),\n\t\tbyte(v>>40),\n\t\tbyte(v>>48),\n\t\tbyte(v>>56))\n}\n\n// ConsumeFixed64 parses b as a little-endian uint64, reporting its length.\n// This returns a negative length upon an error (see ParseError).\nfunc ConsumeFixed64(b []byte) (v uint64, n int) {\n\tif len(b) < 8 {\n\t\treturn 0, errCodeTruncated\n\t}\n\tv = uint64(b[0])<<0 | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56\n\treturn v, 8\n}\n\n// SizeFixed64 returns the encoded size of a fixed64; which is always 8.\nfunc SizeFixed64() int {\n\treturn 8\n}\n\n// AppendBytes appends v to b as a length-prefixed bytes value.\nfunc AppendBytes(b []byte, v []byte) []byte {\n\treturn append(AppendVarint(b, uint64(len(v))), v...)\n}\n\n// ConsumeBytes parses b as a length-prefixed bytes value, reporting its length.\n// This returns a negative length upon an error (see ParseError).\nfunc ConsumeBytes(b []byte) (v []byte, n int) {\n\tm, n := ConsumeVarint(b)\n\tif n < 0 {\n\t\treturn nil, n // forward error code\n\t}\n\tif m > uint64(len(b[n:])) {\n\t\treturn nil, errCodeTruncated\n\t}\n\treturn b[n:][:m], n + int(m)\n}\n\n// SizeBytes returns the encoded size of a length-prefixed bytes value,\n// given only the length.\nfunc SizeBytes(n int) int {\n\treturn SizeVarint(uint64(n)) + n\n}\n\n// AppendString appends v to b as a length-prefixed bytes value.\nfunc AppendString(b []byte, v string) []byte {\n\treturn append(AppendVarint(b, uint64(len(v))), v...)\n}\n\n// ConsumeString parses b as a length-prefixed bytes value, reporting its length.\n// This returns a negative length upon an error (see ParseError).\nfunc ConsumeString(b []byte) (v string, n int) {\n\tbb, n := ConsumeBytes(b)\n\treturn string(bb), n\n}\n\n// AppendGroup appends v to b as group value, with a trailing end group marker.\n// The value v must not contain the end marker.\nfunc AppendGroup(b []byte, num Number, v []byte) []byte {\n\treturn AppendVarint(append(b, v...), EncodeTag(num, EndGroupType))\n}\n\n// ConsumeGroup parses b as a group value until the trailing end group marker,\n// and verifies that the end marker matches the provided num. The value v\n// does not contain the end marker, while the length does contain the end marker.\n// This returns a negative length upon an error (see ParseError).\nfunc ConsumeGroup(num Number, b []byte) (v []byte, n int) {\n\tn = ConsumeFieldValue(num, StartGroupType, b)\n\tif n < 0 {\n\t\treturn nil, n // forward error code\n\t}\n\tb = b[:n]\n\n\t// Truncate off end group marker, but need to handle denormalized varints.\n\t// Assuming end marker is never 0 (which is always the case since\n\t// EndGroupType is non-zero), we can truncate all trailing bytes where the\n\t// lower 7 bits are all zero (implying that the varint is denormalized).\n\tfor len(b) > 0 && b[len(b)-1]&0x7f == 0 {\n\t\tb = b[:len(b)-1]\n\t}\n\tb = b[:len(b)-SizeTag(num)]\n\treturn b, n\n}\n\n// SizeGroup returns the encoded size of a group, given only the length.\nfunc SizeGroup(num Number, n int) int {\n\treturn n + SizeTag(num)\n}\n\n// DecodeTag decodes the field Number and wire Type from its unified form.\n// The Number is -1 if the decoded field number overflows int32.\n// Other than overflow, this does not check for field number validity.\nfunc DecodeTag(x uint64) (Number, Type) {\n\t// NOTE: MessageSet allows for larger field numbers than normal.\n\tif x>>3 > uint64(math.MaxInt32) {\n\t\treturn -1, 0\n\t}\n\treturn Number(x >> 3), Type(x & 7)\n}\n\n// EncodeTag encodes the field Number and wire Type into its unified form.\nfunc EncodeTag(num Number, typ Type) uint64 {\n\treturn uint64(num)<<3 | uint64(typ&7)\n}\n\n// DecodeZigZag decodes a zig-zag-encoded uint64 as an int64.\n//\tInput:  {…,  5,  3,  1,  0,  2,  4,  6, …}\n//\tOutput: {…, -3, -2, -1,  0, +1, +2, +3, …}\nfunc DecodeZigZag(x uint64) int64 {\n\treturn int64(x>>1) ^ int64(x)<<63>>63\n}\n\n// EncodeZigZag encodes an int64 as a zig-zag-encoded uint64.\n//\tInput:  {…, -3, -2, -1,  0, +1, +2, +3, …}\n//\tOutput: {…,  5,  3,  1,  0,  2,  4,  6, …}\nfunc EncodeZigZag(x int64) uint64 {\n\treturn uint64(x<<1) ^ uint64(x>>63)\n}\n\n// DecodeBool decodes a uint64 as a bool.\n//\tInput:  {    0,    1,    2, …}\n//\tOutput: {false, true, true, …}\nfunc DecodeBool(x uint64) bool {\n\treturn x != 0\n}\n\n// EncodeBool encodes a bool as a uint64.\n//\tInput:  {false, true}\n//\tOutput: {    0,    1}\nfunc EncodeBool(x bool) uint64 {\n\tif x {\n\t\treturn 1\n\t}\n\treturn 0\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/descfmt/stringer.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 descfmt provides functionality to format descriptors.\npackage descfmt\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"google.golang.org/protobuf/internal/detrand\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype list interface {\n\tLen() int\n\tpragma.DoNotImplement\n}\n\nfunc FormatList(s fmt.State, r rune, vs list) {\n\tio.WriteString(s, formatListOpt(vs, true, r == 'v' && (s.Flag('+') || s.Flag('#'))))\n}\nfunc formatListOpt(vs list, isRoot, allowMulti bool) string {\n\tstart, end := \"[\", \"]\"\n\tif isRoot {\n\t\tvar name string\n\t\tswitch vs.(type) {\n\t\tcase pref.Names:\n\t\t\tname = \"Names\"\n\t\tcase pref.FieldNumbers:\n\t\t\tname = \"FieldNumbers\"\n\t\tcase pref.FieldRanges:\n\t\t\tname = \"FieldRanges\"\n\t\tcase pref.EnumRanges:\n\t\t\tname = \"EnumRanges\"\n\t\tcase pref.FileImports:\n\t\t\tname = \"FileImports\"\n\t\tcase pref.Descriptor:\n\t\t\tname = reflect.ValueOf(vs).MethodByName(\"Get\").Type().Out(0).Name() + \"s\"\n\t\tdefault:\n\t\t\tname = reflect.ValueOf(vs).Elem().Type().Name()\n\t\t}\n\t\tstart, end = name+\"{\", \"}\"\n\t}\n\n\tvar ss []string\n\tswitch vs := vs.(type) {\n\tcase pref.Names:\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\tss = append(ss, fmt.Sprint(vs.Get(i)))\n\t\t}\n\t\treturn start + joinStrings(ss, false) + end\n\tcase pref.FieldNumbers:\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\tss = append(ss, fmt.Sprint(vs.Get(i)))\n\t\t}\n\t\treturn start + joinStrings(ss, false) + end\n\tcase pref.FieldRanges:\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\tr := vs.Get(i)\n\t\t\tif r[0]+1 == r[1] {\n\t\t\t\tss = append(ss, fmt.Sprintf(\"%d\", r[0]))\n\t\t\t} else {\n\t\t\t\tss = append(ss, fmt.Sprintf(\"%d:%d\", r[0], r[1])) // enum ranges are end exclusive\n\t\t\t}\n\t\t}\n\t\treturn start + joinStrings(ss, false) + end\n\tcase pref.EnumRanges:\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\tr := vs.Get(i)\n\t\t\tif r[0] == r[1] {\n\t\t\t\tss = append(ss, fmt.Sprintf(\"%d\", r[0]))\n\t\t\t} else {\n\t\t\t\tss = append(ss, fmt.Sprintf(\"%d:%d\", r[0], int64(r[1])+1)) // enum ranges are end inclusive\n\t\t\t}\n\t\t}\n\t\treturn start + joinStrings(ss, false) + end\n\tcase pref.FileImports:\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\tvar rs records\n\t\t\trs.Append(reflect.ValueOf(vs.Get(i)), \"Path\", \"Package\", \"IsPublic\", \"IsWeak\")\n\t\t\tss = append(ss, \"{\"+rs.Join()+\"}\")\n\t\t}\n\t\treturn start + joinStrings(ss, allowMulti) + end\n\tdefault:\n\t\t_, isEnumValue := vs.(pref.EnumValueDescriptors)\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\tm := reflect.ValueOf(vs).MethodByName(\"Get\")\n\t\t\tv := m.Call([]reflect.Value{reflect.ValueOf(i)})[0].Interface()\n\t\t\tss = append(ss, formatDescOpt(v.(pref.Descriptor), false, allowMulti && !isEnumValue))\n\t\t}\n\t\treturn start + joinStrings(ss, allowMulti && isEnumValue) + end\n\t}\n}\n\n// descriptorAccessors is a list of accessors to print for each descriptor.\n//\n// Do not print all accessors since some contain redundant information,\n// while others are pointers that we do not want to follow since the descriptor\n// is actually a cyclic graph.\n//\n// Using a list allows us to print the accessors in a sensible order.\nvar descriptorAccessors = map[reflect.Type][]string{\n\treflect.TypeOf((*pref.FileDescriptor)(nil)).Elem():      {\"Path\", \"Package\", \"Imports\", \"Messages\", \"Enums\", \"Extensions\", \"Services\"},\n\treflect.TypeOf((*pref.MessageDescriptor)(nil)).Elem():   {\"IsMapEntry\", \"Fields\", \"Oneofs\", \"ReservedNames\", \"ReservedRanges\", \"RequiredNumbers\", \"ExtensionRanges\", \"Messages\", \"Enums\", \"Extensions\"},\n\treflect.TypeOf((*pref.FieldDescriptor)(nil)).Elem():     {\"Number\", \"Cardinality\", \"Kind\", \"HasJSONName\", \"JSONName\", \"HasPresence\", \"IsExtension\", \"IsPacked\", \"IsWeak\", \"IsList\", \"IsMap\", \"MapKey\", \"MapValue\", \"HasDefault\", \"Default\", \"ContainingOneof\", \"ContainingMessage\", \"Message\", \"Enum\"},\n\treflect.TypeOf((*pref.OneofDescriptor)(nil)).Elem():     {\"Fields\"}, // not directly used; must keep in sync with formatDescOpt\n\treflect.TypeOf((*pref.EnumDescriptor)(nil)).Elem():      {\"Values\", \"ReservedNames\", \"ReservedRanges\"},\n\treflect.TypeOf((*pref.EnumValueDescriptor)(nil)).Elem(): {\"Number\"},\n\treflect.TypeOf((*pref.ServiceDescriptor)(nil)).Elem():   {\"Methods\"},\n\treflect.TypeOf((*pref.MethodDescriptor)(nil)).Elem():    {\"Input\", \"Output\", \"IsStreamingClient\", \"IsStreamingServer\"},\n}\n\nfunc FormatDesc(s fmt.State, r rune, t pref.Descriptor) {\n\tio.WriteString(s, formatDescOpt(t, true, r == 'v' && (s.Flag('+') || s.Flag('#'))))\n}\nfunc formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {\n\trv := reflect.ValueOf(t)\n\trt := rv.MethodByName(\"ProtoType\").Type().In(0)\n\n\tstart, end := \"{\", \"}\"\n\tif isRoot {\n\t\tstart = rt.Name() + \"{\"\n\t}\n\n\t_, isFile := t.(pref.FileDescriptor)\n\trs := records{allowMulti: allowMulti}\n\tif t.IsPlaceholder() {\n\t\tif isFile {\n\t\t\trs.Append(rv, \"Path\", \"Package\", \"IsPlaceholder\")\n\t\t} else {\n\t\t\trs.Append(rv, \"FullName\", \"IsPlaceholder\")\n\t\t}\n\t} else {\n\t\tswitch {\n\t\tcase isFile:\n\t\t\trs.Append(rv, \"Syntax\")\n\t\tcase isRoot:\n\t\t\trs.Append(rv, \"Syntax\", \"FullName\")\n\t\tdefault:\n\t\t\trs.Append(rv, \"Name\")\n\t\t}\n\t\tswitch t := t.(type) {\n\t\tcase pref.FieldDescriptor:\n\t\t\tfor _, s := range descriptorAccessors[rt] {\n\t\t\t\tswitch s {\n\t\t\t\tcase \"MapKey\":\n\t\t\t\t\tif k := t.MapKey(); k != nil {\n\t\t\t\t\t\trs.recs = append(rs.recs, [2]string{\"MapKey\", k.Kind().String()})\n\t\t\t\t\t}\n\t\t\t\tcase \"MapValue\":\n\t\t\t\t\tif v := t.MapValue(); v != nil {\n\t\t\t\t\t\tswitch v.Kind() {\n\t\t\t\t\t\tcase pref.EnumKind:\n\t\t\t\t\t\t\trs.recs = append(rs.recs, [2]string{\"MapValue\", string(v.Enum().FullName())})\n\t\t\t\t\t\tcase pref.MessageKind, pref.GroupKind:\n\t\t\t\t\t\t\trs.recs = append(rs.recs, [2]string{\"MapValue\", string(v.Message().FullName())})\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\trs.recs = append(rs.recs, [2]string{\"MapValue\", v.Kind().String()})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tcase \"ContainingOneof\":\n\t\t\t\t\tif od := t.ContainingOneof(); od != nil {\n\t\t\t\t\t\trs.recs = append(rs.recs, [2]string{\"Oneof\", string(od.Name())})\n\t\t\t\t\t}\n\t\t\t\tcase \"ContainingMessage\":\n\t\t\t\t\tif t.IsExtension() {\n\t\t\t\t\t\trs.recs = append(rs.recs, [2]string{\"Extendee\", string(t.ContainingMessage().FullName())})\n\t\t\t\t\t}\n\t\t\t\tcase \"Message\":\n\t\t\t\t\tif !t.IsMap() {\n\t\t\t\t\t\trs.Append(rv, s)\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\trs.Append(rv, s)\n\t\t\t\t}\n\t\t\t}\n\t\tcase pref.OneofDescriptor:\n\t\t\tvar ss []string\n\t\t\tfs := t.Fields()\n\t\t\tfor i := 0; i < fs.Len(); i++ {\n\t\t\t\tss = append(ss, string(fs.Get(i).Name()))\n\t\t\t}\n\t\t\tif len(ss) > 0 {\n\t\t\t\trs.recs = append(rs.recs, [2]string{\"Fields\", \"[\" + joinStrings(ss, false) + \"]\"})\n\t\t\t}\n\t\tdefault:\n\t\t\trs.Append(rv, descriptorAccessors[rt]...)\n\t\t}\n\t\tif rv.MethodByName(\"GoType\").IsValid() {\n\t\t\trs.Append(rv, \"GoType\")\n\t\t}\n\t}\n\treturn start + rs.Join() + end\n}\n\ntype records struct {\n\trecs       [][2]string\n\tallowMulti bool\n}\n\nfunc (rs *records) Append(v reflect.Value, accessors ...string) {\n\tfor _, a := range accessors {\n\t\tvar rv reflect.Value\n\t\tif m := v.MethodByName(a); m.IsValid() {\n\t\t\trv = m.Call(nil)[0]\n\t\t}\n\t\tif v.Kind() == reflect.Struct && !rv.IsValid() {\n\t\t\trv = v.FieldByName(a)\n\t\t}\n\t\tif !rv.IsValid() {\n\t\t\tpanic(fmt.Sprintf(\"unknown accessor: %v.%s\", v.Type(), a))\n\t\t}\n\t\tif _, ok := rv.Interface().(pref.Value); ok {\n\t\t\trv = rv.MethodByName(\"Interface\").Call(nil)[0]\n\t\t\tif !rv.IsNil() {\n\t\t\t\trv = rv.Elem()\n\t\t\t}\n\t\t}\n\n\t\t// Ignore zero values.\n\t\tvar isZero bool\n\t\tswitch rv.Kind() {\n\t\tcase reflect.Interface, reflect.Slice:\n\t\t\tisZero = rv.IsNil()\n\t\tcase reflect.Bool:\n\t\t\tisZero = rv.Bool() == false\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\tisZero = rv.Int() == 0\n\t\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\t\tisZero = rv.Uint() == 0\n\t\tcase reflect.String:\n\t\t\tisZero = rv.String() == \"\"\n\t\t}\n\t\tif n, ok := rv.Interface().(list); ok {\n\t\t\tisZero = n.Len() == 0\n\t\t}\n\t\tif isZero {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Format the value.\n\t\tvar s string\n\t\tv := rv.Interface()\n\t\tswitch v := v.(type) {\n\t\tcase list:\n\t\t\ts = formatListOpt(v, false, rs.allowMulti)\n\t\tcase pref.FieldDescriptor, pref.OneofDescriptor, pref.EnumValueDescriptor, pref.MethodDescriptor:\n\t\t\ts = string(v.(pref.Descriptor).Name())\n\t\tcase pref.Descriptor:\n\t\t\ts = string(v.FullName())\n\t\tcase string:\n\t\t\ts = strconv.Quote(v)\n\t\tcase []byte:\n\t\t\ts = fmt.Sprintf(\"%q\", v)\n\t\tdefault:\n\t\t\ts = fmt.Sprint(v)\n\t\t}\n\t\trs.recs = append(rs.recs, [2]string{a, s})\n\t}\n}\n\nfunc (rs *records) Join() string {\n\tvar ss []string\n\n\t// In single line mode, simply join all records with commas.\n\tif !rs.allowMulti {\n\t\tfor _, r := range rs.recs {\n\t\t\tss = append(ss, r[0]+formatColon(0)+r[1])\n\t\t}\n\t\treturn joinStrings(ss, false)\n\t}\n\n\t// In allowMulti line mode, align single line records for more readable output.\n\tvar maxLen int\n\tflush := func(i int) {\n\t\tfor _, r := range rs.recs[len(ss):i] {\n\t\t\tss = append(ss, r[0]+formatColon(maxLen-len(r[0]))+r[1])\n\t\t}\n\t\tmaxLen = 0\n\t}\n\tfor i, r := range rs.recs {\n\t\tif isMulti := strings.Contains(r[1], \"\\n\"); isMulti {\n\t\t\tflush(i)\n\t\t\tss = append(ss, r[0]+formatColon(0)+strings.Join(strings.Split(r[1], \"\\n\"), \"\\n\\t\"))\n\t\t} else if maxLen < len(r[0]) {\n\t\t\tmaxLen = len(r[0])\n\t\t}\n\t}\n\tflush(len(rs.recs))\n\treturn joinStrings(ss, true)\n}\n\nfunc formatColon(padding int) string {\n\t// Deliberately introduce instability into the debug output to\n\t// discourage users from performing string comparisons.\n\t// This provides us flexibility to change the output in the future.\n\tif detrand.Bool() {\n\t\treturn \":\" + strings.Repeat(\" \", 1+padding) // use non-breaking spaces (U+00a0)\n\t} else {\n\t\treturn \":\" + strings.Repeat(\" \", 1+padding) // use regular spaces (U+0020)\n\t}\n}\n\nfunc joinStrings(ss []string, isMulti bool) string {\n\tif len(ss) == 0 {\n\t\treturn \"\"\n\t}\n\tif isMulti {\n\t\treturn \"\\n\\t\" + strings.Join(ss, \"\\n\\t\") + \"\\n\"\n\t}\n\treturn strings.Join(ss, \", \")\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/descopts/options.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 descopts contains the nil pointers to concrete descriptor options.\n//\n// This package exists as a form of reverse dependency injection so that certain\n// packages (e.g., internal/filedesc and internal/filetype can avoid a direct\n// dependency on the descriptor proto package).\npackage descopts\n\nimport pref \"google.golang.org/protobuf/reflect/protoreflect\"\n\n// These variables are set by the init function in descriptor.pb.go via logic\n// in internal/filetype. In other words, so long as the descriptor proto package\n// is linked in, these variables will be populated.\n//\n// Each variable is populated with a nil pointer to the options struct.\nvar (\n\tFile           pref.ProtoMessage\n\tEnum           pref.ProtoMessage\n\tEnumValue      pref.ProtoMessage\n\tMessage        pref.ProtoMessage\n\tField          pref.ProtoMessage\n\tOneof          pref.ProtoMessage\n\tExtensionRange pref.ProtoMessage\n\tService        pref.ProtoMessage\n\tMethod         pref.ProtoMessage\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/detrand/rand.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 detrand provides deterministically random functionality.\n//\n// The pseudo-randomness of these functions is seeded by the program binary\n// itself and guarantees that the output does not change within a program,\n// while ensuring that the output is unstable across different builds.\npackage detrand\n\nimport (\n\t\"encoding/binary\"\n\t\"hash/fnv\"\n\t\"os\"\n)\n\n// Disable disables detrand such that all functions returns the zero value.\n// This function is not concurrent-safe and must be called during program init.\nfunc Disable() {\n\trandSeed = 0\n}\n\n// Bool returns a deterministically random boolean.\nfunc Bool() bool {\n\treturn randSeed%2 == 1\n}\n\n// Intn returns a deterministically random integer between 0 and n-1, inclusive.\nfunc Intn(n int) int {\n\tif n <= 0 {\n\t\tpanic(\"must be positive\")\n\t}\n\treturn int(randSeed % uint64(n))\n}\n\n// randSeed is a best-effort at an approximate hash of the Go binary.\nvar randSeed = binaryHash()\n\nfunc binaryHash() uint64 {\n\t// Open the Go binary.\n\ts, err := os.Executable()\n\tif err != nil {\n\t\treturn 0\n\t}\n\tf, err := os.Open(s)\n\tif err != nil {\n\t\treturn 0\n\t}\n\tdefer f.Close()\n\n\t// Hash the size and several samples of the Go binary.\n\tconst numSamples = 8\n\tvar buf [64]byte\n\th := fnv.New64()\n\tfi, err := f.Stat()\n\tif err != nil {\n\t\treturn 0\n\t}\n\tbinary.LittleEndian.PutUint64(buf[:8], uint64(fi.Size()))\n\th.Write(buf[:8])\n\tfor i := int64(0); i < numSamples; i++ {\n\t\tif _, err := f.ReadAt(buf[:], i*fi.Size()/numSamples); err != nil {\n\t\t\treturn 0\n\t\t}\n\t\th.Write(buf[:])\n\t}\n\treturn h.Sum64()\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/encoding/defval/default.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 defval marshals and unmarshals textual forms of default values.\n//\n// This package handles both the form historically used in Go struct field tags\n// and also the form used by google.protobuf.FieldDescriptorProto.default_value\n// since they differ in superficial ways.\npackage defval\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\t\"strconv\"\n\n\tptext \"google.golang.org/protobuf/internal/encoding/text\"\n\terrors \"google.golang.org/protobuf/internal/errors\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// Format is the serialization format used to represent the default value.\ntype Format int\n\nconst (\n\t_ Format = iota\n\n\t// Descriptor uses the serialization format that protoc uses with the\n\t// google.protobuf.FieldDescriptorProto.default_value field.\n\tDescriptor\n\n\t// GoTag uses the historical serialization format in Go struct field tags.\n\tGoTag\n)\n\n// Unmarshal deserializes the default string s according to the given kind k.\n// When k is an enum, a list of enum value descriptors must be provided.\nfunc Unmarshal(s string, k pref.Kind, evs pref.EnumValueDescriptors, f Format) (pref.Value, pref.EnumValueDescriptor, error) {\n\tswitch k {\n\tcase pref.BoolKind:\n\t\tif f == GoTag {\n\t\t\tswitch s {\n\t\t\tcase \"1\":\n\t\t\t\treturn pref.ValueOfBool(true), nil, nil\n\t\t\tcase \"0\":\n\t\t\t\treturn pref.ValueOfBool(false), nil, nil\n\t\t\t}\n\t\t} else {\n\t\t\tswitch s {\n\t\t\tcase \"true\":\n\t\t\t\treturn pref.ValueOfBool(true), nil, nil\n\t\t\tcase \"false\":\n\t\t\t\treturn pref.ValueOfBool(false), nil, nil\n\t\t\t}\n\t\t}\n\tcase pref.EnumKind:\n\t\tif f == GoTag {\n\t\t\t// Go tags use the numeric form of the enum value.\n\t\t\tif n, err := strconv.ParseInt(s, 10, 32); err == nil {\n\t\t\t\tif ev := evs.ByNumber(pref.EnumNumber(n)); ev != nil {\n\t\t\t\t\treturn pref.ValueOfEnum(ev.Number()), ev, nil\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Descriptor default_value use the enum identifier.\n\t\t\tev := evs.ByName(pref.Name(s))\n\t\t\tif ev != nil {\n\t\t\t\treturn pref.ValueOfEnum(ev.Number()), ev, nil\n\t\t\t}\n\t\t}\n\tcase pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:\n\t\tif v, err := strconv.ParseInt(s, 10, 32); err == nil {\n\t\t\treturn pref.ValueOfInt32(int32(v)), nil, nil\n\t\t}\n\tcase pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:\n\t\tif v, err := strconv.ParseInt(s, 10, 64); err == nil {\n\t\t\treturn pref.ValueOfInt64(int64(v)), nil, nil\n\t\t}\n\tcase pref.Uint32Kind, pref.Fixed32Kind:\n\t\tif v, err := strconv.ParseUint(s, 10, 32); err == nil {\n\t\t\treturn pref.ValueOfUint32(uint32(v)), nil, nil\n\t\t}\n\tcase pref.Uint64Kind, pref.Fixed64Kind:\n\t\tif v, err := strconv.ParseUint(s, 10, 64); err == nil {\n\t\t\treturn pref.ValueOfUint64(uint64(v)), nil, nil\n\t\t}\n\tcase pref.FloatKind, pref.DoubleKind:\n\t\tvar v float64\n\t\tvar err error\n\t\tswitch s {\n\t\tcase \"-inf\":\n\t\t\tv = math.Inf(-1)\n\t\tcase \"inf\":\n\t\t\tv = math.Inf(+1)\n\t\tcase \"nan\":\n\t\t\tv = math.NaN()\n\t\tdefault:\n\t\t\tv, err = strconv.ParseFloat(s, 64)\n\t\t}\n\t\tif err == nil {\n\t\t\tif k == pref.FloatKind {\n\t\t\t\treturn pref.ValueOfFloat32(float32(v)), nil, nil\n\t\t\t} else {\n\t\t\t\treturn pref.ValueOfFloat64(float64(v)), nil, nil\n\t\t\t}\n\t\t}\n\tcase pref.StringKind:\n\t\t// String values are already unescaped and can be used as is.\n\t\treturn pref.ValueOfString(s), nil, nil\n\tcase pref.BytesKind:\n\t\tif b, ok := unmarshalBytes(s); ok {\n\t\t\treturn pref.ValueOfBytes(b), nil, nil\n\t\t}\n\t}\n\treturn pref.Value{}, nil, errors.New(\"could not parse value for %v: %q\", k, s)\n}\n\n// Marshal serializes v as the default string according to the given kind k.\n// When specifying the Descriptor format for an enum kind, the associated\n// enum value descriptor must be provided.\nfunc Marshal(v pref.Value, ev pref.EnumValueDescriptor, k pref.Kind, f Format) (string, error) {\n\tswitch k {\n\tcase pref.BoolKind:\n\t\tif f == GoTag {\n\t\t\tif v.Bool() {\n\t\t\t\treturn \"1\", nil\n\t\t\t} else {\n\t\t\t\treturn \"0\", nil\n\t\t\t}\n\t\t} else {\n\t\t\tif v.Bool() {\n\t\t\t\treturn \"true\", nil\n\t\t\t} else {\n\t\t\t\treturn \"false\", nil\n\t\t\t}\n\t\t}\n\tcase pref.EnumKind:\n\t\tif f == GoTag {\n\t\t\treturn strconv.FormatInt(int64(v.Enum()), 10), nil\n\t\t} else {\n\t\t\treturn string(ev.Name()), nil\n\t\t}\n\tcase pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind, pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:\n\t\treturn strconv.FormatInt(v.Int(), 10), nil\n\tcase pref.Uint32Kind, pref.Fixed32Kind, pref.Uint64Kind, pref.Fixed64Kind:\n\t\treturn strconv.FormatUint(v.Uint(), 10), nil\n\tcase pref.FloatKind, pref.DoubleKind:\n\t\tf := v.Float()\n\t\tswitch {\n\t\tcase math.IsInf(f, -1):\n\t\t\treturn \"-inf\", nil\n\t\tcase math.IsInf(f, +1):\n\t\t\treturn \"inf\", nil\n\t\tcase math.IsNaN(f):\n\t\t\treturn \"nan\", nil\n\t\tdefault:\n\t\t\tif k == pref.FloatKind {\n\t\t\t\treturn strconv.FormatFloat(f, 'g', -1, 32), nil\n\t\t\t} else {\n\t\t\t\treturn strconv.FormatFloat(f, 'g', -1, 64), nil\n\t\t\t}\n\t\t}\n\tcase pref.StringKind:\n\t\t// String values are serialized as is without any escaping.\n\t\treturn v.String(), nil\n\tcase pref.BytesKind:\n\t\tif s, ok := marshalBytes(v.Bytes()); ok {\n\t\t\treturn s, nil\n\t\t}\n\t}\n\treturn \"\", errors.New(\"could not format value for %v: %v\", k, v)\n}\n\n// unmarshalBytes deserializes bytes by applying C unescaping.\nfunc unmarshalBytes(s string) ([]byte, bool) {\n\t// Bytes values use the same escaping as the text format,\n\t// however they lack the surrounding double quotes.\n\tv, err := ptext.UnmarshalString(`\"` + s + `\"`)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\treturn []byte(v), true\n}\n\n// marshalBytes serializes bytes by using C escaping.\n// To match the exact output of protoc, this is identical to the\n// CEscape function in strutil.cc of the protoc source code.\nfunc marshalBytes(b []byte) (string, bool) {\n\tvar s []byte\n\tfor _, c := range b {\n\t\tswitch c {\n\t\tcase '\\n':\n\t\t\ts = append(s, `\\n`...)\n\t\tcase '\\r':\n\t\t\ts = append(s, `\\r`...)\n\t\tcase '\\t':\n\t\t\ts = append(s, `\\t`...)\n\t\tcase '\"':\n\t\t\ts = append(s, `\\\"`...)\n\t\tcase '\\'':\n\t\t\ts = append(s, `\\'`...)\n\t\tcase '\\\\':\n\t\t\ts = append(s, `\\\\`...)\n\t\tdefault:\n\t\t\tif printableASCII := c >= 0x20 && c <= 0x7e; printableASCII {\n\t\t\t\ts = append(s, c)\n\t\t\t} else {\n\t\t\t\ts = append(s, fmt.Sprintf(`\\%03o`, c)...)\n\t\t\t}\n\t\t}\n\t}\n\treturn string(s), true\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/encoding/messageset/messageset.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 messageset encodes and decodes the obsolete MessageSet wire format.\npackage messageset\n\nimport (\n\t\"math\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// The MessageSet wire format is equivalent to a message defined as follows,\n// where each Item defines an extension field with a field number of 'type_id'\n// and content of 'message'. MessageSet extensions must be non-repeated message\n// fields.\n//\n//\tmessage MessageSet {\n//\t\trepeated group Item = 1 {\n//\t\t\trequired int32 type_id = 2;\n//\t\t\trequired string message = 3;\n//\t\t}\n//\t}\nconst (\n\tFieldItem    = protowire.Number(1)\n\tFieldTypeID  = protowire.Number(2)\n\tFieldMessage = protowire.Number(3)\n)\n\n// ExtensionName is the field name for extensions of MessageSet.\n//\n// A valid MessageSet extension must be of the form:\n//\tmessage MyMessage {\n//\t\textend proto2.bridge.MessageSet {\n//\t\t\toptional MyMessage message_set_extension = 1234;\n//\t\t}\n//\t\t...\n//\t}\nconst ExtensionName = \"message_set_extension\"\n\n// IsMessageSet returns whether the message uses the MessageSet wire format.\nfunc IsMessageSet(md pref.MessageDescriptor) bool {\n\txmd, ok := md.(interface{ IsMessageSet() bool })\n\treturn ok && xmd.IsMessageSet()\n}\n\n// IsMessageSetExtension reports this field properly extends a MessageSet.\nfunc IsMessageSetExtension(fd pref.FieldDescriptor) bool {\n\tswitch {\n\tcase fd.Name() != ExtensionName:\n\t\treturn false\n\tcase !IsMessageSet(fd.ContainingMessage()):\n\t\treturn false\n\tcase fd.FullName().Parent() != fd.Message().FullName():\n\t\treturn false\n\t}\n\treturn true\n}\n\n// SizeField returns the size of a MessageSet item field containing an extension\n// with the given field number, not counting the contents of the message subfield.\nfunc SizeField(num protowire.Number) int {\n\treturn 2*protowire.SizeTag(FieldItem) + protowire.SizeTag(FieldTypeID) + protowire.SizeVarint(uint64(num))\n}\n\n// Unmarshal parses a MessageSet.\n//\n// It calls fn with the type ID and value of each item in the MessageSet.\n// Unknown fields are discarded.\n//\n// If wantLen is true, the item values include the varint length prefix.\n// This is ugly, but simplifies the fast-path decoder in internal/impl.\nfunc Unmarshal(b []byte, wantLen bool, fn func(typeID protowire.Number, value []byte) error) error {\n\tfor len(b) > 0 {\n\t\tnum, wtyp, n := protowire.ConsumeTag(b)\n\t\tif n < 0 {\n\t\t\treturn protowire.ParseError(n)\n\t\t}\n\t\tb = b[n:]\n\t\tif num != FieldItem || wtyp != protowire.StartGroupType {\n\t\t\tn := protowire.ConsumeFieldValue(num, wtyp, b)\n\t\t\tif n < 0 {\n\t\t\t\treturn protowire.ParseError(n)\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t\tcontinue\n\t\t}\n\t\ttypeID, value, n, err := ConsumeFieldValue(b, wantLen)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tb = b[n:]\n\t\tif typeID == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif err := fn(typeID, value); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// ConsumeFieldValue parses b as a MessageSet item field value until and including\n// the trailing end group marker. It assumes the start group tag has already been parsed.\n// It returns the contents of the type_id and message subfields and the total\n// item length.\n//\n// If wantLen is true, the returned message value includes the length prefix.\nfunc ConsumeFieldValue(b []byte, wantLen bool) (typeid protowire.Number, message []byte, n int, err error) {\n\tilen := len(b)\n\tfor {\n\t\tnum, wtyp, n := protowire.ConsumeTag(b)\n\t\tif n < 0 {\n\t\t\treturn 0, nil, 0, protowire.ParseError(n)\n\t\t}\n\t\tb = b[n:]\n\t\tswitch {\n\t\tcase num == FieldItem && wtyp == protowire.EndGroupType:\n\t\t\tif wantLen && len(message) == 0 {\n\t\t\t\t// The message field was missing, which should never happen.\n\t\t\t\t// Be prepared for this case anyway.\n\t\t\t\tmessage = protowire.AppendVarint(message, 0)\n\t\t\t}\n\t\t\treturn typeid, message, ilen - len(b), nil\n\t\tcase num == FieldTypeID && wtyp == protowire.VarintType:\n\t\t\tv, n := protowire.ConsumeVarint(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, nil, 0, protowire.ParseError(n)\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t\tif v < 1 || v > math.MaxInt32 {\n\t\t\t\treturn 0, nil, 0, errors.New(\"invalid type_id in message set\")\n\t\t\t}\n\t\t\ttypeid = protowire.Number(v)\n\t\tcase num == FieldMessage && wtyp == protowire.BytesType:\n\t\t\tm, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, nil, 0, protowire.ParseError(n)\n\t\t\t}\n\t\t\tif message == nil {\n\t\t\t\tif wantLen {\n\t\t\t\t\tmessage = b[:n:n]\n\t\t\t\t} else {\n\t\t\t\t\tmessage = m[:len(m):len(m)]\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// This case should never happen in practice, but handle it for\n\t\t\t\t// correctness: The MessageSet item contains multiple message\n\t\t\t\t// fields, which need to be merged.\n\t\t\t\t//\n\t\t\t\t// In the case where we're returning the length, this becomes\n\t\t\t\t// quite inefficient since we need to strip the length off\n\t\t\t\t// the existing data and reconstruct it with the combined length.\n\t\t\t\tif wantLen {\n\t\t\t\t\t_, nn := protowire.ConsumeVarint(message)\n\t\t\t\t\tm0 := message[nn:]\n\t\t\t\t\tmessage = nil\n\t\t\t\t\tmessage = protowire.AppendVarint(message, uint64(len(m0)+len(m)))\n\t\t\t\t\tmessage = append(message, m0...)\n\t\t\t\t\tmessage = append(message, m...)\n\t\t\t\t} else {\n\t\t\t\t\tmessage = append(message, m...)\n\t\t\t\t}\n\t\t\t}\n\t\t\tb = b[n:]\n\t\tdefault:\n\t\t\t// We have no place to put it, so we just ignore unknown fields.\n\t\t\tn := protowire.ConsumeFieldValue(num, wtyp, b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, nil, 0, protowire.ParseError(n)\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t}\n\t}\n}\n\n// AppendFieldStart appends the start of a MessageSet item field containing\n// an extension with the given number. The caller must add the message\n// subfield (including the tag).\nfunc AppendFieldStart(b []byte, num protowire.Number) []byte {\n\tb = protowire.AppendTag(b, FieldItem, protowire.StartGroupType)\n\tb = protowire.AppendTag(b, FieldTypeID, protowire.VarintType)\n\tb = protowire.AppendVarint(b, uint64(num))\n\treturn b\n}\n\n// AppendFieldEnd appends the trailing end group marker for a MessageSet item field.\nfunc AppendFieldEnd(b []byte) []byte {\n\treturn protowire.AppendTag(b, FieldItem, protowire.EndGroupType)\n}\n\n// SizeUnknown returns the size of an unknown fields section in MessageSet format.\n//\n// See AppendUnknown.\nfunc SizeUnknown(unknown []byte) (size int) {\n\tfor len(unknown) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(unknown)\n\t\tif n < 0 || typ != protowire.BytesType {\n\t\t\treturn 0\n\t\t}\n\t\tunknown = unknown[n:]\n\t\t_, n = protowire.ConsumeBytes(unknown)\n\t\tif n < 0 {\n\t\t\treturn 0\n\t\t}\n\t\tunknown = unknown[n:]\n\t\tsize += SizeField(num) + protowire.SizeTag(FieldMessage) + n\n\t}\n\treturn size\n}\n\n// AppendUnknown appends unknown fields to b in MessageSet format.\n//\n// For historic reasons, unresolved items in a MessageSet are stored in a\n// message's unknown fields section in non-MessageSet format. That is, an\n// unknown item with typeID T and value V appears in the unknown fields as\n// a field with number T and value V.\n//\n// This function converts the unknown fields back into MessageSet form.\nfunc AppendUnknown(b, unknown []byte) ([]byte, error) {\n\tfor len(unknown) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(unknown)\n\t\tif n < 0 || typ != protowire.BytesType {\n\t\t\treturn nil, errors.New(\"invalid data in message set unknown fields\")\n\t\t}\n\t\tunknown = unknown[n:]\n\t\t_, n = protowire.ConsumeBytes(unknown)\n\t\tif n < 0 {\n\t\t\treturn nil, errors.New(\"invalid data in message set unknown fields\")\n\t\t}\n\t\tb = AppendFieldStart(b, num)\n\t\tb = protowire.AppendTag(b, FieldMessage, protowire.BytesType)\n\t\tb = append(b, unknown[:n]...)\n\t\tb = AppendFieldEnd(b)\n\t\tunknown = unknown[n:]\n\t}\n\treturn b, nil\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/encoding/tag/tag.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 tag marshals and unmarshals the legacy struct tags as generated\n// by historical versions of protoc-gen-go.\npackage tag\n\nimport (\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\n\tdefval \"google.golang.org/protobuf/internal/encoding/defval\"\n\tfdesc \"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nvar byteType = reflect.TypeOf(byte(0))\n\n// Unmarshal decodes the tag into a prototype.Field.\n//\n// The goType is needed to determine the original protoreflect.Kind since the\n// tag does not record sufficient information to determine that.\n// The type is the underlying field type (e.g., a repeated field may be\n// represented by []T, but the Go type passed in is just T).\n// A list of enum value descriptors must be provided for enum fields.\n// This does not populate the Enum or Message (except for weak message).\n//\n// This function is a best effort attempt; parsing errors are ignored.\nfunc Unmarshal(tag string, goType reflect.Type, evs pref.EnumValueDescriptors) pref.FieldDescriptor {\n\tf := new(fdesc.Field)\n\tf.L0.ParentFile = fdesc.SurrogateProto2\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\tf.L0.FullName = pref.FullName(s[len(\"name=\"):])\n\t\tcase strings.Trim(s, \"0123456789\") == \"\":\n\t\t\tn, _ := strconv.ParseUint(s, 10, 32)\n\t\t\tf.L1.Number = pref.FieldNumber(n)\n\t\tcase s == \"opt\":\n\t\t\tf.L1.Cardinality = pref.Optional\n\t\tcase s == \"req\":\n\t\t\tf.L1.Cardinality = pref.Required\n\t\tcase s == \"rep\":\n\t\t\tf.L1.Cardinality = pref.Repeated\n\t\tcase s == \"varint\":\n\t\t\tswitch goType.Kind() {\n\t\t\tcase reflect.Bool:\n\t\t\t\tf.L1.Kind = pref.BoolKind\n\t\t\tcase reflect.Int32:\n\t\t\t\tf.L1.Kind = pref.Int32Kind\n\t\t\tcase reflect.Int64:\n\t\t\t\tf.L1.Kind = pref.Int64Kind\n\t\t\tcase reflect.Uint32:\n\t\t\t\tf.L1.Kind = pref.Uint32Kind\n\t\t\tcase reflect.Uint64:\n\t\t\t\tf.L1.Kind = pref.Uint64Kind\n\t\t\t}\n\t\tcase s == \"zigzag32\":\n\t\t\tif goType.Kind() == reflect.Int32 {\n\t\t\t\tf.L1.Kind = pref.Sint32Kind\n\t\t\t}\n\t\tcase s == \"zigzag64\":\n\t\t\tif goType.Kind() == reflect.Int64 {\n\t\t\t\tf.L1.Kind = pref.Sint64Kind\n\t\t\t}\n\t\tcase s == \"fixed32\":\n\t\t\tswitch goType.Kind() {\n\t\t\tcase reflect.Int32:\n\t\t\t\tf.L1.Kind = pref.Sfixed32Kind\n\t\t\tcase reflect.Uint32:\n\t\t\t\tf.L1.Kind = pref.Fixed32Kind\n\t\t\tcase reflect.Float32:\n\t\t\t\tf.L1.Kind = pref.FloatKind\n\t\t\t}\n\t\tcase s == \"fixed64\":\n\t\t\tswitch goType.Kind() {\n\t\t\tcase reflect.Int64:\n\t\t\t\tf.L1.Kind = pref.Sfixed64Kind\n\t\t\tcase reflect.Uint64:\n\t\t\t\tf.L1.Kind = pref.Fixed64Kind\n\t\t\tcase reflect.Float64:\n\t\t\t\tf.L1.Kind = pref.DoubleKind\n\t\t\t}\n\t\tcase s == \"bytes\":\n\t\t\tswitch {\n\t\t\tcase goType.Kind() == reflect.String:\n\t\t\t\tf.L1.Kind = pref.StringKind\n\t\t\tcase goType.Kind() == reflect.Slice && goType.Elem() == byteType:\n\t\t\t\tf.L1.Kind = pref.BytesKind\n\t\t\tdefault:\n\t\t\t\tf.L1.Kind = pref.MessageKind\n\t\t\t}\n\t\tcase s == \"group\":\n\t\t\tf.L1.Kind = pref.GroupKind\n\t\tcase strings.HasPrefix(s, \"enum=\"):\n\t\t\tf.L1.Kind = pref.EnumKind\n\t\tcase strings.HasPrefix(s, \"json=\"):\n\t\t\tjsonName := s[len(\"json=\"):]\n\t\t\tif jsonName != strs.JSONCamelCase(string(f.L0.FullName.Name())) {\n\t\t\t\tf.L1.StringName.InitJSON(jsonName)\n\t\t\t}\n\t\tcase s == \"packed\":\n\t\t\tf.L1.HasPacked = true\n\t\t\tf.L1.IsPacked = true\n\t\tcase strings.HasPrefix(s, \"weak=\"):\n\t\t\tf.L1.IsWeak = true\n\t\t\tf.L1.Message = fdesc.PlaceholderMessage(pref.FullName(s[len(\"weak=\"):]))\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\ts, i = tag[len(\"def=\"):], len(tag)\n\t\t\tv, ev, _ := defval.Unmarshal(s, f.L1.Kind, evs, defval.GoTag)\n\t\t\tf.L1.Default = fdesc.DefaultValue(v, ev)\n\t\tcase s == \"proto3\":\n\t\t\tf.L0.ParentFile = fdesc.SurrogateProto3\n\t\t}\n\t\ttag = strings.TrimPrefix(tag[i:], \",\")\n\t}\n\n\t// The generator uses the group message name instead of the field name.\n\t// We obtain the real field name by lowercasing the group name.\n\tif f.L1.Kind == pref.GroupKind {\n\t\tf.L0.FullName = pref.FullName(strings.ToLower(string(f.L0.FullName)))\n\t}\n\treturn f\n}\n\n// Marshal encodes the protoreflect.FieldDescriptor as a tag.\n//\n// The enumName must be provided if the kind is an enum.\n// Historically, the formulation of the enum \"name\" was the proto package\n// dot-concatenated with the generated Go identifier for the enum type.\n// Depending on the context on how Marshal is called, there are different ways\n// through which that information is determined. As such it is the caller's\n// responsibility to provide a function to obtain that information.\nfunc Marshal(fd pref.FieldDescriptor, enumName string) string {\n\tvar tag []string\n\tswitch fd.Kind() {\n\tcase pref.BoolKind, pref.EnumKind, pref.Int32Kind, pref.Uint32Kind, pref.Int64Kind, pref.Uint64Kind:\n\t\ttag = append(tag, \"varint\")\n\tcase pref.Sint32Kind:\n\t\ttag = append(tag, \"zigzag32\")\n\tcase pref.Sint64Kind:\n\t\ttag = append(tag, \"zigzag64\")\n\tcase pref.Sfixed32Kind, pref.Fixed32Kind, pref.FloatKind:\n\t\ttag = append(tag, \"fixed32\")\n\tcase pref.Sfixed64Kind, pref.Fixed64Kind, pref.DoubleKind:\n\t\ttag = append(tag, \"fixed64\")\n\tcase pref.StringKind, pref.BytesKind, pref.MessageKind:\n\t\ttag = append(tag, \"bytes\")\n\tcase pref.GroupKind:\n\t\ttag = append(tag, \"group\")\n\t}\n\ttag = append(tag, strconv.Itoa(int(fd.Number())))\n\tswitch fd.Cardinality() {\n\tcase pref.Optional:\n\t\ttag = append(tag, \"opt\")\n\tcase pref.Required:\n\t\ttag = append(tag, \"req\")\n\tcase pref.Repeated:\n\t\ttag = append(tag, \"rep\")\n\t}\n\tif fd.IsPacked() {\n\t\ttag = append(tag, \"packed\")\n\t}\n\tname := string(fd.Name())\n\tif fd.Kind() == pref.GroupKind {\n\t\t// The name of the FieldDescriptor for a group field is\n\t\t// lowercased. To find the original capitalization, we\n\t\t// look in the field's MessageType.\n\t\tname = string(fd.Message().Name())\n\t}\n\ttag = append(tag, \"name=\"+name)\n\tif jsonName := fd.JSONName(); jsonName != \"\" && jsonName != name && !fd.IsExtension() {\n\t\t// NOTE: The jsonName != name condition is suspect, but it preserve\n\t\t// the exact same semantics from the previous generator.\n\t\ttag = append(tag, \"json=\"+jsonName)\n\t}\n\tif fd.IsWeak() {\n\t\ttag = append(tag, \"weak=\"+string(fd.Message().FullName()))\n\t}\n\t// The previous implementation does not tag extension fields as proto3,\n\t// even when the field is defined in a proto3 file. Match that behavior\n\t// for consistency.\n\tif fd.Syntax() == pref.Proto3 && !fd.IsExtension() {\n\t\ttag = append(tag, \"proto3\")\n\t}\n\tif fd.Kind() == pref.EnumKind && enumName != \"\" {\n\t\ttag = append(tag, \"enum=\"+enumName)\n\t}\n\tif fd.ContainingOneof() != nil {\n\t\ttag = append(tag, \"oneof\")\n\t}\n\t// This must appear last in the tag, since commas in strings aren't escaped.\n\tif fd.HasDefault() {\n\t\tdef, _ := defval.Marshal(fd.Default(), fd.DefaultEnumValue(), fd.Kind(), defval.GoTag)\n\t\ttag = append(tag, \"def=\"+def)\n\t}\n\treturn strings.Join(tag, \",\")\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/encoding/text/decode.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 text\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/internal/errors\"\n)\n\n// Decoder is a token-based textproto decoder.\ntype Decoder struct {\n\t// lastCall is last method called, either readCall or peekCall.\n\t// Initial value is readCall.\n\tlastCall call\n\n\t// lastToken contains the last read token.\n\tlastToken Token\n\n\t// lastErr contains the last read error.\n\tlastErr error\n\n\t// openStack is a stack containing the byte characters for MessageOpen and\n\t// ListOpen kinds. The top of stack represents the message or the list that\n\t// the current token is nested in. An empty stack means the current token is\n\t// at the top level message. The characters '{' and '<' both represent the\n\t// MessageOpen kind.\n\topenStack []byte\n\n\t// orig is used in reporting line and column.\n\torig []byte\n\t// in contains the unconsumed input.\n\tin []byte\n}\n\n// NewDecoder returns a Decoder to read the given []byte.\nfunc NewDecoder(b []byte) *Decoder {\n\treturn &Decoder{orig: b, in: b}\n}\n\n// ErrUnexpectedEOF means that EOF was encountered in the middle of the input.\nvar ErrUnexpectedEOF = errors.New(\"%v\", io.ErrUnexpectedEOF)\n\n// call specifies which Decoder method was invoked.\ntype call uint8\n\nconst (\n\treadCall call = iota\n\tpeekCall\n)\n\n// Peek looks ahead and returns the next token and error without advancing a read.\nfunc (d *Decoder) Peek() (Token, error) {\n\tdefer func() { d.lastCall = peekCall }()\n\tif d.lastCall == readCall {\n\t\td.lastToken, d.lastErr = d.Read()\n\t}\n\treturn d.lastToken, d.lastErr\n}\n\n// Read returns the next token.\n// It will return an error if there is no valid token.\nfunc (d *Decoder) Read() (Token, error) {\n\tdefer func() { d.lastCall = readCall }()\n\tif d.lastCall == peekCall {\n\t\treturn d.lastToken, d.lastErr\n\t}\n\n\ttok, err := d.parseNext(d.lastToken.kind)\n\tif err != nil {\n\t\treturn Token{}, err\n\t}\n\n\tswitch tok.kind {\n\tcase comma, semicolon:\n\t\ttok, err = d.parseNext(tok.kind)\n\t\tif err != nil {\n\t\t\treturn Token{}, err\n\t\t}\n\t}\n\td.lastToken = tok\n\treturn tok, nil\n}\n\nconst (\n\tmismatchedFmt = \"mismatched close character %q\"\n\tunexpectedFmt = \"unexpected character %q\"\n)\n\n// parseNext parses the next Token based on given last kind.\nfunc (d *Decoder) parseNext(lastKind Kind) (Token, error) {\n\t// Trim leading spaces.\n\td.consume(0)\n\tisEOF := false\n\tif len(d.in) == 0 {\n\t\tisEOF = true\n\t}\n\n\tswitch lastKind {\n\tcase EOF:\n\t\treturn d.consumeToken(EOF, 0, 0), nil\n\n\tcase bof:\n\t\t// Start of top level message. Next token can be EOF or Name.\n\t\tif isEOF {\n\t\t\treturn d.consumeToken(EOF, 0, 0), nil\n\t\t}\n\t\treturn d.parseFieldName()\n\n\tcase Name:\n\t\t// Next token can be MessageOpen, ListOpen or Scalar.\n\t\tif isEOF {\n\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t}\n\t\tswitch ch := d.in[0]; ch {\n\t\tcase '{', '<':\n\t\t\td.pushOpenStack(ch)\n\t\t\treturn d.consumeToken(MessageOpen, 1, 0), nil\n\t\tcase '[':\n\t\t\td.pushOpenStack(ch)\n\t\t\treturn d.consumeToken(ListOpen, 1, 0), nil\n\t\tdefault:\n\t\t\treturn d.parseScalar()\n\t\t}\n\n\tcase Scalar:\n\t\topenKind, closeCh := d.currentOpenKind()\n\t\tswitch openKind {\n\t\tcase bof:\n\t\t\t// Top level message.\n\t\t\t// \tNext token can be EOF, comma, semicolon or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn d.consumeToken(EOF, 0, 0), nil\n\t\t\t}\n\t\t\tswitch d.in[0] {\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tcase ';':\n\t\t\t\treturn d.consumeToken(semicolon, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn d.parseFieldName()\n\t\t\t}\n\n\t\tcase MessageOpen:\n\t\t\t// Next token can be MessageClose, comma, semicolon or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase closeCh:\n\t\t\t\td.popOpenStack()\n\t\t\t\treturn d.consumeToken(MessageClose, 1, 0), nil\n\t\t\tcase otherCloseChar[closeCh]:\n\t\t\t\treturn Token{}, d.newSyntaxError(mismatchedFmt, ch)\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tcase ';':\n\t\t\t\treturn d.consumeToken(semicolon, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn d.parseFieldName()\n\t\t\t}\n\n\t\tcase ListOpen:\n\t\t\t// Next token can be ListClose or comma.\n\t\t\tif isEOF {\n\t\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase ']':\n\t\t\t\td.popOpenStack()\n\t\t\t\treturn d.consumeToken(ListClose, 1, 0), nil\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn Token{}, d.newSyntaxError(unexpectedFmt, ch)\n\t\t\t}\n\t\t}\n\n\tcase MessageOpen:\n\t\t// Next token can be MessageClose or Name.\n\t\tif isEOF {\n\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t}\n\t\t_, closeCh := d.currentOpenKind()\n\t\tswitch ch := d.in[0]; ch {\n\t\tcase closeCh:\n\t\t\td.popOpenStack()\n\t\t\treturn d.consumeToken(MessageClose, 1, 0), nil\n\t\tcase otherCloseChar[closeCh]:\n\t\t\treturn Token{}, d.newSyntaxError(mismatchedFmt, ch)\n\t\tdefault:\n\t\t\treturn d.parseFieldName()\n\t\t}\n\n\tcase MessageClose:\n\t\topenKind, closeCh := d.currentOpenKind()\n\t\tswitch openKind {\n\t\tcase bof:\n\t\t\t// Top level message.\n\t\t\t// Next token can be EOF, comma, semicolon or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn d.consumeToken(EOF, 0, 0), nil\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tcase ';':\n\t\t\t\treturn d.consumeToken(semicolon, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn d.parseFieldName()\n\t\t\t}\n\n\t\tcase MessageOpen:\n\t\t\t// Next token can be MessageClose, comma, semicolon or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase closeCh:\n\t\t\t\td.popOpenStack()\n\t\t\t\treturn d.consumeToken(MessageClose, 1, 0), nil\n\t\t\tcase otherCloseChar[closeCh]:\n\t\t\t\treturn Token{}, d.newSyntaxError(mismatchedFmt, ch)\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tcase ';':\n\t\t\t\treturn d.consumeToken(semicolon, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn d.parseFieldName()\n\t\t\t}\n\n\t\tcase ListOpen:\n\t\t\t// Next token can be ListClose or comma\n\t\t\tif isEOF {\n\t\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase closeCh:\n\t\t\t\td.popOpenStack()\n\t\t\t\treturn d.consumeToken(ListClose, 1, 0), nil\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn Token{}, d.newSyntaxError(unexpectedFmt, ch)\n\t\t\t}\n\t\t}\n\n\tcase ListOpen:\n\t\t// Next token can be ListClose, MessageStart or Scalar.\n\t\tif isEOF {\n\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t}\n\t\tswitch ch := d.in[0]; ch {\n\t\tcase ']':\n\t\t\td.popOpenStack()\n\t\t\treturn d.consumeToken(ListClose, 1, 0), nil\n\t\tcase '{', '<':\n\t\t\td.pushOpenStack(ch)\n\t\t\treturn d.consumeToken(MessageOpen, 1, 0), nil\n\t\tdefault:\n\t\t\treturn d.parseScalar()\n\t\t}\n\n\tcase ListClose:\n\t\topenKind, closeCh := d.currentOpenKind()\n\t\tswitch openKind {\n\t\tcase bof:\n\t\t\t// Top level message.\n\t\t\t// Next token can be EOF, comma, semicolon or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn d.consumeToken(EOF, 0, 0), nil\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tcase ';':\n\t\t\t\treturn d.consumeToken(semicolon, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn d.parseFieldName()\n\t\t\t}\n\n\t\tcase MessageOpen:\n\t\t\t// Next token can be MessageClose, comma, semicolon or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase closeCh:\n\t\t\t\td.popOpenStack()\n\t\t\t\treturn d.consumeToken(MessageClose, 1, 0), nil\n\t\t\tcase otherCloseChar[closeCh]:\n\t\t\t\treturn Token{}, d.newSyntaxError(mismatchedFmt, ch)\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tcase ';':\n\t\t\t\treturn d.consumeToken(semicolon, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn d.parseFieldName()\n\t\t\t}\n\n\t\tdefault:\n\t\t\t// It is not possible to have this case. Let it panic below.\n\t\t}\n\n\tcase comma, semicolon:\n\t\topenKind, closeCh := d.currentOpenKind()\n\t\tswitch openKind {\n\t\tcase bof:\n\t\t\t// Top level message. Next token can be EOF or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn d.consumeToken(EOF, 0, 0), nil\n\t\t\t}\n\t\t\treturn d.parseFieldName()\n\n\t\tcase MessageOpen:\n\t\t\t// Next token can be MessageClose or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase closeCh:\n\t\t\t\td.popOpenStack()\n\t\t\t\treturn d.consumeToken(MessageClose, 1, 0), nil\n\t\t\tcase otherCloseChar[closeCh]:\n\t\t\t\treturn Token{}, d.newSyntaxError(mismatchedFmt, ch)\n\t\t\tdefault:\n\t\t\t\treturn d.parseFieldName()\n\t\t\t}\n\n\t\tcase ListOpen:\n\t\t\tif lastKind == semicolon {\n\t\t\t\t// It is not be possible to have this case as logic here\n\t\t\t\t// should not have produced a semicolon Token when inside a\n\t\t\t\t// list. Let it panic below.\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// Next token can be MessageOpen or Scalar.\n\t\t\tif isEOF {\n\t\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase '{', '<':\n\t\t\t\td.pushOpenStack(ch)\n\t\t\t\treturn d.consumeToken(MessageOpen, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn d.parseScalar()\n\t\t\t}\n\t\t}\n\t}\n\n\tline, column := d.Position(len(d.orig) - len(d.in))\n\tpanic(fmt.Sprintf(\"Decoder.parseNext: bug at handling line %d:%d with lastKind=%v\", line, column, lastKind))\n}\n\nvar otherCloseChar = map[byte]byte{\n\t'}': '>',\n\t'>': '}',\n}\n\n// currentOpenKind indicates whether current position is inside a message, list\n// or top-level message by returning MessageOpen, ListOpen or bof respectively.\n// If the returned kind is either a MessageOpen or ListOpen, it also returns the\n// corresponding closing character.\nfunc (d *Decoder) currentOpenKind() (Kind, byte) {\n\tif len(d.openStack) == 0 {\n\t\treturn bof, 0\n\t}\n\topenCh := d.openStack[len(d.openStack)-1]\n\tswitch openCh {\n\tcase '{':\n\t\treturn MessageOpen, '}'\n\tcase '<':\n\t\treturn MessageOpen, '>'\n\tcase '[':\n\t\treturn ListOpen, ']'\n\t}\n\tpanic(fmt.Sprintf(\"Decoder: openStack contains invalid byte %s\", string(openCh)))\n}\n\nfunc (d *Decoder) pushOpenStack(ch byte) {\n\td.openStack = append(d.openStack, ch)\n}\n\nfunc (d *Decoder) popOpenStack() {\n\td.openStack = d.openStack[:len(d.openStack)-1]\n}\n\n// parseFieldName parses field name and separator.\nfunc (d *Decoder) parseFieldName() (tok Token, err error) {\n\tdefer func() {\n\t\tif err == nil && d.tryConsumeChar(':') {\n\t\t\ttok.attrs |= hasSeparator\n\t\t}\n\t}()\n\n\t// Extension or Any type URL.\n\tif d.in[0] == '[' {\n\t\treturn d.parseTypeName()\n\t}\n\n\t// Identifier.\n\tif size := parseIdent(d.in, false); size > 0 {\n\t\treturn d.consumeToken(Name, size, uint8(IdentName)), nil\n\t}\n\n\t// Field number. Identify if input is a valid number that is not negative\n\t// and is decimal integer within 32-bit range.\n\tif num := parseNumber(d.in); num.size > 0 {\n\t\tif !num.neg && num.kind == numDec {\n\t\t\tif _, err := strconv.ParseInt(string(d.in[:num.size]), 10, 32); err == nil {\n\t\t\t\treturn d.consumeToken(Name, num.size, uint8(FieldNumber)), nil\n\t\t\t}\n\t\t}\n\t\treturn Token{}, d.newSyntaxError(\"invalid field number: %s\", d.in[:num.size])\n\t}\n\n\treturn Token{}, d.newSyntaxError(\"invalid field name: %s\", errRegexp.Find(d.in))\n}\n\n// parseTypeName parses Any type URL or extension field name. The name is\n// enclosed in [ and ] characters. The C++ parser does not handle many legal URL\n// strings. This implementation is more liberal and allows for the pattern\n// ^[-_a-zA-Z0-9]+([./][-_a-zA-Z0-9]+)*`). Whitespaces and comments are allowed\n// in between [ ], '.', '/' and the sub names.\nfunc (d *Decoder) parseTypeName() (Token, error) {\n\tstartPos := len(d.orig) - len(d.in)\n\t// Use alias s to advance first in order to use d.in for error handling.\n\t// Caller already checks for [ as first character.\n\ts := consume(d.in[1:], 0)\n\tif len(s) == 0 {\n\t\treturn Token{}, ErrUnexpectedEOF\n\t}\n\n\tvar name []byte\n\tfor len(s) > 0 && isTypeNameChar(s[0]) {\n\t\tname = append(name, s[0])\n\t\ts = s[1:]\n\t}\n\ts = consume(s, 0)\n\n\tvar closed bool\n\tfor len(s) > 0 && !closed {\n\t\tswitch {\n\t\tcase s[0] == ']':\n\t\t\ts = s[1:]\n\t\t\tclosed = true\n\n\t\tcase s[0] == '/', s[0] == '.':\n\t\t\tif len(name) > 0 && (name[len(name)-1] == '/' || name[len(name)-1] == '.') {\n\t\t\t\treturn Token{}, d.newSyntaxError(\"invalid type URL/extension field name: %s\",\n\t\t\t\t\td.orig[startPos:len(d.orig)-len(s)+1])\n\t\t\t}\n\t\t\tname = append(name, s[0])\n\t\t\ts = s[1:]\n\t\t\ts = consume(s, 0)\n\t\t\tfor len(s) > 0 && isTypeNameChar(s[0]) {\n\t\t\t\tname = append(name, s[0])\n\t\t\t\ts = s[1:]\n\t\t\t}\n\t\t\ts = consume(s, 0)\n\n\t\tdefault:\n\t\t\treturn Token{}, d.newSyntaxError(\n\t\t\t\t\"invalid type URL/extension field name: %s\", d.orig[startPos:len(d.orig)-len(s)+1])\n\t\t}\n\t}\n\n\tif !closed {\n\t\treturn Token{}, ErrUnexpectedEOF\n\t}\n\n\t// First character cannot be '.'. Last character cannot be '.' or '/'.\n\tsize := len(name)\n\tif size == 0 || name[0] == '.' || name[size-1] == '.' || name[size-1] == '/' {\n\t\treturn Token{}, d.newSyntaxError(\"invalid type URL/extension field name: %s\",\n\t\t\td.orig[startPos:len(d.orig)-len(s)])\n\t}\n\n\td.in = s\n\tendPos := len(d.orig) - len(d.in)\n\td.consume(0)\n\n\treturn Token{\n\t\tkind:  Name,\n\t\tattrs: uint8(TypeName),\n\t\tpos:   startPos,\n\t\traw:   d.orig[startPos:endPos],\n\t\tstr:   string(name),\n\t}, nil\n}\n\nfunc isTypeNameChar(b byte) bool {\n\treturn (b == '-' || b == '_' ||\n\t\t('0' <= b && b <= '9') ||\n\t\t('a' <= b && b <= 'z') ||\n\t\t('A' <= b && b <= 'Z'))\n}\n\nfunc isWhiteSpace(b byte) bool {\n\tswitch b {\n\tcase ' ', '\\n', '\\r', '\\t':\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\n// parseIdent parses an unquoted proto identifier and returns size.\n// If allowNeg is true, it allows '-' to be the first character in the\n// identifier. This is used when parsing literal values like -infinity, etc.\n// Regular expression matches an identifier: `^[_a-zA-Z][_a-zA-Z0-9]*`\nfunc parseIdent(input []byte, allowNeg bool) int {\n\tvar size int\n\n\ts := input\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\n\tif allowNeg && s[0] == '-' {\n\t\ts = s[1:]\n\t\tsize++\n\t\tif len(s) == 0 {\n\t\t\treturn 0\n\t\t}\n\t}\n\n\tswitch {\n\tcase s[0] == '_',\n\t\t'a' <= s[0] && s[0] <= 'z',\n\t\t'A' <= s[0] && s[0] <= 'Z':\n\t\ts = s[1:]\n\t\tsize++\n\tdefault:\n\t\treturn 0\n\t}\n\n\tfor len(s) > 0 && (s[0] == '_' ||\n\t\t'a' <= s[0] && s[0] <= 'z' ||\n\t\t'A' <= s[0] && s[0] <= 'Z' ||\n\t\t'0' <= s[0] && s[0] <= '9') {\n\t\ts = s[1:]\n\t\tsize++\n\t}\n\n\tif len(s) > 0 && !isDelim(s[0]) {\n\t\treturn 0\n\t}\n\n\treturn size\n}\n\n// parseScalar parses for a string, literal or number value.\nfunc (d *Decoder) parseScalar() (Token, error) {\n\tif d.in[0] == '\"' || d.in[0] == '\\'' {\n\t\treturn d.parseStringValue()\n\t}\n\n\tif tok, ok := d.parseLiteralValue(); ok {\n\t\treturn tok, nil\n\t}\n\n\tif tok, ok := d.parseNumberValue(); ok {\n\t\treturn tok, nil\n\t}\n\n\treturn Token{}, d.newSyntaxError(\"invalid scalar value: %s\", errRegexp.Find(d.in))\n}\n\n// parseLiteralValue parses a literal value. A literal value is used for\n// bools, special floats and enums. This function simply identifies that the\n// field value is a literal.\nfunc (d *Decoder) parseLiteralValue() (Token, bool) {\n\tsize := parseIdent(d.in, true)\n\tif size == 0 {\n\t\treturn Token{}, false\n\t}\n\treturn d.consumeToken(Scalar, size, literalValue), true\n}\n\n// consumeToken constructs a Token for given Kind from d.in and consumes given\n// size-length from it.\nfunc (d *Decoder) consumeToken(kind Kind, size int, attrs uint8) Token {\n\t// Important to compute raw and pos before consuming.\n\ttok := Token{\n\t\tkind:  kind,\n\t\tattrs: attrs,\n\t\tpos:   len(d.orig) - len(d.in),\n\t\traw:   d.in[:size],\n\t}\n\td.consume(size)\n\treturn tok\n}\n\n// newSyntaxError returns a syntax error with line and column information for\n// current position.\nfunc (d *Decoder) newSyntaxError(f string, x ...interface{}) error {\n\te := errors.New(f, x...)\n\tline, column := d.Position(len(d.orig) - len(d.in))\n\treturn errors.New(\"syntax error (line %d:%d): %v\", line, column, e)\n}\n\n// Position returns line and column number of given index of the original input.\n// It will panic if index is out of range.\nfunc (d *Decoder) Position(idx int) (line int, column int) {\n\tb := d.orig[:idx]\n\tline = bytes.Count(b, []byte(\"\\n\")) + 1\n\tif i := bytes.LastIndexByte(b, '\\n'); i >= 0 {\n\t\tb = b[i+1:]\n\t}\n\tcolumn = utf8.RuneCount(b) + 1 // ignore multi-rune characters\n\treturn line, column\n}\n\nfunc (d *Decoder) tryConsumeChar(c byte) bool {\n\tif len(d.in) > 0 && d.in[0] == c {\n\t\td.consume(1)\n\t\treturn true\n\t}\n\treturn false\n}\n\n// consume consumes n bytes of input and any subsequent whitespace or comments.\nfunc (d *Decoder) consume(n int) {\n\td.in = consume(d.in, n)\n\treturn\n}\n\n// consume consumes n bytes of input and any subsequent whitespace or comments.\nfunc consume(b []byte, n int) []byte {\n\tb = b[n:]\n\tfor len(b) > 0 {\n\t\tswitch b[0] {\n\t\tcase ' ', '\\n', '\\r', '\\t':\n\t\t\tb = b[1:]\n\t\tcase '#':\n\t\t\tif i := bytes.IndexByte(b, '\\n'); i >= 0 {\n\t\t\t\tb = b[i+len(\"\\n\"):]\n\t\t\t} else {\n\t\t\t\tb = nil\n\t\t\t}\n\t\tdefault:\n\t\t\treturn b\n\t\t}\n\t}\n\treturn b\n}\n\n// Any sequence that looks like a non-delimiter (for error reporting).\nvar errRegexp = regexp.MustCompile(`^([-+._a-zA-Z0-9\\/]+|.)`)\n\n// isDelim returns true if given byte is a delimiter character.\nfunc isDelim(c byte) bool {\n\treturn !(c == '-' || c == '+' || c == '.' || c == '_' ||\n\t\t('a' <= c && c <= 'z') ||\n\t\t('A' <= c && c <= 'Z') ||\n\t\t('0' <= c && c <= '9'))\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/encoding/text/decode_number.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 text\n\n// parseNumberValue parses a number from the input and returns a Token object.\nfunc (d *Decoder) parseNumberValue() (Token, bool) {\n\tin := d.in\n\tnum := parseNumber(in)\n\tif num.size == 0 {\n\t\treturn Token{}, false\n\t}\n\tnumAttrs := num.kind\n\tif num.neg {\n\t\tnumAttrs |= isNegative\n\t}\n\tstrSize := num.size\n\tlast := num.size - 1\n\tif num.kind == numFloat && (d.in[last] == 'f' || d.in[last] == 'F') {\n\t\tstrSize = last\n\t}\n\ttok := Token{\n\t\tkind:     Scalar,\n\t\tattrs:    numberValue,\n\t\tpos:      len(d.orig) - len(d.in),\n\t\traw:      d.in[:num.size],\n\t\tstr:      string(d.in[:strSize]),\n\t\tnumAttrs: numAttrs,\n\t}\n\td.consume(num.size)\n\treturn tok, true\n}\n\nconst (\n\tnumDec uint8 = (1 << iota) / 2\n\tnumHex\n\tnumOct\n\tnumFloat\n)\n\n// number is the result of parsing out a valid number from parseNumber. It\n// contains data for doing float or integer conversion via the strconv package\n// in conjunction with the input bytes.\ntype number struct {\n\tkind uint8\n\tneg  bool\n\tsize int\n}\n\n// parseNumber constructs a number object from given input. It allows for the\n// following patterns:\n//   integer: ^-?([1-9][0-9]*|0[xX][0-9a-fA-F]+|0[0-7]*)\n//   float: ^-?((0|[1-9][0-9]*)?([.][0-9]*)?([eE][+-]?[0-9]+)?[fF]?)\n// It also returns the number of parsed bytes for the given number, 0 if it is\n// not a number.\nfunc parseNumber(input []byte) number {\n\tkind := numDec\n\tvar size int\n\tvar neg bool\n\n\ts := input\n\tif len(s) == 0 {\n\t\treturn number{}\n\t}\n\n\t// Optional -\n\tif s[0] == '-' {\n\t\tneg = true\n\t\ts = s[1:]\n\t\tsize++\n\t\tif len(s) == 0 {\n\t\t\treturn number{}\n\t\t}\n\t}\n\n\t// C++ allows for whitespace and comments in between the negative sign and\n\t// the rest of the number. This logic currently does not but is consistent\n\t// with v1.\n\n\tswitch {\n\tcase s[0] == '0':\n\t\tif len(s) > 1 {\n\t\t\tswitch {\n\t\t\tcase s[1] == 'x' || s[1] == 'X':\n\t\t\t\t// Parse as hex number.\n\t\t\t\tkind = numHex\n\t\t\t\tn := 2\n\t\t\t\ts = s[2:]\n\t\t\t\tfor len(s) > 0 && (('0' <= s[0] && s[0] <= '9') ||\n\t\t\t\t\t('a' <= s[0] && s[0] <= 'f') ||\n\t\t\t\t\t('A' <= s[0] && s[0] <= 'F')) {\n\t\t\t\t\ts = s[1:]\n\t\t\t\t\tn++\n\t\t\t\t}\n\t\t\t\tif n == 2 {\n\t\t\t\t\treturn number{}\n\t\t\t\t}\n\t\t\t\tsize += n\n\n\t\t\tcase '0' <= s[1] && s[1] <= '7':\n\t\t\t\t// Parse as octal number.\n\t\t\t\tkind = numOct\n\t\t\t\tn := 2\n\t\t\t\ts = s[2:]\n\t\t\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '7' {\n\t\t\t\t\ts = s[1:]\n\t\t\t\t\tn++\n\t\t\t\t}\n\t\t\t\tsize += n\n\t\t\t}\n\n\t\t\tif kind&(numHex|numOct) > 0 {\n\t\t\t\tif len(s) > 0 && !isDelim(s[0]) {\n\t\t\t\t\treturn number{}\n\t\t\t\t}\n\t\t\t\treturn number{kind: kind, neg: neg, size: size}\n\t\t\t}\n\t\t}\n\t\ts = s[1:]\n\t\tsize++\n\n\tcase '1' <= s[0] && s[0] <= '9':\n\t\tn := 1\n\t\ts = s[1:]\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t}\n\t\tsize += n\n\n\tcase s[0] == '.':\n\t\t// Set kind to numFloat to signify the intent to parse as float. And\n\t\t// that it needs to have other digits after '.'.\n\t\tkind = numFloat\n\n\tdefault:\n\t\treturn number{}\n\t}\n\n\t// . followed by 0 or more digits.\n\tif len(s) > 0 && s[0] == '.' {\n\t\tn := 1\n\t\ts = s[1:]\n\t\t// If decimal point was before any digits, it should be followed by\n\t\t// other digits.\n\t\tif len(s) == 0 && kind == numFloat {\n\t\t\treturn number{}\n\t\t}\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t}\n\t\tsize += n\n\t\tkind = numFloat\n\t}\n\n\t// e or E followed by an optional - or + and 1 or more digits.\n\tif len(s) >= 2 && (s[0] == 'e' || s[0] == 'E') {\n\t\tkind = numFloat\n\t\ts = s[1:]\n\t\tn := 1\n\t\tif s[0] == '+' || s[0] == '-' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t\tif len(s) == 0 {\n\t\t\t\treturn number{}\n\t\t\t}\n\t\t}\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t}\n\t\tsize += n\n\t}\n\n\t// Optional suffix f or F for floats.\n\tif len(s) > 0 && (s[0] == 'f' || s[0] == 'F') {\n\t\tkind = numFloat\n\t\ts = s[1:]\n\t\tsize++\n\t}\n\n\t// Check that next byte is a delimiter or it is at the end.\n\tif len(s) > 0 && !isDelim(s[0]) {\n\t\treturn number{}\n\t}\n\n\treturn number{kind: kind, neg: neg, size: size}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/encoding/text/decode_string.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 text\n\nimport (\n\t\"bytes\"\n\t\"strconv\"\n\t\"strings\"\n\t\"unicode\"\n\t\"unicode/utf16\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/internal/strs\"\n)\n\n// parseStringValue parses string field token.\n// This differs from parseString since the text format allows\n// multiple back-to-back string literals where they are semantically treated\n// as a single large string with all values concatenated.\n//\n// E.g., `\"foo\" \"bar\" \"baz\"` => \"foobarbaz\"\nfunc (d *Decoder) parseStringValue() (Token, error) {\n\t// Note that the ending quote is sufficient to unambiguously mark the end\n\t// of a string. Thus, the text grammar does not require intervening\n\t// whitespace or control characters in-between strings.\n\t// Thus, the following is valid:\n\t//\t`\"foo\"'bar'\"baz\"` => \"foobarbaz\"\n\tin0 := d.in\n\tvar ss []string\n\tfor len(d.in) > 0 && (d.in[0] == '\"' || d.in[0] == '\\'') {\n\t\ts, err := d.parseString()\n\t\tif err != nil {\n\t\t\treturn Token{}, err\n\t\t}\n\t\tss = append(ss, s)\n\t}\n\t// d.in already points to the end of the value at this point.\n\treturn Token{\n\t\tkind:  Scalar,\n\t\tattrs: stringValue,\n\t\tpos:   len(d.orig) - len(in0),\n\t\traw:   in0[:len(in0)-len(d.in)],\n\t\tstr:   strings.Join(ss, \"\"),\n\t}, nil\n}\n\n// parseString parses a string value enclosed in \" or '.\nfunc (d *Decoder) parseString() (string, error) {\n\tin := d.in\n\tif len(in) == 0 {\n\t\treturn \"\", ErrUnexpectedEOF\n\t}\n\tquote := in[0]\n\tin = in[1:]\n\ti := indexNeedEscapeInBytes(in)\n\tin, out := in[i:], in[:i:i] // set cap to prevent mutations\n\tfor len(in) > 0 {\n\t\tswitch r, n := utf8.DecodeRune(in); {\n\t\tcase r == utf8.RuneError && n == 1:\n\t\t\treturn \"\", d.newSyntaxError(\"invalid UTF-8 detected\")\n\t\tcase r == 0 || r == '\\n':\n\t\t\treturn \"\", d.newSyntaxError(\"invalid character %q in string\", r)\n\t\tcase r == rune(quote):\n\t\t\tin = in[1:]\n\t\t\td.consume(len(d.in) - len(in))\n\t\t\treturn string(out), nil\n\t\tcase r == '\\\\':\n\t\t\tif len(in) < 2 {\n\t\t\t\treturn \"\", ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch r := in[1]; r {\n\t\t\tcase '\"', '\\'', '\\\\', '?':\n\t\t\t\tin, out = in[2:], append(out, r)\n\t\t\tcase 'a':\n\t\t\t\tin, out = in[2:], append(out, '\\a')\n\t\t\tcase 'b':\n\t\t\t\tin, out = in[2:], append(out, '\\b')\n\t\t\tcase 'n':\n\t\t\t\tin, out = in[2:], append(out, '\\n')\n\t\t\tcase 'r':\n\t\t\t\tin, out = in[2:], append(out, '\\r')\n\t\t\tcase 't':\n\t\t\t\tin, out = in[2:], append(out, '\\t')\n\t\t\tcase 'v':\n\t\t\t\tin, out = in[2:], append(out, '\\v')\n\t\t\tcase 'f':\n\t\t\t\tin, out = in[2:], append(out, '\\f')\n\t\t\tcase '0', '1', '2', '3', '4', '5', '6', '7':\n\t\t\t\t// One, two, or three octal characters.\n\t\t\t\tn := len(in[1:]) - len(bytes.TrimLeft(in[1:], \"01234567\"))\n\t\t\t\tif n > 3 {\n\t\t\t\t\tn = 3\n\t\t\t\t}\n\t\t\t\tv, err := strconv.ParseUint(string(in[1:1+n]), 8, 8)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", d.newSyntaxError(\"invalid octal escape code %q in string\", in[:1+n])\n\t\t\t\t}\n\t\t\t\tin, out = in[1+n:], append(out, byte(v))\n\t\t\tcase 'x':\n\t\t\t\t// One or two hexadecimal characters.\n\t\t\t\tn := len(in[2:]) - len(bytes.TrimLeft(in[2:], \"0123456789abcdefABCDEF\"))\n\t\t\t\tif n > 2 {\n\t\t\t\t\tn = 2\n\t\t\t\t}\n\t\t\t\tv, err := strconv.ParseUint(string(in[2:2+n]), 16, 8)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", d.newSyntaxError(\"invalid hex escape code %q in string\", in[:2+n])\n\t\t\t\t}\n\t\t\t\tin, out = in[2+n:], append(out, byte(v))\n\t\t\tcase 'u', 'U':\n\t\t\t\t// Four or eight hexadecimal characters\n\t\t\t\tn := 6\n\t\t\t\tif r == 'U' {\n\t\t\t\t\tn = 10\n\t\t\t\t}\n\t\t\t\tif len(in) < n {\n\t\t\t\t\treturn \"\", ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tv, err := strconv.ParseUint(string(in[2:n]), 16, 32)\n\t\t\t\tif utf8.MaxRune < v || err != nil {\n\t\t\t\t\treturn \"\", d.newSyntaxError(\"invalid Unicode escape code %q in string\", in[:n])\n\t\t\t\t}\n\t\t\t\tin = in[n:]\n\n\t\t\t\tr := rune(v)\n\t\t\t\tif utf16.IsSurrogate(r) {\n\t\t\t\t\tif len(in) < 6 {\n\t\t\t\t\t\treturn \"\", ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tv, err := strconv.ParseUint(string(in[2:6]), 16, 16)\n\t\t\t\t\tr = utf16.DecodeRune(r, rune(v))\n\t\t\t\t\tif in[0] != '\\\\' || in[1] != 'u' || r == unicode.ReplacementChar || err != nil {\n\t\t\t\t\t\treturn \"\", d.newSyntaxError(\"invalid Unicode escape code %q in string\", in[:6])\n\t\t\t\t\t}\n\t\t\t\t\tin = in[6:]\n\t\t\t\t}\n\t\t\t\tout = append(out, string(r)...)\n\t\t\tdefault:\n\t\t\t\treturn \"\", d.newSyntaxError(\"invalid escape code %q in string\", in[:2])\n\t\t\t}\n\t\tdefault:\n\t\t\ti := indexNeedEscapeInBytes(in[n:])\n\t\t\tin, out = in[n+i:], append(out, in[:n+i]...)\n\t\t}\n\t}\n\treturn \"\", ErrUnexpectedEOF\n}\n\n// indexNeedEscapeInString returns the index of the character that needs\n// escaping. If no characters need escaping, this returns the input length.\nfunc indexNeedEscapeInBytes(b []byte) int { return indexNeedEscapeInString(strs.UnsafeString(b)) }\n\n// UnmarshalString returns an unescaped string given a textproto string value.\n// String value needs to contain single or double quotes. This is only used by\n// internal/encoding/defval package for unmarshaling bytes.\nfunc UnmarshalString(s string) (string, error) {\n\td := NewDecoder([]byte(s))\n\treturn d.parseString()\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/encoding/text/decode_token.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 text\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"math\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"google.golang.org/protobuf/internal/flags\"\n)\n\n// Kind represents a token kind expressible in the textproto format.\ntype Kind uint8\n\n// Kind values.\nconst (\n\tInvalid Kind = iota\n\tEOF\n\tName   // Name indicates the field name.\n\tScalar // Scalar are scalar values, e.g. \"string\", 47, ENUM_LITERAL, true.\n\tMessageOpen\n\tMessageClose\n\tListOpen\n\tListClose\n\n\t// comma and semi-colon are only for parsing in between values and should not be exposed.\n\tcomma\n\tsemicolon\n\n\t// bof indicates beginning of file, which is the default token\n\t// kind at the beginning of parsing.\n\tbof = Invalid\n)\n\nfunc (t Kind) String() string {\n\tswitch t {\n\tcase Invalid:\n\t\treturn \"<invalid>\"\n\tcase EOF:\n\t\treturn \"eof\"\n\tcase Scalar:\n\t\treturn \"scalar\"\n\tcase Name:\n\t\treturn \"name\"\n\tcase MessageOpen:\n\t\treturn \"{\"\n\tcase MessageClose:\n\t\treturn \"}\"\n\tcase ListOpen:\n\t\treturn \"[\"\n\tcase ListClose:\n\t\treturn \"]\"\n\tcase comma:\n\t\treturn \",\"\n\tcase semicolon:\n\t\treturn \";\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"<invalid:%v>\", uint8(t))\n\t}\n}\n\n// NameKind represents different types of field names.\ntype NameKind uint8\n\n// NameKind values.\nconst (\n\tIdentName NameKind = iota + 1\n\tTypeName\n\tFieldNumber\n)\n\nfunc (t NameKind) String() string {\n\tswitch t {\n\tcase IdentName:\n\t\treturn \"IdentName\"\n\tcase TypeName:\n\t\treturn \"TypeName\"\n\tcase FieldNumber:\n\t\treturn \"FieldNumber\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"<invalid:%v>\", uint8(t))\n\t}\n}\n\n// Bit mask in Token.attrs to indicate if a Name token is followed by the\n// separator char ':'. The field name separator char is optional for message\n// field or repeated message field, but required for all other types. Decoder\n// simply indicates whether a Name token is followed by separator or not.  It is\n// up to the prototext package to validate.\nconst hasSeparator = 1 << 7\n\n// Scalar value types.\nconst (\n\tnumberValue = iota + 1\n\tstringValue\n\tliteralValue\n)\n\n// Bit mask in Token.numAttrs to indicate that the number is a negative.\nconst isNegative = 1 << 7\n\n// Token provides a parsed token kind and value. Values are provided by the\n// different accessor methods.\ntype Token struct {\n\t// Kind of the Token object.\n\tkind Kind\n\t// attrs contains metadata for the following Kinds:\n\t// Name: hasSeparator bit and one of NameKind.\n\t// Scalar: one of numberValue, stringValue, literalValue.\n\tattrs uint8\n\t// numAttrs contains metadata for numberValue:\n\t// - highest bit is whether negative or positive.\n\t// - lower bits indicate one of numDec, numHex, numOct, numFloat.\n\tnumAttrs uint8\n\t// pos provides the position of the token in the original input.\n\tpos int\n\t// raw bytes of the serialized token.\n\t// This is a subslice into the original input.\n\traw []byte\n\t// str contains parsed string for the following:\n\t// - stringValue of Scalar kind\n\t// - numberValue of Scalar kind\n\t// - TypeName of Name kind\n\tstr string\n}\n\n// Kind returns the token kind.\nfunc (t Token) Kind() Kind {\n\treturn t.kind\n}\n\n// RawString returns the read value in string.\nfunc (t Token) RawString() string {\n\treturn string(t.raw)\n}\n\n// Pos returns the token position from the input.\nfunc (t Token) Pos() int {\n\treturn t.pos\n}\n\n// NameKind returns IdentName, TypeName or FieldNumber.\n// It panics if type is not Name.\nfunc (t Token) NameKind() NameKind {\n\tif t.kind == Name {\n\t\treturn NameKind(t.attrs &^ hasSeparator)\n\t}\n\tpanic(fmt.Sprintf(\"Token is not a Name type: %s\", t.kind))\n}\n\n// HasSeparator returns true if the field name is followed by the separator char\n// ':', else false. It panics if type is not Name.\nfunc (t Token) HasSeparator() bool {\n\tif t.kind == Name {\n\t\treturn t.attrs&hasSeparator != 0\n\t}\n\tpanic(fmt.Sprintf(\"Token is not a Name type: %s\", t.kind))\n}\n\n// IdentName returns the value for IdentName type.\nfunc (t Token) IdentName() string {\n\tif t.kind == Name && t.attrs&uint8(IdentName) != 0 {\n\t\treturn string(t.raw)\n\t}\n\tpanic(fmt.Sprintf(\"Token is not an IdentName: %s:%s\", t.kind, NameKind(t.attrs&^hasSeparator)))\n}\n\n// TypeName returns the value for TypeName type.\nfunc (t Token) TypeName() string {\n\tif t.kind == Name && t.attrs&uint8(TypeName) != 0 {\n\t\treturn t.str\n\t}\n\tpanic(fmt.Sprintf(\"Token is not a TypeName: %s:%s\", t.kind, NameKind(t.attrs&^hasSeparator)))\n}\n\n// FieldNumber returns the value for FieldNumber type. It returns a\n// non-negative int32 value. Caller will still need to validate for the correct\n// field number range.\nfunc (t Token) FieldNumber() int32 {\n\tif t.kind != Name || t.attrs&uint8(FieldNumber) == 0 {\n\t\tpanic(fmt.Sprintf(\"Token is not a FieldNumber: %s:%s\", t.kind, NameKind(t.attrs&^hasSeparator)))\n\t}\n\t// Following should not return an error as it had already been called right\n\t// before this Token was constructed.\n\tnum, _ := strconv.ParseInt(string(t.raw), 10, 32)\n\treturn int32(num)\n}\n\n// String returns the string value for a Scalar type.\nfunc (t Token) String() (string, bool) {\n\tif t.kind != Scalar || t.attrs != stringValue {\n\t\treturn \"\", false\n\t}\n\treturn t.str, true\n}\n\n// Enum returns the literal value for a Scalar type for use as enum literals.\nfunc (t Token) Enum() (string, bool) {\n\tif t.kind != Scalar || t.attrs != literalValue || (len(t.raw) > 0 && t.raw[0] == '-') {\n\t\treturn \"\", false\n\t}\n\treturn string(t.raw), true\n}\n\n// Bool returns the bool value for a Scalar type.\nfunc (t Token) Bool() (bool, bool) {\n\tif t.kind != Scalar {\n\t\treturn false, false\n\t}\n\tswitch t.attrs {\n\tcase literalValue:\n\t\tif b, ok := boolLits[string(t.raw)]; ok {\n\t\t\treturn b, true\n\t\t}\n\tcase numberValue:\n\t\t// Unsigned integer representation of 0 or 1 is permitted: 00, 0x0, 01,\n\t\t// 0x1, etc.\n\t\tn, err := strconv.ParseUint(t.str, 0, 64)\n\t\tif err == nil {\n\t\t\tswitch n {\n\t\t\tcase 0:\n\t\t\t\treturn false, true\n\t\t\tcase 1:\n\t\t\t\treturn true, true\n\t\t\t}\n\t\t}\n\t}\n\treturn false, false\n}\n\n// These exact boolean literals are the ones supported in C++.\nvar boolLits = map[string]bool{\n\t\"t\":     true,\n\t\"true\":  true,\n\t\"True\":  true,\n\t\"f\":     false,\n\t\"false\": false,\n\t\"False\": false,\n}\n\n// Uint64 returns the uint64 value for a Scalar type.\nfunc (t Token) Uint64() (uint64, bool) {\n\tif t.kind != Scalar || t.attrs != numberValue ||\n\t\tt.numAttrs&isNegative > 0 || t.numAttrs&numFloat > 0 {\n\t\treturn 0, false\n\t}\n\tn, err := strconv.ParseUint(t.str, 0, 64)\n\tif err != nil {\n\t\treturn 0, false\n\t}\n\treturn n, true\n}\n\n// Uint32 returns the uint32 value for a Scalar type.\nfunc (t Token) Uint32() (uint32, bool) {\n\tif t.kind != Scalar || t.attrs != numberValue ||\n\t\tt.numAttrs&isNegative > 0 || t.numAttrs&numFloat > 0 {\n\t\treturn 0, false\n\t}\n\tn, err := strconv.ParseUint(t.str, 0, 32)\n\tif err != nil {\n\t\treturn 0, false\n\t}\n\treturn uint32(n), true\n}\n\n// Int64 returns the int64 value for a Scalar type.\nfunc (t Token) Int64() (int64, bool) {\n\tif t.kind != Scalar || t.attrs != numberValue || t.numAttrs&numFloat > 0 {\n\t\treturn 0, false\n\t}\n\tif n, err := strconv.ParseInt(t.str, 0, 64); err == nil {\n\t\treturn n, true\n\t}\n\t// C++ accepts large positive hex numbers as negative values.\n\t// This feature is here for proto1 backwards compatibility purposes.\n\tif flags.ProtoLegacy && (t.numAttrs == numHex) {\n\t\tif n, err := strconv.ParseUint(t.str, 0, 64); err == nil {\n\t\t\treturn int64(n), true\n\t\t}\n\t}\n\treturn 0, false\n}\n\n// Int32 returns the int32 value for a Scalar type.\nfunc (t Token) Int32() (int32, bool) {\n\tif t.kind != Scalar || t.attrs != numberValue || t.numAttrs&numFloat > 0 {\n\t\treturn 0, false\n\t}\n\tif n, err := strconv.ParseInt(t.str, 0, 32); err == nil {\n\t\treturn int32(n), true\n\t}\n\t// C++ accepts large positive hex numbers as negative values.\n\t// This feature is here for proto1 backwards compatibility purposes.\n\tif flags.ProtoLegacy && (t.numAttrs == numHex) {\n\t\tif n, err := strconv.ParseUint(t.str, 0, 32); err == nil {\n\t\t\treturn int32(n), true\n\t\t}\n\t}\n\treturn 0, false\n}\n\n// Float64 returns the float64 value for a Scalar type.\nfunc (t Token) Float64() (float64, bool) {\n\tif t.kind != Scalar {\n\t\treturn 0, false\n\t}\n\tswitch t.attrs {\n\tcase literalValue:\n\t\tif f, ok := floatLits[strings.ToLower(string(t.raw))]; ok {\n\t\t\treturn f, true\n\t\t}\n\tcase numberValue:\n\t\tn, err := strconv.ParseFloat(t.str, 64)\n\t\tif err == nil {\n\t\t\treturn n, true\n\t\t}\n\t\tnerr := err.(*strconv.NumError)\n\t\tif nerr.Err == strconv.ErrRange {\n\t\t\treturn n, true\n\t\t}\n\t}\n\treturn 0, false\n}\n\n// Float32 returns the float32 value for a Scalar type.\nfunc (t Token) Float32() (float32, bool) {\n\tif t.kind != Scalar {\n\t\treturn 0, false\n\t}\n\tswitch t.attrs {\n\tcase literalValue:\n\t\tif f, ok := floatLits[strings.ToLower(string(t.raw))]; ok {\n\t\t\treturn float32(f), true\n\t\t}\n\tcase numberValue:\n\t\tn, err := strconv.ParseFloat(t.str, 64)\n\t\tif err == nil {\n\t\t\t// Overflows are treated as (-)infinity.\n\t\t\treturn float32(n), true\n\t\t}\n\t\tnerr := err.(*strconv.NumError)\n\t\tif nerr.Err == strconv.ErrRange {\n\t\t\treturn float32(n), true\n\t\t}\n\t}\n\treturn 0, false\n}\n\n// These are the supported float literals which C++ permits case-insensitive\n// variants of these.\nvar floatLits = map[string]float64{\n\t\"nan\":       math.NaN(),\n\t\"inf\":       math.Inf(1),\n\t\"infinity\":  math.Inf(1),\n\t\"-inf\":      math.Inf(-1),\n\t\"-infinity\": math.Inf(-1),\n}\n\n// TokenEquals returns true if given Tokens are equal, else false.\nfunc TokenEquals(x, y Token) bool {\n\treturn x.kind == y.kind &&\n\t\tx.attrs == y.attrs &&\n\t\tx.numAttrs == y.numAttrs &&\n\t\tx.pos == y.pos &&\n\t\tbytes.Equal(x.raw, y.raw) &&\n\t\tx.str == y.str\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/encoding/text/doc.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 text implements the text format for protocol buffers.\n// This package has no semantic understanding for protocol buffers and is only\n// a parser and composer for the format.\n//\n// There is no formal specification for the protobuf text format, as such the\n// C++ implementation (see google::protobuf::TextFormat) is the reference\n// implementation of the text format.\n//\n// This package is neither a superset nor a subset of the C++ implementation.\n// This implementation permits a more liberal grammar in some cases to be\n// backwards compatible with the historical Go implementation.\n// Future parsings unique to Go should not be added.\n// Some grammars allowed by the C++ implementation are deliberately\n// not implemented here because they are considered a bug by the protobuf team\n// and should not be replicated.\n//\n// The Go implementation should implement a sufficient amount of the C++\n// grammar such that the default text serialization by C++ can be parsed by Go.\n// However, just because the C++ parser accepts some input does not mean that\n// the Go implementation should as well.\n//\n// The text format is almost a superset of JSON except:\n//\t* message keys are not quoted strings, but identifiers\n//\t* the top-level value must be a message without the delimiters\npackage text\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/encoding/text/encode.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 text\n\nimport (\n\t\"math\"\n\t\"math/bits\"\n\t\"strconv\"\n\t\"strings\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/internal/detrand\"\n\t\"google.golang.org/protobuf/internal/errors\"\n)\n\n// encType represents an encoding type.\ntype encType uint8\n\nconst (\n\t_ encType = (1 << iota) / 2\n\tname\n\tscalar\n\tmessageOpen\n\tmessageClose\n)\n\n// Encoder provides methods to write out textproto constructs and values. The user is\n// responsible for producing valid sequences of constructs and values.\ntype Encoder struct {\n\tencoderState\n\n\tindent      string\n\tdelims      [2]byte\n\toutputASCII bool\n}\n\ntype encoderState struct {\n\tlastType encType\n\tindents  []byte\n\tout      []byte\n}\n\n// NewEncoder returns an Encoder.\n//\n// If indent is a non-empty string, it causes every entry in a List or Message\n// to be preceded by the indent and trailed by a newline.\n//\n// If delims is not the zero value, it controls the delimiter characters used\n// for messages (e.g., \"{}\" vs \"<>\").\n//\n// If outputASCII is true, strings will be serialized in such a way that\n// multi-byte UTF-8 sequences are escaped. This property ensures that the\n// overall output is ASCII (as opposed to UTF-8).\nfunc NewEncoder(indent string, delims [2]byte, outputASCII bool) (*Encoder, error) {\n\te := &Encoder{}\n\tif len(indent) > 0 {\n\t\tif strings.Trim(indent, \" \\t\") != \"\" {\n\t\t\treturn nil, errors.New(\"indent may only be composed of space and tab characters\")\n\t\t}\n\t\te.indent = indent\n\t}\n\tswitch delims {\n\tcase [2]byte{0, 0}:\n\t\te.delims = [2]byte{'{', '}'}\n\tcase [2]byte{'{', '}'}, [2]byte{'<', '>'}:\n\t\te.delims = delims\n\tdefault:\n\t\treturn nil, errors.New(\"delimiters may only be \\\"{}\\\" or \\\"<>\\\"\")\n\t}\n\te.outputASCII = outputASCII\n\n\treturn e, nil\n}\n\n// Bytes returns the content of the written bytes.\nfunc (e *Encoder) Bytes() []byte {\n\treturn e.out\n}\n\n// StartMessage writes out the '{' or '<' symbol.\nfunc (e *Encoder) StartMessage() {\n\te.prepareNext(messageOpen)\n\te.out = append(e.out, e.delims[0])\n}\n\n// EndMessage writes out the '}' or '>' symbol.\nfunc (e *Encoder) EndMessage() {\n\te.prepareNext(messageClose)\n\te.out = append(e.out, e.delims[1])\n}\n\n// WriteName writes out the field name and the separator ':'.\nfunc (e *Encoder) WriteName(s string) {\n\te.prepareNext(name)\n\te.out = append(e.out, s...)\n\te.out = append(e.out, ':')\n}\n\n// WriteBool writes out the given boolean value.\nfunc (e *Encoder) WriteBool(b bool) {\n\tif b {\n\t\te.WriteLiteral(\"true\")\n\t} else {\n\t\te.WriteLiteral(\"false\")\n\t}\n}\n\n// WriteString writes out the given string value.\nfunc (e *Encoder) WriteString(s string) {\n\te.prepareNext(scalar)\n\te.out = appendString(e.out, s, e.outputASCII)\n}\n\nfunc appendString(out []byte, in string, outputASCII bool) []byte {\n\tout = append(out, '\"')\n\ti := indexNeedEscapeInString(in)\n\tin, out = in[i:], append(out, in[:i]...)\n\tfor len(in) > 0 {\n\t\tswitch r, n := utf8.DecodeRuneInString(in); {\n\t\tcase r == utf8.RuneError && n == 1:\n\t\t\t// We do not report invalid UTF-8 because strings in the text format\n\t\t\t// are used to represent both the proto string and bytes type.\n\t\t\tr = rune(in[0])\n\t\t\tfallthrough\n\t\tcase r < ' ' || r == '\"' || r == '\\\\' || r == 0x7f:\n\t\t\tout = append(out, '\\\\')\n\t\t\tswitch r {\n\t\t\tcase '\"', '\\\\':\n\t\t\t\tout = append(out, byte(r))\n\t\t\tcase '\\n':\n\t\t\t\tout = append(out, 'n')\n\t\t\tcase '\\r':\n\t\t\t\tout = append(out, 'r')\n\t\t\tcase '\\t':\n\t\t\t\tout = append(out, 't')\n\t\t\tdefault:\n\t\t\t\tout = append(out, 'x')\n\t\t\t\tout = append(out, \"00\"[1+(bits.Len32(uint32(r))-1)/4:]...)\n\t\t\t\tout = strconv.AppendUint(out, uint64(r), 16)\n\t\t\t}\n\t\t\tin = in[n:]\n\t\tcase r >= utf8.RuneSelf && (outputASCII || r <= 0x009f):\n\t\t\tout = append(out, '\\\\')\n\t\t\tif r <= math.MaxUint16 {\n\t\t\t\tout = append(out, 'u')\n\t\t\t\tout = append(out, \"0000\"[1+(bits.Len32(uint32(r))-1)/4:]...)\n\t\t\t\tout = strconv.AppendUint(out, uint64(r), 16)\n\t\t\t} else {\n\t\t\t\tout = append(out, 'U')\n\t\t\t\tout = append(out, \"00000000\"[1+(bits.Len32(uint32(r))-1)/4:]...)\n\t\t\t\tout = strconv.AppendUint(out, uint64(r), 16)\n\t\t\t}\n\t\t\tin = in[n:]\n\t\tdefault:\n\t\t\ti := indexNeedEscapeInString(in[n:])\n\t\t\tin, out = in[n+i:], append(out, in[:n+i]...)\n\t\t}\n\t}\n\tout = append(out, '\"')\n\treturn out\n}\n\n// indexNeedEscapeInString returns the index of the character that needs\n// escaping. If no characters need escaping, this returns the input length.\nfunc indexNeedEscapeInString(s string) int {\n\tfor i := 0; i < len(s); i++ {\n\t\tif c := s[i]; c < ' ' || c == '\"' || c == '\\'' || c == '\\\\' || c >= 0x7f {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn len(s)\n}\n\n// WriteFloat writes out the given float value for given bitSize.\nfunc (e *Encoder) WriteFloat(n float64, bitSize int) {\n\te.prepareNext(scalar)\n\te.out = appendFloat(e.out, n, bitSize)\n}\n\nfunc appendFloat(out []byte, n float64, bitSize int) []byte {\n\tswitch {\n\tcase math.IsNaN(n):\n\t\treturn append(out, \"nan\"...)\n\tcase math.IsInf(n, +1):\n\t\treturn append(out, \"inf\"...)\n\tcase math.IsInf(n, -1):\n\t\treturn append(out, \"-inf\"...)\n\tdefault:\n\t\treturn strconv.AppendFloat(out, n, 'g', -1, bitSize)\n\t}\n}\n\n// WriteInt writes out the given signed integer value.\nfunc (e *Encoder) WriteInt(n int64) {\n\te.prepareNext(scalar)\n\te.out = append(e.out, strconv.FormatInt(n, 10)...)\n}\n\n// WriteUint writes out the given unsigned integer value.\nfunc (e *Encoder) WriteUint(n uint64) {\n\te.prepareNext(scalar)\n\te.out = append(e.out, strconv.FormatUint(n, 10)...)\n}\n\n// WriteLiteral writes out the given string as a literal value without quotes.\n// This is used for writing enum literal strings.\nfunc (e *Encoder) WriteLiteral(s string) {\n\te.prepareNext(scalar)\n\te.out = append(e.out, s...)\n}\n\n// prepareNext adds possible space and indentation for the next value based\n// on last encType and indent option. It also updates e.lastType to next.\nfunc (e *Encoder) prepareNext(next encType) {\n\tdefer func() {\n\t\te.lastType = next\n\t}()\n\n\t// Single line.\n\tif len(e.indent) == 0 {\n\t\t// Add space after each field before the next one.\n\t\tif e.lastType&(scalar|messageClose) != 0 && next == name {\n\t\t\te.out = append(e.out, ' ')\n\t\t\t// Add a random extra space to make output unstable.\n\t\t\tif detrand.Bool() {\n\t\t\t\te.out = append(e.out, ' ')\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\t// Multi-line.\n\tswitch {\n\tcase e.lastType == name:\n\t\te.out = append(e.out, ' ')\n\t\t// Add a random extra space after name: to make output unstable.\n\t\tif detrand.Bool() {\n\t\t\te.out = append(e.out, ' ')\n\t\t}\n\n\tcase e.lastType == messageOpen && next != messageClose:\n\t\te.indents = append(e.indents, e.indent...)\n\t\te.out = append(e.out, '\\n')\n\t\te.out = append(e.out, e.indents...)\n\n\tcase e.lastType&(scalar|messageClose) != 0:\n\t\tif next == messageClose {\n\t\t\te.indents = e.indents[:len(e.indents)-len(e.indent)]\n\t\t}\n\t\te.out = append(e.out, '\\n')\n\t\te.out = append(e.out, e.indents...)\n\t}\n}\n\n// Snapshot returns the current snapshot for use in Reset.\nfunc (e *Encoder) Snapshot() encoderState {\n\treturn e.encoderState\n}\n\n// Reset resets the Encoder to the given encoderState from a Snapshot.\nfunc (e *Encoder) Reset(es encoderState) {\n\te.encoderState = es\n}\n\n// AppendString appends the escaped form of the input string to b.\nfunc AppendString(b []byte, s string) []byte {\n\treturn appendString(b, s, false)\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/errors/errors.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 errors implements functions to manipulate errors.\npackage errors\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\n\t\"google.golang.org/protobuf/internal/detrand\"\n)\n\n// Error is a sentinel matching all errors produced by this package.\nvar Error = errors.New(\"protobuf error\")\n\n// New formats a string according to the format specifier and arguments and\n// returns an error that has a \"proto\" prefix.\nfunc New(f string, x ...interface{}) error {\n\treturn &prefixError{s: format(f, x...)}\n}\n\ntype prefixError struct{ s string }\n\nvar prefix = func() string {\n\t// Deliberately introduce instability into the error message string to\n\t// discourage users from performing error string comparisons.\n\tif detrand.Bool() {\n\t\treturn \"proto: \" // use non-breaking spaces (U+00a0)\n\t} else {\n\t\treturn \"proto: \" // use regular spaces (U+0020)\n\t}\n}()\n\nfunc (e *prefixError) Error() string {\n\treturn prefix + e.s\n}\n\nfunc (e *prefixError) Unwrap() error {\n\treturn Error\n}\n\n// Wrap returns an error that has a \"proto\" prefix, the formatted string described\n// by the format specifier and arguments, and a suffix of err. The error wraps err.\nfunc Wrap(err error, f string, x ...interface{}) error {\n\treturn &wrapError{\n\t\ts:   format(f, x...),\n\t\terr: err,\n\t}\n}\n\ntype wrapError struct {\n\ts   string\n\terr error\n}\n\nfunc (e *wrapError) Error() string {\n\treturn format(\"%v%v: %v\", prefix, e.s, e.err)\n}\n\nfunc (e *wrapError) Unwrap() error {\n\treturn e.err\n}\n\nfunc (e *wrapError) Is(target error) bool {\n\treturn target == Error\n}\n\nfunc format(f string, x ...interface{}) string {\n\t// avoid \"proto: \" prefix when chaining\n\tfor i := 0; i < len(x); i++ {\n\t\tswitch e := x[i].(type) {\n\t\tcase *prefixError:\n\t\t\tx[i] = e.s\n\t\tcase *wrapError:\n\t\t\tx[i] = format(\"%v: %v\", e.s, e.err)\n\t\t}\n\t}\n\treturn fmt.Sprintf(f, x...)\n}\n\nfunc InvalidUTF8(name string) error {\n\treturn New(\"field %v contains invalid UTF-8\", name)\n}\n\nfunc RequiredNotSet(name string) error {\n\treturn New(\"required field %v not set\", name)\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/errors/is_go112.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\n// +build !go1.13\n\npackage errors\n\nimport \"reflect\"\n\n// Is is a copy of Go 1.13's errors.Is for use with older Go versions.\nfunc Is(err, target error) bool {\n\tif target == nil {\n\t\treturn err == target\n\t}\n\n\tisComparable := reflect.TypeOf(target).Comparable()\n\tfor {\n\t\tif isComparable && err == target {\n\t\t\treturn true\n\t\t}\n\t\tif x, ok := err.(interface{ Is(error) bool }); ok && x.Is(target) {\n\t\t\treturn true\n\t\t}\n\t\tif err = unwrap(err); err == nil {\n\t\t\treturn false\n\t\t}\n\t}\n}\n\nfunc unwrap(err error) error {\n\tu, ok := err.(interface {\n\t\tUnwrap() error\n\t})\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn u.Unwrap()\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/errors/is_go113.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\n// +build go1.13\n\npackage errors\n\nimport \"errors\"\n\n// Is is errors.Is.\nfunc Is(err, target error) bool { return errors.Is(err, target) }\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/filedesc/build.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 filedesc provides functionality for constructing descriptors.\n//\n// The types in this package implement interfaces in the protoreflect package\n// related to protobuf descripriptors.\npackage filedesc\n\nimport (\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// Builder construct a protoreflect.FileDescriptor from the raw descriptor.\ntype Builder struct {\n\t// GoPackagePath is the Go package path that is invoking this builder.\n\tGoPackagePath string\n\n\t// RawDescriptor is the wire-encoded bytes of FileDescriptorProto\n\t// and must be populated.\n\tRawDescriptor []byte\n\n\t// NumEnums is the total number of enums declared in the file.\n\tNumEnums int32\n\t// NumMessages is the total number of messages declared in the file.\n\t// It includes the implicit message declarations for map entries.\n\tNumMessages int32\n\t// NumExtensions is the total number of extensions declared in the file.\n\tNumExtensions int32\n\t// NumServices is the total number of services declared in the file.\n\tNumServices int32\n\n\t// TypeResolver resolves extension field types for descriptor options.\n\t// If nil, it uses protoregistry.GlobalTypes.\n\tTypeResolver interface {\n\t\tpreg.ExtensionTypeResolver\n\t}\n\n\t// FileRegistry is use to lookup file, enum, and message dependencies.\n\t// Once constructed, the file descriptor is registered here.\n\t// If nil, it uses protoregistry.GlobalFiles.\n\tFileRegistry interface {\n\t\tFindFileByPath(string) (protoreflect.FileDescriptor, error)\n\t\tFindDescriptorByName(pref.FullName) (pref.Descriptor, error)\n\t\tRegisterFile(pref.FileDescriptor) error\n\t}\n}\n\n// resolverByIndex is an interface Builder.FileRegistry may implement.\n// If so, it permits looking up an enum or message dependency based on the\n// sub-list and element index into filetype.Builder.DependencyIndexes.\ntype resolverByIndex interface {\n\tFindEnumByIndex(int32, int32, []Enum, []Message) pref.EnumDescriptor\n\tFindMessageByIndex(int32, int32, []Enum, []Message) pref.MessageDescriptor\n}\n\n// Indexes of each sub-list in filetype.Builder.DependencyIndexes.\nconst (\n\tlistFieldDeps int32 = iota\n\tlistExtTargets\n\tlistExtDeps\n\tlistMethInDeps\n\tlistMethOutDeps\n)\n\n// Out is the output of the Builder.\ntype Out struct {\n\tFile pref.FileDescriptor\n\n\t// Enums is all enum descriptors in \"flattened ordering\".\n\tEnums []Enum\n\t// Messages is all message descriptors in \"flattened ordering\".\n\t// It includes the implicit message declarations for map entries.\n\tMessages []Message\n\t// Extensions is all extension descriptors in \"flattened ordering\".\n\tExtensions []Extension\n\t// Service is all service descriptors in \"flattened ordering\".\n\tServices []Service\n}\n\n// Build constructs a FileDescriptor given the parameters set in Builder.\n// It assumes that the inputs are well-formed and panics if any inconsistencies\n// are encountered.\n//\n// If NumEnums+NumMessages+NumExtensions+NumServices is zero,\n// then Build automatically derives them from the raw descriptor.\nfunc (db Builder) Build() (out Out) {\n\t// Populate the counts if uninitialized.\n\tif db.NumEnums+db.NumMessages+db.NumExtensions+db.NumServices == 0 {\n\t\tdb.unmarshalCounts(db.RawDescriptor, true)\n\t}\n\n\t// Initialize resolvers and registries if unpopulated.\n\tif db.TypeResolver == nil {\n\t\tdb.TypeResolver = preg.GlobalTypes\n\t}\n\tif db.FileRegistry == nil {\n\t\tdb.FileRegistry = preg.GlobalFiles\n\t}\n\n\tfd := newRawFile(db)\n\tout.File = fd\n\tout.Enums = fd.allEnums\n\tout.Messages = fd.allMessages\n\tout.Extensions = fd.allExtensions\n\tout.Services = fd.allServices\n\n\tif err := db.FileRegistry.RegisterFile(fd); err != nil {\n\t\tpanic(err)\n\t}\n\treturn out\n}\n\n// unmarshalCounts counts the number of enum, message, extension, and service\n// declarations in the raw message, which is either a FileDescriptorProto\n// or a MessageDescriptorProto depending on whether isFile is set.\nfunc (db *Builder) unmarshalCounts(b []byte, isFile bool) {\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tif isFile {\n\t\t\t\tswitch num {\n\t\t\t\tcase genid.FileDescriptorProto_EnumType_field_number:\n\t\t\t\t\tdb.NumEnums++\n\t\t\t\tcase genid.FileDescriptorProto_MessageType_field_number:\n\t\t\t\t\tdb.unmarshalCounts(v, false)\n\t\t\t\t\tdb.NumMessages++\n\t\t\t\tcase genid.FileDescriptorProto_Extension_field_number:\n\t\t\t\t\tdb.NumExtensions++\n\t\t\t\tcase genid.FileDescriptorProto_Service_field_number:\n\t\t\t\t\tdb.NumServices++\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tswitch num {\n\t\t\t\tcase genid.DescriptorProto_EnumType_field_number:\n\t\t\t\t\tdb.NumEnums++\n\t\t\t\tcase genid.DescriptorProto_NestedType_field_number:\n\t\t\t\t\tdb.unmarshalCounts(v, false)\n\t\t\t\t\tdb.NumMessages++\n\t\t\t\tcase genid.DescriptorProto_Extension_field_number:\n\t\t\t\t\tdb.NumExtensions++\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/filedesc/desc.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 filedesc\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"sync\"\n\t\"sync/atomic\"\n\n\t\"google.golang.org/protobuf/internal/descfmt\"\n\t\"google.golang.org/protobuf/internal/descopts\"\n\t\"google.golang.org/protobuf/internal/encoding/defval\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// The types in this file may have a suffix:\n//\t• L0: Contains fields common to all descriptors (except File) and\n//\tmust be initialized up front.\n//\t• L1: Contains fields specific to a descriptor and\n//\tmust be initialized up front.\n//\t• L2: Contains fields that are lazily initialized when constructing\n//\tfrom the raw file descriptor. When constructing as a literal, the L2\n//\tfields must be initialized up front.\n//\n// The types are exported so that packages like reflect/protodesc can\n// directly construct descriptors.\n\ntype (\n\tFile struct {\n\t\tfileRaw\n\t\tL1 FileL1\n\n\t\tonce uint32     // atomically set if L2 is valid\n\t\tmu   sync.Mutex // protects L2\n\t\tL2   *FileL2\n\t}\n\tFileL1 struct {\n\t\tSyntax  pref.Syntax\n\t\tPath    string\n\t\tPackage pref.FullName\n\n\t\tEnums      Enums\n\t\tMessages   Messages\n\t\tExtensions Extensions\n\t\tServices   Services\n\t}\n\tFileL2 struct {\n\t\tOptions   func() pref.ProtoMessage\n\t\tImports   FileImports\n\t\tLocations SourceLocations\n\t}\n)\n\nfunc (fd *File) ParentFile() pref.FileDescriptor { return fd }\nfunc (fd *File) Parent() pref.Descriptor         { return nil }\nfunc (fd *File) Index() int                      { return 0 }\nfunc (fd *File) Syntax() pref.Syntax             { return fd.L1.Syntax }\nfunc (fd *File) Name() pref.Name                 { return fd.L1.Package.Name() }\nfunc (fd *File) FullName() pref.FullName         { return fd.L1.Package }\nfunc (fd *File) IsPlaceholder() bool             { return false }\nfunc (fd *File) Options() pref.ProtoMessage {\n\tif f := fd.lazyInit().Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.File\n}\nfunc (fd *File) Path() string                          { return fd.L1.Path }\nfunc (fd *File) Package() pref.FullName                { return fd.L1.Package }\nfunc (fd *File) Imports() pref.FileImports             { return &fd.lazyInit().Imports }\nfunc (fd *File) Enums() pref.EnumDescriptors           { return &fd.L1.Enums }\nfunc (fd *File) Messages() pref.MessageDescriptors     { return &fd.L1.Messages }\nfunc (fd *File) Extensions() pref.ExtensionDescriptors { return &fd.L1.Extensions }\nfunc (fd *File) Services() pref.ServiceDescriptors     { return &fd.L1.Services }\nfunc (fd *File) SourceLocations() pref.SourceLocations { return &fd.lazyInit().Locations }\nfunc (fd *File) Format(s fmt.State, r rune)            { descfmt.FormatDesc(s, r, fd) }\nfunc (fd *File) ProtoType(pref.FileDescriptor)         {}\nfunc (fd *File) ProtoInternal(pragma.DoNotImplement)   {}\n\nfunc (fd *File) lazyInit() *FileL2 {\n\tif atomic.LoadUint32(&fd.once) == 0 {\n\t\tfd.lazyInitOnce()\n\t}\n\treturn fd.L2\n}\n\nfunc (fd *File) lazyInitOnce() {\n\tfd.mu.Lock()\n\tif fd.L2 == nil {\n\t\tfd.lazyRawInit() // recursively initializes all L2 structures\n\t}\n\tatomic.StoreUint32(&fd.once, 1)\n\tfd.mu.Unlock()\n}\n\n// GoPackagePath is a pseudo-internal API for determining the Go package path\n// that this file descriptor is declared in.\n//\n// WARNING: This method is exempt from the compatibility promise and may be\n// removed in the future without warning.\nfunc (fd *File) GoPackagePath() string {\n\treturn fd.builder.GoPackagePath\n}\n\ntype (\n\tEnum struct {\n\t\tBase\n\t\tL1 EnumL1\n\t\tL2 *EnumL2 // protected by fileDesc.once\n\t}\n\tEnumL1 struct {\n\t\teagerValues bool // controls whether EnumL2.Values is already populated\n\t}\n\tEnumL2 struct {\n\t\tOptions        func() pref.ProtoMessage\n\t\tValues         EnumValues\n\t\tReservedNames  Names\n\t\tReservedRanges EnumRanges\n\t}\n\n\tEnumValue struct {\n\t\tBase\n\t\tL1 EnumValueL1\n\t}\n\tEnumValueL1 struct {\n\t\tOptions func() pref.ProtoMessage\n\t\tNumber  pref.EnumNumber\n\t}\n)\n\nfunc (ed *Enum) Options() pref.ProtoMessage {\n\tif f := ed.lazyInit().Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.Enum\n}\nfunc (ed *Enum) Values() pref.EnumValueDescriptors {\n\tif ed.L1.eagerValues {\n\t\treturn &ed.L2.Values\n\t}\n\treturn &ed.lazyInit().Values\n}\nfunc (ed *Enum) ReservedNames() pref.Names       { return &ed.lazyInit().ReservedNames }\nfunc (ed *Enum) ReservedRanges() pref.EnumRanges { return &ed.lazyInit().ReservedRanges }\nfunc (ed *Enum) Format(s fmt.State, r rune)      { descfmt.FormatDesc(s, r, ed) }\nfunc (ed *Enum) ProtoType(pref.EnumDescriptor)   {}\nfunc (ed *Enum) lazyInit() *EnumL2 {\n\ted.L0.ParentFile.lazyInit() // implicitly initializes L2\n\treturn ed.L2\n}\n\nfunc (ed *EnumValue) Options() pref.ProtoMessage {\n\tif f := ed.L1.Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.EnumValue\n}\nfunc (ed *EnumValue) Number() pref.EnumNumber            { return ed.L1.Number }\nfunc (ed *EnumValue) Format(s fmt.State, r rune)         { descfmt.FormatDesc(s, r, ed) }\nfunc (ed *EnumValue) ProtoType(pref.EnumValueDescriptor) {}\n\ntype (\n\tMessage struct {\n\t\tBase\n\t\tL1 MessageL1\n\t\tL2 *MessageL2 // protected by fileDesc.once\n\t}\n\tMessageL1 struct {\n\t\tEnums        Enums\n\t\tMessages     Messages\n\t\tExtensions   Extensions\n\t\tIsMapEntry   bool // promoted from google.protobuf.MessageOptions\n\t\tIsMessageSet bool // promoted from google.protobuf.MessageOptions\n\t}\n\tMessageL2 struct {\n\t\tOptions               func() pref.ProtoMessage\n\t\tFields                Fields\n\t\tOneofs                Oneofs\n\t\tReservedNames         Names\n\t\tReservedRanges        FieldRanges\n\t\tRequiredNumbers       FieldNumbers // must be consistent with Fields.Cardinality\n\t\tExtensionRanges       FieldRanges\n\t\tExtensionRangeOptions []func() pref.ProtoMessage // must be same length as ExtensionRanges\n\t}\n\n\tField struct {\n\t\tBase\n\t\tL1 FieldL1\n\t}\n\tFieldL1 struct {\n\t\tOptions          func() pref.ProtoMessage\n\t\tNumber           pref.FieldNumber\n\t\tCardinality      pref.Cardinality // must be consistent with Message.RequiredNumbers\n\t\tKind             pref.Kind\n\t\tStringName       stringName\n\t\tIsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto\n\t\tIsWeak           bool // promoted from google.protobuf.FieldOptions\n\t\tHasPacked        bool // promoted from google.protobuf.FieldOptions\n\t\tIsPacked         bool // promoted from google.protobuf.FieldOptions\n\t\tHasEnforceUTF8   bool // promoted from google.protobuf.FieldOptions\n\t\tEnforceUTF8      bool // promoted from google.protobuf.FieldOptions\n\t\tDefault          defaultValue\n\t\tContainingOneof  pref.OneofDescriptor // must be consistent with Message.Oneofs.Fields\n\t\tEnum             pref.EnumDescriptor\n\t\tMessage          pref.MessageDescriptor\n\t}\n\n\tOneof struct {\n\t\tBase\n\t\tL1 OneofL1\n\t}\n\tOneofL1 struct {\n\t\tOptions func() pref.ProtoMessage\n\t\tFields  OneofFields // must be consistent with Message.Fields.ContainingOneof\n\t}\n)\n\nfunc (md *Message) Options() pref.ProtoMessage {\n\tif f := md.lazyInit().Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.Message\n}\nfunc (md *Message) IsMapEntry() bool                   { return md.L1.IsMapEntry }\nfunc (md *Message) Fields() pref.FieldDescriptors      { return &md.lazyInit().Fields }\nfunc (md *Message) Oneofs() pref.OneofDescriptors      { return &md.lazyInit().Oneofs }\nfunc (md *Message) ReservedNames() pref.Names          { return &md.lazyInit().ReservedNames }\nfunc (md *Message) ReservedRanges() pref.FieldRanges   { return &md.lazyInit().ReservedRanges }\nfunc (md *Message) RequiredNumbers() pref.FieldNumbers { return &md.lazyInit().RequiredNumbers }\nfunc (md *Message) ExtensionRanges() pref.FieldRanges  { return &md.lazyInit().ExtensionRanges }\nfunc (md *Message) ExtensionRangeOptions(i int) pref.ProtoMessage {\n\tif f := md.lazyInit().ExtensionRangeOptions[i]; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.ExtensionRange\n}\nfunc (md *Message) Enums() pref.EnumDescriptors           { return &md.L1.Enums }\nfunc (md *Message) Messages() pref.MessageDescriptors     { return &md.L1.Messages }\nfunc (md *Message) Extensions() pref.ExtensionDescriptors { return &md.L1.Extensions }\nfunc (md *Message) ProtoType(pref.MessageDescriptor)      {}\nfunc (md *Message) Format(s fmt.State, r rune)            { descfmt.FormatDesc(s, r, md) }\nfunc (md *Message) lazyInit() *MessageL2 {\n\tmd.L0.ParentFile.lazyInit() // implicitly initializes L2\n\treturn md.L2\n}\n\n// IsMessageSet is a pseudo-internal API for checking whether a message\n// should serialize in the proto1 message format.\n//\n// WARNING: This method is exempt from the compatibility promise and may be\n// removed in the future without warning.\nfunc (md *Message) IsMessageSet() bool {\n\treturn md.L1.IsMessageSet\n}\n\nfunc (fd *Field) Options() pref.ProtoMessage {\n\tif f := fd.L1.Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.Field\n}\nfunc (fd *Field) Number() pref.FieldNumber      { return fd.L1.Number }\nfunc (fd *Field) Cardinality() pref.Cardinality { return fd.L1.Cardinality }\nfunc (fd *Field) Kind() pref.Kind               { return fd.L1.Kind }\nfunc (fd *Field) HasJSONName() bool             { return fd.L1.StringName.hasJSON }\nfunc (fd *Field) JSONName() string              { return fd.L1.StringName.getJSON(fd) }\nfunc (fd *Field) TextName() string              { return fd.L1.StringName.getText(fd) }\nfunc (fd *Field) HasPresence() bool {\n\treturn fd.L1.Cardinality != pref.Repeated && (fd.L0.ParentFile.L1.Syntax == pref.Proto2 || fd.L1.Message != nil || fd.L1.ContainingOneof != nil)\n}\nfunc (fd *Field) HasOptionalKeyword() bool {\n\treturn (fd.L0.ParentFile.L1.Syntax == pref.Proto2 && fd.L1.Cardinality == pref.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional\n}\nfunc (fd *Field) IsPacked() bool {\n\tif !fd.L1.HasPacked && fd.L0.ParentFile.L1.Syntax != pref.Proto2 && fd.L1.Cardinality == pref.Repeated {\n\t\tswitch fd.L1.Kind {\n\t\tcase pref.StringKind, pref.BytesKind, pref.MessageKind, pref.GroupKind:\n\t\tdefault:\n\t\t\treturn true\n\t\t}\n\t}\n\treturn fd.L1.IsPacked\n}\nfunc (fd *Field) IsExtension() bool { return false }\nfunc (fd *Field) IsWeak() bool      { return fd.L1.IsWeak }\nfunc (fd *Field) IsList() bool      { return fd.Cardinality() == pref.Repeated && !fd.IsMap() }\nfunc (fd *Field) IsMap() bool       { return fd.Message() != nil && fd.Message().IsMapEntry() }\nfunc (fd *Field) MapKey() pref.FieldDescriptor {\n\tif !fd.IsMap() {\n\t\treturn nil\n\t}\n\treturn fd.Message().Fields().ByNumber(genid.MapEntry_Key_field_number)\n}\nfunc (fd *Field) MapValue() pref.FieldDescriptor {\n\tif !fd.IsMap() {\n\t\treturn nil\n\t}\n\treturn fd.Message().Fields().ByNumber(genid.MapEntry_Value_field_number)\n}\nfunc (fd *Field) HasDefault() bool                           { return fd.L1.Default.has }\nfunc (fd *Field) Default() pref.Value                        { return fd.L1.Default.get(fd) }\nfunc (fd *Field) DefaultEnumValue() pref.EnumValueDescriptor { return fd.L1.Default.enum }\nfunc (fd *Field) ContainingOneof() pref.OneofDescriptor      { return fd.L1.ContainingOneof }\nfunc (fd *Field) ContainingMessage() pref.MessageDescriptor {\n\treturn fd.L0.Parent.(pref.MessageDescriptor)\n}\nfunc (fd *Field) Enum() pref.EnumDescriptor {\n\treturn fd.L1.Enum\n}\nfunc (fd *Field) Message() pref.MessageDescriptor {\n\tif fd.L1.IsWeak {\n\t\tif d, _ := protoregistry.GlobalFiles.FindDescriptorByName(fd.L1.Message.FullName()); d != nil {\n\t\t\treturn d.(pref.MessageDescriptor)\n\t\t}\n\t}\n\treturn fd.L1.Message\n}\nfunc (fd *Field) Format(s fmt.State, r rune)     { descfmt.FormatDesc(s, r, fd) }\nfunc (fd *Field) ProtoType(pref.FieldDescriptor) {}\n\n// EnforceUTF8 is a pseudo-internal API to determine whether to enforce UTF-8\n// validation for the string field. This exists for Google-internal use only\n// since proto3 did not enforce UTF-8 validity prior to the open-source release.\n// If this method does not exist, the default is to enforce valid UTF-8.\n//\n// WARNING: This method is exempt from the compatibility promise and may be\n// removed in the future without warning.\nfunc (fd *Field) EnforceUTF8() bool {\n\tif fd.L1.HasEnforceUTF8 {\n\t\treturn fd.L1.EnforceUTF8\n\t}\n\treturn fd.L0.ParentFile.L1.Syntax == pref.Proto3\n}\n\nfunc (od *Oneof) IsSynthetic() bool {\n\treturn od.L0.ParentFile.L1.Syntax == pref.Proto3 && len(od.L1.Fields.List) == 1 && od.L1.Fields.List[0].HasOptionalKeyword()\n}\nfunc (od *Oneof) Options() pref.ProtoMessage {\n\tif f := od.L1.Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.Oneof\n}\nfunc (od *Oneof) Fields() pref.FieldDescriptors  { return &od.L1.Fields }\nfunc (od *Oneof) Format(s fmt.State, r rune)     { descfmt.FormatDesc(s, r, od) }\nfunc (od *Oneof) ProtoType(pref.OneofDescriptor) {}\n\ntype (\n\tExtension struct {\n\t\tBase\n\t\tL1 ExtensionL1\n\t\tL2 *ExtensionL2 // protected by fileDesc.once\n\t}\n\tExtensionL1 struct {\n\t\tNumber      pref.FieldNumber\n\t\tExtendee    pref.MessageDescriptor\n\t\tCardinality pref.Cardinality\n\t\tKind        pref.Kind\n\t}\n\tExtensionL2 struct {\n\t\tOptions          func() pref.ProtoMessage\n\t\tStringName       stringName\n\t\tIsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto\n\t\tIsPacked         bool // promoted from google.protobuf.FieldOptions\n\t\tDefault          defaultValue\n\t\tEnum             pref.EnumDescriptor\n\t\tMessage          pref.MessageDescriptor\n\t}\n)\n\nfunc (xd *Extension) Options() pref.ProtoMessage {\n\tif f := xd.lazyInit().Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.Field\n}\nfunc (xd *Extension) Number() pref.FieldNumber      { return xd.L1.Number }\nfunc (xd *Extension) Cardinality() pref.Cardinality { return xd.L1.Cardinality }\nfunc (xd *Extension) Kind() pref.Kind               { return xd.L1.Kind }\nfunc (xd *Extension) HasJSONName() bool             { return xd.lazyInit().StringName.hasJSON }\nfunc (xd *Extension) JSONName() string              { return xd.lazyInit().StringName.getJSON(xd) }\nfunc (xd *Extension) TextName() string              { return xd.lazyInit().StringName.getText(xd) }\nfunc (xd *Extension) HasPresence() bool             { return xd.L1.Cardinality != pref.Repeated }\nfunc (xd *Extension) HasOptionalKeyword() bool {\n\treturn (xd.L0.ParentFile.L1.Syntax == pref.Proto2 && xd.L1.Cardinality == pref.Optional) || xd.lazyInit().IsProto3Optional\n}\nfunc (xd *Extension) IsPacked() bool                             { return xd.lazyInit().IsPacked }\nfunc (xd *Extension) IsExtension() bool                          { return true }\nfunc (xd *Extension) IsWeak() bool                               { return false }\nfunc (xd *Extension) IsList() bool                               { return xd.Cardinality() == pref.Repeated }\nfunc (xd *Extension) IsMap() bool                                { return false }\nfunc (xd *Extension) MapKey() pref.FieldDescriptor               { return nil }\nfunc (xd *Extension) MapValue() pref.FieldDescriptor             { return nil }\nfunc (xd *Extension) HasDefault() bool                           { return xd.lazyInit().Default.has }\nfunc (xd *Extension) Default() pref.Value                        { return xd.lazyInit().Default.get(xd) }\nfunc (xd *Extension) DefaultEnumValue() pref.EnumValueDescriptor { return xd.lazyInit().Default.enum }\nfunc (xd *Extension) ContainingOneof() pref.OneofDescriptor      { return nil }\nfunc (xd *Extension) ContainingMessage() pref.MessageDescriptor  { return xd.L1.Extendee }\nfunc (xd *Extension) Enum() pref.EnumDescriptor                  { return xd.lazyInit().Enum }\nfunc (xd *Extension) Message() pref.MessageDescriptor            { return xd.lazyInit().Message }\nfunc (xd *Extension) Format(s fmt.State, r rune)                 { descfmt.FormatDesc(s, r, xd) }\nfunc (xd *Extension) ProtoType(pref.FieldDescriptor)             {}\nfunc (xd *Extension) ProtoInternal(pragma.DoNotImplement)        {}\nfunc (xd *Extension) lazyInit() *ExtensionL2 {\n\txd.L0.ParentFile.lazyInit() // implicitly initializes L2\n\treturn xd.L2\n}\n\ntype (\n\tService struct {\n\t\tBase\n\t\tL1 ServiceL1\n\t\tL2 *ServiceL2 // protected by fileDesc.once\n\t}\n\tServiceL1 struct{}\n\tServiceL2 struct {\n\t\tOptions func() pref.ProtoMessage\n\t\tMethods Methods\n\t}\n\n\tMethod struct {\n\t\tBase\n\t\tL1 MethodL1\n\t}\n\tMethodL1 struct {\n\t\tOptions           func() pref.ProtoMessage\n\t\tInput             pref.MessageDescriptor\n\t\tOutput            pref.MessageDescriptor\n\t\tIsStreamingClient bool\n\t\tIsStreamingServer bool\n\t}\n)\n\nfunc (sd *Service) Options() pref.ProtoMessage {\n\tif f := sd.lazyInit().Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.Service\n}\nfunc (sd *Service) Methods() pref.MethodDescriptors     { return &sd.lazyInit().Methods }\nfunc (sd *Service) Format(s fmt.State, r rune)          { descfmt.FormatDesc(s, r, sd) }\nfunc (sd *Service) ProtoType(pref.ServiceDescriptor)    {}\nfunc (sd *Service) ProtoInternal(pragma.DoNotImplement) {}\nfunc (sd *Service) lazyInit() *ServiceL2 {\n\tsd.L0.ParentFile.lazyInit() // implicitly initializes L2\n\treturn sd.L2\n}\n\nfunc (md *Method) Options() pref.ProtoMessage {\n\tif f := md.L1.Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.Method\n}\nfunc (md *Method) Input() pref.MessageDescriptor       { return md.L1.Input }\nfunc (md *Method) Output() pref.MessageDescriptor      { return md.L1.Output }\nfunc (md *Method) IsStreamingClient() bool             { return md.L1.IsStreamingClient }\nfunc (md *Method) IsStreamingServer() bool             { return md.L1.IsStreamingServer }\nfunc (md *Method) Format(s fmt.State, r rune)          { descfmt.FormatDesc(s, r, md) }\nfunc (md *Method) ProtoType(pref.MethodDescriptor)     {}\nfunc (md *Method) ProtoInternal(pragma.DoNotImplement) {}\n\n// Surrogate files are can be used to create standalone descriptors\n// where the syntax is only information derived from the parent file.\nvar (\n\tSurrogateProto2 = &File{L1: FileL1{Syntax: pref.Proto2}, L2: &FileL2{}}\n\tSurrogateProto3 = &File{L1: FileL1{Syntax: pref.Proto3}, L2: &FileL2{}}\n)\n\ntype (\n\tBase struct {\n\t\tL0 BaseL0\n\t}\n\tBaseL0 struct {\n\t\tFullName   pref.FullName // must be populated\n\t\tParentFile *File         // must be populated\n\t\tParent     pref.Descriptor\n\t\tIndex      int\n\t}\n)\n\nfunc (d *Base) Name() pref.Name         { return d.L0.FullName.Name() }\nfunc (d *Base) FullName() pref.FullName { return d.L0.FullName }\nfunc (d *Base) ParentFile() pref.FileDescriptor {\n\tif d.L0.ParentFile == SurrogateProto2 || d.L0.ParentFile == SurrogateProto3 {\n\t\treturn nil // surrogate files are not real parents\n\t}\n\treturn d.L0.ParentFile\n}\nfunc (d *Base) Parent() pref.Descriptor             { return d.L0.Parent }\nfunc (d *Base) Index() int                          { return d.L0.Index }\nfunc (d *Base) Syntax() pref.Syntax                 { return d.L0.ParentFile.Syntax() }\nfunc (d *Base) IsPlaceholder() bool                 { return false }\nfunc (d *Base) ProtoInternal(pragma.DoNotImplement) {}\n\ntype stringName struct {\n\thasJSON  bool\n\tonce     sync.Once\n\tnameJSON string\n\tnameText string\n}\n\n// InitJSON initializes the name. It is exported for use by other internal packages.\nfunc (s *stringName) InitJSON(name string) {\n\ts.hasJSON = true\n\ts.nameJSON = name\n}\n\nfunc (s *stringName) lazyInit(fd pref.FieldDescriptor) *stringName {\n\ts.once.Do(func() {\n\t\tif fd.IsExtension() {\n\t\t\t// For extensions, JSON and text are formatted the same way.\n\t\t\tvar name string\n\t\t\tif messageset.IsMessageSetExtension(fd) {\n\t\t\t\tname = string(\"[\" + fd.FullName().Parent() + \"]\")\n\t\t\t} else {\n\t\t\t\tname = string(\"[\" + fd.FullName() + \"]\")\n\t\t\t}\n\t\t\ts.nameJSON = name\n\t\t\ts.nameText = name\n\t\t} else {\n\t\t\t// Format the JSON name.\n\t\t\tif !s.hasJSON {\n\t\t\t\ts.nameJSON = strs.JSONCamelCase(string(fd.Name()))\n\t\t\t}\n\n\t\t\t// Format the text name.\n\t\t\ts.nameText = string(fd.Name())\n\t\t\tif fd.Kind() == pref.GroupKind {\n\t\t\t\ts.nameText = string(fd.Message().Name())\n\t\t\t}\n\t\t}\n\t})\n\treturn s\n}\n\nfunc (s *stringName) getJSON(fd pref.FieldDescriptor) string { return s.lazyInit(fd).nameJSON }\nfunc (s *stringName) getText(fd pref.FieldDescriptor) string { return s.lazyInit(fd).nameText }\n\nfunc DefaultValue(v pref.Value, ev pref.EnumValueDescriptor) defaultValue {\n\tdv := defaultValue{has: v.IsValid(), val: v, enum: ev}\n\tif b, ok := v.Interface().([]byte); ok {\n\t\t// Store a copy of the default bytes, so that we can detect\n\t\t// accidental mutations of the original value.\n\t\tdv.bytes = append([]byte(nil), b...)\n\t}\n\treturn dv\n}\n\nfunc unmarshalDefault(b []byte, k pref.Kind, pf *File, ed pref.EnumDescriptor) defaultValue {\n\tvar evs pref.EnumValueDescriptors\n\tif k == pref.EnumKind {\n\t\t// If the enum is declared within the same file, be careful not to\n\t\t// blindly call the Values method, lest we bind ourselves in a deadlock.\n\t\tif e, ok := ed.(*Enum); ok && e.L0.ParentFile == pf {\n\t\t\tevs = &e.L2.Values\n\t\t} else {\n\t\t\tevs = ed.Values()\n\t\t}\n\n\t\t// If we are unable to resolve the enum dependency, use a placeholder\n\t\t// enum value since we will not be able to parse the default value.\n\t\tif ed.IsPlaceholder() && pref.Name(b).IsValid() {\n\t\t\tv := pref.ValueOfEnum(0)\n\t\t\tev := PlaceholderEnumValue(ed.FullName().Parent().Append(pref.Name(b)))\n\t\t\treturn DefaultValue(v, ev)\n\t\t}\n\t}\n\n\tv, ev, err := defval.Unmarshal(string(b), k, evs, defval.Descriptor)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn DefaultValue(v, ev)\n}\n\ntype defaultValue struct {\n\thas   bool\n\tval   pref.Value\n\tenum  pref.EnumValueDescriptor\n\tbytes []byte\n}\n\nfunc (dv *defaultValue) get(fd pref.FieldDescriptor) pref.Value {\n\t// Return the zero value as the default if unpopulated.\n\tif !dv.has {\n\t\tif fd.Cardinality() == pref.Repeated {\n\t\t\treturn pref.Value{}\n\t\t}\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\treturn pref.ValueOfBool(false)\n\t\tcase pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:\n\t\t\treturn pref.ValueOfInt32(0)\n\t\tcase pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:\n\t\t\treturn pref.ValueOfInt64(0)\n\t\tcase pref.Uint32Kind, pref.Fixed32Kind:\n\t\t\treturn pref.ValueOfUint32(0)\n\t\tcase pref.Uint64Kind, pref.Fixed64Kind:\n\t\t\treturn pref.ValueOfUint64(0)\n\t\tcase pref.FloatKind:\n\t\t\treturn pref.ValueOfFloat32(0)\n\t\tcase pref.DoubleKind:\n\t\t\treturn pref.ValueOfFloat64(0)\n\t\tcase pref.StringKind:\n\t\t\treturn pref.ValueOfString(\"\")\n\t\tcase pref.BytesKind:\n\t\t\treturn pref.ValueOfBytes(nil)\n\t\tcase pref.EnumKind:\n\t\t\tif evs := fd.Enum().Values(); evs.Len() > 0 {\n\t\t\t\treturn pref.ValueOfEnum(evs.Get(0).Number())\n\t\t\t}\n\t\t\treturn pref.ValueOfEnum(0)\n\t\t}\n\t}\n\n\tif len(dv.bytes) > 0 && !bytes.Equal(dv.bytes, dv.val.Bytes()) {\n\t\t// TODO: Avoid panic if we're running with the race detector\n\t\t// and instead spawn a goroutine that periodically resets\n\t\t// this value back to the original to induce a race.\n\t\tpanic(fmt.Sprintf(\"detected mutation on the default bytes for %v\", fd.FullName()))\n\t}\n\treturn dv.val\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/filedesc/desc_init.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 filedesc\n\nimport (\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// fileRaw is a data struct used when initializing a file descriptor from\n// a raw FileDescriptorProto.\ntype fileRaw struct {\n\tbuilder       Builder\n\tallEnums      []Enum\n\tallMessages   []Message\n\tallExtensions []Extension\n\tallServices   []Service\n}\n\nfunc newRawFile(db Builder) *File {\n\tfd := &File{fileRaw: fileRaw{builder: db}}\n\tfd.initDecls(db.NumEnums, db.NumMessages, db.NumExtensions, db.NumServices)\n\tfd.unmarshalSeed(db.RawDescriptor)\n\n\t// Extended message targets are eagerly resolved since registration\n\t// needs this information at program init time.\n\tfor i := range fd.allExtensions {\n\t\txd := &fd.allExtensions[i]\n\t\txd.L1.Extendee = fd.resolveMessageDependency(xd.L1.Extendee, listExtTargets, int32(i))\n\t}\n\n\tfd.checkDecls()\n\treturn fd\n}\n\n// initDecls pre-allocates slices for the exact number of enums, messages\n// (including map entries), extensions, and services declared in the proto file.\n// This is done to avoid regrowing the slice, which would change the address\n// for any previously seen declaration.\n//\n// The alloc methods \"allocates\" slices by pulling from the capacity.\nfunc (fd *File) initDecls(numEnums, numMessages, numExtensions, numServices int32) {\n\tfd.allEnums = make([]Enum, 0, numEnums)\n\tfd.allMessages = make([]Message, 0, numMessages)\n\tfd.allExtensions = make([]Extension, 0, numExtensions)\n\tfd.allServices = make([]Service, 0, numServices)\n}\n\nfunc (fd *File) allocEnums(n int) []Enum {\n\ttotal := len(fd.allEnums)\n\tes := fd.allEnums[total : total+n]\n\tfd.allEnums = fd.allEnums[:total+n]\n\treturn es\n}\nfunc (fd *File) allocMessages(n int) []Message {\n\ttotal := len(fd.allMessages)\n\tms := fd.allMessages[total : total+n]\n\tfd.allMessages = fd.allMessages[:total+n]\n\treturn ms\n}\nfunc (fd *File) allocExtensions(n int) []Extension {\n\ttotal := len(fd.allExtensions)\n\txs := fd.allExtensions[total : total+n]\n\tfd.allExtensions = fd.allExtensions[:total+n]\n\treturn xs\n}\nfunc (fd *File) allocServices(n int) []Service {\n\ttotal := len(fd.allServices)\n\txs := fd.allServices[total : total+n]\n\tfd.allServices = fd.allServices[:total+n]\n\treturn xs\n}\n\n// checkDecls performs a sanity check that the expected number of expected\n// declarations matches the number that were found in the descriptor proto.\nfunc (fd *File) checkDecls() {\n\tswitch {\n\tcase len(fd.allEnums) != cap(fd.allEnums):\n\tcase len(fd.allMessages) != cap(fd.allMessages):\n\tcase len(fd.allExtensions) != cap(fd.allExtensions):\n\tcase len(fd.allServices) != cap(fd.allServices):\n\tdefault:\n\t\treturn\n\t}\n\tpanic(\"mismatching cardinality\")\n}\n\nfunc (fd *File) unmarshalSeed(b []byte) {\n\tsb := getBuilder()\n\tdefer putBuilder(sb)\n\n\tvar prevField pref.FieldNumber\n\tvar numEnums, numMessages, numExtensions, numServices int\n\tvar posEnums, posMessages, posExtensions, posServices int\n\tb0 := b\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FileDescriptorProto_Syntax_field_number:\n\t\t\t\tswitch string(v) {\n\t\t\t\tcase \"proto2\":\n\t\t\t\t\tfd.L1.Syntax = pref.Proto2\n\t\t\t\tcase \"proto3\":\n\t\t\t\t\tfd.L1.Syntax = pref.Proto3\n\t\t\t\tdefault:\n\t\t\t\t\tpanic(\"invalid syntax\")\n\t\t\t\t}\n\t\t\tcase genid.FileDescriptorProto_Name_field_number:\n\t\t\t\tfd.L1.Path = sb.MakeString(v)\n\t\t\tcase genid.FileDescriptorProto_Package_field_number:\n\t\t\t\tfd.L1.Package = pref.FullName(sb.MakeString(v))\n\t\t\tcase genid.FileDescriptorProto_EnumType_field_number:\n\t\t\t\tif prevField != genid.FileDescriptorProto_EnumType_field_number {\n\t\t\t\t\tif numEnums > 0 {\n\t\t\t\t\t\tpanic(\"non-contiguous repeated field\")\n\t\t\t\t\t}\n\t\t\t\t\tposEnums = len(b0) - len(b) - n - m\n\t\t\t\t}\n\t\t\t\tnumEnums++\n\t\t\tcase genid.FileDescriptorProto_MessageType_field_number:\n\t\t\t\tif prevField != genid.FileDescriptorProto_MessageType_field_number {\n\t\t\t\t\tif numMessages > 0 {\n\t\t\t\t\t\tpanic(\"non-contiguous repeated field\")\n\t\t\t\t\t}\n\t\t\t\t\tposMessages = len(b0) - len(b) - n - m\n\t\t\t\t}\n\t\t\t\tnumMessages++\n\t\t\tcase genid.FileDescriptorProto_Extension_field_number:\n\t\t\t\tif prevField != genid.FileDescriptorProto_Extension_field_number {\n\t\t\t\t\tif numExtensions > 0 {\n\t\t\t\t\t\tpanic(\"non-contiguous repeated field\")\n\t\t\t\t\t}\n\t\t\t\t\tposExtensions = len(b0) - len(b) - n - m\n\t\t\t\t}\n\t\t\t\tnumExtensions++\n\t\t\tcase genid.FileDescriptorProto_Service_field_number:\n\t\t\t\tif prevField != genid.FileDescriptorProto_Service_field_number {\n\t\t\t\t\tif numServices > 0 {\n\t\t\t\t\t\tpanic(\"non-contiguous repeated field\")\n\t\t\t\t\t}\n\t\t\t\t\tposServices = len(b0) - len(b) - n - m\n\t\t\t\t}\n\t\t\t\tnumServices++\n\t\t\t}\n\t\t\tprevField = num\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t\tprevField = -1 // ignore known field numbers of unknown wire type\n\t\t}\n\t}\n\n\t// If syntax is missing, it is assumed to be proto2.\n\tif fd.L1.Syntax == 0 {\n\t\tfd.L1.Syntax = pref.Proto2\n\t}\n\n\t// Must allocate all declarations before parsing each descriptor type\n\t// to ensure we handled all descriptors in \"flattened ordering\".\n\tif numEnums > 0 {\n\t\tfd.L1.Enums.List = fd.allocEnums(numEnums)\n\t}\n\tif numMessages > 0 {\n\t\tfd.L1.Messages.List = fd.allocMessages(numMessages)\n\t}\n\tif numExtensions > 0 {\n\t\tfd.L1.Extensions.List = fd.allocExtensions(numExtensions)\n\t}\n\tif numServices > 0 {\n\t\tfd.L1.Services.List = fd.allocServices(numServices)\n\t}\n\n\tif numEnums > 0 {\n\t\tb := b0[posEnums:]\n\t\tfor i := range fd.L1.Enums.List {\n\t\t\t_, n := protowire.ConsumeVarint(b)\n\t\t\tv, m := protowire.ConsumeBytes(b[n:])\n\t\t\tfd.L1.Enums.List[i].unmarshalSeed(v, sb, fd, fd, i)\n\t\t\tb = b[n+m:]\n\t\t}\n\t}\n\tif numMessages > 0 {\n\t\tb := b0[posMessages:]\n\t\tfor i := range fd.L1.Messages.List {\n\t\t\t_, n := protowire.ConsumeVarint(b)\n\t\t\tv, m := protowire.ConsumeBytes(b[n:])\n\t\t\tfd.L1.Messages.List[i].unmarshalSeed(v, sb, fd, fd, i)\n\t\t\tb = b[n+m:]\n\t\t}\n\t}\n\tif numExtensions > 0 {\n\t\tb := b0[posExtensions:]\n\t\tfor i := range fd.L1.Extensions.List {\n\t\t\t_, n := protowire.ConsumeVarint(b)\n\t\t\tv, m := protowire.ConsumeBytes(b[n:])\n\t\t\tfd.L1.Extensions.List[i].unmarshalSeed(v, sb, fd, fd, i)\n\t\t\tb = b[n+m:]\n\t\t}\n\t}\n\tif numServices > 0 {\n\t\tb := b0[posServices:]\n\t\tfor i := range fd.L1.Services.List {\n\t\t\t_, n := protowire.ConsumeVarint(b)\n\t\t\tv, m := protowire.ConsumeBytes(b[n:])\n\t\t\tfd.L1.Services.List[i].unmarshalSeed(v, sb, fd, fd, i)\n\t\t\tb = b[n+m:]\n\t\t}\n\t}\n}\n\nfunc (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\ted.L0.ParentFile = pf\n\ted.L0.Parent = pd\n\ted.L0.Index = i\n\n\tvar numValues int\n\tfor b := b; len(b) > 0; {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.EnumDescriptorProto_Name_field_number:\n\t\t\t\ted.L0.FullName = appendFullName(sb, pd.FullName(), v)\n\t\t\tcase genid.EnumDescriptorProto_Value_field_number:\n\t\t\t\tnumValues++\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\n\t// Only construct enum value descriptors for top-level enums since\n\t// they are needed for registration.\n\tif pd != pf {\n\t\treturn\n\t}\n\ted.L1.eagerValues = true\n\ted.L2 = new(EnumL2)\n\ted.L2.Values.List = make([]EnumValue, numValues)\n\tfor i := 0; len(b) > 0; {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.EnumDescriptorProto_Value_field_number:\n\t\t\t\ted.L2.Values.List[i].unmarshalFull(v, sb, pf, ed, i)\n\t\t\t\ti++\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n\nfunc (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\tmd.L0.ParentFile = pf\n\tmd.L0.Parent = pd\n\tmd.L0.Index = i\n\n\tvar prevField pref.FieldNumber\n\tvar numEnums, numMessages, numExtensions int\n\tvar posEnums, posMessages, posExtensions int\n\tb0 := b\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.DescriptorProto_Name_field_number:\n\t\t\t\tmd.L0.FullName = appendFullName(sb, pd.FullName(), v)\n\t\t\tcase genid.DescriptorProto_EnumType_field_number:\n\t\t\t\tif prevField != genid.DescriptorProto_EnumType_field_number {\n\t\t\t\t\tif numEnums > 0 {\n\t\t\t\t\t\tpanic(\"non-contiguous repeated field\")\n\t\t\t\t\t}\n\t\t\t\t\tposEnums = len(b0) - len(b) - n - m\n\t\t\t\t}\n\t\t\t\tnumEnums++\n\t\t\tcase genid.DescriptorProto_NestedType_field_number:\n\t\t\t\tif prevField != genid.DescriptorProto_NestedType_field_number {\n\t\t\t\t\tif numMessages > 0 {\n\t\t\t\t\t\tpanic(\"non-contiguous repeated field\")\n\t\t\t\t\t}\n\t\t\t\t\tposMessages = len(b0) - len(b) - n - m\n\t\t\t\t}\n\t\t\t\tnumMessages++\n\t\t\tcase genid.DescriptorProto_Extension_field_number:\n\t\t\t\tif prevField != genid.DescriptorProto_Extension_field_number {\n\t\t\t\t\tif numExtensions > 0 {\n\t\t\t\t\t\tpanic(\"non-contiguous repeated field\")\n\t\t\t\t\t}\n\t\t\t\t\tposExtensions = len(b0) - len(b) - n - m\n\t\t\t\t}\n\t\t\t\tnumExtensions++\n\t\t\tcase genid.DescriptorProto_Options_field_number:\n\t\t\t\tmd.unmarshalSeedOptions(v)\n\t\t\t}\n\t\t\tprevField = num\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t\tprevField = -1 // ignore known field numbers of unknown wire type\n\t\t}\n\t}\n\n\t// Must allocate all declarations before parsing each descriptor type\n\t// to ensure we handled all descriptors in \"flattened ordering\".\n\tif numEnums > 0 {\n\t\tmd.L1.Enums.List = pf.allocEnums(numEnums)\n\t}\n\tif numMessages > 0 {\n\t\tmd.L1.Messages.List = pf.allocMessages(numMessages)\n\t}\n\tif numExtensions > 0 {\n\t\tmd.L1.Extensions.List = pf.allocExtensions(numExtensions)\n\t}\n\n\tif numEnums > 0 {\n\t\tb := b0[posEnums:]\n\t\tfor i := range md.L1.Enums.List {\n\t\t\t_, n := protowire.ConsumeVarint(b)\n\t\t\tv, m := protowire.ConsumeBytes(b[n:])\n\t\t\tmd.L1.Enums.List[i].unmarshalSeed(v, sb, pf, md, i)\n\t\t\tb = b[n+m:]\n\t\t}\n\t}\n\tif numMessages > 0 {\n\t\tb := b0[posMessages:]\n\t\tfor i := range md.L1.Messages.List {\n\t\t\t_, n := protowire.ConsumeVarint(b)\n\t\t\tv, m := protowire.ConsumeBytes(b[n:])\n\t\t\tmd.L1.Messages.List[i].unmarshalSeed(v, sb, pf, md, i)\n\t\t\tb = b[n+m:]\n\t\t}\n\t}\n\tif numExtensions > 0 {\n\t\tb := b0[posExtensions:]\n\t\tfor i := range md.L1.Extensions.List {\n\t\t\t_, n := protowire.ConsumeVarint(b)\n\t\t\tv, m := protowire.ConsumeBytes(b[n:])\n\t\t\tmd.L1.Extensions.List[i].unmarshalSeed(v, sb, pf, md, i)\n\t\t\tb = b[n+m:]\n\t\t}\n\t}\n}\n\nfunc (md *Message) unmarshalSeedOptions(b []byte) {\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.MessageOptions_MapEntry_field_number:\n\t\t\t\tmd.L1.IsMapEntry = protowire.DecodeBool(v)\n\t\t\tcase genid.MessageOptions_MessageSetWireFormat_field_number:\n\t\t\t\tmd.L1.IsMessageSet = protowire.DecodeBool(v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n\nfunc (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\txd.L0.ParentFile = pf\n\txd.L0.Parent = pd\n\txd.L0.Index = i\n\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldDescriptorProto_Number_field_number:\n\t\t\t\txd.L1.Number = pref.FieldNumber(v)\n\t\t\tcase genid.FieldDescriptorProto_Label_field_number:\n\t\t\t\txd.L1.Cardinality = pref.Cardinality(v)\n\t\t\tcase genid.FieldDescriptorProto_Type_field_number:\n\t\t\t\txd.L1.Kind = pref.Kind(v)\n\t\t\t}\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldDescriptorProto_Name_field_number:\n\t\t\t\txd.L0.FullName = appendFullName(sb, pd.FullName(), v)\n\t\t\tcase genid.FieldDescriptorProto_Extendee_field_number:\n\t\t\t\txd.L1.Extendee = PlaceholderMessage(makeFullName(sb, v))\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n\nfunc (sd *Service) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\tsd.L0.ParentFile = pf\n\tsd.L0.Parent = pd\n\tsd.L0.Index = i\n\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.ServiceDescriptorProto_Name_field_number:\n\t\t\t\tsd.L0.FullName = appendFullName(sb, pd.FullName(), v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n\nvar nameBuilderPool = sync.Pool{\n\tNew: func() interface{} { return new(strs.Builder) },\n}\n\nfunc getBuilder() *strs.Builder {\n\treturn nameBuilderPool.Get().(*strs.Builder)\n}\nfunc putBuilder(b *strs.Builder) {\n\tnameBuilderPool.Put(b)\n}\n\n// makeFullName converts b to a protoreflect.FullName,\n// where b must start with a leading dot.\nfunc makeFullName(sb *strs.Builder, b []byte) pref.FullName {\n\tif len(b) == 0 || b[0] != '.' {\n\t\tpanic(\"name reference must be fully qualified\")\n\t}\n\treturn pref.FullName(sb.MakeString(b[1:]))\n}\n\nfunc appendFullName(sb *strs.Builder, prefix pref.FullName, suffix []byte) pref.FullName {\n\treturn sb.AppendFullName(prefix, pref.Name(strs.UnsafeString(suffix)))\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/filedesc/desc_lazy.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 filedesc\n\nimport (\n\t\"reflect\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/descopts\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/proto\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nfunc (fd *File) lazyRawInit() {\n\tfd.unmarshalFull(fd.builder.RawDescriptor)\n\tfd.resolveMessages()\n\tfd.resolveExtensions()\n\tfd.resolveServices()\n}\n\nfunc (file *File) resolveMessages() {\n\tvar depIdx int32\n\tfor i := range file.allMessages {\n\t\tmd := &file.allMessages[i]\n\n\t\t// Resolve message field dependencies.\n\t\tfor j := range md.L2.Fields.List {\n\t\t\tfd := &md.L2.Fields.List[j]\n\n\t\t\t// Weak fields are resolved upon actual use.\n\t\t\tif fd.L1.IsWeak {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Resolve message field dependency.\n\t\t\tswitch fd.L1.Kind {\n\t\t\tcase pref.EnumKind:\n\t\t\t\tfd.L1.Enum = file.resolveEnumDependency(fd.L1.Enum, listFieldDeps, depIdx)\n\t\t\t\tdepIdx++\n\t\t\tcase pref.MessageKind, pref.GroupKind:\n\t\t\t\tfd.L1.Message = file.resolveMessageDependency(fd.L1.Message, listFieldDeps, depIdx)\n\t\t\t\tdepIdx++\n\t\t\t}\n\n\t\t\t// Default is resolved here since it depends on Enum being resolved.\n\t\t\tif v := fd.L1.Default.val; v.IsValid() {\n\t\t\t\tfd.L1.Default = unmarshalDefault(v.Bytes(), fd.L1.Kind, file, fd.L1.Enum)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc (file *File) resolveExtensions() {\n\tvar depIdx int32\n\tfor i := range file.allExtensions {\n\t\txd := &file.allExtensions[i]\n\n\t\t// Resolve extension field dependency.\n\t\tswitch xd.L1.Kind {\n\t\tcase pref.EnumKind:\n\t\t\txd.L2.Enum = file.resolveEnumDependency(xd.L2.Enum, listExtDeps, depIdx)\n\t\t\tdepIdx++\n\t\tcase pref.MessageKind, pref.GroupKind:\n\t\t\txd.L2.Message = file.resolveMessageDependency(xd.L2.Message, listExtDeps, depIdx)\n\t\t\tdepIdx++\n\t\t}\n\n\t\t// Default is resolved here since it depends on Enum being resolved.\n\t\tif v := xd.L2.Default.val; v.IsValid() {\n\t\t\txd.L2.Default = unmarshalDefault(v.Bytes(), xd.L1.Kind, file, xd.L2.Enum)\n\t\t}\n\t}\n}\n\nfunc (file *File) resolveServices() {\n\tvar depIdx int32\n\tfor i := range file.allServices {\n\t\tsd := &file.allServices[i]\n\n\t\t// Resolve method dependencies.\n\t\tfor j := range sd.L2.Methods.List {\n\t\t\tmd := &sd.L2.Methods.List[j]\n\t\t\tmd.L1.Input = file.resolveMessageDependency(md.L1.Input, listMethInDeps, depIdx)\n\t\t\tmd.L1.Output = file.resolveMessageDependency(md.L1.Output, listMethOutDeps, depIdx)\n\t\t\tdepIdx++\n\t\t}\n\t}\n}\n\nfunc (file *File) resolveEnumDependency(ed pref.EnumDescriptor, i, j int32) pref.EnumDescriptor {\n\tr := file.builder.FileRegistry\n\tif r, ok := r.(resolverByIndex); ok {\n\t\tif ed2 := r.FindEnumByIndex(i, j, file.allEnums, file.allMessages); ed2 != nil {\n\t\t\treturn ed2\n\t\t}\n\t}\n\tfor i := range file.allEnums {\n\t\tif ed2 := &file.allEnums[i]; ed2.L0.FullName == ed.FullName() {\n\t\t\treturn ed2\n\t\t}\n\t}\n\tif d, _ := r.FindDescriptorByName(ed.FullName()); d != nil {\n\t\treturn d.(pref.EnumDescriptor)\n\t}\n\treturn ed\n}\n\nfunc (file *File) resolveMessageDependency(md pref.MessageDescriptor, i, j int32) pref.MessageDescriptor {\n\tr := file.builder.FileRegistry\n\tif r, ok := r.(resolverByIndex); ok {\n\t\tif md2 := r.FindMessageByIndex(i, j, file.allEnums, file.allMessages); md2 != nil {\n\t\t\treturn md2\n\t\t}\n\t}\n\tfor i := range file.allMessages {\n\t\tif md2 := &file.allMessages[i]; md2.L0.FullName == md.FullName() {\n\t\t\treturn md2\n\t\t}\n\t}\n\tif d, _ := r.FindDescriptorByName(md.FullName()); d != nil {\n\t\treturn d.(pref.MessageDescriptor)\n\t}\n\treturn md\n}\n\nfunc (fd *File) unmarshalFull(b []byte) {\n\tsb := getBuilder()\n\tdefer putBuilder(sb)\n\n\tvar enumIdx, messageIdx, extensionIdx, serviceIdx int\n\tvar rawOptions []byte\n\tfd.L2 = new(FileL2)\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FileDescriptorProto_PublicDependency_field_number:\n\t\t\t\tfd.L2.Imports[v].IsPublic = true\n\t\t\tcase genid.FileDescriptorProto_WeakDependency_field_number:\n\t\t\t\tfd.L2.Imports[v].IsWeak = true\n\t\t\t}\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FileDescriptorProto_Dependency_field_number:\n\t\t\t\tpath := sb.MakeString(v)\n\t\t\t\timp, _ := fd.builder.FileRegistry.FindFileByPath(path)\n\t\t\t\tif imp == nil {\n\t\t\t\t\timp = PlaceholderFile(path)\n\t\t\t\t}\n\t\t\t\tfd.L2.Imports = append(fd.L2.Imports, pref.FileImport{FileDescriptor: imp})\n\t\t\tcase genid.FileDescriptorProto_EnumType_field_number:\n\t\t\t\tfd.L1.Enums.List[enumIdx].unmarshalFull(v, sb)\n\t\t\t\tenumIdx++\n\t\t\tcase genid.FileDescriptorProto_MessageType_field_number:\n\t\t\t\tfd.L1.Messages.List[messageIdx].unmarshalFull(v, sb)\n\t\t\t\tmessageIdx++\n\t\t\tcase genid.FileDescriptorProto_Extension_field_number:\n\t\t\t\tfd.L1.Extensions.List[extensionIdx].unmarshalFull(v, sb)\n\t\t\t\textensionIdx++\n\t\t\tcase genid.FileDescriptorProto_Service_field_number:\n\t\t\t\tfd.L1.Services.List[serviceIdx].unmarshalFull(v, sb)\n\t\t\t\tserviceIdx++\n\t\t\tcase genid.FileDescriptorProto_Options_field_number:\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tfd.L2.Options = fd.builder.optionsUnmarshaler(&descopts.File, rawOptions)\n}\n\nfunc (ed *Enum) unmarshalFull(b []byte, sb *strs.Builder) {\n\tvar rawValues [][]byte\n\tvar rawOptions []byte\n\tif !ed.L1.eagerValues {\n\t\ted.L2 = new(EnumL2)\n\t}\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.EnumDescriptorProto_Value_field_number:\n\t\t\t\trawValues = append(rawValues, v)\n\t\t\tcase genid.EnumDescriptorProto_ReservedName_field_number:\n\t\t\t\ted.L2.ReservedNames.List = append(ed.L2.ReservedNames.List, pref.Name(sb.MakeString(v)))\n\t\t\tcase genid.EnumDescriptorProto_ReservedRange_field_number:\n\t\t\t\ted.L2.ReservedRanges.List = append(ed.L2.ReservedRanges.List, unmarshalEnumReservedRange(v))\n\t\t\tcase genid.EnumDescriptorProto_Options_field_number:\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tif !ed.L1.eagerValues && len(rawValues) > 0 {\n\t\ted.L2.Values.List = make([]EnumValue, len(rawValues))\n\t\tfor i, b := range rawValues {\n\t\t\ted.L2.Values.List[i].unmarshalFull(b, sb, ed.L0.ParentFile, ed, i)\n\t\t}\n\t}\n\ted.L2.Options = ed.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Enum, rawOptions)\n}\n\nfunc unmarshalEnumReservedRange(b []byte) (r [2]pref.EnumNumber) {\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.EnumDescriptorProto_EnumReservedRange_Start_field_number:\n\t\t\t\tr[0] = pref.EnumNumber(v)\n\t\t\tcase genid.EnumDescriptorProto_EnumReservedRange_End_field_number:\n\t\t\t\tr[1] = pref.EnumNumber(v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\treturn r\n}\n\nfunc (vd *EnumValue) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\tvd.L0.ParentFile = pf\n\tvd.L0.Parent = pd\n\tvd.L0.Index = i\n\n\tvar rawOptions []byte\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.EnumValueDescriptorProto_Number_field_number:\n\t\t\t\tvd.L1.Number = pref.EnumNumber(v)\n\t\t\t}\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.EnumValueDescriptorProto_Name_field_number:\n\t\t\t\t// NOTE: Enum values are in the same scope as the enum parent.\n\t\t\t\tvd.L0.FullName = appendFullName(sb, pd.Parent().FullName(), v)\n\t\t\tcase genid.EnumValueDescriptorProto_Options_field_number:\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tvd.L1.Options = pf.builder.optionsUnmarshaler(&descopts.EnumValue, rawOptions)\n}\n\nfunc (md *Message) unmarshalFull(b []byte, sb *strs.Builder) {\n\tvar rawFields, rawOneofs [][]byte\n\tvar enumIdx, messageIdx, extensionIdx int\n\tvar rawOptions []byte\n\tmd.L2 = new(MessageL2)\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.DescriptorProto_Field_field_number:\n\t\t\t\trawFields = append(rawFields, v)\n\t\t\tcase genid.DescriptorProto_OneofDecl_field_number:\n\t\t\t\trawOneofs = append(rawOneofs, v)\n\t\t\tcase genid.DescriptorProto_ReservedName_field_number:\n\t\t\t\tmd.L2.ReservedNames.List = append(md.L2.ReservedNames.List, pref.Name(sb.MakeString(v)))\n\t\t\tcase genid.DescriptorProto_ReservedRange_field_number:\n\t\t\t\tmd.L2.ReservedRanges.List = append(md.L2.ReservedRanges.List, unmarshalMessageReservedRange(v))\n\t\t\tcase genid.DescriptorProto_ExtensionRange_field_number:\n\t\t\t\tr, rawOptions := unmarshalMessageExtensionRange(v)\n\t\t\t\topts := md.L0.ParentFile.builder.optionsUnmarshaler(&descopts.ExtensionRange, rawOptions)\n\t\t\t\tmd.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, r)\n\t\t\t\tmd.L2.ExtensionRangeOptions = append(md.L2.ExtensionRangeOptions, opts)\n\t\t\tcase genid.DescriptorProto_EnumType_field_number:\n\t\t\t\tmd.L1.Enums.List[enumIdx].unmarshalFull(v, sb)\n\t\t\t\tenumIdx++\n\t\t\tcase genid.DescriptorProto_NestedType_field_number:\n\t\t\t\tmd.L1.Messages.List[messageIdx].unmarshalFull(v, sb)\n\t\t\t\tmessageIdx++\n\t\t\tcase genid.DescriptorProto_Extension_field_number:\n\t\t\t\tmd.L1.Extensions.List[extensionIdx].unmarshalFull(v, sb)\n\t\t\t\textensionIdx++\n\t\t\tcase genid.DescriptorProto_Options_field_number:\n\t\t\t\tmd.unmarshalOptions(v)\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tif len(rawFields) > 0 || len(rawOneofs) > 0 {\n\t\tmd.L2.Fields.List = make([]Field, len(rawFields))\n\t\tmd.L2.Oneofs.List = make([]Oneof, len(rawOneofs))\n\t\tfor i, b := range rawFields {\n\t\t\tfd := &md.L2.Fields.List[i]\n\t\t\tfd.unmarshalFull(b, sb, md.L0.ParentFile, md, i)\n\t\t\tif fd.L1.Cardinality == pref.Required {\n\t\t\t\tmd.L2.RequiredNumbers.List = append(md.L2.RequiredNumbers.List, fd.L1.Number)\n\t\t\t}\n\t\t}\n\t\tfor i, b := range rawOneofs {\n\t\t\tod := &md.L2.Oneofs.List[i]\n\t\t\tod.unmarshalFull(b, sb, md.L0.ParentFile, md, i)\n\t\t}\n\t}\n\tmd.L2.Options = md.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Message, rawOptions)\n}\n\nfunc (md *Message) unmarshalOptions(b []byte) {\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.MessageOptions_MapEntry_field_number:\n\t\t\t\tmd.L1.IsMapEntry = protowire.DecodeBool(v)\n\t\t\tcase genid.MessageOptions_MessageSetWireFormat_field_number:\n\t\t\t\tmd.L1.IsMessageSet = protowire.DecodeBool(v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n\nfunc unmarshalMessageReservedRange(b []byte) (r [2]pref.FieldNumber) {\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.DescriptorProto_ReservedRange_Start_field_number:\n\t\t\t\tr[0] = pref.FieldNumber(v)\n\t\t\tcase genid.DescriptorProto_ReservedRange_End_field_number:\n\t\t\t\tr[1] = pref.FieldNumber(v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\treturn r\n}\n\nfunc unmarshalMessageExtensionRange(b []byte) (r [2]pref.FieldNumber, rawOptions []byte) {\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.DescriptorProto_ExtensionRange_Start_field_number:\n\t\t\t\tr[0] = pref.FieldNumber(v)\n\t\t\tcase genid.DescriptorProto_ExtensionRange_End_field_number:\n\t\t\t\tr[1] = pref.FieldNumber(v)\n\t\t\t}\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.DescriptorProto_ExtensionRange_Options_field_number:\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\treturn r, rawOptions\n}\n\nfunc (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\tfd.L0.ParentFile = pf\n\tfd.L0.Parent = pd\n\tfd.L0.Index = i\n\n\tvar rawTypeName []byte\n\tvar rawOptions []byte\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldDescriptorProto_Number_field_number:\n\t\t\t\tfd.L1.Number = pref.FieldNumber(v)\n\t\t\tcase genid.FieldDescriptorProto_Label_field_number:\n\t\t\t\tfd.L1.Cardinality = pref.Cardinality(v)\n\t\t\tcase genid.FieldDescriptorProto_Type_field_number:\n\t\t\t\tfd.L1.Kind = pref.Kind(v)\n\t\t\tcase genid.FieldDescriptorProto_OneofIndex_field_number:\n\t\t\t\t// In Message.unmarshalFull, we allocate slices for both\n\t\t\t\t// the field and oneof descriptors before unmarshaling either\n\t\t\t\t// of them. This ensures pointers to slice elements are stable.\n\t\t\t\tod := &pd.(*Message).L2.Oneofs.List[v]\n\t\t\t\tod.L1.Fields.List = append(od.L1.Fields.List, fd)\n\t\t\t\tif fd.L1.ContainingOneof != nil {\n\t\t\t\t\tpanic(\"oneof type already set\")\n\t\t\t\t}\n\t\t\t\tfd.L1.ContainingOneof = od\n\t\t\tcase genid.FieldDescriptorProto_Proto3Optional_field_number:\n\t\t\t\tfd.L1.IsProto3Optional = protowire.DecodeBool(v)\n\t\t\t}\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldDescriptorProto_Name_field_number:\n\t\t\t\tfd.L0.FullName = appendFullName(sb, pd.FullName(), v)\n\t\t\tcase genid.FieldDescriptorProto_JsonName_field_number:\n\t\t\t\tfd.L1.StringName.InitJSON(sb.MakeString(v))\n\t\t\tcase genid.FieldDescriptorProto_DefaultValue_field_number:\n\t\t\t\tfd.L1.Default.val = pref.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveMessages\n\t\t\tcase genid.FieldDescriptorProto_TypeName_field_number:\n\t\t\t\trawTypeName = v\n\t\t\tcase genid.FieldDescriptorProto_Options_field_number:\n\t\t\t\tfd.unmarshalOptions(v)\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tif rawTypeName != nil {\n\t\tname := makeFullName(sb, rawTypeName)\n\t\tswitch fd.L1.Kind {\n\t\tcase pref.EnumKind:\n\t\t\tfd.L1.Enum = PlaceholderEnum(name)\n\t\tcase pref.MessageKind, pref.GroupKind:\n\t\t\tfd.L1.Message = PlaceholderMessage(name)\n\t\t}\n\t}\n\tfd.L1.Options = pf.builder.optionsUnmarshaler(&descopts.Field, rawOptions)\n}\n\nfunc (fd *Field) unmarshalOptions(b []byte) {\n\tconst FieldOptions_EnforceUTF8 = 13\n\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldOptions_Packed_field_number:\n\t\t\t\tfd.L1.HasPacked = true\n\t\t\t\tfd.L1.IsPacked = protowire.DecodeBool(v)\n\t\t\tcase genid.FieldOptions_Weak_field_number:\n\t\t\t\tfd.L1.IsWeak = protowire.DecodeBool(v)\n\t\t\tcase FieldOptions_EnforceUTF8:\n\t\t\t\tfd.L1.HasEnforceUTF8 = true\n\t\t\t\tfd.L1.EnforceUTF8 = protowire.DecodeBool(v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n\nfunc (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\tod.L0.ParentFile = pf\n\tod.L0.Parent = pd\n\tod.L0.Index = i\n\n\tvar rawOptions []byte\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.OneofDescriptorProto_Name_field_number:\n\t\t\t\tod.L0.FullName = appendFullName(sb, pd.FullName(), v)\n\t\t\tcase genid.OneofDescriptorProto_Options_field_number:\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tod.L1.Options = pf.builder.optionsUnmarshaler(&descopts.Oneof, rawOptions)\n}\n\nfunc (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {\n\tvar rawTypeName []byte\n\tvar rawOptions []byte\n\txd.L2 = new(ExtensionL2)\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldDescriptorProto_Proto3Optional_field_number:\n\t\t\t\txd.L2.IsProto3Optional = protowire.DecodeBool(v)\n\t\t\t}\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldDescriptorProto_JsonName_field_number:\n\t\t\t\txd.L2.StringName.InitJSON(sb.MakeString(v))\n\t\t\tcase genid.FieldDescriptorProto_DefaultValue_field_number:\n\t\t\t\txd.L2.Default.val = pref.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveExtensions\n\t\t\tcase genid.FieldDescriptorProto_TypeName_field_number:\n\t\t\t\trawTypeName = v\n\t\t\tcase genid.FieldDescriptorProto_Options_field_number:\n\t\t\t\txd.unmarshalOptions(v)\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tif rawTypeName != nil {\n\t\tname := makeFullName(sb, rawTypeName)\n\t\tswitch xd.L1.Kind {\n\t\tcase pref.EnumKind:\n\t\t\txd.L2.Enum = PlaceholderEnum(name)\n\t\tcase pref.MessageKind, pref.GroupKind:\n\t\t\txd.L2.Message = PlaceholderMessage(name)\n\t\t}\n\t}\n\txd.L2.Options = xd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Field, rawOptions)\n}\n\nfunc (xd *Extension) unmarshalOptions(b []byte) {\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldOptions_Packed_field_number:\n\t\t\t\txd.L2.IsPacked = protowire.DecodeBool(v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n\nfunc (sd *Service) unmarshalFull(b []byte, sb *strs.Builder) {\n\tvar rawMethods [][]byte\n\tvar rawOptions []byte\n\tsd.L2 = new(ServiceL2)\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.ServiceDescriptorProto_Method_field_number:\n\t\t\t\trawMethods = append(rawMethods, v)\n\t\t\tcase genid.ServiceDescriptorProto_Options_field_number:\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tif len(rawMethods) > 0 {\n\t\tsd.L2.Methods.List = make([]Method, len(rawMethods))\n\t\tfor i, b := range rawMethods {\n\t\t\tsd.L2.Methods.List[i].unmarshalFull(b, sb, sd.L0.ParentFile, sd, i)\n\t\t}\n\t}\n\tsd.L2.Options = sd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Service, rawOptions)\n}\n\nfunc (md *Method) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\tmd.L0.ParentFile = pf\n\tmd.L0.Parent = pd\n\tmd.L0.Index = i\n\n\tvar rawOptions []byte\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.MethodDescriptorProto_ClientStreaming_field_number:\n\t\t\t\tmd.L1.IsStreamingClient = protowire.DecodeBool(v)\n\t\t\tcase genid.MethodDescriptorProto_ServerStreaming_field_number:\n\t\t\t\tmd.L1.IsStreamingServer = protowire.DecodeBool(v)\n\t\t\t}\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.MethodDescriptorProto_Name_field_number:\n\t\t\t\tmd.L0.FullName = appendFullName(sb, pd.FullName(), v)\n\t\t\tcase genid.MethodDescriptorProto_InputType_field_number:\n\t\t\t\tmd.L1.Input = PlaceholderMessage(makeFullName(sb, v))\n\t\t\tcase genid.MethodDescriptorProto_OutputType_field_number:\n\t\t\t\tmd.L1.Output = PlaceholderMessage(makeFullName(sb, v))\n\t\t\tcase genid.MethodDescriptorProto_Options_field_number:\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tmd.L1.Options = pf.builder.optionsUnmarshaler(&descopts.Method, rawOptions)\n}\n\n// appendOptions appends src to dst, where the returned slice is never nil.\n// This is necessary to distinguish between empty and unpopulated options.\nfunc appendOptions(dst, src []byte) []byte {\n\tif dst == nil {\n\t\tdst = []byte{}\n\t}\n\treturn append(dst, src...)\n}\n\n// optionsUnmarshaler constructs a lazy unmarshal function for an options message.\n//\n// The type of message to unmarshal to is passed as a pointer since the\n// vars in descopts may not yet be populated at the time this function is called.\nfunc (db *Builder) optionsUnmarshaler(p *pref.ProtoMessage, b []byte) func() pref.ProtoMessage {\n\tif b == nil {\n\t\treturn nil\n\t}\n\tvar opts pref.ProtoMessage\n\tvar once sync.Once\n\treturn func() pref.ProtoMessage {\n\t\tonce.Do(func() {\n\t\t\tif *p == nil {\n\t\t\t\tpanic(\"Descriptor.Options called without importing the descriptor package\")\n\t\t\t}\n\t\t\topts = reflect.New(reflect.TypeOf(*p).Elem()).Interface().(pref.ProtoMessage)\n\t\t\tif err := (proto.UnmarshalOptions{\n\t\t\t\tAllowPartial: true,\n\t\t\t\tResolver:     db.TypeResolver,\n\t\t\t}).Unmarshal(b, opts); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t})\n\t\treturn opts\n\t}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/filedesc/desc_list.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 filedesc\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\t\"sort\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/genid\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/descfmt\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype FileImports []pref.FileImport\n\nfunc (p *FileImports) Len() int                            { return len(*p) }\nfunc (p *FileImports) Get(i int) pref.FileImport           { return (*p)[i] }\nfunc (p *FileImports) Format(s fmt.State, r rune)          { descfmt.FormatList(s, r, p) }\nfunc (p *FileImports) ProtoInternal(pragma.DoNotImplement) {}\n\ntype Names struct {\n\tList []pref.Name\n\tonce sync.Once\n\thas  map[pref.Name]int // protected by once\n}\n\nfunc (p *Names) Len() int                            { return len(p.List) }\nfunc (p *Names) Get(i int) pref.Name                 { return p.List[i] }\nfunc (p *Names) Has(s pref.Name) bool                { return p.lazyInit().has[s] > 0 }\nfunc (p *Names) Format(s fmt.State, r rune)          { descfmt.FormatList(s, r, p) }\nfunc (p *Names) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Names) lazyInit() *Names {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.has = make(map[pref.Name]int, len(p.List))\n\t\t\tfor _, s := range p.List {\n\t\t\t\tp.has[s] = p.has[s] + 1\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\n// CheckValid reports any errors with the set of names with an error message\n// that completes the sentence: \"ranges is invalid because it has ...\"\nfunc (p *Names) CheckValid() error {\n\tfor s, n := range p.lazyInit().has {\n\t\tswitch {\n\t\tcase n > 1:\n\t\t\treturn errors.New(\"duplicate name: %q\", s)\n\t\tcase false && !s.IsValid():\n\t\t\t// NOTE: The C++ implementation does not validate the identifier.\n\t\t\t// See https://github.com/protocolbuffers/protobuf/issues/6335.\n\t\t\treturn errors.New(\"invalid name: %q\", s)\n\t\t}\n\t}\n\treturn nil\n}\n\ntype EnumRanges struct {\n\tList   [][2]pref.EnumNumber // start inclusive; end inclusive\n\tonce   sync.Once\n\tsorted [][2]pref.EnumNumber // protected by once\n}\n\nfunc (p *EnumRanges) Len() int                     { return len(p.List) }\nfunc (p *EnumRanges) Get(i int) [2]pref.EnumNumber { return p.List[i] }\nfunc (p *EnumRanges) Has(n pref.EnumNumber) bool {\n\tfor ls := p.lazyInit().sorted; len(ls) > 0; {\n\t\ti := len(ls) / 2\n\t\tswitch r := enumRange(ls[i]); {\n\t\tcase n < r.Start():\n\t\t\tls = ls[:i] // search lower\n\t\tcase n > r.End():\n\t\t\tls = ls[i+1:] // search upper\n\t\tdefault:\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\nfunc (p *EnumRanges) Format(s fmt.State, r rune)          { descfmt.FormatList(s, r, p) }\nfunc (p *EnumRanges) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *EnumRanges) lazyInit() *EnumRanges {\n\tp.once.Do(func() {\n\t\tp.sorted = append(p.sorted, p.List...)\n\t\tsort.Slice(p.sorted, func(i, j int) bool {\n\t\t\treturn p.sorted[i][0] < p.sorted[j][0]\n\t\t})\n\t})\n\treturn p\n}\n\n// CheckValid reports any errors with the set of names with an error message\n// that completes the sentence: \"ranges is invalid because it has ...\"\nfunc (p *EnumRanges) CheckValid() error {\n\tvar rp enumRange\n\tfor i, r := range p.lazyInit().sorted {\n\t\tr := enumRange(r)\n\t\tswitch {\n\t\tcase !(r.Start() <= r.End()):\n\t\t\treturn errors.New(\"invalid range: %v\", r)\n\t\tcase !(rp.End() < r.Start()) && i > 0:\n\t\t\treturn errors.New(\"overlapping ranges: %v with %v\", rp, r)\n\t\t}\n\t\trp = r\n\t}\n\treturn nil\n}\n\ntype enumRange [2]protoreflect.EnumNumber\n\nfunc (r enumRange) Start() protoreflect.EnumNumber { return r[0] } // inclusive\nfunc (r enumRange) End() protoreflect.EnumNumber   { return r[1] } // inclusive\nfunc (r enumRange) String() string {\n\tif r.Start() == r.End() {\n\t\treturn fmt.Sprintf(\"%d\", r.Start())\n\t}\n\treturn fmt.Sprintf(\"%d to %d\", r.Start(), r.End())\n}\n\ntype FieldRanges struct {\n\tList   [][2]pref.FieldNumber // start inclusive; end exclusive\n\tonce   sync.Once\n\tsorted [][2]pref.FieldNumber // protected by once\n}\n\nfunc (p *FieldRanges) Len() int                      { return len(p.List) }\nfunc (p *FieldRanges) Get(i int) [2]pref.FieldNumber { return p.List[i] }\nfunc (p *FieldRanges) Has(n pref.FieldNumber) bool {\n\tfor ls := p.lazyInit().sorted; len(ls) > 0; {\n\t\ti := len(ls) / 2\n\t\tswitch r := fieldRange(ls[i]); {\n\t\tcase n < r.Start():\n\t\t\tls = ls[:i] // search lower\n\t\tcase n > r.End():\n\t\t\tls = ls[i+1:] // search upper\n\t\tdefault:\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\nfunc (p *FieldRanges) Format(s fmt.State, r rune)          { descfmt.FormatList(s, r, p) }\nfunc (p *FieldRanges) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *FieldRanges) lazyInit() *FieldRanges {\n\tp.once.Do(func() {\n\t\tp.sorted = append(p.sorted, p.List...)\n\t\tsort.Slice(p.sorted, func(i, j int) bool {\n\t\t\treturn p.sorted[i][0] < p.sorted[j][0]\n\t\t})\n\t})\n\treturn p\n}\n\n// CheckValid reports any errors with the set of ranges with an error message\n// that completes the sentence: \"ranges is invalid because it has ...\"\nfunc (p *FieldRanges) CheckValid(isMessageSet bool) error {\n\tvar rp fieldRange\n\tfor i, r := range p.lazyInit().sorted {\n\t\tr := fieldRange(r)\n\t\tswitch {\n\t\tcase !isValidFieldNumber(r.Start(), isMessageSet):\n\t\t\treturn errors.New(\"invalid field number: %d\", r.Start())\n\t\tcase !isValidFieldNumber(r.End(), isMessageSet):\n\t\t\treturn errors.New(\"invalid field number: %d\", r.End())\n\t\tcase !(r.Start() <= r.End()):\n\t\t\treturn errors.New(\"invalid range: %v\", r)\n\t\tcase !(rp.End() < r.Start()) && i > 0:\n\t\t\treturn errors.New(\"overlapping ranges: %v with %v\", rp, r)\n\t\t}\n\t\trp = r\n\t}\n\treturn nil\n}\n\n// isValidFieldNumber reports whether the field number is valid.\n// Unlike the FieldNumber.IsValid method, it allows ranges that cover the\n// reserved number range.\nfunc isValidFieldNumber(n protoreflect.FieldNumber, isMessageSet bool) bool {\n\treturn protowire.MinValidNumber <= n && (n <= protowire.MaxValidNumber || isMessageSet)\n}\n\n// CheckOverlap reports an error if p and q overlap.\nfunc (p *FieldRanges) CheckOverlap(q *FieldRanges) error {\n\trps := p.lazyInit().sorted\n\trqs := q.lazyInit().sorted\n\tfor pi, qi := 0, 0; pi < len(rps) && qi < len(rqs); {\n\t\trp := fieldRange(rps[pi])\n\t\trq := fieldRange(rqs[qi])\n\t\tif !(rp.End() < rq.Start() || rq.End() < rp.Start()) {\n\t\t\treturn errors.New(\"overlapping ranges: %v with %v\", rp, rq)\n\t\t}\n\t\tif rp.Start() < rq.Start() {\n\t\t\tpi++\n\t\t} else {\n\t\t\tqi++\n\t\t}\n\t}\n\treturn nil\n}\n\ntype fieldRange [2]protoreflect.FieldNumber\n\nfunc (r fieldRange) Start() protoreflect.FieldNumber { return r[0] }     // inclusive\nfunc (r fieldRange) End() protoreflect.FieldNumber   { return r[1] - 1 } // inclusive\nfunc (r fieldRange) String() string {\n\tif r.Start() == r.End() {\n\t\treturn fmt.Sprintf(\"%d\", r.Start())\n\t}\n\treturn fmt.Sprintf(\"%d to %d\", r.Start(), r.End())\n}\n\ntype FieldNumbers struct {\n\tList []pref.FieldNumber\n\tonce sync.Once\n\thas  map[pref.FieldNumber]struct{} // protected by once\n}\n\nfunc (p *FieldNumbers) Len() int                   { return len(p.List) }\nfunc (p *FieldNumbers) Get(i int) pref.FieldNumber { return p.List[i] }\nfunc (p *FieldNumbers) Has(n pref.FieldNumber) bool {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.has = make(map[pref.FieldNumber]struct{}, len(p.List))\n\t\t\tfor _, n := range p.List {\n\t\t\t\tp.has[n] = struct{}{}\n\t\t\t}\n\t\t}\n\t})\n\t_, ok := p.has[n]\n\treturn ok\n}\nfunc (p *FieldNumbers) Format(s fmt.State, r rune)          { descfmt.FormatList(s, r, p) }\nfunc (p *FieldNumbers) ProtoInternal(pragma.DoNotImplement) {}\n\ntype OneofFields struct {\n\tList   []pref.FieldDescriptor\n\tonce   sync.Once\n\tbyName map[pref.Name]pref.FieldDescriptor        // protected by once\n\tbyJSON map[string]pref.FieldDescriptor           // protected by once\n\tbyText map[string]pref.FieldDescriptor           // protected by once\n\tbyNum  map[pref.FieldNumber]pref.FieldDescriptor // protected by once\n}\n\nfunc (p *OneofFields) Len() int                                         { return len(p.List) }\nfunc (p *OneofFields) Get(i int) pref.FieldDescriptor                   { return p.List[i] }\nfunc (p *OneofFields) ByName(s pref.Name) pref.FieldDescriptor          { return p.lazyInit().byName[s] }\nfunc (p *OneofFields) ByJSONName(s string) pref.FieldDescriptor         { return p.lazyInit().byJSON[s] }\nfunc (p *OneofFields) ByTextName(s string) pref.FieldDescriptor         { return p.lazyInit().byText[s] }\nfunc (p *OneofFields) ByNumber(n pref.FieldNumber) pref.FieldDescriptor { return p.lazyInit().byNum[n] }\nfunc (p *OneofFields) Format(s fmt.State, r rune)                       { descfmt.FormatList(s, r, p) }\nfunc (p *OneofFields) ProtoInternal(pragma.DoNotImplement)              {}\n\nfunc (p *OneofFields) lazyInit() *OneofFields {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[pref.Name]pref.FieldDescriptor, len(p.List))\n\t\t\tp.byJSON = make(map[string]pref.FieldDescriptor, len(p.List))\n\t\t\tp.byText = make(map[string]pref.FieldDescriptor, len(p.List))\n\t\t\tp.byNum = make(map[pref.FieldNumber]pref.FieldDescriptor, len(p.List))\n\t\t\tfor _, f := range p.List {\n\t\t\t\t// Field names and numbers are guaranteed to be unique.\n\t\t\t\tp.byName[f.Name()] = f\n\t\t\t\tp.byJSON[f.JSONName()] = f\n\t\t\t\tp.byText[f.TextName()] = f\n\t\t\t\tp.byNum[f.Number()] = f\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype SourceLocations struct {\n\t// List is a list of SourceLocations.\n\t// The SourceLocation.Next field does not need to be populated\n\t// as it will be lazily populated upon first need.\n\tList []pref.SourceLocation\n\n\t// File is the parent file descriptor that these locations are relative to.\n\t// If non-nil, ByDescriptor verifies that the provided descriptor\n\t// is a child of this file descriptor.\n\tFile pref.FileDescriptor\n\n\tonce   sync.Once\n\tbyPath map[pathKey]int\n}\n\nfunc (p *SourceLocations) Len() int                      { return len(p.List) }\nfunc (p *SourceLocations) Get(i int) pref.SourceLocation { return p.lazyInit().List[i] }\nfunc (p *SourceLocations) byKey(k pathKey) pref.SourceLocation {\n\tif i, ok := p.lazyInit().byPath[k]; ok {\n\t\treturn p.List[i]\n\t}\n\treturn pref.SourceLocation{}\n}\nfunc (p *SourceLocations) ByPath(path pref.SourcePath) pref.SourceLocation {\n\treturn p.byKey(newPathKey(path))\n}\nfunc (p *SourceLocations) ByDescriptor(desc pref.Descriptor) pref.SourceLocation {\n\tif p.File != nil && desc != nil && p.File != desc.ParentFile() {\n\t\treturn pref.SourceLocation{} // mismatching parent files\n\t}\n\tvar pathArr [16]int32\n\tpath := pathArr[:0]\n\tfor {\n\t\tswitch desc.(type) {\n\t\tcase pref.FileDescriptor:\n\t\t\t// Reverse the path since it was constructed in reverse.\n\t\t\tfor i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 {\n\t\t\t\tpath[i], path[j] = path[j], path[i]\n\t\t\t}\n\t\t\treturn p.byKey(newPathKey(path))\n\t\tcase pref.MessageDescriptor:\n\t\t\tpath = append(path, int32(desc.Index()))\n\t\t\tdesc = desc.Parent()\n\t\t\tswitch desc.(type) {\n\t\t\tcase pref.FileDescriptor:\n\t\t\t\tpath = append(path, int32(genid.FileDescriptorProto_MessageType_field_number))\n\t\t\tcase pref.MessageDescriptor:\n\t\t\t\tpath = append(path, int32(genid.DescriptorProto_NestedType_field_number))\n\t\t\tdefault:\n\t\t\t\treturn pref.SourceLocation{}\n\t\t\t}\n\t\tcase pref.FieldDescriptor:\n\t\t\tisExtension := desc.(pref.FieldDescriptor).IsExtension()\n\t\t\tpath = append(path, int32(desc.Index()))\n\t\t\tdesc = desc.Parent()\n\t\t\tif isExtension {\n\t\t\t\tswitch desc.(type) {\n\t\t\t\tcase pref.FileDescriptor:\n\t\t\t\t\tpath = append(path, int32(genid.FileDescriptorProto_Extension_field_number))\n\t\t\t\tcase pref.MessageDescriptor:\n\t\t\t\t\tpath = append(path, int32(genid.DescriptorProto_Extension_field_number))\n\t\t\t\tdefault:\n\t\t\t\t\treturn pref.SourceLocation{}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tswitch desc.(type) {\n\t\t\t\tcase pref.MessageDescriptor:\n\t\t\t\t\tpath = append(path, int32(genid.DescriptorProto_Field_field_number))\n\t\t\t\tdefault:\n\t\t\t\t\treturn pref.SourceLocation{}\n\t\t\t\t}\n\t\t\t}\n\t\tcase pref.OneofDescriptor:\n\t\t\tpath = append(path, int32(desc.Index()))\n\t\t\tdesc = desc.Parent()\n\t\t\tswitch desc.(type) {\n\t\t\tcase pref.MessageDescriptor:\n\t\t\t\tpath = append(path, int32(genid.DescriptorProto_OneofDecl_field_number))\n\t\t\tdefault:\n\t\t\t\treturn pref.SourceLocation{}\n\t\t\t}\n\t\tcase pref.EnumDescriptor:\n\t\t\tpath = append(path, int32(desc.Index()))\n\t\t\tdesc = desc.Parent()\n\t\t\tswitch desc.(type) {\n\t\t\tcase pref.FileDescriptor:\n\t\t\t\tpath = append(path, int32(genid.FileDescriptorProto_EnumType_field_number))\n\t\t\tcase pref.MessageDescriptor:\n\t\t\t\tpath = append(path, int32(genid.DescriptorProto_EnumType_field_number))\n\t\t\tdefault:\n\t\t\t\treturn pref.SourceLocation{}\n\t\t\t}\n\t\tcase pref.EnumValueDescriptor:\n\t\t\tpath = append(path, int32(desc.Index()))\n\t\t\tdesc = desc.Parent()\n\t\t\tswitch desc.(type) {\n\t\t\tcase pref.EnumDescriptor:\n\t\t\t\tpath = append(path, int32(genid.EnumDescriptorProto_Value_field_number))\n\t\t\tdefault:\n\t\t\t\treturn pref.SourceLocation{}\n\t\t\t}\n\t\tcase pref.ServiceDescriptor:\n\t\t\tpath = append(path, int32(desc.Index()))\n\t\t\tdesc = desc.Parent()\n\t\t\tswitch desc.(type) {\n\t\t\tcase pref.FileDescriptor:\n\t\t\t\tpath = append(path, int32(genid.FileDescriptorProto_Service_field_number))\n\t\t\tdefault:\n\t\t\t\treturn pref.SourceLocation{}\n\t\t\t}\n\t\tcase pref.MethodDescriptor:\n\t\t\tpath = append(path, int32(desc.Index()))\n\t\t\tdesc = desc.Parent()\n\t\t\tswitch desc.(type) {\n\t\t\tcase pref.ServiceDescriptor:\n\t\t\t\tpath = append(path, int32(genid.ServiceDescriptorProto_Method_field_number))\n\t\t\tdefault:\n\t\t\t\treturn pref.SourceLocation{}\n\t\t\t}\n\t\tdefault:\n\t\t\treturn pref.SourceLocation{}\n\t\t}\n\t}\n}\nfunc (p *SourceLocations) lazyInit() *SourceLocations {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\t// Collect all the indexes for a given path.\n\t\t\tpathIdxs := make(map[pathKey][]int, len(p.List))\n\t\t\tfor i, l := range p.List {\n\t\t\t\tk := newPathKey(l.Path)\n\t\t\t\tpathIdxs[k] = append(pathIdxs[k], i)\n\t\t\t}\n\n\t\t\t// Update the next index for all locations.\n\t\t\tp.byPath = make(map[pathKey]int, len(p.List))\n\t\t\tfor k, idxs := range pathIdxs {\n\t\t\t\tfor i := 0; i < len(idxs)-1; i++ {\n\t\t\t\t\tp.List[idxs[i]].Next = idxs[i+1]\n\t\t\t\t}\n\t\t\t\tp.List[idxs[len(idxs)-1]].Next = 0\n\t\t\t\tp.byPath[k] = idxs[0] // record the first location for this path\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\nfunc (p *SourceLocations) ProtoInternal(pragma.DoNotImplement) {}\n\n// pathKey is a comparable representation of protoreflect.SourcePath.\ntype pathKey struct {\n\tarr [16]uint8 // first n-1 path segments; last element is the length\n\tstr string    // used if the path does not fit in arr\n}\n\nfunc newPathKey(p pref.SourcePath) (k pathKey) {\n\tif len(p) < len(k.arr) {\n\t\tfor i, ps := range p {\n\t\t\tif ps < 0 || math.MaxUint8 <= ps {\n\t\t\t\treturn pathKey{str: p.String()}\n\t\t\t}\n\t\t\tk.arr[i] = uint8(ps)\n\t\t}\n\t\tk.arr[len(k.arr)-1] = uint8(len(p))\n\t\treturn k\n\t}\n\treturn pathKey{str: p.String()}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/filedesc/desc_list_gen.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// Code generated by generate-types. DO NOT EDIT.\n\npackage filedesc\n\nimport (\n\t\"fmt\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/descfmt\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype Enums struct {\n\tList   []Enum\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*Enum // protected by once\n}\n\nfunc (p *Enums) Len() int {\n\treturn len(p.List)\n}\nfunc (p *Enums) Get(i int) protoreflect.EnumDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *Enums) ByName(s protoreflect.Name) protoreflect.EnumDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Enums) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *Enums) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Enums) lazyInit() *Enums {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*Enum, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype EnumValues struct {\n\tList   []EnumValue\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*EnumValue       // protected by once\n\tbyNum  map[protoreflect.EnumNumber]*EnumValue // protected by once\n}\n\nfunc (p *EnumValues) Len() int {\n\treturn len(p.List)\n}\nfunc (p *EnumValues) Get(i int) protoreflect.EnumValueDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *EnumValues) ByName(s protoreflect.Name) protoreflect.EnumValueDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *EnumValues) ByNumber(n protoreflect.EnumNumber) protoreflect.EnumValueDescriptor {\n\tif d := p.lazyInit().byNum[n]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *EnumValues) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *EnumValues) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *EnumValues) lazyInit() *EnumValues {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*EnumValue, len(p.List))\n\t\t\tp.byNum = make(map[protoreflect.EnumNumber]*EnumValue, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t\tif _, ok := p.byNum[d.Number()]; !ok {\n\t\t\t\t\tp.byNum[d.Number()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype Messages struct {\n\tList   []Message\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*Message // protected by once\n}\n\nfunc (p *Messages) Len() int {\n\treturn len(p.List)\n}\nfunc (p *Messages) Get(i int) protoreflect.MessageDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *Messages) ByName(s protoreflect.Name) protoreflect.MessageDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Messages) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *Messages) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Messages) lazyInit() *Messages {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*Message, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype Fields struct {\n\tList   []Field\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*Field        // protected by once\n\tbyJSON map[string]*Field                   // protected by once\n\tbyText map[string]*Field                   // protected by once\n\tbyNum  map[protoreflect.FieldNumber]*Field // protected by once\n}\n\nfunc (p *Fields) Len() int {\n\treturn len(p.List)\n}\nfunc (p *Fields) Get(i int) protoreflect.FieldDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *Fields) ByName(s protoreflect.Name) protoreflect.FieldDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Fields) ByJSONName(s string) protoreflect.FieldDescriptor {\n\tif d := p.lazyInit().byJSON[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Fields) ByTextName(s string) protoreflect.FieldDescriptor {\n\tif d := p.lazyInit().byText[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Fields) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDescriptor {\n\tif d := p.lazyInit().byNum[n]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Fields) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *Fields) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Fields) lazyInit() *Fields {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*Field, len(p.List))\n\t\t\tp.byJSON = make(map[string]*Field, len(p.List))\n\t\t\tp.byText = make(map[string]*Field, len(p.List))\n\t\t\tp.byNum = make(map[protoreflect.FieldNumber]*Field, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t\tif _, ok := p.byJSON[d.JSONName()]; !ok {\n\t\t\t\t\tp.byJSON[d.JSONName()] = d\n\t\t\t\t}\n\t\t\t\tif _, ok := p.byText[d.TextName()]; !ok {\n\t\t\t\t\tp.byText[d.TextName()] = d\n\t\t\t\t}\n\t\t\t\tif _, ok := p.byNum[d.Number()]; !ok {\n\t\t\t\t\tp.byNum[d.Number()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype Oneofs struct {\n\tList   []Oneof\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*Oneof // protected by once\n}\n\nfunc (p *Oneofs) Len() int {\n\treturn len(p.List)\n}\nfunc (p *Oneofs) Get(i int) protoreflect.OneofDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *Oneofs) ByName(s protoreflect.Name) protoreflect.OneofDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Oneofs) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *Oneofs) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Oneofs) lazyInit() *Oneofs {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*Oneof, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype Extensions struct {\n\tList   []Extension\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*Extension // protected by once\n}\n\nfunc (p *Extensions) Len() int {\n\treturn len(p.List)\n}\nfunc (p *Extensions) Get(i int) protoreflect.ExtensionDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *Extensions) ByName(s protoreflect.Name) protoreflect.ExtensionDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Extensions) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *Extensions) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Extensions) lazyInit() *Extensions {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*Extension, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype Services struct {\n\tList   []Service\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*Service // protected by once\n}\n\nfunc (p *Services) Len() int {\n\treturn len(p.List)\n}\nfunc (p *Services) Get(i int) protoreflect.ServiceDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *Services) ByName(s protoreflect.Name) protoreflect.ServiceDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Services) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *Services) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Services) lazyInit() *Services {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*Service, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype Methods struct {\n\tList   []Method\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*Method // protected by once\n}\n\nfunc (p *Methods) Len() int {\n\treturn len(p.List)\n}\nfunc (p *Methods) Get(i int) protoreflect.MethodDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *Methods) ByName(s protoreflect.Name) protoreflect.MethodDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Methods) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *Methods) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Methods) lazyInit() *Methods {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*Method, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/filedesc/placeholder.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 filedesc\n\nimport (\n\t\"google.golang.org/protobuf/internal/descopts\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nvar (\n\temptyNames           = new(Names)\n\temptyEnumRanges      = new(EnumRanges)\n\temptyFieldRanges     = new(FieldRanges)\n\temptyFieldNumbers    = new(FieldNumbers)\n\temptySourceLocations = new(SourceLocations)\n\n\temptyFiles      = new(FileImports)\n\temptyMessages   = new(Messages)\n\temptyFields     = new(Fields)\n\temptyOneofs     = new(Oneofs)\n\temptyEnums      = new(Enums)\n\temptyEnumValues = new(EnumValues)\n\temptyExtensions = new(Extensions)\n\temptyServices   = new(Services)\n)\n\n// PlaceholderFile is a placeholder, representing only the file path.\ntype PlaceholderFile string\n\nfunc (f PlaceholderFile) ParentFile() pref.FileDescriptor       { return f }\nfunc (f PlaceholderFile) Parent() pref.Descriptor               { return nil }\nfunc (f PlaceholderFile) Index() int                            { return 0 }\nfunc (f PlaceholderFile) Syntax() pref.Syntax                   { return 0 }\nfunc (f PlaceholderFile) Name() pref.Name                       { return \"\" }\nfunc (f PlaceholderFile) FullName() pref.FullName               { return \"\" }\nfunc (f PlaceholderFile) IsPlaceholder() bool                   { return true }\nfunc (f PlaceholderFile) Options() pref.ProtoMessage            { return descopts.File }\nfunc (f PlaceholderFile) Path() string                          { return string(f) }\nfunc (f PlaceholderFile) Package() pref.FullName                { return \"\" }\nfunc (f PlaceholderFile) Imports() pref.FileImports             { return emptyFiles }\nfunc (f PlaceholderFile) Messages() pref.MessageDescriptors     { return emptyMessages }\nfunc (f PlaceholderFile) Enums() pref.EnumDescriptors           { return emptyEnums }\nfunc (f PlaceholderFile) Extensions() pref.ExtensionDescriptors { return emptyExtensions }\nfunc (f PlaceholderFile) Services() pref.ServiceDescriptors     { return emptyServices }\nfunc (f PlaceholderFile) SourceLocations() pref.SourceLocations { return emptySourceLocations }\nfunc (f PlaceholderFile) ProtoType(pref.FileDescriptor)         { return }\nfunc (f PlaceholderFile) ProtoInternal(pragma.DoNotImplement)   { return }\n\n// PlaceholderEnum is a placeholder, representing only the full name.\ntype PlaceholderEnum pref.FullName\n\nfunc (e PlaceholderEnum) ParentFile() pref.FileDescriptor     { return nil }\nfunc (e PlaceholderEnum) Parent() pref.Descriptor             { return nil }\nfunc (e PlaceholderEnum) Index() int                          { return 0 }\nfunc (e PlaceholderEnum) Syntax() pref.Syntax                 { return 0 }\nfunc (e PlaceholderEnum) Name() pref.Name                     { return pref.FullName(e).Name() }\nfunc (e PlaceholderEnum) FullName() pref.FullName             { return pref.FullName(e) }\nfunc (e PlaceholderEnum) IsPlaceholder() bool                 { return true }\nfunc (e PlaceholderEnum) Options() pref.ProtoMessage          { return descopts.Enum }\nfunc (e PlaceholderEnum) Values() pref.EnumValueDescriptors   { return emptyEnumValues }\nfunc (e PlaceholderEnum) ReservedNames() pref.Names           { return emptyNames }\nfunc (e PlaceholderEnum) ReservedRanges() pref.EnumRanges     { return emptyEnumRanges }\nfunc (e PlaceholderEnum) ProtoType(pref.EnumDescriptor)       { return }\nfunc (e PlaceholderEnum) ProtoInternal(pragma.DoNotImplement) { return }\n\n// PlaceholderEnumValue is a placeholder, representing only the full name.\ntype PlaceholderEnumValue pref.FullName\n\nfunc (e PlaceholderEnumValue) ParentFile() pref.FileDescriptor     { return nil }\nfunc (e PlaceholderEnumValue) Parent() pref.Descriptor             { return nil }\nfunc (e PlaceholderEnumValue) Index() int                          { return 0 }\nfunc (e PlaceholderEnumValue) Syntax() pref.Syntax                 { return 0 }\nfunc (e PlaceholderEnumValue) Name() pref.Name                     { return pref.FullName(e).Name() }\nfunc (e PlaceholderEnumValue) FullName() pref.FullName             { return pref.FullName(e) }\nfunc (e PlaceholderEnumValue) IsPlaceholder() bool                 { return true }\nfunc (e PlaceholderEnumValue) Options() pref.ProtoMessage          { return descopts.EnumValue }\nfunc (e PlaceholderEnumValue) Number() pref.EnumNumber             { return 0 }\nfunc (e PlaceholderEnumValue) ProtoType(pref.EnumValueDescriptor)  { return }\nfunc (e PlaceholderEnumValue) ProtoInternal(pragma.DoNotImplement) { return }\n\n// PlaceholderMessage is a placeholder, representing only the full name.\ntype PlaceholderMessage pref.FullName\n\nfunc (m PlaceholderMessage) ParentFile() pref.FileDescriptor             { return nil }\nfunc (m PlaceholderMessage) Parent() pref.Descriptor                     { return nil }\nfunc (m PlaceholderMessage) Index() int                                  { return 0 }\nfunc (m PlaceholderMessage) Syntax() pref.Syntax                         { return 0 }\nfunc (m PlaceholderMessage) Name() pref.Name                             { return pref.FullName(m).Name() }\nfunc (m PlaceholderMessage) FullName() pref.FullName                     { return pref.FullName(m) }\nfunc (m PlaceholderMessage) IsPlaceholder() bool                         { return true }\nfunc (m PlaceholderMessage) Options() pref.ProtoMessage                  { return descopts.Message }\nfunc (m PlaceholderMessage) IsMapEntry() bool                            { return false }\nfunc (m PlaceholderMessage) Fields() pref.FieldDescriptors               { return emptyFields }\nfunc (m PlaceholderMessage) Oneofs() pref.OneofDescriptors               { return emptyOneofs }\nfunc (m PlaceholderMessage) ReservedNames() pref.Names                   { return emptyNames }\nfunc (m PlaceholderMessage) ReservedRanges() pref.FieldRanges            { return emptyFieldRanges }\nfunc (m PlaceholderMessage) RequiredNumbers() pref.FieldNumbers          { return emptyFieldNumbers }\nfunc (m PlaceholderMessage) ExtensionRanges() pref.FieldRanges           { return emptyFieldRanges }\nfunc (m PlaceholderMessage) ExtensionRangeOptions(int) pref.ProtoMessage { panic(\"index out of range\") }\nfunc (m PlaceholderMessage) Messages() pref.MessageDescriptors           { return emptyMessages }\nfunc (m PlaceholderMessage) Enums() pref.EnumDescriptors                 { return emptyEnums }\nfunc (m PlaceholderMessage) Extensions() pref.ExtensionDescriptors       { return emptyExtensions }\nfunc (m PlaceholderMessage) ProtoType(pref.MessageDescriptor)            { return }\nfunc (m PlaceholderMessage) ProtoInternal(pragma.DoNotImplement)         { return }\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/filetype/build.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 filetype provides functionality for wrapping descriptors\n// with Go type information.\npackage filetype\n\nimport (\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/internal/descopts\"\n\tfdesc \"google.golang.org/protobuf/internal/filedesc\"\n\tpimpl \"google.golang.org/protobuf/internal/impl\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// Builder constructs type descriptors from a raw file descriptor\n// and associated Go types for each enum and message declaration.\n//\n//\n// Flattened Ordering\n//\n// The protobuf type system represents declarations as a tree. Certain nodes in\n// the tree require us to either associate it with a concrete Go type or to\n// resolve a dependency, which is information that must be provided separately\n// since it cannot be derived from the file descriptor alone.\n//\n// However, representing a tree as Go literals is difficult to simply do in a\n// space and time efficient way. Thus, we store them as a flattened list of\n// objects where the serialization order from the tree-based form is important.\n//\n// The \"flattened ordering\" is defined as a tree traversal of all enum, message,\n// extension, and service declarations using the following algorithm:\n//\n//\tdef VisitFileDecls(fd):\n//\t\tfor e in fd.Enums:      yield e\n//\t\tfor m in fd.Messages:   yield m\n//\t\tfor x in fd.Extensions: yield x\n//\t\tfor s in fd.Services:   yield s\n//\t\tfor m in fd.Messages:   yield from VisitMessageDecls(m)\n//\n//\tdef VisitMessageDecls(md):\n//\t\tfor e in md.Enums:      yield e\n//\t\tfor m in md.Messages:   yield m\n//\t\tfor x in md.Extensions: yield x\n//\t\tfor m in md.Messages:   yield from VisitMessageDecls(m)\n//\n// The traversal starts at the root file descriptor and yields each direct\n// declaration within each node before traversing into sub-declarations\n// that children themselves may have.\ntype Builder struct {\n\t// File is the underlying file descriptor builder.\n\tFile fdesc.Builder\n\n\t// GoTypes is a unique set of the Go types for all declarations and\n\t// dependencies. Each type is represented as a zero value of the Go type.\n\t//\n\t// Declarations are Go types generated for enums and messages directly\n\t// declared (not publicly imported) in the proto source file.\n\t// Messages for map entries are accounted for, but represented by nil.\n\t// Enum declarations in \"flattened ordering\" come first, followed by\n\t// message declarations in \"flattened ordering\".\n\t//\n\t// Dependencies are Go types for enums or messages referenced by\n\t// message fields (excluding weak fields), for parent extended messages of\n\t// extension fields, for enums or messages referenced by extension fields,\n\t// and for input and output messages referenced by service methods.\n\t// Dependencies must come after declarations, but the ordering of\n\t// dependencies themselves is unspecified.\n\tGoTypes []interface{}\n\n\t// DependencyIndexes is an ordered list of indexes into GoTypes for the\n\t// dependencies of messages, extensions, or services.\n\t//\n\t// There are 5 sub-lists in \"flattened ordering\" concatenated back-to-back:\n\t//\t0. Message field dependencies: list of the enum or message type\n\t//\treferred to by every message field.\n\t//\t1. Extension field targets: list of the extended parent message of\n\t//\tevery extension.\n\t//\t2. Extension field dependencies: list of the enum or message type\n\t//\treferred to by every extension field.\n\t//\t3. Service method inputs: list of the input message type\n\t//\treferred to by every service method.\n\t//\t4. Service method outputs: list of the output message type\n\t//\treferred to by every service method.\n\t//\n\t// The offset into DependencyIndexes for the start of each sub-list\n\t// is appended to the end in reverse order.\n\tDependencyIndexes []int32\n\n\t// EnumInfos is a list of enum infos in \"flattened ordering\".\n\tEnumInfos []pimpl.EnumInfo\n\n\t// MessageInfos is a list of message infos in \"flattened ordering\".\n\t// If provided, the GoType and PBType for each element is populated.\n\t//\n\t// Requirement: len(MessageInfos) == len(Build.Messages)\n\tMessageInfos []pimpl.MessageInfo\n\n\t// ExtensionInfos is a list of extension infos in \"flattened ordering\".\n\t// Each element is initialized and registered with the protoregistry package.\n\t//\n\t// Requirement: len(LegacyExtensions) == len(Build.Extensions)\n\tExtensionInfos []pimpl.ExtensionInfo\n\n\t// TypeRegistry is the registry to register each type descriptor.\n\t// If nil, it uses protoregistry.GlobalTypes.\n\tTypeRegistry interface {\n\t\tRegisterMessage(pref.MessageType) error\n\t\tRegisterEnum(pref.EnumType) error\n\t\tRegisterExtension(pref.ExtensionType) error\n\t}\n}\n\n// Out is the output of the builder.\ntype Out struct {\n\tFile pref.FileDescriptor\n}\n\nfunc (tb Builder) Build() (out Out) {\n\t// Replace the resolver with one that resolves dependencies by index,\n\t// which is faster and more reliable than relying on the global registry.\n\tif tb.File.FileRegistry == nil {\n\t\ttb.File.FileRegistry = preg.GlobalFiles\n\t}\n\ttb.File.FileRegistry = &resolverByIndex{\n\t\tgoTypes:      tb.GoTypes,\n\t\tdepIdxs:      tb.DependencyIndexes,\n\t\tfileRegistry: tb.File.FileRegistry,\n\t}\n\n\t// Initialize registry if unpopulated.\n\tif tb.TypeRegistry == nil {\n\t\ttb.TypeRegistry = preg.GlobalTypes\n\t}\n\n\tfbOut := tb.File.Build()\n\tout.File = fbOut.File\n\n\t// Process enums.\n\tenumGoTypes := tb.GoTypes[:len(fbOut.Enums)]\n\tif len(tb.EnumInfos) != len(fbOut.Enums) {\n\t\tpanic(\"mismatching enum lengths\")\n\t}\n\tif len(fbOut.Enums) > 0 {\n\t\tfor i := range fbOut.Enums {\n\t\t\ttb.EnumInfos[i] = pimpl.EnumInfo{\n\t\t\t\tGoReflectType: reflect.TypeOf(enumGoTypes[i]),\n\t\t\t\tDesc:          &fbOut.Enums[i],\n\t\t\t}\n\t\t\t// Register enum types.\n\t\t\tif err := tb.TypeRegistry.RegisterEnum(&tb.EnumInfos[i]); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Process messages.\n\tmessageGoTypes := tb.GoTypes[len(fbOut.Enums):][:len(fbOut.Messages)]\n\tif len(tb.MessageInfos) != len(fbOut.Messages) {\n\t\tpanic(\"mismatching message lengths\")\n\t}\n\tif len(fbOut.Messages) > 0 {\n\t\tfor i := range fbOut.Messages {\n\t\t\tif messageGoTypes[i] == nil {\n\t\t\t\tcontinue // skip map entry\n\t\t\t}\n\n\t\t\ttb.MessageInfos[i].GoReflectType = reflect.TypeOf(messageGoTypes[i])\n\t\t\ttb.MessageInfos[i].Desc = &fbOut.Messages[i]\n\n\t\t\t// Register message types.\n\t\t\tif err := tb.TypeRegistry.RegisterMessage(&tb.MessageInfos[i]); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\n\t\t// As a special-case for descriptor.proto,\n\t\t// locally register concrete message type for the options.\n\t\tif out.File.Path() == \"google/protobuf/descriptor.proto\" && out.File.Package() == \"google.protobuf\" {\n\t\t\tfor i := range fbOut.Messages {\n\t\t\t\tswitch fbOut.Messages[i].Name() {\n\t\t\t\tcase \"FileOptions\":\n\t\t\t\t\tdescopts.File = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"EnumOptions\":\n\t\t\t\t\tdescopts.Enum = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"EnumValueOptions\":\n\t\t\t\t\tdescopts.EnumValue = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"MessageOptions\":\n\t\t\t\t\tdescopts.Message = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"FieldOptions\":\n\t\t\t\t\tdescopts.Field = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"OneofOptions\":\n\t\t\t\t\tdescopts.Oneof = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"ExtensionRangeOptions\":\n\t\t\t\t\tdescopts.ExtensionRange = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"ServiceOptions\":\n\t\t\t\t\tdescopts.Service = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"MethodOptions\":\n\t\t\t\t\tdescopts.Method = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Process extensions.\n\tif len(tb.ExtensionInfos) != len(fbOut.Extensions) {\n\t\tpanic(\"mismatching extension lengths\")\n\t}\n\tvar depIdx int32\n\tfor i := range fbOut.Extensions {\n\t\t// For enum and message kinds, determine the referent Go type so\n\t\t// that we can construct their constructors.\n\t\tconst listExtDeps = 2\n\t\tvar goType reflect.Type\n\t\tswitch fbOut.Extensions[i].L1.Kind {\n\t\tcase pref.EnumKind:\n\t\t\tj := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)\n\t\t\tgoType = reflect.TypeOf(tb.GoTypes[j])\n\t\t\tdepIdx++\n\t\tcase pref.MessageKind, pref.GroupKind:\n\t\t\tj := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)\n\t\t\tgoType = reflect.TypeOf(tb.GoTypes[j])\n\t\t\tdepIdx++\n\t\tdefault:\n\t\t\tgoType = goTypeForPBKind[fbOut.Extensions[i].L1.Kind]\n\t\t}\n\t\tif fbOut.Extensions[i].IsList() {\n\t\t\tgoType = reflect.SliceOf(goType)\n\t\t}\n\n\t\tpimpl.InitExtensionInfo(&tb.ExtensionInfos[i], &fbOut.Extensions[i], goType)\n\n\t\t// Register extension types.\n\t\tif err := tb.TypeRegistry.RegisterExtension(&tb.ExtensionInfos[i]); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\treturn out\n}\n\nvar goTypeForPBKind = map[pref.Kind]reflect.Type{\n\tpref.BoolKind:     reflect.TypeOf(bool(false)),\n\tpref.Int32Kind:    reflect.TypeOf(int32(0)),\n\tpref.Sint32Kind:   reflect.TypeOf(int32(0)),\n\tpref.Sfixed32Kind: reflect.TypeOf(int32(0)),\n\tpref.Int64Kind:    reflect.TypeOf(int64(0)),\n\tpref.Sint64Kind:   reflect.TypeOf(int64(0)),\n\tpref.Sfixed64Kind: reflect.TypeOf(int64(0)),\n\tpref.Uint32Kind:   reflect.TypeOf(uint32(0)),\n\tpref.Fixed32Kind:  reflect.TypeOf(uint32(0)),\n\tpref.Uint64Kind:   reflect.TypeOf(uint64(0)),\n\tpref.Fixed64Kind:  reflect.TypeOf(uint64(0)),\n\tpref.FloatKind:    reflect.TypeOf(float32(0)),\n\tpref.DoubleKind:   reflect.TypeOf(float64(0)),\n\tpref.StringKind:   reflect.TypeOf(string(\"\")),\n\tpref.BytesKind:    reflect.TypeOf([]byte(nil)),\n}\n\ntype depIdxs []int32\n\n// Get retrieves the jth element of the ith sub-list.\nfunc (x depIdxs) Get(i, j int32) int32 {\n\treturn x[x[int32(len(x))-i-1]+j]\n}\n\ntype (\n\tresolverByIndex struct {\n\t\tgoTypes []interface{}\n\t\tdepIdxs depIdxs\n\t\tfileRegistry\n\t}\n\tfileRegistry interface {\n\t\tFindFileByPath(string) (pref.FileDescriptor, error)\n\t\tFindDescriptorByName(pref.FullName) (pref.Descriptor, error)\n\t\tRegisterFile(pref.FileDescriptor) error\n\t}\n)\n\nfunc (r *resolverByIndex) FindEnumByIndex(i, j int32, es []fdesc.Enum, ms []fdesc.Message) pref.EnumDescriptor {\n\tif depIdx := int(r.depIdxs.Get(i, j)); int(depIdx) < len(es)+len(ms) {\n\t\treturn &es[depIdx]\n\t} else {\n\t\treturn pimpl.Export{}.EnumDescriptorOf(r.goTypes[depIdx])\n\t}\n}\n\nfunc (r *resolverByIndex) FindMessageByIndex(i, j int32, es []fdesc.Enum, ms []fdesc.Message) pref.MessageDescriptor {\n\tif depIdx := int(r.depIdxs.Get(i, j)); depIdx < len(es)+len(ms) {\n\t\treturn &ms[depIdx-len(es)]\n\t} else {\n\t\treturn pimpl.Export{}.MessageDescriptorOf(r.goTypes[depIdx])\n\t}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/flags/flags.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 flags provides a set of flags controlled by build tags.\npackage flags\n\n// ProtoLegacy specifies whether to enable support for legacy functionality\n// such as MessageSets, weak fields, and various other obscure behavior\n// that is necessary to maintain backwards compatibility with proto1 or\n// the pre-release variants of proto2 and proto3.\n//\n// This is disabled by default unless built with the \"protolegacy\" tag.\n//\n// WARNING: The compatibility agreement covers nothing provided by this flag.\n// As such, functionality may suddenly be removed or changed at our discretion.\nconst ProtoLegacy = protoLegacy\n\n// LazyUnmarshalExtensions specifies whether to lazily unmarshal extensions.\n//\n// Lazy extension unmarshaling validates the contents of message-valued\n// extension fields at unmarshal time, but defers creating the message\n// structure until the extension is first accessed.\nconst LazyUnmarshalExtensions = ProtoLegacy\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/flags/proto_legacy_disable.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// +build !protolegacy\n\npackage flags\n\nconst protoLegacy = false\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/flags/proto_legacy_enable.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// +build protolegacy\n\npackage flags\n\nconst protoLegacy = true\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/any_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_any_proto = \"google/protobuf/any.proto\"\n\n// Names for google.protobuf.Any.\nconst (\n\tAny_message_name     protoreflect.Name     = \"Any\"\n\tAny_message_fullname protoreflect.FullName = \"google.protobuf.Any\"\n)\n\n// Field names for google.protobuf.Any.\nconst (\n\tAny_TypeUrl_field_name protoreflect.Name = \"type_url\"\n\tAny_Value_field_name   protoreflect.Name = \"value\"\n\n\tAny_TypeUrl_field_fullname protoreflect.FullName = \"google.protobuf.Any.type_url\"\n\tAny_Value_field_fullname   protoreflect.FullName = \"google.protobuf.Any.value\"\n)\n\n// Field numbers for google.protobuf.Any.\nconst (\n\tAny_TypeUrl_field_number protoreflect.FieldNumber = 1\n\tAny_Value_field_number   protoreflect.FieldNumber = 2\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/api_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_api_proto = \"google/protobuf/api.proto\"\n\n// Names for google.protobuf.Api.\nconst (\n\tApi_message_name     protoreflect.Name     = \"Api\"\n\tApi_message_fullname protoreflect.FullName = \"google.protobuf.Api\"\n)\n\n// Field names for google.protobuf.Api.\nconst (\n\tApi_Name_field_name          protoreflect.Name = \"name\"\n\tApi_Methods_field_name       protoreflect.Name = \"methods\"\n\tApi_Options_field_name       protoreflect.Name = \"options\"\n\tApi_Version_field_name       protoreflect.Name = \"version\"\n\tApi_SourceContext_field_name protoreflect.Name = \"source_context\"\n\tApi_Mixins_field_name        protoreflect.Name = \"mixins\"\n\tApi_Syntax_field_name        protoreflect.Name = \"syntax\"\n\n\tApi_Name_field_fullname          protoreflect.FullName = \"google.protobuf.Api.name\"\n\tApi_Methods_field_fullname       protoreflect.FullName = \"google.protobuf.Api.methods\"\n\tApi_Options_field_fullname       protoreflect.FullName = \"google.protobuf.Api.options\"\n\tApi_Version_field_fullname       protoreflect.FullName = \"google.protobuf.Api.version\"\n\tApi_SourceContext_field_fullname protoreflect.FullName = \"google.protobuf.Api.source_context\"\n\tApi_Mixins_field_fullname        protoreflect.FullName = \"google.protobuf.Api.mixins\"\n\tApi_Syntax_field_fullname        protoreflect.FullName = \"google.protobuf.Api.syntax\"\n)\n\n// Field numbers for google.protobuf.Api.\nconst (\n\tApi_Name_field_number          protoreflect.FieldNumber = 1\n\tApi_Methods_field_number       protoreflect.FieldNumber = 2\n\tApi_Options_field_number       protoreflect.FieldNumber = 3\n\tApi_Version_field_number       protoreflect.FieldNumber = 4\n\tApi_SourceContext_field_number protoreflect.FieldNumber = 5\n\tApi_Mixins_field_number        protoreflect.FieldNumber = 6\n\tApi_Syntax_field_number        protoreflect.FieldNumber = 7\n)\n\n// Names for google.protobuf.Method.\nconst (\n\tMethod_message_name     protoreflect.Name     = \"Method\"\n\tMethod_message_fullname protoreflect.FullName = \"google.protobuf.Method\"\n)\n\n// Field names for google.protobuf.Method.\nconst (\n\tMethod_Name_field_name              protoreflect.Name = \"name\"\n\tMethod_RequestTypeUrl_field_name    protoreflect.Name = \"request_type_url\"\n\tMethod_RequestStreaming_field_name  protoreflect.Name = \"request_streaming\"\n\tMethod_ResponseTypeUrl_field_name   protoreflect.Name = \"response_type_url\"\n\tMethod_ResponseStreaming_field_name protoreflect.Name = \"response_streaming\"\n\tMethod_Options_field_name           protoreflect.Name = \"options\"\n\tMethod_Syntax_field_name            protoreflect.Name = \"syntax\"\n\n\tMethod_Name_field_fullname              protoreflect.FullName = \"google.protobuf.Method.name\"\n\tMethod_RequestTypeUrl_field_fullname    protoreflect.FullName = \"google.protobuf.Method.request_type_url\"\n\tMethod_RequestStreaming_field_fullname  protoreflect.FullName = \"google.protobuf.Method.request_streaming\"\n\tMethod_ResponseTypeUrl_field_fullname   protoreflect.FullName = \"google.protobuf.Method.response_type_url\"\n\tMethod_ResponseStreaming_field_fullname protoreflect.FullName = \"google.protobuf.Method.response_streaming\"\n\tMethod_Options_field_fullname           protoreflect.FullName = \"google.protobuf.Method.options\"\n\tMethod_Syntax_field_fullname            protoreflect.FullName = \"google.protobuf.Method.syntax\"\n)\n\n// Field numbers for google.protobuf.Method.\nconst (\n\tMethod_Name_field_number              protoreflect.FieldNumber = 1\n\tMethod_RequestTypeUrl_field_number    protoreflect.FieldNumber = 2\n\tMethod_RequestStreaming_field_number  protoreflect.FieldNumber = 3\n\tMethod_ResponseTypeUrl_field_number   protoreflect.FieldNumber = 4\n\tMethod_ResponseStreaming_field_number protoreflect.FieldNumber = 5\n\tMethod_Options_field_number           protoreflect.FieldNumber = 6\n\tMethod_Syntax_field_number            protoreflect.FieldNumber = 7\n)\n\n// Names for google.protobuf.Mixin.\nconst (\n\tMixin_message_name     protoreflect.Name     = \"Mixin\"\n\tMixin_message_fullname protoreflect.FullName = \"google.protobuf.Mixin\"\n)\n\n// Field names for google.protobuf.Mixin.\nconst (\n\tMixin_Name_field_name protoreflect.Name = \"name\"\n\tMixin_Root_field_name protoreflect.Name = \"root\"\n\n\tMixin_Name_field_fullname protoreflect.FullName = \"google.protobuf.Mixin.name\"\n\tMixin_Root_field_fullname protoreflect.FullName = \"google.protobuf.Mixin.root\"\n)\n\n// Field numbers for google.protobuf.Mixin.\nconst (\n\tMixin_Name_field_number protoreflect.FieldNumber = 1\n\tMixin_Root_field_number protoreflect.FieldNumber = 2\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/descriptor_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_descriptor_proto = \"google/protobuf/descriptor.proto\"\n\n// Names for google.protobuf.FileDescriptorSet.\nconst (\n\tFileDescriptorSet_message_name     protoreflect.Name     = \"FileDescriptorSet\"\n\tFileDescriptorSet_message_fullname protoreflect.FullName = \"google.protobuf.FileDescriptorSet\"\n)\n\n// Field names for google.protobuf.FileDescriptorSet.\nconst (\n\tFileDescriptorSet_File_field_name protoreflect.Name = \"file\"\n\n\tFileDescriptorSet_File_field_fullname protoreflect.FullName = \"google.protobuf.FileDescriptorSet.file\"\n)\n\n// Field numbers for google.protobuf.FileDescriptorSet.\nconst (\n\tFileDescriptorSet_File_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.FileDescriptorProto.\nconst (\n\tFileDescriptorProto_message_name     protoreflect.Name     = \"FileDescriptorProto\"\n\tFileDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.FileDescriptorProto\"\n)\n\n// Field names for google.protobuf.FileDescriptorProto.\nconst (\n\tFileDescriptorProto_Name_field_name             protoreflect.Name = \"name\"\n\tFileDescriptorProto_Package_field_name          protoreflect.Name = \"package\"\n\tFileDescriptorProto_Dependency_field_name       protoreflect.Name = \"dependency\"\n\tFileDescriptorProto_PublicDependency_field_name protoreflect.Name = \"public_dependency\"\n\tFileDescriptorProto_WeakDependency_field_name   protoreflect.Name = \"weak_dependency\"\n\tFileDescriptorProto_MessageType_field_name      protoreflect.Name = \"message_type\"\n\tFileDescriptorProto_EnumType_field_name         protoreflect.Name = \"enum_type\"\n\tFileDescriptorProto_Service_field_name          protoreflect.Name = \"service\"\n\tFileDescriptorProto_Extension_field_name        protoreflect.Name = \"extension\"\n\tFileDescriptorProto_Options_field_name          protoreflect.Name = \"options\"\n\tFileDescriptorProto_SourceCodeInfo_field_name   protoreflect.Name = \"source_code_info\"\n\tFileDescriptorProto_Syntax_field_name           protoreflect.Name = \"syntax\"\n\n\tFileDescriptorProto_Name_field_fullname             protoreflect.FullName = \"google.protobuf.FileDescriptorProto.name\"\n\tFileDescriptorProto_Package_field_fullname          protoreflect.FullName = \"google.protobuf.FileDescriptorProto.package\"\n\tFileDescriptorProto_Dependency_field_fullname       protoreflect.FullName = \"google.protobuf.FileDescriptorProto.dependency\"\n\tFileDescriptorProto_PublicDependency_field_fullname protoreflect.FullName = \"google.protobuf.FileDescriptorProto.public_dependency\"\n\tFileDescriptorProto_WeakDependency_field_fullname   protoreflect.FullName = \"google.protobuf.FileDescriptorProto.weak_dependency\"\n\tFileDescriptorProto_MessageType_field_fullname      protoreflect.FullName = \"google.protobuf.FileDescriptorProto.message_type\"\n\tFileDescriptorProto_EnumType_field_fullname         protoreflect.FullName = \"google.protobuf.FileDescriptorProto.enum_type\"\n\tFileDescriptorProto_Service_field_fullname          protoreflect.FullName = \"google.protobuf.FileDescriptorProto.service\"\n\tFileDescriptorProto_Extension_field_fullname        protoreflect.FullName = \"google.protobuf.FileDescriptorProto.extension\"\n\tFileDescriptorProto_Options_field_fullname          protoreflect.FullName = \"google.protobuf.FileDescriptorProto.options\"\n\tFileDescriptorProto_SourceCodeInfo_field_fullname   protoreflect.FullName = \"google.protobuf.FileDescriptorProto.source_code_info\"\n\tFileDescriptorProto_Syntax_field_fullname           protoreflect.FullName = \"google.protobuf.FileDescriptorProto.syntax\"\n)\n\n// Field numbers for google.protobuf.FileDescriptorProto.\nconst (\n\tFileDescriptorProto_Name_field_number             protoreflect.FieldNumber = 1\n\tFileDescriptorProto_Package_field_number          protoreflect.FieldNumber = 2\n\tFileDescriptorProto_Dependency_field_number       protoreflect.FieldNumber = 3\n\tFileDescriptorProto_PublicDependency_field_number protoreflect.FieldNumber = 10\n\tFileDescriptorProto_WeakDependency_field_number   protoreflect.FieldNumber = 11\n\tFileDescriptorProto_MessageType_field_number      protoreflect.FieldNumber = 4\n\tFileDescriptorProto_EnumType_field_number         protoreflect.FieldNumber = 5\n\tFileDescriptorProto_Service_field_number          protoreflect.FieldNumber = 6\n\tFileDescriptorProto_Extension_field_number        protoreflect.FieldNumber = 7\n\tFileDescriptorProto_Options_field_number          protoreflect.FieldNumber = 8\n\tFileDescriptorProto_SourceCodeInfo_field_number   protoreflect.FieldNumber = 9\n\tFileDescriptorProto_Syntax_field_number           protoreflect.FieldNumber = 12\n)\n\n// Names for google.protobuf.DescriptorProto.\nconst (\n\tDescriptorProto_message_name     protoreflect.Name     = \"DescriptorProto\"\n\tDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.DescriptorProto\"\n)\n\n// Field names for google.protobuf.DescriptorProto.\nconst (\n\tDescriptorProto_Name_field_name           protoreflect.Name = \"name\"\n\tDescriptorProto_Field_field_name          protoreflect.Name = \"field\"\n\tDescriptorProto_Extension_field_name      protoreflect.Name = \"extension\"\n\tDescriptorProto_NestedType_field_name     protoreflect.Name = \"nested_type\"\n\tDescriptorProto_EnumType_field_name       protoreflect.Name = \"enum_type\"\n\tDescriptorProto_ExtensionRange_field_name protoreflect.Name = \"extension_range\"\n\tDescriptorProto_OneofDecl_field_name      protoreflect.Name = \"oneof_decl\"\n\tDescriptorProto_Options_field_name        protoreflect.Name = \"options\"\n\tDescriptorProto_ReservedRange_field_name  protoreflect.Name = \"reserved_range\"\n\tDescriptorProto_ReservedName_field_name   protoreflect.Name = \"reserved_name\"\n\n\tDescriptorProto_Name_field_fullname           protoreflect.FullName = \"google.protobuf.DescriptorProto.name\"\n\tDescriptorProto_Field_field_fullname          protoreflect.FullName = \"google.protobuf.DescriptorProto.field\"\n\tDescriptorProto_Extension_field_fullname      protoreflect.FullName = \"google.protobuf.DescriptorProto.extension\"\n\tDescriptorProto_NestedType_field_fullname     protoreflect.FullName = \"google.protobuf.DescriptorProto.nested_type\"\n\tDescriptorProto_EnumType_field_fullname       protoreflect.FullName = \"google.protobuf.DescriptorProto.enum_type\"\n\tDescriptorProto_ExtensionRange_field_fullname protoreflect.FullName = \"google.protobuf.DescriptorProto.extension_range\"\n\tDescriptorProto_OneofDecl_field_fullname      protoreflect.FullName = \"google.protobuf.DescriptorProto.oneof_decl\"\n\tDescriptorProto_Options_field_fullname        protoreflect.FullName = \"google.protobuf.DescriptorProto.options\"\n\tDescriptorProto_ReservedRange_field_fullname  protoreflect.FullName = \"google.protobuf.DescriptorProto.reserved_range\"\n\tDescriptorProto_ReservedName_field_fullname   protoreflect.FullName = \"google.protobuf.DescriptorProto.reserved_name\"\n)\n\n// Field numbers for google.protobuf.DescriptorProto.\nconst (\n\tDescriptorProto_Name_field_number           protoreflect.FieldNumber = 1\n\tDescriptorProto_Field_field_number          protoreflect.FieldNumber = 2\n\tDescriptorProto_Extension_field_number      protoreflect.FieldNumber = 6\n\tDescriptorProto_NestedType_field_number     protoreflect.FieldNumber = 3\n\tDescriptorProto_EnumType_field_number       protoreflect.FieldNumber = 4\n\tDescriptorProto_ExtensionRange_field_number protoreflect.FieldNumber = 5\n\tDescriptorProto_OneofDecl_field_number      protoreflect.FieldNumber = 8\n\tDescriptorProto_Options_field_number        protoreflect.FieldNumber = 7\n\tDescriptorProto_ReservedRange_field_number  protoreflect.FieldNumber = 9\n\tDescriptorProto_ReservedName_field_number   protoreflect.FieldNumber = 10\n)\n\n// Names for google.protobuf.DescriptorProto.ExtensionRange.\nconst (\n\tDescriptorProto_ExtensionRange_message_name     protoreflect.Name     = \"ExtensionRange\"\n\tDescriptorProto_ExtensionRange_message_fullname protoreflect.FullName = \"google.protobuf.DescriptorProto.ExtensionRange\"\n)\n\n// Field names for google.protobuf.DescriptorProto.ExtensionRange.\nconst (\n\tDescriptorProto_ExtensionRange_Start_field_name   protoreflect.Name = \"start\"\n\tDescriptorProto_ExtensionRange_End_field_name     protoreflect.Name = \"end\"\n\tDescriptorProto_ExtensionRange_Options_field_name protoreflect.Name = \"options\"\n\n\tDescriptorProto_ExtensionRange_Start_field_fullname   protoreflect.FullName = \"google.protobuf.DescriptorProto.ExtensionRange.start\"\n\tDescriptorProto_ExtensionRange_End_field_fullname     protoreflect.FullName = \"google.protobuf.DescriptorProto.ExtensionRange.end\"\n\tDescriptorProto_ExtensionRange_Options_field_fullname protoreflect.FullName = \"google.protobuf.DescriptorProto.ExtensionRange.options\"\n)\n\n// Field numbers for google.protobuf.DescriptorProto.ExtensionRange.\nconst (\n\tDescriptorProto_ExtensionRange_Start_field_number   protoreflect.FieldNumber = 1\n\tDescriptorProto_ExtensionRange_End_field_number     protoreflect.FieldNumber = 2\n\tDescriptorProto_ExtensionRange_Options_field_number protoreflect.FieldNumber = 3\n)\n\n// Names for google.protobuf.DescriptorProto.ReservedRange.\nconst (\n\tDescriptorProto_ReservedRange_message_name     protoreflect.Name     = \"ReservedRange\"\n\tDescriptorProto_ReservedRange_message_fullname protoreflect.FullName = \"google.protobuf.DescriptorProto.ReservedRange\"\n)\n\n// Field names for google.protobuf.DescriptorProto.ReservedRange.\nconst (\n\tDescriptorProto_ReservedRange_Start_field_name protoreflect.Name = \"start\"\n\tDescriptorProto_ReservedRange_End_field_name   protoreflect.Name = \"end\"\n\n\tDescriptorProto_ReservedRange_Start_field_fullname protoreflect.FullName = \"google.protobuf.DescriptorProto.ReservedRange.start\"\n\tDescriptorProto_ReservedRange_End_field_fullname   protoreflect.FullName = \"google.protobuf.DescriptorProto.ReservedRange.end\"\n)\n\n// Field numbers for google.protobuf.DescriptorProto.ReservedRange.\nconst (\n\tDescriptorProto_ReservedRange_Start_field_number protoreflect.FieldNumber = 1\n\tDescriptorProto_ReservedRange_End_field_number   protoreflect.FieldNumber = 2\n)\n\n// Names for google.protobuf.ExtensionRangeOptions.\nconst (\n\tExtensionRangeOptions_message_name     protoreflect.Name     = \"ExtensionRangeOptions\"\n\tExtensionRangeOptions_message_fullname protoreflect.FullName = \"google.protobuf.ExtensionRangeOptions\"\n)\n\n// Field names for google.protobuf.ExtensionRangeOptions.\nconst (\n\tExtensionRangeOptions_UninterpretedOption_field_name protoreflect.Name = \"uninterpreted_option\"\n\n\tExtensionRangeOptions_UninterpretedOption_field_fullname protoreflect.FullName = \"google.protobuf.ExtensionRangeOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.ExtensionRangeOptions.\nconst (\n\tExtensionRangeOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999\n)\n\n// Names for google.protobuf.FieldDescriptorProto.\nconst (\n\tFieldDescriptorProto_message_name     protoreflect.Name     = \"FieldDescriptorProto\"\n\tFieldDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.FieldDescriptorProto\"\n)\n\n// Field names for google.protobuf.FieldDescriptorProto.\nconst (\n\tFieldDescriptorProto_Name_field_name           protoreflect.Name = \"name\"\n\tFieldDescriptorProto_Number_field_name         protoreflect.Name = \"number\"\n\tFieldDescriptorProto_Label_field_name          protoreflect.Name = \"label\"\n\tFieldDescriptorProto_Type_field_name           protoreflect.Name = \"type\"\n\tFieldDescriptorProto_TypeName_field_name       protoreflect.Name = \"type_name\"\n\tFieldDescriptorProto_Extendee_field_name       protoreflect.Name = \"extendee\"\n\tFieldDescriptorProto_DefaultValue_field_name   protoreflect.Name = \"default_value\"\n\tFieldDescriptorProto_OneofIndex_field_name     protoreflect.Name = \"oneof_index\"\n\tFieldDescriptorProto_JsonName_field_name       protoreflect.Name = \"json_name\"\n\tFieldDescriptorProto_Options_field_name        protoreflect.Name = \"options\"\n\tFieldDescriptorProto_Proto3Optional_field_name protoreflect.Name = \"proto3_optional\"\n\n\tFieldDescriptorProto_Name_field_fullname           protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.name\"\n\tFieldDescriptorProto_Number_field_fullname         protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.number\"\n\tFieldDescriptorProto_Label_field_fullname          protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.label\"\n\tFieldDescriptorProto_Type_field_fullname           protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.type\"\n\tFieldDescriptorProto_TypeName_field_fullname       protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.type_name\"\n\tFieldDescriptorProto_Extendee_field_fullname       protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.extendee\"\n\tFieldDescriptorProto_DefaultValue_field_fullname   protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.default_value\"\n\tFieldDescriptorProto_OneofIndex_field_fullname     protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.oneof_index\"\n\tFieldDescriptorProto_JsonName_field_fullname       protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.json_name\"\n\tFieldDescriptorProto_Options_field_fullname        protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.options\"\n\tFieldDescriptorProto_Proto3Optional_field_fullname protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.proto3_optional\"\n)\n\n// Field numbers for google.protobuf.FieldDescriptorProto.\nconst (\n\tFieldDescriptorProto_Name_field_number           protoreflect.FieldNumber = 1\n\tFieldDescriptorProto_Number_field_number         protoreflect.FieldNumber = 3\n\tFieldDescriptorProto_Label_field_number          protoreflect.FieldNumber = 4\n\tFieldDescriptorProto_Type_field_number           protoreflect.FieldNumber = 5\n\tFieldDescriptorProto_TypeName_field_number       protoreflect.FieldNumber = 6\n\tFieldDescriptorProto_Extendee_field_number       protoreflect.FieldNumber = 2\n\tFieldDescriptorProto_DefaultValue_field_number   protoreflect.FieldNumber = 7\n\tFieldDescriptorProto_OneofIndex_field_number     protoreflect.FieldNumber = 9\n\tFieldDescriptorProto_JsonName_field_number       protoreflect.FieldNumber = 10\n\tFieldDescriptorProto_Options_field_number        protoreflect.FieldNumber = 8\n\tFieldDescriptorProto_Proto3Optional_field_number protoreflect.FieldNumber = 17\n)\n\n// Full and short names for google.protobuf.FieldDescriptorProto.Type.\nconst (\n\tFieldDescriptorProto_Type_enum_fullname = \"google.protobuf.FieldDescriptorProto.Type\"\n\tFieldDescriptorProto_Type_enum_name     = \"Type\"\n)\n\n// Full and short names for google.protobuf.FieldDescriptorProto.Label.\nconst (\n\tFieldDescriptorProto_Label_enum_fullname = \"google.protobuf.FieldDescriptorProto.Label\"\n\tFieldDescriptorProto_Label_enum_name     = \"Label\"\n)\n\n// Names for google.protobuf.OneofDescriptorProto.\nconst (\n\tOneofDescriptorProto_message_name     protoreflect.Name     = \"OneofDescriptorProto\"\n\tOneofDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.OneofDescriptorProto\"\n)\n\n// Field names for google.protobuf.OneofDescriptorProto.\nconst (\n\tOneofDescriptorProto_Name_field_name    protoreflect.Name = \"name\"\n\tOneofDescriptorProto_Options_field_name protoreflect.Name = \"options\"\n\n\tOneofDescriptorProto_Name_field_fullname    protoreflect.FullName = \"google.protobuf.OneofDescriptorProto.name\"\n\tOneofDescriptorProto_Options_field_fullname protoreflect.FullName = \"google.protobuf.OneofDescriptorProto.options\"\n)\n\n// Field numbers for google.protobuf.OneofDescriptorProto.\nconst (\n\tOneofDescriptorProto_Name_field_number    protoreflect.FieldNumber = 1\n\tOneofDescriptorProto_Options_field_number protoreflect.FieldNumber = 2\n)\n\n// Names for google.protobuf.EnumDescriptorProto.\nconst (\n\tEnumDescriptorProto_message_name     protoreflect.Name     = \"EnumDescriptorProto\"\n\tEnumDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.EnumDescriptorProto\"\n)\n\n// Field names for google.protobuf.EnumDescriptorProto.\nconst (\n\tEnumDescriptorProto_Name_field_name          protoreflect.Name = \"name\"\n\tEnumDescriptorProto_Value_field_name         protoreflect.Name = \"value\"\n\tEnumDescriptorProto_Options_field_name       protoreflect.Name = \"options\"\n\tEnumDescriptorProto_ReservedRange_field_name protoreflect.Name = \"reserved_range\"\n\tEnumDescriptorProto_ReservedName_field_name  protoreflect.Name = \"reserved_name\"\n\n\tEnumDescriptorProto_Name_field_fullname          protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.name\"\n\tEnumDescriptorProto_Value_field_fullname         protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.value\"\n\tEnumDescriptorProto_Options_field_fullname       protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.options\"\n\tEnumDescriptorProto_ReservedRange_field_fullname protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.reserved_range\"\n\tEnumDescriptorProto_ReservedName_field_fullname  protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.reserved_name\"\n)\n\n// Field numbers for google.protobuf.EnumDescriptorProto.\nconst (\n\tEnumDescriptorProto_Name_field_number          protoreflect.FieldNumber = 1\n\tEnumDescriptorProto_Value_field_number         protoreflect.FieldNumber = 2\n\tEnumDescriptorProto_Options_field_number       protoreflect.FieldNumber = 3\n\tEnumDescriptorProto_ReservedRange_field_number protoreflect.FieldNumber = 4\n\tEnumDescriptorProto_ReservedName_field_number  protoreflect.FieldNumber = 5\n)\n\n// Names for google.protobuf.EnumDescriptorProto.EnumReservedRange.\nconst (\n\tEnumDescriptorProto_EnumReservedRange_message_name     protoreflect.Name     = \"EnumReservedRange\"\n\tEnumDescriptorProto_EnumReservedRange_message_fullname protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.EnumReservedRange\"\n)\n\n// Field names for google.protobuf.EnumDescriptorProto.EnumReservedRange.\nconst (\n\tEnumDescriptorProto_EnumReservedRange_Start_field_name protoreflect.Name = \"start\"\n\tEnumDescriptorProto_EnumReservedRange_End_field_name   protoreflect.Name = \"end\"\n\n\tEnumDescriptorProto_EnumReservedRange_Start_field_fullname protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.EnumReservedRange.start\"\n\tEnumDescriptorProto_EnumReservedRange_End_field_fullname   protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.EnumReservedRange.end\"\n)\n\n// Field numbers for google.protobuf.EnumDescriptorProto.EnumReservedRange.\nconst (\n\tEnumDescriptorProto_EnumReservedRange_Start_field_number protoreflect.FieldNumber = 1\n\tEnumDescriptorProto_EnumReservedRange_End_field_number   protoreflect.FieldNumber = 2\n)\n\n// Names for google.protobuf.EnumValueDescriptorProto.\nconst (\n\tEnumValueDescriptorProto_message_name     protoreflect.Name     = \"EnumValueDescriptorProto\"\n\tEnumValueDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.EnumValueDescriptorProto\"\n)\n\n// Field names for google.protobuf.EnumValueDescriptorProto.\nconst (\n\tEnumValueDescriptorProto_Name_field_name    protoreflect.Name = \"name\"\n\tEnumValueDescriptorProto_Number_field_name  protoreflect.Name = \"number\"\n\tEnumValueDescriptorProto_Options_field_name protoreflect.Name = \"options\"\n\n\tEnumValueDescriptorProto_Name_field_fullname    protoreflect.FullName = \"google.protobuf.EnumValueDescriptorProto.name\"\n\tEnumValueDescriptorProto_Number_field_fullname  protoreflect.FullName = \"google.protobuf.EnumValueDescriptorProto.number\"\n\tEnumValueDescriptorProto_Options_field_fullname protoreflect.FullName = \"google.protobuf.EnumValueDescriptorProto.options\"\n)\n\n// Field numbers for google.protobuf.EnumValueDescriptorProto.\nconst (\n\tEnumValueDescriptorProto_Name_field_number    protoreflect.FieldNumber = 1\n\tEnumValueDescriptorProto_Number_field_number  protoreflect.FieldNumber = 2\n\tEnumValueDescriptorProto_Options_field_number protoreflect.FieldNumber = 3\n)\n\n// Names for google.protobuf.ServiceDescriptorProto.\nconst (\n\tServiceDescriptorProto_message_name     protoreflect.Name     = \"ServiceDescriptorProto\"\n\tServiceDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.ServiceDescriptorProto\"\n)\n\n// Field names for google.protobuf.ServiceDescriptorProto.\nconst (\n\tServiceDescriptorProto_Name_field_name    protoreflect.Name = \"name\"\n\tServiceDescriptorProto_Method_field_name  protoreflect.Name = \"method\"\n\tServiceDescriptorProto_Options_field_name protoreflect.Name = \"options\"\n\n\tServiceDescriptorProto_Name_field_fullname    protoreflect.FullName = \"google.protobuf.ServiceDescriptorProto.name\"\n\tServiceDescriptorProto_Method_field_fullname  protoreflect.FullName = \"google.protobuf.ServiceDescriptorProto.method\"\n\tServiceDescriptorProto_Options_field_fullname protoreflect.FullName = \"google.protobuf.ServiceDescriptorProto.options\"\n)\n\n// Field numbers for google.protobuf.ServiceDescriptorProto.\nconst (\n\tServiceDescriptorProto_Name_field_number    protoreflect.FieldNumber = 1\n\tServiceDescriptorProto_Method_field_number  protoreflect.FieldNumber = 2\n\tServiceDescriptorProto_Options_field_number protoreflect.FieldNumber = 3\n)\n\n// Names for google.protobuf.MethodDescriptorProto.\nconst (\n\tMethodDescriptorProto_message_name     protoreflect.Name     = \"MethodDescriptorProto\"\n\tMethodDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.MethodDescriptorProto\"\n)\n\n// Field names for google.protobuf.MethodDescriptorProto.\nconst (\n\tMethodDescriptorProto_Name_field_name            protoreflect.Name = \"name\"\n\tMethodDescriptorProto_InputType_field_name       protoreflect.Name = \"input_type\"\n\tMethodDescriptorProto_OutputType_field_name      protoreflect.Name = \"output_type\"\n\tMethodDescriptorProto_Options_field_name         protoreflect.Name = \"options\"\n\tMethodDescriptorProto_ClientStreaming_field_name protoreflect.Name = \"client_streaming\"\n\tMethodDescriptorProto_ServerStreaming_field_name protoreflect.Name = \"server_streaming\"\n\n\tMethodDescriptorProto_Name_field_fullname            protoreflect.FullName = \"google.protobuf.MethodDescriptorProto.name\"\n\tMethodDescriptorProto_InputType_field_fullname       protoreflect.FullName = \"google.protobuf.MethodDescriptorProto.input_type\"\n\tMethodDescriptorProto_OutputType_field_fullname      protoreflect.FullName = \"google.protobuf.MethodDescriptorProto.output_type\"\n\tMethodDescriptorProto_Options_field_fullname         protoreflect.FullName = \"google.protobuf.MethodDescriptorProto.options\"\n\tMethodDescriptorProto_ClientStreaming_field_fullname protoreflect.FullName = \"google.protobuf.MethodDescriptorProto.client_streaming\"\n\tMethodDescriptorProto_ServerStreaming_field_fullname protoreflect.FullName = \"google.protobuf.MethodDescriptorProto.server_streaming\"\n)\n\n// Field numbers for google.protobuf.MethodDescriptorProto.\nconst (\n\tMethodDescriptorProto_Name_field_number            protoreflect.FieldNumber = 1\n\tMethodDescriptorProto_InputType_field_number       protoreflect.FieldNumber = 2\n\tMethodDescriptorProto_OutputType_field_number      protoreflect.FieldNumber = 3\n\tMethodDescriptorProto_Options_field_number         protoreflect.FieldNumber = 4\n\tMethodDescriptorProto_ClientStreaming_field_number protoreflect.FieldNumber = 5\n\tMethodDescriptorProto_ServerStreaming_field_number protoreflect.FieldNumber = 6\n)\n\n// Names for google.protobuf.FileOptions.\nconst (\n\tFileOptions_message_name     protoreflect.Name     = \"FileOptions\"\n\tFileOptions_message_fullname protoreflect.FullName = \"google.protobuf.FileOptions\"\n)\n\n// Field names for google.protobuf.FileOptions.\nconst (\n\tFileOptions_JavaPackage_field_name               protoreflect.Name = \"java_package\"\n\tFileOptions_JavaOuterClassname_field_name        protoreflect.Name = \"java_outer_classname\"\n\tFileOptions_JavaMultipleFiles_field_name         protoreflect.Name = \"java_multiple_files\"\n\tFileOptions_JavaGenerateEqualsAndHash_field_name protoreflect.Name = \"java_generate_equals_and_hash\"\n\tFileOptions_JavaStringCheckUtf8_field_name       protoreflect.Name = \"java_string_check_utf8\"\n\tFileOptions_OptimizeFor_field_name               protoreflect.Name = \"optimize_for\"\n\tFileOptions_GoPackage_field_name                 protoreflect.Name = \"go_package\"\n\tFileOptions_CcGenericServices_field_name         protoreflect.Name = \"cc_generic_services\"\n\tFileOptions_JavaGenericServices_field_name       protoreflect.Name = \"java_generic_services\"\n\tFileOptions_PyGenericServices_field_name         protoreflect.Name = \"py_generic_services\"\n\tFileOptions_PhpGenericServices_field_name        protoreflect.Name = \"php_generic_services\"\n\tFileOptions_Deprecated_field_name                protoreflect.Name = \"deprecated\"\n\tFileOptions_CcEnableArenas_field_name            protoreflect.Name = \"cc_enable_arenas\"\n\tFileOptions_ObjcClassPrefix_field_name           protoreflect.Name = \"objc_class_prefix\"\n\tFileOptions_CsharpNamespace_field_name           protoreflect.Name = \"csharp_namespace\"\n\tFileOptions_SwiftPrefix_field_name               protoreflect.Name = \"swift_prefix\"\n\tFileOptions_PhpClassPrefix_field_name            protoreflect.Name = \"php_class_prefix\"\n\tFileOptions_PhpNamespace_field_name              protoreflect.Name = \"php_namespace\"\n\tFileOptions_PhpMetadataNamespace_field_name      protoreflect.Name = \"php_metadata_namespace\"\n\tFileOptions_RubyPackage_field_name               protoreflect.Name = \"ruby_package\"\n\tFileOptions_UninterpretedOption_field_name       protoreflect.Name = \"uninterpreted_option\"\n\n\tFileOptions_JavaPackage_field_fullname               protoreflect.FullName = \"google.protobuf.FileOptions.java_package\"\n\tFileOptions_JavaOuterClassname_field_fullname        protoreflect.FullName = \"google.protobuf.FileOptions.java_outer_classname\"\n\tFileOptions_JavaMultipleFiles_field_fullname         protoreflect.FullName = \"google.protobuf.FileOptions.java_multiple_files\"\n\tFileOptions_JavaGenerateEqualsAndHash_field_fullname protoreflect.FullName = \"google.protobuf.FileOptions.java_generate_equals_and_hash\"\n\tFileOptions_JavaStringCheckUtf8_field_fullname       protoreflect.FullName = \"google.protobuf.FileOptions.java_string_check_utf8\"\n\tFileOptions_OptimizeFor_field_fullname               protoreflect.FullName = \"google.protobuf.FileOptions.optimize_for\"\n\tFileOptions_GoPackage_field_fullname                 protoreflect.FullName = \"google.protobuf.FileOptions.go_package\"\n\tFileOptions_CcGenericServices_field_fullname         protoreflect.FullName = \"google.protobuf.FileOptions.cc_generic_services\"\n\tFileOptions_JavaGenericServices_field_fullname       protoreflect.FullName = \"google.protobuf.FileOptions.java_generic_services\"\n\tFileOptions_PyGenericServices_field_fullname         protoreflect.FullName = \"google.protobuf.FileOptions.py_generic_services\"\n\tFileOptions_PhpGenericServices_field_fullname        protoreflect.FullName = \"google.protobuf.FileOptions.php_generic_services\"\n\tFileOptions_Deprecated_field_fullname                protoreflect.FullName = \"google.protobuf.FileOptions.deprecated\"\n\tFileOptions_CcEnableArenas_field_fullname            protoreflect.FullName = \"google.protobuf.FileOptions.cc_enable_arenas\"\n\tFileOptions_ObjcClassPrefix_field_fullname           protoreflect.FullName = \"google.protobuf.FileOptions.objc_class_prefix\"\n\tFileOptions_CsharpNamespace_field_fullname           protoreflect.FullName = \"google.protobuf.FileOptions.csharp_namespace\"\n\tFileOptions_SwiftPrefix_field_fullname               protoreflect.FullName = \"google.protobuf.FileOptions.swift_prefix\"\n\tFileOptions_PhpClassPrefix_field_fullname            protoreflect.FullName = \"google.protobuf.FileOptions.php_class_prefix\"\n\tFileOptions_PhpNamespace_field_fullname              protoreflect.FullName = \"google.protobuf.FileOptions.php_namespace\"\n\tFileOptions_PhpMetadataNamespace_field_fullname      protoreflect.FullName = \"google.protobuf.FileOptions.php_metadata_namespace\"\n\tFileOptions_RubyPackage_field_fullname               protoreflect.FullName = \"google.protobuf.FileOptions.ruby_package\"\n\tFileOptions_UninterpretedOption_field_fullname       protoreflect.FullName = \"google.protobuf.FileOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.FileOptions.\nconst (\n\tFileOptions_JavaPackage_field_number               protoreflect.FieldNumber = 1\n\tFileOptions_JavaOuterClassname_field_number        protoreflect.FieldNumber = 8\n\tFileOptions_JavaMultipleFiles_field_number         protoreflect.FieldNumber = 10\n\tFileOptions_JavaGenerateEqualsAndHash_field_number protoreflect.FieldNumber = 20\n\tFileOptions_JavaStringCheckUtf8_field_number       protoreflect.FieldNumber = 27\n\tFileOptions_OptimizeFor_field_number               protoreflect.FieldNumber = 9\n\tFileOptions_GoPackage_field_number                 protoreflect.FieldNumber = 11\n\tFileOptions_CcGenericServices_field_number         protoreflect.FieldNumber = 16\n\tFileOptions_JavaGenericServices_field_number       protoreflect.FieldNumber = 17\n\tFileOptions_PyGenericServices_field_number         protoreflect.FieldNumber = 18\n\tFileOptions_PhpGenericServices_field_number        protoreflect.FieldNumber = 42\n\tFileOptions_Deprecated_field_number                protoreflect.FieldNumber = 23\n\tFileOptions_CcEnableArenas_field_number            protoreflect.FieldNumber = 31\n\tFileOptions_ObjcClassPrefix_field_number           protoreflect.FieldNumber = 36\n\tFileOptions_CsharpNamespace_field_number           protoreflect.FieldNumber = 37\n\tFileOptions_SwiftPrefix_field_number               protoreflect.FieldNumber = 39\n\tFileOptions_PhpClassPrefix_field_number            protoreflect.FieldNumber = 40\n\tFileOptions_PhpNamespace_field_number              protoreflect.FieldNumber = 41\n\tFileOptions_PhpMetadataNamespace_field_number      protoreflect.FieldNumber = 44\n\tFileOptions_RubyPackage_field_number               protoreflect.FieldNumber = 45\n\tFileOptions_UninterpretedOption_field_number       protoreflect.FieldNumber = 999\n)\n\n// Full and short names for google.protobuf.FileOptions.OptimizeMode.\nconst (\n\tFileOptions_OptimizeMode_enum_fullname = \"google.protobuf.FileOptions.OptimizeMode\"\n\tFileOptions_OptimizeMode_enum_name     = \"OptimizeMode\"\n)\n\n// Names for google.protobuf.MessageOptions.\nconst (\n\tMessageOptions_message_name     protoreflect.Name     = \"MessageOptions\"\n\tMessageOptions_message_fullname protoreflect.FullName = \"google.protobuf.MessageOptions\"\n)\n\n// Field names for google.protobuf.MessageOptions.\nconst (\n\tMessageOptions_MessageSetWireFormat_field_name         protoreflect.Name = \"message_set_wire_format\"\n\tMessageOptions_NoStandardDescriptorAccessor_field_name protoreflect.Name = \"no_standard_descriptor_accessor\"\n\tMessageOptions_Deprecated_field_name                   protoreflect.Name = \"deprecated\"\n\tMessageOptions_MapEntry_field_name                     protoreflect.Name = \"map_entry\"\n\tMessageOptions_UninterpretedOption_field_name          protoreflect.Name = \"uninterpreted_option\"\n\n\tMessageOptions_MessageSetWireFormat_field_fullname         protoreflect.FullName = \"google.protobuf.MessageOptions.message_set_wire_format\"\n\tMessageOptions_NoStandardDescriptorAccessor_field_fullname protoreflect.FullName = \"google.protobuf.MessageOptions.no_standard_descriptor_accessor\"\n\tMessageOptions_Deprecated_field_fullname                   protoreflect.FullName = \"google.protobuf.MessageOptions.deprecated\"\n\tMessageOptions_MapEntry_field_fullname                     protoreflect.FullName = \"google.protobuf.MessageOptions.map_entry\"\n\tMessageOptions_UninterpretedOption_field_fullname          protoreflect.FullName = \"google.protobuf.MessageOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.MessageOptions.\nconst (\n\tMessageOptions_MessageSetWireFormat_field_number         protoreflect.FieldNumber = 1\n\tMessageOptions_NoStandardDescriptorAccessor_field_number protoreflect.FieldNumber = 2\n\tMessageOptions_Deprecated_field_number                   protoreflect.FieldNumber = 3\n\tMessageOptions_MapEntry_field_number                     protoreflect.FieldNumber = 7\n\tMessageOptions_UninterpretedOption_field_number          protoreflect.FieldNumber = 999\n)\n\n// Names for google.protobuf.FieldOptions.\nconst (\n\tFieldOptions_message_name     protoreflect.Name     = \"FieldOptions\"\n\tFieldOptions_message_fullname protoreflect.FullName = \"google.protobuf.FieldOptions\"\n)\n\n// Field names for google.protobuf.FieldOptions.\nconst (\n\tFieldOptions_Ctype_field_name               protoreflect.Name = \"ctype\"\n\tFieldOptions_Packed_field_name              protoreflect.Name = \"packed\"\n\tFieldOptions_Jstype_field_name              protoreflect.Name = \"jstype\"\n\tFieldOptions_Lazy_field_name                protoreflect.Name = \"lazy\"\n\tFieldOptions_Deprecated_field_name          protoreflect.Name = \"deprecated\"\n\tFieldOptions_Weak_field_name                protoreflect.Name = \"weak\"\n\tFieldOptions_UninterpretedOption_field_name protoreflect.Name = \"uninterpreted_option\"\n\n\tFieldOptions_Ctype_field_fullname               protoreflect.FullName = \"google.protobuf.FieldOptions.ctype\"\n\tFieldOptions_Packed_field_fullname              protoreflect.FullName = \"google.protobuf.FieldOptions.packed\"\n\tFieldOptions_Jstype_field_fullname              protoreflect.FullName = \"google.protobuf.FieldOptions.jstype\"\n\tFieldOptions_Lazy_field_fullname                protoreflect.FullName = \"google.protobuf.FieldOptions.lazy\"\n\tFieldOptions_Deprecated_field_fullname          protoreflect.FullName = \"google.protobuf.FieldOptions.deprecated\"\n\tFieldOptions_Weak_field_fullname                protoreflect.FullName = \"google.protobuf.FieldOptions.weak\"\n\tFieldOptions_UninterpretedOption_field_fullname protoreflect.FullName = \"google.protobuf.FieldOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.FieldOptions.\nconst (\n\tFieldOptions_Ctype_field_number               protoreflect.FieldNumber = 1\n\tFieldOptions_Packed_field_number              protoreflect.FieldNumber = 2\n\tFieldOptions_Jstype_field_number              protoreflect.FieldNumber = 6\n\tFieldOptions_Lazy_field_number                protoreflect.FieldNumber = 5\n\tFieldOptions_Deprecated_field_number          protoreflect.FieldNumber = 3\n\tFieldOptions_Weak_field_number                protoreflect.FieldNumber = 10\n\tFieldOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999\n)\n\n// Full and short names for google.protobuf.FieldOptions.CType.\nconst (\n\tFieldOptions_CType_enum_fullname = \"google.protobuf.FieldOptions.CType\"\n\tFieldOptions_CType_enum_name     = \"CType\"\n)\n\n// Full and short names for google.protobuf.FieldOptions.JSType.\nconst (\n\tFieldOptions_JSType_enum_fullname = \"google.protobuf.FieldOptions.JSType\"\n\tFieldOptions_JSType_enum_name     = \"JSType\"\n)\n\n// Names for google.protobuf.OneofOptions.\nconst (\n\tOneofOptions_message_name     protoreflect.Name     = \"OneofOptions\"\n\tOneofOptions_message_fullname protoreflect.FullName = \"google.protobuf.OneofOptions\"\n)\n\n// Field names for google.protobuf.OneofOptions.\nconst (\n\tOneofOptions_UninterpretedOption_field_name protoreflect.Name = \"uninterpreted_option\"\n\n\tOneofOptions_UninterpretedOption_field_fullname protoreflect.FullName = \"google.protobuf.OneofOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.OneofOptions.\nconst (\n\tOneofOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999\n)\n\n// Names for google.protobuf.EnumOptions.\nconst (\n\tEnumOptions_message_name     protoreflect.Name     = \"EnumOptions\"\n\tEnumOptions_message_fullname protoreflect.FullName = \"google.protobuf.EnumOptions\"\n)\n\n// Field names for google.protobuf.EnumOptions.\nconst (\n\tEnumOptions_AllowAlias_field_name          protoreflect.Name = \"allow_alias\"\n\tEnumOptions_Deprecated_field_name          protoreflect.Name = \"deprecated\"\n\tEnumOptions_UninterpretedOption_field_name protoreflect.Name = \"uninterpreted_option\"\n\n\tEnumOptions_AllowAlias_field_fullname          protoreflect.FullName = \"google.protobuf.EnumOptions.allow_alias\"\n\tEnumOptions_Deprecated_field_fullname          protoreflect.FullName = \"google.protobuf.EnumOptions.deprecated\"\n\tEnumOptions_UninterpretedOption_field_fullname protoreflect.FullName = \"google.protobuf.EnumOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.EnumOptions.\nconst (\n\tEnumOptions_AllowAlias_field_number          protoreflect.FieldNumber = 2\n\tEnumOptions_Deprecated_field_number          protoreflect.FieldNumber = 3\n\tEnumOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999\n)\n\n// Names for google.protobuf.EnumValueOptions.\nconst (\n\tEnumValueOptions_message_name     protoreflect.Name     = \"EnumValueOptions\"\n\tEnumValueOptions_message_fullname protoreflect.FullName = \"google.protobuf.EnumValueOptions\"\n)\n\n// Field names for google.protobuf.EnumValueOptions.\nconst (\n\tEnumValueOptions_Deprecated_field_name          protoreflect.Name = \"deprecated\"\n\tEnumValueOptions_UninterpretedOption_field_name protoreflect.Name = \"uninterpreted_option\"\n\n\tEnumValueOptions_Deprecated_field_fullname          protoreflect.FullName = \"google.protobuf.EnumValueOptions.deprecated\"\n\tEnumValueOptions_UninterpretedOption_field_fullname protoreflect.FullName = \"google.protobuf.EnumValueOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.EnumValueOptions.\nconst (\n\tEnumValueOptions_Deprecated_field_number          protoreflect.FieldNumber = 1\n\tEnumValueOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999\n)\n\n// Names for google.protobuf.ServiceOptions.\nconst (\n\tServiceOptions_message_name     protoreflect.Name     = \"ServiceOptions\"\n\tServiceOptions_message_fullname protoreflect.FullName = \"google.protobuf.ServiceOptions\"\n)\n\n// Field names for google.protobuf.ServiceOptions.\nconst (\n\tServiceOptions_Deprecated_field_name          protoreflect.Name = \"deprecated\"\n\tServiceOptions_UninterpretedOption_field_name protoreflect.Name = \"uninterpreted_option\"\n\n\tServiceOptions_Deprecated_field_fullname          protoreflect.FullName = \"google.protobuf.ServiceOptions.deprecated\"\n\tServiceOptions_UninterpretedOption_field_fullname protoreflect.FullName = \"google.protobuf.ServiceOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.ServiceOptions.\nconst (\n\tServiceOptions_Deprecated_field_number          protoreflect.FieldNumber = 33\n\tServiceOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999\n)\n\n// Names for google.protobuf.MethodOptions.\nconst (\n\tMethodOptions_message_name     protoreflect.Name     = \"MethodOptions\"\n\tMethodOptions_message_fullname protoreflect.FullName = \"google.protobuf.MethodOptions\"\n)\n\n// Field names for google.protobuf.MethodOptions.\nconst (\n\tMethodOptions_Deprecated_field_name          protoreflect.Name = \"deprecated\"\n\tMethodOptions_IdempotencyLevel_field_name    protoreflect.Name = \"idempotency_level\"\n\tMethodOptions_UninterpretedOption_field_name protoreflect.Name = \"uninterpreted_option\"\n\n\tMethodOptions_Deprecated_field_fullname          protoreflect.FullName = \"google.protobuf.MethodOptions.deprecated\"\n\tMethodOptions_IdempotencyLevel_field_fullname    protoreflect.FullName = \"google.protobuf.MethodOptions.idempotency_level\"\n\tMethodOptions_UninterpretedOption_field_fullname protoreflect.FullName = \"google.protobuf.MethodOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.MethodOptions.\nconst (\n\tMethodOptions_Deprecated_field_number          protoreflect.FieldNumber = 33\n\tMethodOptions_IdempotencyLevel_field_number    protoreflect.FieldNumber = 34\n\tMethodOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999\n)\n\n// Full and short names for google.protobuf.MethodOptions.IdempotencyLevel.\nconst (\n\tMethodOptions_IdempotencyLevel_enum_fullname = \"google.protobuf.MethodOptions.IdempotencyLevel\"\n\tMethodOptions_IdempotencyLevel_enum_name     = \"IdempotencyLevel\"\n)\n\n// Names for google.protobuf.UninterpretedOption.\nconst (\n\tUninterpretedOption_message_name     protoreflect.Name     = \"UninterpretedOption\"\n\tUninterpretedOption_message_fullname protoreflect.FullName = \"google.protobuf.UninterpretedOption\"\n)\n\n// Field names for google.protobuf.UninterpretedOption.\nconst (\n\tUninterpretedOption_Name_field_name             protoreflect.Name = \"name\"\n\tUninterpretedOption_IdentifierValue_field_name  protoreflect.Name = \"identifier_value\"\n\tUninterpretedOption_PositiveIntValue_field_name protoreflect.Name = \"positive_int_value\"\n\tUninterpretedOption_NegativeIntValue_field_name protoreflect.Name = \"negative_int_value\"\n\tUninterpretedOption_DoubleValue_field_name      protoreflect.Name = \"double_value\"\n\tUninterpretedOption_StringValue_field_name      protoreflect.Name = \"string_value\"\n\tUninterpretedOption_AggregateValue_field_name   protoreflect.Name = \"aggregate_value\"\n\n\tUninterpretedOption_Name_field_fullname             protoreflect.FullName = \"google.protobuf.UninterpretedOption.name\"\n\tUninterpretedOption_IdentifierValue_field_fullname  protoreflect.FullName = \"google.protobuf.UninterpretedOption.identifier_value\"\n\tUninterpretedOption_PositiveIntValue_field_fullname protoreflect.FullName = \"google.protobuf.UninterpretedOption.positive_int_value\"\n\tUninterpretedOption_NegativeIntValue_field_fullname protoreflect.FullName = \"google.protobuf.UninterpretedOption.negative_int_value\"\n\tUninterpretedOption_DoubleValue_field_fullname      protoreflect.FullName = \"google.protobuf.UninterpretedOption.double_value\"\n\tUninterpretedOption_StringValue_field_fullname      protoreflect.FullName = \"google.protobuf.UninterpretedOption.string_value\"\n\tUninterpretedOption_AggregateValue_field_fullname   protoreflect.FullName = \"google.protobuf.UninterpretedOption.aggregate_value\"\n)\n\n// Field numbers for google.protobuf.UninterpretedOption.\nconst (\n\tUninterpretedOption_Name_field_number             protoreflect.FieldNumber = 2\n\tUninterpretedOption_IdentifierValue_field_number  protoreflect.FieldNumber = 3\n\tUninterpretedOption_PositiveIntValue_field_number protoreflect.FieldNumber = 4\n\tUninterpretedOption_NegativeIntValue_field_number protoreflect.FieldNumber = 5\n\tUninterpretedOption_DoubleValue_field_number      protoreflect.FieldNumber = 6\n\tUninterpretedOption_StringValue_field_number      protoreflect.FieldNumber = 7\n\tUninterpretedOption_AggregateValue_field_number   protoreflect.FieldNumber = 8\n)\n\n// Names for google.protobuf.UninterpretedOption.NamePart.\nconst (\n\tUninterpretedOption_NamePart_message_name     protoreflect.Name     = \"NamePart\"\n\tUninterpretedOption_NamePart_message_fullname protoreflect.FullName = \"google.protobuf.UninterpretedOption.NamePart\"\n)\n\n// Field names for google.protobuf.UninterpretedOption.NamePart.\nconst (\n\tUninterpretedOption_NamePart_NamePart_field_name    protoreflect.Name = \"name_part\"\n\tUninterpretedOption_NamePart_IsExtension_field_name protoreflect.Name = \"is_extension\"\n\n\tUninterpretedOption_NamePart_NamePart_field_fullname    protoreflect.FullName = \"google.protobuf.UninterpretedOption.NamePart.name_part\"\n\tUninterpretedOption_NamePart_IsExtension_field_fullname protoreflect.FullName = \"google.protobuf.UninterpretedOption.NamePart.is_extension\"\n)\n\n// Field numbers for google.protobuf.UninterpretedOption.NamePart.\nconst (\n\tUninterpretedOption_NamePart_NamePart_field_number    protoreflect.FieldNumber = 1\n\tUninterpretedOption_NamePart_IsExtension_field_number protoreflect.FieldNumber = 2\n)\n\n// Names for google.protobuf.SourceCodeInfo.\nconst (\n\tSourceCodeInfo_message_name     protoreflect.Name     = \"SourceCodeInfo\"\n\tSourceCodeInfo_message_fullname protoreflect.FullName = \"google.protobuf.SourceCodeInfo\"\n)\n\n// Field names for google.protobuf.SourceCodeInfo.\nconst (\n\tSourceCodeInfo_Location_field_name protoreflect.Name = \"location\"\n\n\tSourceCodeInfo_Location_field_fullname protoreflect.FullName = \"google.protobuf.SourceCodeInfo.location\"\n)\n\n// Field numbers for google.protobuf.SourceCodeInfo.\nconst (\n\tSourceCodeInfo_Location_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.SourceCodeInfo.Location.\nconst (\n\tSourceCodeInfo_Location_message_name     protoreflect.Name     = \"Location\"\n\tSourceCodeInfo_Location_message_fullname protoreflect.FullName = \"google.protobuf.SourceCodeInfo.Location\"\n)\n\n// Field names for google.protobuf.SourceCodeInfo.Location.\nconst (\n\tSourceCodeInfo_Location_Path_field_name                    protoreflect.Name = \"path\"\n\tSourceCodeInfo_Location_Span_field_name                    protoreflect.Name = \"span\"\n\tSourceCodeInfo_Location_LeadingComments_field_name         protoreflect.Name = \"leading_comments\"\n\tSourceCodeInfo_Location_TrailingComments_field_name        protoreflect.Name = \"trailing_comments\"\n\tSourceCodeInfo_Location_LeadingDetachedComments_field_name protoreflect.Name = \"leading_detached_comments\"\n\n\tSourceCodeInfo_Location_Path_field_fullname                    protoreflect.FullName = \"google.protobuf.SourceCodeInfo.Location.path\"\n\tSourceCodeInfo_Location_Span_field_fullname                    protoreflect.FullName = \"google.protobuf.SourceCodeInfo.Location.span\"\n\tSourceCodeInfo_Location_LeadingComments_field_fullname         protoreflect.FullName = \"google.protobuf.SourceCodeInfo.Location.leading_comments\"\n\tSourceCodeInfo_Location_TrailingComments_field_fullname        protoreflect.FullName = \"google.protobuf.SourceCodeInfo.Location.trailing_comments\"\n\tSourceCodeInfo_Location_LeadingDetachedComments_field_fullname protoreflect.FullName = \"google.protobuf.SourceCodeInfo.Location.leading_detached_comments\"\n)\n\n// Field numbers for google.protobuf.SourceCodeInfo.Location.\nconst (\n\tSourceCodeInfo_Location_Path_field_number                    protoreflect.FieldNumber = 1\n\tSourceCodeInfo_Location_Span_field_number                    protoreflect.FieldNumber = 2\n\tSourceCodeInfo_Location_LeadingComments_field_number         protoreflect.FieldNumber = 3\n\tSourceCodeInfo_Location_TrailingComments_field_number        protoreflect.FieldNumber = 4\n\tSourceCodeInfo_Location_LeadingDetachedComments_field_number protoreflect.FieldNumber = 6\n)\n\n// Names for google.protobuf.GeneratedCodeInfo.\nconst (\n\tGeneratedCodeInfo_message_name     protoreflect.Name     = \"GeneratedCodeInfo\"\n\tGeneratedCodeInfo_message_fullname protoreflect.FullName = \"google.protobuf.GeneratedCodeInfo\"\n)\n\n// Field names for google.protobuf.GeneratedCodeInfo.\nconst (\n\tGeneratedCodeInfo_Annotation_field_name protoreflect.Name = \"annotation\"\n\n\tGeneratedCodeInfo_Annotation_field_fullname protoreflect.FullName = \"google.protobuf.GeneratedCodeInfo.annotation\"\n)\n\n// Field numbers for google.protobuf.GeneratedCodeInfo.\nconst (\n\tGeneratedCodeInfo_Annotation_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.GeneratedCodeInfo.Annotation.\nconst (\n\tGeneratedCodeInfo_Annotation_message_name     protoreflect.Name     = \"Annotation\"\n\tGeneratedCodeInfo_Annotation_message_fullname protoreflect.FullName = \"google.protobuf.GeneratedCodeInfo.Annotation\"\n)\n\n// Field names for google.protobuf.GeneratedCodeInfo.Annotation.\nconst (\n\tGeneratedCodeInfo_Annotation_Path_field_name       protoreflect.Name = \"path\"\n\tGeneratedCodeInfo_Annotation_SourceFile_field_name protoreflect.Name = \"source_file\"\n\tGeneratedCodeInfo_Annotation_Begin_field_name      protoreflect.Name = \"begin\"\n\tGeneratedCodeInfo_Annotation_End_field_name        protoreflect.Name = \"end\"\n\n\tGeneratedCodeInfo_Annotation_Path_field_fullname       protoreflect.FullName = \"google.protobuf.GeneratedCodeInfo.Annotation.path\"\n\tGeneratedCodeInfo_Annotation_SourceFile_field_fullname protoreflect.FullName = \"google.protobuf.GeneratedCodeInfo.Annotation.source_file\"\n\tGeneratedCodeInfo_Annotation_Begin_field_fullname      protoreflect.FullName = \"google.protobuf.GeneratedCodeInfo.Annotation.begin\"\n\tGeneratedCodeInfo_Annotation_End_field_fullname        protoreflect.FullName = \"google.protobuf.GeneratedCodeInfo.Annotation.end\"\n)\n\n// Field numbers for google.protobuf.GeneratedCodeInfo.Annotation.\nconst (\n\tGeneratedCodeInfo_Annotation_Path_field_number       protoreflect.FieldNumber = 1\n\tGeneratedCodeInfo_Annotation_SourceFile_field_number protoreflect.FieldNumber = 2\n\tGeneratedCodeInfo_Annotation_Begin_field_number      protoreflect.FieldNumber = 3\n\tGeneratedCodeInfo_Annotation_End_field_number        protoreflect.FieldNumber = 4\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/doc.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 genid contains constants for declarations in descriptor.proto\n// and the well-known types.\npackage genid\n\nimport protoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\nconst GoogleProtobuf_package protoreflect.FullName = \"google.protobuf\"\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/duration_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_duration_proto = \"google/protobuf/duration.proto\"\n\n// Names for google.protobuf.Duration.\nconst (\n\tDuration_message_name     protoreflect.Name     = \"Duration\"\n\tDuration_message_fullname protoreflect.FullName = \"google.protobuf.Duration\"\n)\n\n// Field names for google.protobuf.Duration.\nconst (\n\tDuration_Seconds_field_name protoreflect.Name = \"seconds\"\n\tDuration_Nanos_field_name   protoreflect.Name = \"nanos\"\n\n\tDuration_Seconds_field_fullname protoreflect.FullName = \"google.protobuf.Duration.seconds\"\n\tDuration_Nanos_field_fullname   protoreflect.FullName = \"google.protobuf.Duration.nanos\"\n)\n\n// Field numbers for google.protobuf.Duration.\nconst (\n\tDuration_Seconds_field_number protoreflect.FieldNumber = 1\n\tDuration_Nanos_field_number   protoreflect.FieldNumber = 2\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/empty_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_empty_proto = \"google/protobuf/empty.proto\"\n\n// Names for google.protobuf.Empty.\nconst (\n\tEmpty_message_name     protoreflect.Name     = \"Empty\"\n\tEmpty_message_fullname protoreflect.FullName = \"google.protobuf.Empty\"\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/field_mask_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_field_mask_proto = \"google/protobuf/field_mask.proto\"\n\n// Names for google.protobuf.FieldMask.\nconst (\n\tFieldMask_message_name     protoreflect.Name     = \"FieldMask\"\n\tFieldMask_message_fullname protoreflect.FullName = \"google.protobuf.FieldMask\"\n)\n\n// Field names for google.protobuf.FieldMask.\nconst (\n\tFieldMask_Paths_field_name protoreflect.Name = \"paths\"\n\n\tFieldMask_Paths_field_fullname protoreflect.FullName = \"google.protobuf.FieldMask.paths\"\n)\n\n// Field numbers for google.protobuf.FieldMask.\nconst (\n\tFieldMask_Paths_field_number protoreflect.FieldNumber = 1\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/goname.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 genid\n\n// Go names of implementation-specific struct fields in generated messages.\nconst (\n\tState_goname = \"state\"\n\n\tSizeCache_goname  = \"sizeCache\"\n\tSizeCacheA_goname = \"XXX_sizecache\"\n\n\tWeakFields_goname  = \"weakFields\"\n\tWeakFieldsA_goname = \"XXX_weak\"\n\n\tUnknownFields_goname  = \"unknownFields\"\n\tUnknownFieldsA_goname = \"XXX_unrecognized\"\n\n\tExtensionFields_goname  = \"extensionFields\"\n\tExtensionFieldsA_goname = \"XXX_InternalExtensions\"\n\tExtensionFieldsB_goname = \"XXX_extensions\"\n\n\tWeakFieldPrefix_goname = \"XXX_weak_\"\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/map_entry.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 genid\n\nimport protoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\n// Generic field names and numbers for synthetic map entry messages.\nconst (\n\tMapEntry_Key_field_name   protoreflect.Name = \"key\"\n\tMapEntry_Value_field_name protoreflect.Name = \"value\"\n\n\tMapEntry_Key_field_number   protoreflect.FieldNumber = 1\n\tMapEntry_Value_field_number protoreflect.FieldNumber = 2\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/source_context_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_source_context_proto = \"google/protobuf/source_context.proto\"\n\n// Names for google.protobuf.SourceContext.\nconst (\n\tSourceContext_message_name     protoreflect.Name     = \"SourceContext\"\n\tSourceContext_message_fullname protoreflect.FullName = \"google.protobuf.SourceContext\"\n)\n\n// Field names for google.protobuf.SourceContext.\nconst (\n\tSourceContext_FileName_field_name protoreflect.Name = \"file_name\"\n\n\tSourceContext_FileName_field_fullname protoreflect.FullName = \"google.protobuf.SourceContext.file_name\"\n)\n\n// Field numbers for google.protobuf.SourceContext.\nconst (\n\tSourceContext_FileName_field_number protoreflect.FieldNumber = 1\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/struct_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_struct_proto = \"google/protobuf/struct.proto\"\n\n// Full and short names for google.protobuf.NullValue.\nconst (\n\tNullValue_enum_fullname = \"google.protobuf.NullValue\"\n\tNullValue_enum_name     = \"NullValue\"\n)\n\n// Names for google.protobuf.Struct.\nconst (\n\tStruct_message_name     protoreflect.Name     = \"Struct\"\n\tStruct_message_fullname protoreflect.FullName = \"google.protobuf.Struct\"\n)\n\n// Field names for google.protobuf.Struct.\nconst (\n\tStruct_Fields_field_name protoreflect.Name = \"fields\"\n\n\tStruct_Fields_field_fullname protoreflect.FullName = \"google.protobuf.Struct.fields\"\n)\n\n// Field numbers for google.protobuf.Struct.\nconst (\n\tStruct_Fields_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.Struct.FieldsEntry.\nconst (\n\tStruct_FieldsEntry_message_name     protoreflect.Name     = \"FieldsEntry\"\n\tStruct_FieldsEntry_message_fullname protoreflect.FullName = \"google.protobuf.Struct.FieldsEntry\"\n)\n\n// Field names for google.protobuf.Struct.FieldsEntry.\nconst (\n\tStruct_FieldsEntry_Key_field_name   protoreflect.Name = \"key\"\n\tStruct_FieldsEntry_Value_field_name protoreflect.Name = \"value\"\n\n\tStruct_FieldsEntry_Key_field_fullname   protoreflect.FullName = \"google.protobuf.Struct.FieldsEntry.key\"\n\tStruct_FieldsEntry_Value_field_fullname protoreflect.FullName = \"google.protobuf.Struct.FieldsEntry.value\"\n)\n\n// Field numbers for google.protobuf.Struct.FieldsEntry.\nconst (\n\tStruct_FieldsEntry_Key_field_number   protoreflect.FieldNumber = 1\n\tStruct_FieldsEntry_Value_field_number protoreflect.FieldNumber = 2\n)\n\n// Names for google.protobuf.Value.\nconst (\n\tValue_message_name     protoreflect.Name     = \"Value\"\n\tValue_message_fullname protoreflect.FullName = \"google.protobuf.Value\"\n)\n\n// Field names for google.protobuf.Value.\nconst (\n\tValue_NullValue_field_name   protoreflect.Name = \"null_value\"\n\tValue_NumberValue_field_name protoreflect.Name = \"number_value\"\n\tValue_StringValue_field_name protoreflect.Name = \"string_value\"\n\tValue_BoolValue_field_name   protoreflect.Name = \"bool_value\"\n\tValue_StructValue_field_name protoreflect.Name = \"struct_value\"\n\tValue_ListValue_field_name   protoreflect.Name = \"list_value\"\n\n\tValue_NullValue_field_fullname   protoreflect.FullName = \"google.protobuf.Value.null_value\"\n\tValue_NumberValue_field_fullname protoreflect.FullName = \"google.protobuf.Value.number_value\"\n\tValue_StringValue_field_fullname protoreflect.FullName = \"google.protobuf.Value.string_value\"\n\tValue_BoolValue_field_fullname   protoreflect.FullName = \"google.protobuf.Value.bool_value\"\n\tValue_StructValue_field_fullname protoreflect.FullName = \"google.protobuf.Value.struct_value\"\n\tValue_ListValue_field_fullname   protoreflect.FullName = \"google.protobuf.Value.list_value\"\n)\n\n// Field numbers for google.protobuf.Value.\nconst (\n\tValue_NullValue_field_number   protoreflect.FieldNumber = 1\n\tValue_NumberValue_field_number protoreflect.FieldNumber = 2\n\tValue_StringValue_field_number protoreflect.FieldNumber = 3\n\tValue_BoolValue_field_number   protoreflect.FieldNumber = 4\n\tValue_StructValue_field_number protoreflect.FieldNumber = 5\n\tValue_ListValue_field_number   protoreflect.FieldNumber = 6\n)\n\n// Oneof names for google.protobuf.Value.\nconst (\n\tValue_Kind_oneof_name protoreflect.Name = \"kind\"\n\n\tValue_Kind_oneof_fullname protoreflect.FullName = \"google.protobuf.Value.kind\"\n)\n\n// Names for google.protobuf.ListValue.\nconst (\n\tListValue_message_name     protoreflect.Name     = \"ListValue\"\n\tListValue_message_fullname protoreflect.FullName = \"google.protobuf.ListValue\"\n)\n\n// Field names for google.protobuf.ListValue.\nconst (\n\tListValue_Values_field_name protoreflect.Name = \"values\"\n\n\tListValue_Values_field_fullname protoreflect.FullName = \"google.protobuf.ListValue.values\"\n)\n\n// Field numbers for google.protobuf.ListValue.\nconst (\n\tListValue_Values_field_number protoreflect.FieldNumber = 1\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/timestamp_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_timestamp_proto = \"google/protobuf/timestamp.proto\"\n\n// Names for google.protobuf.Timestamp.\nconst (\n\tTimestamp_message_name     protoreflect.Name     = \"Timestamp\"\n\tTimestamp_message_fullname protoreflect.FullName = \"google.protobuf.Timestamp\"\n)\n\n// Field names for google.protobuf.Timestamp.\nconst (\n\tTimestamp_Seconds_field_name protoreflect.Name = \"seconds\"\n\tTimestamp_Nanos_field_name   protoreflect.Name = \"nanos\"\n\n\tTimestamp_Seconds_field_fullname protoreflect.FullName = \"google.protobuf.Timestamp.seconds\"\n\tTimestamp_Nanos_field_fullname   protoreflect.FullName = \"google.protobuf.Timestamp.nanos\"\n)\n\n// Field numbers for google.protobuf.Timestamp.\nconst (\n\tTimestamp_Seconds_field_number protoreflect.FieldNumber = 1\n\tTimestamp_Nanos_field_number   protoreflect.FieldNumber = 2\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/type_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_type_proto = \"google/protobuf/type.proto\"\n\n// Full and short names for google.protobuf.Syntax.\nconst (\n\tSyntax_enum_fullname = \"google.protobuf.Syntax\"\n\tSyntax_enum_name     = \"Syntax\"\n)\n\n// Names for google.protobuf.Type.\nconst (\n\tType_message_name     protoreflect.Name     = \"Type\"\n\tType_message_fullname protoreflect.FullName = \"google.protobuf.Type\"\n)\n\n// Field names for google.protobuf.Type.\nconst (\n\tType_Name_field_name          protoreflect.Name = \"name\"\n\tType_Fields_field_name        protoreflect.Name = \"fields\"\n\tType_Oneofs_field_name        protoreflect.Name = \"oneofs\"\n\tType_Options_field_name       protoreflect.Name = \"options\"\n\tType_SourceContext_field_name protoreflect.Name = \"source_context\"\n\tType_Syntax_field_name        protoreflect.Name = \"syntax\"\n\n\tType_Name_field_fullname          protoreflect.FullName = \"google.protobuf.Type.name\"\n\tType_Fields_field_fullname        protoreflect.FullName = \"google.protobuf.Type.fields\"\n\tType_Oneofs_field_fullname        protoreflect.FullName = \"google.protobuf.Type.oneofs\"\n\tType_Options_field_fullname       protoreflect.FullName = \"google.protobuf.Type.options\"\n\tType_SourceContext_field_fullname protoreflect.FullName = \"google.protobuf.Type.source_context\"\n\tType_Syntax_field_fullname        protoreflect.FullName = \"google.protobuf.Type.syntax\"\n)\n\n// Field numbers for google.protobuf.Type.\nconst (\n\tType_Name_field_number          protoreflect.FieldNumber = 1\n\tType_Fields_field_number        protoreflect.FieldNumber = 2\n\tType_Oneofs_field_number        protoreflect.FieldNumber = 3\n\tType_Options_field_number       protoreflect.FieldNumber = 4\n\tType_SourceContext_field_number protoreflect.FieldNumber = 5\n\tType_Syntax_field_number        protoreflect.FieldNumber = 6\n)\n\n// Names for google.protobuf.Field.\nconst (\n\tField_message_name     protoreflect.Name     = \"Field\"\n\tField_message_fullname protoreflect.FullName = \"google.protobuf.Field\"\n)\n\n// Field names for google.protobuf.Field.\nconst (\n\tField_Kind_field_name         protoreflect.Name = \"kind\"\n\tField_Cardinality_field_name  protoreflect.Name = \"cardinality\"\n\tField_Number_field_name       protoreflect.Name = \"number\"\n\tField_Name_field_name         protoreflect.Name = \"name\"\n\tField_TypeUrl_field_name      protoreflect.Name = \"type_url\"\n\tField_OneofIndex_field_name   protoreflect.Name = \"oneof_index\"\n\tField_Packed_field_name       protoreflect.Name = \"packed\"\n\tField_Options_field_name      protoreflect.Name = \"options\"\n\tField_JsonName_field_name     protoreflect.Name = \"json_name\"\n\tField_DefaultValue_field_name protoreflect.Name = \"default_value\"\n\n\tField_Kind_field_fullname         protoreflect.FullName = \"google.protobuf.Field.kind\"\n\tField_Cardinality_field_fullname  protoreflect.FullName = \"google.protobuf.Field.cardinality\"\n\tField_Number_field_fullname       protoreflect.FullName = \"google.protobuf.Field.number\"\n\tField_Name_field_fullname         protoreflect.FullName = \"google.protobuf.Field.name\"\n\tField_TypeUrl_field_fullname      protoreflect.FullName = \"google.protobuf.Field.type_url\"\n\tField_OneofIndex_field_fullname   protoreflect.FullName = \"google.protobuf.Field.oneof_index\"\n\tField_Packed_field_fullname       protoreflect.FullName = \"google.protobuf.Field.packed\"\n\tField_Options_field_fullname      protoreflect.FullName = \"google.protobuf.Field.options\"\n\tField_JsonName_field_fullname     protoreflect.FullName = \"google.protobuf.Field.json_name\"\n\tField_DefaultValue_field_fullname protoreflect.FullName = \"google.protobuf.Field.default_value\"\n)\n\n// Field numbers for google.protobuf.Field.\nconst (\n\tField_Kind_field_number         protoreflect.FieldNumber = 1\n\tField_Cardinality_field_number  protoreflect.FieldNumber = 2\n\tField_Number_field_number       protoreflect.FieldNumber = 3\n\tField_Name_field_number         protoreflect.FieldNumber = 4\n\tField_TypeUrl_field_number      protoreflect.FieldNumber = 6\n\tField_OneofIndex_field_number   protoreflect.FieldNumber = 7\n\tField_Packed_field_number       protoreflect.FieldNumber = 8\n\tField_Options_field_number      protoreflect.FieldNumber = 9\n\tField_JsonName_field_number     protoreflect.FieldNumber = 10\n\tField_DefaultValue_field_number protoreflect.FieldNumber = 11\n)\n\n// Full and short names for google.protobuf.Field.Kind.\nconst (\n\tField_Kind_enum_fullname = \"google.protobuf.Field.Kind\"\n\tField_Kind_enum_name     = \"Kind\"\n)\n\n// Full and short names for google.protobuf.Field.Cardinality.\nconst (\n\tField_Cardinality_enum_fullname = \"google.protobuf.Field.Cardinality\"\n\tField_Cardinality_enum_name     = \"Cardinality\"\n)\n\n// Names for google.protobuf.Enum.\nconst (\n\tEnum_message_name     protoreflect.Name     = \"Enum\"\n\tEnum_message_fullname protoreflect.FullName = \"google.protobuf.Enum\"\n)\n\n// Field names for google.protobuf.Enum.\nconst (\n\tEnum_Name_field_name          protoreflect.Name = \"name\"\n\tEnum_Enumvalue_field_name     protoreflect.Name = \"enumvalue\"\n\tEnum_Options_field_name       protoreflect.Name = \"options\"\n\tEnum_SourceContext_field_name protoreflect.Name = \"source_context\"\n\tEnum_Syntax_field_name        protoreflect.Name = \"syntax\"\n\n\tEnum_Name_field_fullname          protoreflect.FullName = \"google.protobuf.Enum.name\"\n\tEnum_Enumvalue_field_fullname     protoreflect.FullName = \"google.protobuf.Enum.enumvalue\"\n\tEnum_Options_field_fullname       protoreflect.FullName = \"google.protobuf.Enum.options\"\n\tEnum_SourceContext_field_fullname protoreflect.FullName = \"google.protobuf.Enum.source_context\"\n\tEnum_Syntax_field_fullname        protoreflect.FullName = \"google.protobuf.Enum.syntax\"\n)\n\n// Field numbers for google.protobuf.Enum.\nconst (\n\tEnum_Name_field_number          protoreflect.FieldNumber = 1\n\tEnum_Enumvalue_field_number     protoreflect.FieldNumber = 2\n\tEnum_Options_field_number       protoreflect.FieldNumber = 3\n\tEnum_SourceContext_field_number protoreflect.FieldNumber = 4\n\tEnum_Syntax_field_number        protoreflect.FieldNumber = 5\n)\n\n// Names for google.protobuf.EnumValue.\nconst (\n\tEnumValue_message_name     protoreflect.Name     = \"EnumValue\"\n\tEnumValue_message_fullname protoreflect.FullName = \"google.protobuf.EnumValue\"\n)\n\n// Field names for google.protobuf.EnumValue.\nconst (\n\tEnumValue_Name_field_name    protoreflect.Name = \"name\"\n\tEnumValue_Number_field_name  protoreflect.Name = \"number\"\n\tEnumValue_Options_field_name protoreflect.Name = \"options\"\n\n\tEnumValue_Name_field_fullname    protoreflect.FullName = \"google.protobuf.EnumValue.name\"\n\tEnumValue_Number_field_fullname  protoreflect.FullName = \"google.protobuf.EnumValue.number\"\n\tEnumValue_Options_field_fullname protoreflect.FullName = \"google.protobuf.EnumValue.options\"\n)\n\n// Field numbers for google.protobuf.EnumValue.\nconst (\n\tEnumValue_Name_field_number    protoreflect.FieldNumber = 1\n\tEnumValue_Number_field_number  protoreflect.FieldNumber = 2\n\tEnumValue_Options_field_number protoreflect.FieldNumber = 3\n)\n\n// Names for google.protobuf.Option.\nconst (\n\tOption_message_name     protoreflect.Name     = \"Option\"\n\tOption_message_fullname protoreflect.FullName = \"google.protobuf.Option\"\n)\n\n// Field names for google.protobuf.Option.\nconst (\n\tOption_Name_field_name  protoreflect.Name = \"name\"\n\tOption_Value_field_name protoreflect.Name = \"value\"\n\n\tOption_Name_field_fullname  protoreflect.FullName = \"google.protobuf.Option.name\"\n\tOption_Value_field_fullname protoreflect.FullName = \"google.protobuf.Option.value\"\n)\n\n// Field numbers for google.protobuf.Option.\nconst (\n\tOption_Name_field_number  protoreflect.FieldNumber = 1\n\tOption_Value_field_number protoreflect.FieldNumber = 2\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/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 genid\n\nimport protoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\n// Generic field name and number for messages in wrappers.proto.\nconst (\n\tWrapperValue_Value_field_name   protoreflect.Name        = \"value\"\n\tWrapperValue_Value_field_number protoreflect.FieldNumber = 1\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/genid/wrappers_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_wrappers_proto = \"google/protobuf/wrappers.proto\"\n\n// Names for google.protobuf.DoubleValue.\nconst (\n\tDoubleValue_message_name     protoreflect.Name     = \"DoubleValue\"\n\tDoubleValue_message_fullname protoreflect.FullName = \"google.protobuf.DoubleValue\"\n)\n\n// Field names for google.protobuf.DoubleValue.\nconst (\n\tDoubleValue_Value_field_name protoreflect.Name = \"value\"\n\n\tDoubleValue_Value_field_fullname protoreflect.FullName = \"google.protobuf.DoubleValue.value\"\n)\n\n// Field numbers for google.protobuf.DoubleValue.\nconst (\n\tDoubleValue_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.FloatValue.\nconst (\n\tFloatValue_message_name     protoreflect.Name     = \"FloatValue\"\n\tFloatValue_message_fullname protoreflect.FullName = \"google.protobuf.FloatValue\"\n)\n\n// Field names for google.protobuf.FloatValue.\nconst (\n\tFloatValue_Value_field_name protoreflect.Name = \"value\"\n\n\tFloatValue_Value_field_fullname protoreflect.FullName = \"google.protobuf.FloatValue.value\"\n)\n\n// Field numbers for google.protobuf.FloatValue.\nconst (\n\tFloatValue_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.Int64Value.\nconst (\n\tInt64Value_message_name     protoreflect.Name     = \"Int64Value\"\n\tInt64Value_message_fullname protoreflect.FullName = \"google.protobuf.Int64Value\"\n)\n\n// Field names for google.protobuf.Int64Value.\nconst (\n\tInt64Value_Value_field_name protoreflect.Name = \"value\"\n\n\tInt64Value_Value_field_fullname protoreflect.FullName = \"google.protobuf.Int64Value.value\"\n)\n\n// Field numbers for google.protobuf.Int64Value.\nconst (\n\tInt64Value_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.UInt64Value.\nconst (\n\tUInt64Value_message_name     protoreflect.Name     = \"UInt64Value\"\n\tUInt64Value_message_fullname protoreflect.FullName = \"google.protobuf.UInt64Value\"\n)\n\n// Field names for google.protobuf.UInt64Value.\nconst (\n\tUInt64Value_Value_field_name protoreflect.Name = \"value\"\n\n\tUInt64Value_Value_field_fullname protoreflect.FullName = \"google.protobuf.UInt64Value.value\"\n)\n\n// Field numbers for google.protobuf.UInt64Value.\nconst (\n\tUInt64Value_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.Int32Value.\nconst (\n\tInt32Value_message_name     protoreflect.Name     = \"Int32Value\"\n\tInt32Value_message_fullname protoreflect.FullName = \"google.protobuf.Int32Value\"\n)\n\n// Field names for google.protobuf.Int32Value.\nconst (\n\tInt32Value_Value_field_name protoreflect.Name = \"value\"\n\n\tInt32Value_Value_field_fullname protoreflect.FullName = \"google.protobuf.Int32Value.value\"\n)\n\n// Field numbers for google.protobuf.Int32Value.\nconst (\n\tInt32Value_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.UInt32Value.\nconst (\n\tUInt32Value_message_name     protoreflect.Name     = \"UInt32Value\"\n\tUInt32Value_message_fullname protoreflect.FullName = \"google.protobuf.UInt32Value\"\n)\n\n// Field names for google.protobuf.UInt32Value.\nconst (\n\tUInt32Value_Value_field_name protoreflect.Name = \"value\"\n\n\tUInt32Value_Value_field_fullname protoreflect.FullName = \"google.protobuf.UInt32Value.value\"\n)\n\n// Field numbers for google.protobuf.UInt32Value.\nconst (\n\tUInt32Value_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.BoolValue.\nconst (\n\tBoolValue_message_name     protoreflect.Name     = \"BoolValue\"\n\tBoolValue_message_fullname protoreflect.FullName = \"google.protobuf.BoolValue\"\n)\n\n// Field names for google.protobuf.BoolValue.\nconst (\n\tBoolValue_Value_field_name protoreflect.Name = \"value\"\n\n\tBoolValue_Value_field_fullname protoreflect.FullName = \"google.protobuf.BoolValue.value\"\n)\n\n// Field numbers for google.protobuf.BoolValue.\nconst (\n\tBoolValue_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.StringValue.\nconst (\n\tStringValue_message_name     protoreflect.Name     = \"StringValue\"\n\tStringValue_message_fullname protoreflect.FullName = \"google.protobuf.StringValue\"\n)\n\n// Field names for google.protobuf.StringValue.\nconst (\n\tStringValue_Value_field_name protoreflect.Name = \"value\"\n\n\tStringValue_Value_field_fullname protoreflect.FullName = \"google.protobuf.StringValue.value\"\n)\n\n// Field numbers for google.protobuf.StringValue.\nconst (\n\tStringValue_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.BytesValue.\nconst (\n\tBytesValue_message_name     protoreflect.Name     = \"BytesValue\"\n\tBytesValue_message_fullname protoreflect.FullName = \"google.protobuf.BytesValue\"\n)\n\n// Field names for google.protobuf.BytesValue.\nconst (\n\tBytesValue_Value_field_name protoreflect.Name = \"value\"\n\n\tBytesValue_Value_field_fullname protoreflect.FullName = \"google.protobuf.BytesValue.value\"\n)\n\n// Field numbers for google.protobuf.BytesValue.\nconst (\n\tBytesValue_Value_field_number protoreflect.FieldNumber = 1\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/api_export.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n\n\t\"google.golang.org/protobuf/encoding/prototext\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/proto\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// Export is a zero-length named type that exists only to export a set of\n// functions that we do not want to appear in godoc.\ntype Export struct{}\n\n// NewError formats a string according to the format specifier and arguments and\n// returns an error that has a \"proto\" prefix.\nfunc (Export) NewError(f string, x ...interface{}) error {\n\treturn errors.New(f, x...)\n}\n\n// enum is any enum type generated by protoc-gen-go\n// and must be a named int32 type.\ntype enum = interface{}\n\n// EnumOf returns the protoreflect.Enum interface over e.\n// It returns nil if e is nil.\nfunc (Export) EnumOf(e enum) pref.Enum {\n\tswitch e := e.(type) {\n\tcase nil:\n\t\treturn nil\n\tcase pref.Enum:\n\t\treturn e\n\tdefault:\n\t\treturn legacyWrapEnum(reflect.ValueOf(e))\n\t}\n}\n\n// EnumDescriptorOf returns the protoreflect.EnumDescriptor for e.\n// It returns nil if e is nil.\nfunc (Export) EnumDescriptorOf(e enum) pref.EnumDescriptor {\n\tswitch e := e.(type) {\n\tcase nil:\n\t\treturn nil\n\tcase pref.Enum:\n\t\treturn e.Descriptor()\n\tdefault:\n\t\treturn LegacyLoadEnumDesc(reflect.TypeOf(e))\n\t}\n}\n\n// EnumTypeOf returns the protoreflect.EnumType for e.\n// It returns nil if e is nil.\nfunc (Export) EnumTypeOf(e enum) pref.EnumType {\n\tswitch e := e.(type) {\n\tcase nil:\n\t\treturn nil\n\tcase pref.Enum:\n\t\treturn e.Type()\n\tdefault:\n\t\treturn legacyLoadEnumType(reflect.TypeOf(e))\n\t}\n}\n\n// EnumStringOf returns the enum value as a string, either as the name if\n// the number is resolvable, or the number formatted as a string.\nfunc (Export) EnumStringOf(ed pref.EnumDescriptor, n pref.EnumNumber) string {\n\tev := ed.Values().ByNumber(n)\n\tif ev != nil {\n\t\treturn string(ev.Name())\n\t}\n\treturn strconv.Itoa(int(n))\n}\n\n// message is any message type generated by protoc-gen-go\n// and must be a pointer to a named struct type.\ntype message = interface{}\n\n// legacyMessageWrapper wraps a v2 message as a v1 message.\ntype legacyMessageWrapper struct{ m pref.ProtoMessage }\n\nfunc (m legacyMessageWrapper) Reset()         { proto.Reset(m.m) }\nfunc (m legacyMessageWrapper) String() string { return Export{}.MessageStringOf(m.m) }\nfunc (m legacyMessageWrapper) ProtoMessage()  {}\n\n// ProtoMessageV1Of converts either a v1 or v2 message to a v1 message.\n// It returns nil if m is nil.\nfunc (Export) ProtoMessageV1Of(m message) piface.MessageV1 {\n\tswitch mv := m.(type) {\n\tcase nil:\n\t\treturn nil\n\tcase piface.MessageV1:\n\t\treturn mv\n\tcase unwrapper:\n\t\treturn Export{}.ProtoMessageV1Of(mv.protoUnwrap())\n\tcase pref.ProtoMessage:\n\t\treturn legacyMessageWrapper{mv}\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"message %T is neither a v1 or v2 Message\", m))\n\t}\n}\n\nfunc (Export) protoMessageV2Of(m message) pref.ProtoMessage {\n\tswitch mv := m.(type) {\n\tcase nil:\n\t\treturn nil\n\tcase pref.ProtoMessage:\n\t\treturn mv\n\tcase legacyMessageWrapper:\n\t\treturn mv.m\n\tcase piface.MessageV1:\n\t\treturn nil\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"message %T is neither a v1 or v2 Message\", m))\n\t}\n}\n\n// ProtoMessageV2Of converts either a v1 or v2 message to a v2 message.\n// It returns nil if m is nil.\nfunc (Export) ProtoMessageV2Of(m message) pref.ProtoMessage {\n\tif m == nil {\n\t\treturn nil\n\t}\n\tif mv := (Export{}).protoMessageV2Of(m); mv != nil {\n\t\treturn mv\n\t}\n\treturn legacyWrapMessage(reflect.ValueOf(m)).Interface()\n}\n\n// MessageOf returns the protoreflect.Message interface over m.\n// It returns nil if m is nil.\nfunc (Export) MessageOf(m message) pref.Message {\n\tif m == nil {\n\t\treturn nil\n\t}\n\tif mv := (Export{}).protoMessageV2Of(m); mv != nil {\n\t\treturn mv.ProtoReflect()\n\t}\n\treturn legacyWrapMessage(reflect.ValueOf(m))\n}\n\n// MessageDescriptorOf returns the protoreflect.MessageDescriptor for m.\n// It returns nil if m is nil.\nfunc (Export) MessageDescriptorOf(m message) pref.MessageDescriptor {\n\tif m == nil {\n\t\treturn nil\n\t}\n\tif mv := (Export{}).protoMessageV2Of(m); mv != nil {\n\t\treturn mv.ProtoReflect().Descriptor()\n\t}\n\treturn LegacyLoadMessageDesc(reflect.TypeOf(m))\n}\n\n// MessageTypeOf returns the protoreflect.MessageType for m.\n// It returns nil if m is nil.\nfunc (Export) MessageTypeOf(m message) pref.MessageType {\n\tif m == nil {\n\t\treturn nil\n\t}\n\tif mv := (Export{}).protoMessageV2Of(m); mv != nil {\n\t\treturn mv.ProtoReflect().Type()\n\t}\n\treturn legacyLoadMessageType(reflect.TypeOf(m), \"\")\n}\n\n// MessageStringOf returns the message value as a string,\n// which is the message serialized in the protobuf text format.\nfunc (Export) MessageStringOf(m pref.ProtoMessage) string {\n\treturn prototext.MarshalOptions{Multiline: false}.Format(m)\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/checkinit.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 impl\n\nimport (\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/errors\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\nfunc (mi *MessageInfo) checkInitialized(in piface.CheckInitializedInput) (piface.CheckInitializedOutput, error) {\n\tvar p pointer\n\tif ms, ok := in.Message.(*messageState); ok {\n\t\tp = ms.pointer()\n\t} else {\n\t\tp = in.Message.(*messageReflectWrapper).pointer()\n\t}\n\treturn piface.CheckInitializedOutput{}, mi.checkInitializedPointer(p)\n}\n\nfunc (mi *MessageInfo) checkInitializedPointer(p pointer) error {\n\tmi.init()\n\tif !mi.needsInitCheck {\n\t\treturn nil\n\t}\n\tif p.IsNil() {\n\t\tfor _, f := range mi.orderedCoderFields {\n\t\t\tif f.isRequired {\n\t\t\t\treturn errors.RequiredNotSet(string(mi.Desc.Fields().ByNumber(f.num).FullName()))\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\tif mi.extensionOffset.IsValid() {\n\t\te := p.Apply(mi.extensionOffset).Extensions()\n\t\tif err := mi.isInitExtensions(e); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfor _, f := range mi.orderedCoderFields {\n\t\tif !f.isRequired && f.funcs.isInit == nil {\n\t\t\tcontinue\n\t\t}\n\t\tfptr := p.Apply(f.offset)\n\t\tif f.isPointer && fptr.Elem().IsNil() {\n\t\t\tif f.isRequired {\n\t\t\t\treturn errors.RequiredNotSet(string(mi.Desc.Fields().ByNumber(f.num).FullName()))\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif f.funcs.isInit == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif err := f.funcs.isInit(fptr, f); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (mi *MessageInfo) isInitExtensions(ext *map[int32]ExtensionField) error {\n\tif ext == nil {\n\t\treturn nil\n\t}\n\tfor _, x := range *ext {\n\t\tei := getExtensionFieldInfo(x.Type())\n\t\tif ei.funcs.isInit == nil {\n\t\t\tcontinue\n\t\t}\n\t\tv := x.Value()\n\t\tif !v.IsValid() {\n\t\t\tcontinue\n\t\t}\n\t\tif err := ei.funcs.isInit(v); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nvar (\n\tneedsInitCheckMu  sync.Mutex\n\tneedsInitCheckMap sync.Map\n)\n\n// needsInitCheck reports whether a message needs to be checked for partial initialization.\n//\n// It returns true if the message transitively includes any required or extension fields.\nfunc needsInitCheck(md pref.MessageDescriptor) bool {\n\tif v, ok := needsInitCheckMap.Load(md); ok {\n\t\tif has, ok := v.(bool); ok {\n\t\t\treturn has\n\t\t}\n\t}\n\tneedsInitCheckMu.Lock()\n\tdefer needsInitCheckMu.Unlock()\n\treturn needsInitCheckLocked(md)\n}\n\nfunc needsInitCheckLocked(md pref.MessageDescriptor) (has bool) {\n\tif v, ok := needsInitCheckMap.Load(md); ok {\n\t\t// If has is true, we've previously determined that this message\n\t\t// needs init checks.\n\t\t//\n\t\t// If has is false, we've previously determined that it can never\n\t\t// be uninitialized.\n\t\t//\n\t\t// If has is not a bool, we've just encountered a cycle in the\n\t\t// message graph. In this case, it is safe to return false: If\n\t\t// the message does have required fields, we'll detect them later\n\t\t// in the graph traversal.\n\t\thas, ok := v.(bool)\n\t\treturn ok && has\n\t}\n\tneedsInitCheckMap.Store(md, struct{}{}) // avoid cycles while descending into this message\n\tdefer func() {\n\t\tneedsInitCheckMap.Store(md, has)\n\t}()\n\tif md.RequiredNumbers().Len() > 0 {\n\t\treturn true\n\t}\n\tif md.ExtensionRanges().Len() > 0 {\n\t\treturn true\n\t}\n\tfor i := 0; i < md.Fields().Len(); i++ {\n\t\tfd := md.Fields().Get(i)\n\t\t// Map keys are never messages, so just consider the map value.\n\t\tif fd.IsMap() {\n\t\t\tfd = fd.MapValue()\n\t\t}\n\t\tfmd := fd.Message()\n\t\tif fmd != nil && needsInitCheckLocked(fmd) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/codec_extension.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 impl\n\nimport (\n\t\"sync\"\n\t\"sync/atomic\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype extensionFieldInfo struct {\n\twiretag             uint64\n\ttagsize             int\n\tunmarshalNeedsValue bool\n\tfuncs               valueCoderFuncs\n\tvalidation          validationInfo\n}\n\nvar legacyExtensionFieldInfoCache sync.Map // map[protoreflect.ExtensionType]*extensionFieldInfo\n\nfunc getExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo {\n\tif xi, ok := xt.(*ExtensionInfo); ok {\n\t\txi.lazyInit()\n\t\treturn xi.info\n\t}\n\treturn legacyLoadExtensionFieldInfo(xt)\n}\n\n// legacyLoadExtensionFieldInfo dynamically loads a *ExtensionInfo for xt.\nfunc legacyLoadExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo {\n\tif xi, ok := legacyExtensionFieldInfoCache.Load(xt); ok {\n\t\treturn xi.(*extensionFieldInfo)\n\t}\n\te := makeExtensionFieldInfo(xt.TypeDescriptor())\n\tif e, ok := legacyMessageTypeCache.LoadOrStore(xt, e); ok {\n\t\treturn e.(*extensionFieldInfo)\n\t}\n\treturn e\n}\n\nfunc makeExtensionFieldInfo(xd pref.ExtensionDescriptor) *extensionFieldInfo {\n\tvar wiretag uint64\n\tif !xd.IsPacked() {\n\t\twiretag = protowire.EncodeTag(xd.Number(), wireTypes[xd.Kind()])\n\t} else {\n\t\twiretag = protowire.EncodeTag(xd.Number(), protowire.BytesType)\n\t}\n\te := &extensionFieldInfo{\n\t\twiretag: wiretag,\n\t\ttagsize: protowire.SizeVarint(wiretag),\n\t\tfuncs:   encoderFuncsForValue(xd),\n\t}\n\t// Does the unmarshal function need a value passed to it?\n\t// This is true for composite types, where we pass in a message, list, or map to fill in,\n\t// and for enums, where we pass in a prototype value to specify the concrete enum type.\n\tswitch xd.Kind() {\n\tcase pref.MessageKind, pref.GroupKind, pref.EnumKind:\n\t\te.unmarshalNeedsValue = true\n\tdefault:\n\t\tif xd.Cardinality() == pref.Repeated {\n\t\t\te.unmarshalNeedsValue = true\n\t\t}\n\t}\n\treturn e\n}\n\ntype lazyExtensionValue struct {\n\tatomicOnce uint32 // atomically set if value is valid\n\tmu         sync.Mutex\n\txi         *extensionFieldInfo\n\tvalue      pref.Value\n\tb          []byte\n\tfn         func() pref.Value\n}\n\ntype ExtensionField struct {\n\ttyp pref.ExtensionType\n\n\t// value is either the value of GetValue,\n\t// or a *lazyExtensionValue that then returns the value of GetValue.\n\tvalue pref.Value\n\tlazy  *lazyExtensionValue\n}\n\nfunc (f *ExtensionField) appendLazyBytes(xt pref.ExtensionType, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, b []byte) {\n\tif f.lazy == nil {\n\t\tf.lazy = &lazyExtensionValue{xi: xi}\n\t}\n\tf.typ = xt\n\tf.lazy.xi = xi\n\tf.lazy.b = protowire.AppendTag(f.lazy.b, num, wtyp)\n\tf.lazy.b = append(f.lazy.b, b...)\n}\n\nfunc (f *ExtensionField) canLazy(xt pref.ExtensionType) bool {\n\tif f.typ == nil {\n\t\treturn true\n\t}\n\tif f.typ == xt && f.lazy != nil && atomic.LoadUint32(&f.lazy.atomicOnce) == 0 {\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc (f *ExtensionField) lazyInit() {\n\tf.lazy.mu.Lock()\n\tdefer f.lazy.mu.Unlock()\n\tif atomic.LoadUint32(&f.lazy.atomicOnce) == 1 {\n\t\treturn\n\t}\n\tif f.lazy.xi != nil {\n\t\tb := f.lazy.b\n\t\tval := f.typ.New()\n\t\tfor len(b) > 0 {\n\t\t\tvar tag uint64\n\t\t\tif b[0] < 0x80 {\n\t\t\t\ttag = uint64(b[0])\n\t\t\t\tb = b[1:]\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\ttag = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tb = b[2:]\n\t\t\t} else {\n\t\t\t\tvar n int\n\t\t\t\ttag, n = protowire.ConsumeVarint(b)\n\t\t\t\tif n < 0 {\n\t\t\t\t\tpanic(errors.New(\"bad tag in lazy extension decoding\"))\n\t\t\t\t}\n\t\t\t\tb = b[n:]\n\t\t\t}\n\t\t\tnum := protowire.Number(tag >> 3)\n\t\t\twtyp := protowire.Type(tag & 7)\n\t\t\tvar out unmarshalOutput\n\t\t\tvar err error\n\t\t\tval, out, err = f.lazy.xi.funcs.unmarshal(b, val, num, wtyp, lazyUnmarshalOptions)\n\t\t\tif err != nil {\n\t\t\t\tpanic(errors.New(\"decode failure in lazy extension decoding: %v\", err))\n\t\t\t}\n\t\t\tb = b[out.n:]\n\t\t}\n\t\tf.lazy.value = val\n\t} else {\n\t\tf.lazy.value = f.lazy.fn()\n\t}\n\tf.lazy.xi = nil\n\tf.lazy.fn = nil\n\tf.lazy.b = nil\n\tatomic.StoreUint32(&f.lazy.atomicOnce, 1)\n}\n\n// Set sets the type and value of the extension field.\n// This must not be called concurrently.\nfunc (f *ExtensionField) Set(t pref.ExtensionType, v pref.Value) {\n\tf.typ = t\n\tf.value = v\n\tf.lazy = nil\n}\n\n// SetLazy sets the type and a value that is to be lazily evaluated upon first use.\n// This must not be called concurrently.\nfunc (f *ExtensionField) SetLazy(t pref.ExtensionType, fn func() pref.Value) {\n\tf.typ = t\n\tf.lazy = &lazyExtensionValue{fn: fn}\n}\n\n// Value returns the value of the extension field.\n// This may be called concurrently.\nfunc (f *ExtensionField) Value() pref.Value {\n\tif f.lazy != nil {\n\t\tif atomic.LoadUint32(&f.lazy.atomicOnce) == 0 {\n\t\t\tf.lazyInit()\n\t\t}\n\t\treturn f.lazy.value\n\t}\n\treturn f.value\n}\n\n// Type returns the type of the extension field.\n// This may be called concurrently.\nfunc (f ExtensionField) Type() pref.ExtensionType {\n\treturn f.typ\n}\n\n// IsSet returns whether the extension field is set.\n// This may be called concurrently.\nfunc (f ExtensionField) IsSet() bool {\n\treturn f.typ != nil\n}\n\n// IsLazy reports whether a field is lazily encoded.\n// It is exported for testing.\nfunc IsLazy(m pref.Message, fd pref.FieldDescriptor) bool {\n\tvar mi *MessageInfo\n\tvar p pointer\n\tswitch m := m.(type) {\n\tcase *messageState:\n\t\tmi = m.messageInfo()\n\t\tp = m.pointer()\n\tcase *messageReflectWrapper:\n\t\tmi = m.messageInfo()\n\t\tp = m.pointer()\n\tdefault:\n\t\treturn false\n\t}\n\txd, ok := fd.(pref.ExtensionTypeDescriptor)\n\tif !ok {\n\t\treturn false\n\t}\n\txt := xd.Type()\n\text := mi.extensionMap(p)\n\tif ext == nil {\n\t\treturn false\n\t}\n\tf, ok := (*ext)[int32(fd.Number())]\n\tif !ok {\n\t\treturn false\n\t}\n\treturn f.typ == xt && f.lazy != nil && atomic.LoadUint32(&f.lazy.atomicOnce) == 0\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/codec_field.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/proto\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\ntype errInvalidUTF8 struct{}\n\nfunc (errInvalidUTF8) Error() string     { return \"string field contains invalid UTF-8\" }\nfunc (errInvalidUTF8) InvalidUTF8() bool { return true }\nfunc (errInvalidUTF8) Unwrap() error     { return errors.Error }\n\n// initOneofFieldCoders initializes the fast-path functions for the fields in a oneof.\n//\n// For size, marshal, and isInit operations, functions are set only on the first field\n// in the oneof. The functions are called when the oneof is non-nil, and will dispatch\n// to the appropriate field-specific function as necessary.\n//\n// The unmarshal function is set on each field individually as usual.\nfunc (mi *MessageInfo) initOneofFieldCoders(od pref.OneofDescriptor, si structInfo) {\n\tfs := si.oneofsByName[od.Name()]\n\tft := fs.Type\n\toneofFields := make(map[reflect.Type]*coderFieldInfo)\n\tneedIsInit := false\n\tfields := od.Fields()\n\tfor i, lim := 0, fields.Len(); i < lim; i++ {\n\t\tfd := od.Fields().Get(i)\n\t\tnum := fd.Number()\n\t\t// Make a copy of the original coderFieldInfo for use in unmarshaling.\n\t\t//\n\t\t// oneofFields[oneofType].funcs.marshal is the field-specific marshal function.\n\t\t//\n\t\t// mi.coderFields[num].marshal is set on only the first field in the oneof,\n\t\t// and dispatches to the field-specific marshaler in oneofFields.\n\t\tcf := *mi.coderFields[num]\n\t\tot := si.oneofWrappersByNumber[num]\n\t\tcf.ft = ot.Field(0).Type\n\t\tcf.mi, cf.funcs = fieldCoder(fd, cf.ft)\n\t\toneofFields[ot] = &cf\n\t\tif cf.funcs.isInit != nil {\n\t\t\tneedIsInit = true\n\t\t}\n\t\tmi.coderFields[num].funcs.unmarshal = func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\tvar vw reflect.Value         // pointer to wrapper type\n\t\t\tvi := p.AsValueOf(ft).Elem() // oneof field value of interface kind\n\t\t\tif !vi.IsNil() && !vi.Elem().IsNil() && vi.Elem().Elem().Type() == ot {\n\t\t\t\tvw = vi.Elem()\n\t\t\t} else {\n\t\t\t\tvw = reflect.New(ot)\n\t\t\t}\n\t\t\tout, err := cf.funcs.unmarshal(b, pointerOfValue(vw).Apply(zeroOffset), wtyp, &cf, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn out, err\n\t\t\t}\n\t\t\tvi.Set(vw)\n\t\t\treturn out, nil\n\t\t}\n\t}\n\tgetInfo := func(p pointer) (pointer, *coderFieldInfo) {\n\t\tv := p.AsValueOf(ft).Elem()\n\t\tif v.IsNil() {\n\t\t\treturn pointer{}, nil\n\t\t}\n\t\tv = v.Elem() // interface -> *struct\n\t\tif v.IsNil() {\n\t\t\treturn pointer{}, nil\n\t\t}\n\t\treturn pointerOfValue(v).Apply(zeroOffset), oneofFields[v.Elem().Type()]\n\t}\n\tfirst := mi.coderFields[od.Fields().Get(0).Number()]\n\tfirst.funcs.size = func(p pointer, _ *coderFieldInfo, opts marshalOptions) int {\n\t\tp, info := getInfo(p)\n\t\tif info == nil || info.funcs.size == nil {\n\t\t\treturn 0\n\t\t}\n\t\treturn info.funcs.size(p, info, opts)\n\t}\n\tfirst.funcs.marshal = func(b []byte, p pointer, _ *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\tp, info := getInfo(p)\n\t\tif info == nil || info.funcs.marshal == nil {\n\t\t\treturn b, nil\n\t\t}\n\t\treturn info.funcs.marshal(b, p, info, opts)\n\t}\n\tfirst.funcs.merge = func(dst, src pointer, _ *coderFieldInfo, opts mergeOptions) {\n\t\tsrcp, srcinfo := getInfo(src)\n\t\tif srcinfo == nil || srcinfo.funcs.merge == nil {\n\t\t\treturn\n\t\t}\n\t\tdstp, dstinfo := getInfo(dst)\n\t\tif dstinfo != srcinfo {\n\t\t\tdst.AsValueOf(ft).Elem().Set(reflect.New(src.AsValueOf(ft).Elem().Elem().Elem().Type()))\n\t\t\tdstp = pointerOfValue(dst.AsValueOf(ft).Elem().Elem()).Apply(zeroOffset)\n\t\t}\n\t\tsrcinfo.funcs.merge(dstp, srcp, srcinfo, opts)\n\t}\n\tif needIsInit {\n\t\tfirst.funcs.isInit = func(p pointer, _ *coderFieldInfo) error {\n\t\t\tp, info := getInfo(p)\n\t\t\tif info == nil || info.funcs.isInit == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn info.funcs.isInit(p, info)\n\t\t}\n\t}\n}\n\nfunc makeWeakMessageFieldCoder(fd pref.FieldDescriptor) pointerCoderFuncs {\n\tvar once sync.Once\n\tvar messageType pref.MessageType\n\tlazyInit := func() {\n\t\tonce.Do(func() {\n\t\t\tmessageName := fd.Message().FullName()\n\t\t\tmessageType, _ = preg.GlobalTypes.FindMessageByName(messageName)\n\t\t})\n\t}\n\n\treturn pointerCoderFuncs{\n\t\tsize: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\t\t\tm, ok := p.WeakFields().get(f.num)\n\t\t\tif !ok {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tlazyInit()\n\t\t\tif messageType == nil {\n\t\t\t\tpanic(fmt.Sprintf(\"weak message %v is not linked in\", fd.Message().FullName()))\n\t\t\t}\n\t\t\treturn sizeMessage(m, f.tagsize, opts)\n\t\t},\n\t\tmarshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\t\tm, ok := p.WeakFields().get(f.num)\n\t\t\tif !ok {\n\t\t\t\treturn b, nil\n\t\t\t}\n\t\t\tlazyInit()\n\t\t\tif messageType == nil {\n\t\t\t\tpanic(fmt.Sprintf(\"weak message %v is not linked in\", fd.Message().FullName()))\n\t\t\t}\n\t\t\treturn appendMessage(b, m, f.wiretag, opts)\n\t\t},\n\t\tunmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\tfs := p.WeakFields()\n\t\t\tm, ok := fs.get(f.num)\n\t\t\tif !ok {\n\t\t\t\tlazyInit()\n\t\t\t\tif messageType == nil {\n\t\t\t\t\treturn unmarshalOutput{}, errUnknown\n\t\t\t\t}\n\t\t\t\tm = messageType.New().Interface()\n\t\t\t\tfs.set(f.num, m)\n\t\t\t}\n\t\t\treturn consumeMessage(b, m, wtyp, opts)\n\t\t},\n\t\tisInit: func(p pointer, f *coderFieldInfo) error {\n\t\t\tm, ok := p.WeakFields().get(f.num)\n\t\t\tif !ok {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn proto.CheckInitialized(m)\n\t\t},\n\t\tmerge: func(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {\n\t\t\tsm, ok := src.WeakFields().get(f.num)\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdm, ok := dst.WeakFields().get(f.num)\n\t\t\tif !ok {\n\t\t\t\tlazyInit()\n\t\t\t\tif messageType == nil {\n\t\t\t\t\tpanic(fmt.Sprintf(\"weak message %v is not linked in\", fd.Message().FullName()))\n\t\t\t\t}\n\t\t\t\tdm = messageType.New().Interface()\n\t\t\t\tdst.WeakFields().set(f.num, dm)\n\t\t\t}\n\t\t\topts.Merge(dm, sm)\n\t\t},\n\t}\n}\n\nfunc makeMessageFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {\n\tif mi := getMessageInfo(ft); mi != nil {\n\t\tfuncs := pointerCoderFuncs{\n\t\t\tsize:      sizeMessageInfo,\n\t\t\tmarshal:   appendMessageInfo,\n\t\t\tunmarshal: consumeMessageInfo,\n\t\t\tmerge:     mergeMessage,\n\t\t}\n\t\tif needsInitCheck(mi.Desc) {\n\t\t\tfuncs.isInit = isInitMessageInfo\n\t\t}\n\t\treturn funcs\n\t} else {\n\t\treturn pointerCoderFuncs{\n\t\t\tsize: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\t\t\t\tm := asMessage(p.AsValueOf(ft).Elem())\n\t\t\t\treturn sizeMessage(m, f.tagsize, opts)\n\t\t\t},\n\t\t\tmarshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\t\t\tm := asMessage(p.AsValueOf(ft).Elem())\n\t\t\t\treturn appendMessage(b, m, f.wiretag, opts)\n\t\t\t},\n\t\t\tunmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\t\tmp := p.AsValueOf(ft).Elem()\n\t\t\t\tif mp.IsNil() {\n\t\t\t\t\tmp.Set(reflect.New(ft.Elem()))\n\t\t\t\t}\n\t\t\t\treturn consumeMessage(b, asMessage(mp), wtyp, opts)\n\t\t\t},\n\t\t\tisInit: func(p pointer, f *coderFieldInfo) error {\n\t\t\t\tm := asMessage(p.AsValueOf(ft).Elem())\n\t\t\t\treturn proto.CheckInitialized(m)\n\t\t\t},\n\t\t\tmerge: mergeMessage,\n\t\t}\n\t}\n}\n\nfunc sizeMessageInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\treturn protowire.SizeBytes(f.mi.sizePointer(p.Elem(), opts)) + f.tagsize\n}\n\nfunc appendMessageInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(f.mi.sizePointer(p.Elem(), opts)))\n\treturn f.mi.marshalAppendPointer(b, p.Elem(), opts)\n}\n\nfunc consumeMessageInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tif p.Elem().IsNil() {\n\t\tp.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem())))\n\t}\n\to, err := f.mi.unmarshalPointer(v, p.Elem(), 0, opts)\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tout.n = n\n\tout.initialized = o.initialized\n\treturn out, nil\n}\n\nfunc isInitMessageInfo(p pointer, f *coderFieldInfo) error {\n\treturn f.mi.checkInitializedPointer(p.Elem())\n}\n\nfunc sizeMessage(m proto.Message, tagsize int, _ marshalOptions) int {\n\treturn protowire.SizeBytes(proto.Size(m)) + tagsize\n}\n\nfunc appendMessage(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, uint64(proto.Size(m)))\n\treturn opts.Options().MarshalAppend(b, m)\n}\n\nfunc consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\to, err := opts.Options().UnmarshalState(piface.UnmarshalInput{\n\t\tBuf:     v,\n\t\tMessage: m.ProtoReflect(),\n\t})\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tout.n = n\n\tout.initialized = o.Flags&piface.UnmarshalInitialized != 0\n\treturn out, nil\n}\n\nfunc sizeMessageValue(v pref.Value, tagsize int, opts marshalOptions) int {\n\tm := v.Message().Interface()\n\treturn sizeMessage(m, tagsize, opts)\n}\n\nfunc appendMessageValue(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tm := v.Message().Interface()\n\treturn appendMessage(b, m, wiretag, opts)\n}\n\nfunc consumeMessageValue(b []byte, v pref.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) {\n\tm := v.Message().Interface()\n\tout, err := consumeMessage(b, m, wtyp, opts)\n\treturn v, out, err\n}\n\nfunc isInitMessageValue(v pref.Value) error {\n\tm := v.Message().Interface()\n\treturn proto.CheckInitialized(m)\n}\n\nvar coderMessageValue = valueCoderFuncs{\n\tsize:      sizeMessageValue,\n\tmarshal:   appendMessageValue,\n\tunmarshal: consumeMessageValue,\n\tisInit:    isInitMessageValue,\n\tmerge:     mergeMessageValue,\n}\n\nfunc sizeGroupValue(v pref.Value, tagsize int, opts marshalOptions) int {\n\tm := v.Message().Interface()\n\treturn sizeGroup(m, tagsize, opts)\n}\n\nfunc appendGroupValue(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tm := v.Message().Interface()\n\treturn appendGroup(b, m, wiretag, opts)\n}\n\nfunc consumeGroupValue(b []byte, v pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) {\n\tm := v.Message().Interface()\n\tout, err := consumeGroup(b, m, num, wtyp, opts)\n\treturn v, out, err\n}\n\nvar coderGroupValue = valueCoderFuncs{\n\tsize:      sizeGroupValue,\n\tmarshal:   appendGroupValue,\n\tunmarshal: consumeGroupValue,\n\tisInit:    isInitMessageValue,\n\tmerge:     mergeMessageValue,\n}\n\nfunc makeGroupFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {\n\tnum := fd.Number()\n\tif mi := getMessageInfo(ft); mi != nil {\n\t\tfuncs := pointerCoderFuncs{\n\t\t\tsize:      sizeGroupType,\n\t\t\tmarshal:   appendGroupType,\n\t\t\tunmarshal: consumeGroupType,\n\t\t\tmerge:     mergeMessage,\n\t\t}\n\t\tif needsInitCheck(mi.Desc) {\n\t\t\tfuncs.isInit = isInitMessageInfo\n\t\t}\n\t\treturn funcs\n\t} else {\n\t\treturn pointerCoderFuncs{\n\t\t\tsize: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\t\t\t\tm := asMessage(p.AsValueOf(ft).Elem())\n\t\t\t\treturn sizeGroup(m, f.tagsize, opts)\n\t\t\t},\n\t\t\tmarshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\t\t\tm := asMessage(p.AsValueOf(ft).Elem())\n\t\t\t\treturn appendGroup(b, m, f.wiretag, opts)\n\t\t\t},\n\t\t\tunmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\t\tmp := p.AsValueOf(ft).Elem()\n\t\t\t\tif mp.IsNil() {\n\t\t\t\t\tmp.Set(reflect.New(ft.Elem()))\n\t\t\t\t}\n\t\t\t\treturn consumeGroup(b, asMessage(mp), num, wtyp, opts)\n\t\t\t},\n\t\t\tisInit: func(p pointer, f *coderFieldInfo) error {\n\t\t\t\tm := asMessage(p.AsValueOf(ft).Elem())\n\t\t\t\treturn proto.CheckInitialized(m)\n\t\t\t},\n\t\t\tmerge: mergeMessage,\n\t\t}\n\t}\n}\n\nfunc sizeGroupType(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\treturn 2*f.tagsize + f.mi.sizePointer(p.Elem(), opts)\n}\n\nfunc appendGroupType(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, f.wiretag) // start group\n\tb, err := f.mi.marshalAppendPointer(b, p.Elem(), opts)\n\tb = protowire.AppendVarint(b, f.wiretag+1) // end group\n\treturn b, err\n}\n\nfunc consumeGroupType(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.StartGroupType {\n\t\treturn out, errUnknown\n\t}\n\tif p.Elem().IsNil() {\n\t\tp.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem())))\n\t}\n\treturn f.mi.unmarshalPointer(b, p.Elem(), f.num, opts)\n}\n\nfunc sizeGroup(m proto.Message, tagsize int, _ marshalOptions) int {\n\treturn 2*tagsize + proto.Size(m)\n}\n\nfunc appendGroup(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag) // start group\n\tb, err := opts.Options().MarshalAppend(b, m)\n\tb = protowire.AppendVarint(b, wiretag+1) // end group\n\treturn b, err\n}\n\nfunc consumeGroup(b []byte, m proto.Message, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.StartGroupType {\n\t\treturn out, errUnknown\n\t}\n\tb, n := protowire.ConsumeGroup(num, b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\to, err := opts.Options().UnmarshalState(piface.UnmarshalInput{\n\t\tBuf:     b,\n\t\tMessage: m.ProtoReflect(),\n\t})\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tout.n = n\n\tout.initialized = o.Flags&piface.UnmarshalInitialized != 0\n\treturn out, nil\n}\n\nfunc makeMessageSliceFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {\n\tif mi := getMessageInfo(ft); mi != nil {\n\t\tfuncs := pointerCoderFuncs{\n\t\t\tsize:      sizeMessageSliceInfo,\n\t\t\tmarshal:   appendMessageSliceInfo,\n\t\t\tunmarshal: consumeMessageSliceInfo,\n\t\t\tmerge:     mergeMessageSlice,\n\t\t}\n\t\tif needsInitCheck(mi.Desc) {\n\t\t\tfuncs.isInit = isInitMessageSliceInfo\n\t\t}\n\t\treturn funcs\n\t}\n\treturn pointerCoderFuncs{\n\t\tsize: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\t\t\treturn sizeMessageSlice(p, ft, f.tagsize, opts)\n\t\t},\n\t\tmarshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\t\treturn appendMessageSlice(b, p, f.wiretag, ft, opts)\n\t\t},\n\t\tunmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\treturn consumeMessageSlice(b, p, ft, wtyp, opts)\n\t\t},\n\t\tisInit: func(p pointer, f *coderFieldInfo) error {\n\t\t\treturn isInitMessageSlice(p, ft)\n\t\t},\n\t\tmerge: mergeMessageSlice,\n\t}\n}\n\nfunc sizeMessageSliceInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\ts := p.PointerSlice()\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeBytes(f.mi.sizePointer(v, opts)) + f.tagsize\n\t}\n\treturn n\n}\n\nfunc appendMessageSliceInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := p.PointerSlice()\n\tvar err error\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tsiz := f.mi.sizePointer(v, opts)\n\t\tb = protowire.AppendVarint(b, uint64(siz))\n\t\tb, err = f.mi.marshalAppendPointer(b, v, opts)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\treturn b, nil\n}\n\nfunc consumeMessageSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tm := reflect.New(f.mi.GoReflectType.Elem()).Interface()\n\tmp := pointerOfIface(m)\n\to, err := f.mi.unmarshalPointer(v, mp, 0, opts)\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tp.AppendPointerSlice(mp)\n\tout.n = n\n\tout.initialized = o.initialized\n\treturn out, nil\n}\n\nfunc isInitMessageSliceInfo(p pointer, f *coderFieldInfo) error {\n\ts := p.PointerSlice()\n\tfor _, v := range s {\n\t\tif err := f.mi.checkInitializedPointer(v); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc sizeMessageSlice(p pointer, goType reflect.Type, tagsize int, _ marshalOptions) int {\n\ts := p.PointerSlice()\n\tn := 0\n\tfor _, v := range s {\n\t\tm := asMessage(v.AsValueOf(goType.Elem()))\n\t\tn += protowire.SizeBytes(proto.Size(m)) + tagsize\n\t}\n\treturn n\n}\n\nfunc appendMessageSlice(b []byte, p pointer, wiretag uint64, goType reflect.Type, opts marshalOptions) ([]byte, error) {\n\ts := p.PointerSlice()\n\tvar err error\n\tfor _, v := range s {\n\t\tm := asMessage(v.AsValueOf(goType.Elem()))\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tsiz := proto.Size(m)\n\t\tb = protowire.AppendVarint(b, uint64(siz))\n\t\tb, err = opts.Options().MarshalAppend(b, m)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\treturn b, nil\n}\n\nfunc consumeMessageSlice(b []byte, p pointer, goType reflect.Type, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tmp := reflect.New(goType.Elem())\n\to, err := opts.Options().UnmarshalState(piface.UnmarshalInput{\n\t\tBuf:     v,\n\t\tMessage: asMessage(mp).ProtoReflect(),\n\t})\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tp.AppendPointerSlice(pointerOfValue(mp))\n\tout.n = n\n\tout.initialized = o.Flags&piface.UnmarshalInitialized != 0\n\treturn out, nil\n}\n\nfunc isInitMessageSlice(p pointer, goType reflect.Type) error {\n\ts := p.PointerSlice()\n\tfor _, v := range s {\n\t\tm := asMessage(v.AsValueOf(goType.Elem()))\n\t\tif err := proto.CheckInitialized(m); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// Slices of messages\n\nfunc sizeMessageSliceValue(listv pref.Value, tagsize int, opts marshalOptions) int {\n\tlist := listv.List()\n\tn := 0\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tm := list.Get(i).Message().Interface()\n\t\tn += protowire.SizeBytes(proto.Size(m)) + tagsize\n\t}\n\treturn n\n}\n\nfunc appendMessageSliceValue(b []byte, listv pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tmopts := opts.Options()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tm := list.Get(i).Message().Interface()\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tsiz := proto.Size(m)\n\t\tb = protowire.AppendVarint(b, uint64(siz))\n\t\tvar err error\n\t\tb, err = mopts.MarshalAppend(b, m)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\treturn b, nil\n}\n\nfunc consumeMessageSliceValue(b []byte, listv pref.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp != protowire.BytesType {\n\t\treturn pref.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn pref.Value{}, out, errDecode\n\t}\n\tm := list.NewElement()\n\to, err := opts.Options().UnmarshalState(piface.UnmarshalInput{\n\t\tBuf:     v,\n\t\tMessage: m.Message(),\n\t})\n\tif err != nil {\n\t\treturn pref.Value{}, out, err\n\t}\n\tlist.Append(m)\n\tout.n = n\n\tout.initialized = o.Flags&piface.UnmarshalInitialized != 0\n\treturn listv, out, nil\n}\n\nfunc isInitMessageSliceValue(listv pref.Value) error {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tm := list.Get(i).Message().Interface()\n\t\tif err := proto.CheckInitialized(m); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nvar coderMessageSliceValue = valueCoderFuncs{\n\tsize:      sizeMessageSliceValue,\n\tmarshal:   appendMessageSliceValue,\n\tunmarshal: consumeMessageSliceValue,\n\tisInit:    isInitMessageSliceValue,\n\tmerge:     mergeMessageListValue,\n}\n\nfunc sizeGroupSliceValue(listv pref.Value, tagsize int, opts marshalOptions) int {\n\tlist := listv.List()\n\tn := 0\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tm := list.Get(i).Message().Interface()\n\t\tn += 2*tagsize + proto.Size(m)\n\t}\n\treturn n\n}\n\nfunc appendGroupSliceValue(b []byte, listv pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tmopts := opts.Options()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tm := list.Get(i).Message().Interface()\n\t\tb = protowire.AppendVarint(b, wiretag) // start group\n\t\tvar err error\n\t\tb, err = mopts.MarshalAppend(b, m)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t\tb = protowire.AppendVarint(b, wiretag+1) // end group\n\t}\n\treturn b, nil\n}\n\nfunc consumeGroupSliceValue(b []byte, listv pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp != protowire.StartGroupType {\n\t\treturn pref.Value{}, out, errUnknown\n\t}\n\tb, n := protowire.ConsumeGroup(num, b)\n\tif n < 0 {\n\t\treturn pref.Value{}, out, errDecode\n\t}\n\tm := list.NewElement()\n\to, err := opts.Options().UnmarshalState(piface.UnmarshalInput{\n\t\tBuf:     b,\n\t\tMessage: m.Message(),\n\t})\n\tif err != nil {\n\t\treturn pref.Value{}, out, err\n\t}\n\tlist.Append(m)\n\tout.n = n\n\tout.initialized = o.Flags&piface.UnmarshalInitialized != 0\n\treturn listv, out, nil\n}\n\nvar coderGroupSliceValue = valueCoderFuncs{\n\tsize:      sizeGroupSliceValue,\n\tmarshal:   appendGroupSliceValue,\n\tunmarshal: consumeGroupSliceValue,\n\tisInit:    isInitMessageSliceValue,\n\tmerge:     mergeMessageListValue,\n}\n\nfunc makeGroupSliceFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {\n\tnum := fd.Number()\n\tif mi := getMessageInfo(ft); mi != nil {\n\t\tfuncs := pointerCoderFuncs{\n\t\t\tsize:      sizeGroupSliceInfo,\n\t\t\tmarshal:   appendGroupSliceInfo,\n\t\t\tunmarshal: consumeGroupSliceInfo,\n\t\t\tmerge:     mergeMessageSlice,\n\t\t}\n\t\tif needsInitCheck(mi.Desc) {\n\t\t\tfuncs.isInit = isInitMessageSliceInfo\n\t\t}\n\t\treturn funcs\n\t}\n\treturn pointerCoderFuncs{\n\t\tsize: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\t\t\treturn sizeGroupSlice(p, ft, f.tagsize, opts)\n\t\t},\n\t\tmarshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\t\treturn appendGroupSlice(b, p, f.wiretag, ft, opts)\n\t\t},\n\t\tunmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\treturn consumeGroupSlice(b, p, num, wtyp, ft, opts)\n\t\t},\n\t\tisInit: func(p pointer, f *coderFieldInfo) error {\n\t\t\treturn isInitMessageSlice(p, ft)\n\t\t},\n\t\tmerge: mergeMessageSlice,\n\t}\n}\n\nfunc sizeGroupSlice(p pointer, messageType reflect.Type, tagsize int, _ marshalOptions) int {\n\ts := p.PointerSlice()\n\tn := 0\n\tfor _, v := range s {\n\t\tm := asMessage(v.AsValueOf(messageType.Elem()))\n\t\tn += 2*tagsize + proto.Size(m)\n\t}\n\treturn n\n}\n\nfunc appendGroupSlice(b []byte, p pointer, wiretag uint64, messageType reflect.Type, opts marshalOptions) ([]byte, error) {\n\ts := p.PointerSlice()\n\tvar err error\n\tfor _, v := range s {\n\t\tm := asMessage(v.AsValueOf(messageType.Elem()))\n\t\tb = protowire.AppendVarint(b, wiretag) // start group\n\t\tb, err = opts.Options().MarshalAppend(b, m)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t\tb = protowire.AppendVarint(b, wiretag+1) // end group\n\t}\n\treturn b, nil\n}\n\nfunc consumeGroupSlice(b []byte, p pointer, num protowire.Number, wtyp protowire.Type, goType reflect.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.StartGroupType {\n\t\treturn out, errUnknown\n\t}\n\tb, n := protowire.ConsumeGroup(num, b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tmp := reflect.New(goType.Elem())\n\to, err := opts.Options().UnmarshalState(piface.UnmarshalInput{\n\t\tBuf:     b,\n\t\tMessage: asMessage(mp).ProtoReflect(),\n\t})\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tp.AppendPointerSlice(pointerOfValue(mp))\n\tout.n = n\n\tout.initialized = o.Flags&piface.UnmarshalInitialized != 0\n\treturn out, nil\n}\n\nfunc sizeGroupSliceInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\ts := p.PointerSlice()\n\tn := 0\n\tfor _, v := range s {\n\t\tn += 2*f.tagsize + f.mi.sizePointer(v, opts)\n\t}\n\treturn n\n}\n\nfunc appendGroupSliceInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := p.PointerSlice()\n\tvar err error\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag) // start group\n\t\tb, err = f.mi.marshalAppendPointer(b, v, opts)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t\tb = protowire.AppendVarint(b, f.wiretag+1) // end group\n\t}\n\treturn b, nil\n}\n\nfunc consumeGroupSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\tif wtyp != protowire.StartGroupType {\n\t\treturn unmarshalOutput{}, errUnknown\n\t}\n\tm := reflect.New(f.mi.GoReflectType.Elem()).Interface()\n\tmp := pointerOfIface(m)\n\tout, err := f.mi.unmarshalPointer(b, mp, f.num, opts)\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tp.AppendPointerSlice(mp)\n\treturn out, nil\n}\n\nfunc asMessage(v reflect.Value) pref.ProtoMessage {\n\tif m, ok := v.Interface().(pref.ProtoMessage); ok {\n\t\treturn m\n\t}\n\treturn legacyWrapMessage(v).Interface()\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/codec_gen.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// Code generated by generate-types. DO NOT EDIT.\n\npackage impl\n\nimport (\n\t\"math\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// sizeBool returns the size of wire encoding a bool pointer as a Bool.\nfunc sizeBool(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Bool()\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))\n}\n\n// appendBool wire encodes a bool pointer as a Bool.\nfunc appendBool(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Bool()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeBool(v))\n\treturn b, nil\n}\n\n// consumeBool wire decodes a bool pointer as a Bool.\nfunc consumeBool(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Bool() = protowire.DecodeBool(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBool = pointerCoderFuncs{\n\tsize:      sizeBool,\n\tmarshal:   appendBool,\n\tunmarshal: consumeBool,\n\tmerge:     mergeBool,\n}\n\n// sizeBoolNoZero returns the size of wire encoding a bool pointer as a Bool.\n// The zero value is not encoded.\nfunc sizeBoolNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Bool()\n\tif v == false {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))\n}\n\n// appendBoolNoZero wire encodes a bool pointer as a Bool.\n// The zero value is not encoded.\nfunc appendBoolNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Bool()\n\tif v == false {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeBool(v))\n\treturn b, nil\n}\n\nvar coderBoolNoZero = pointerCoderFuncs{\n\tsize:      sizeBoolNoZero,\n\tmarshal:   appendBoolNoZero,\n\tunmarshal: consumeBool,\n\tmerge:     mergeBoolNoZero,\n}\n\n// sizeBoolPtr returns the size of wire encoding a *bool pointer as a Bool.\n// It panics if the pointer is nil.\nfunc sizeBoolPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.BoolPtr()\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))\n}\n\n// appendBoolPtr wire encodes a *bool pointer as a Bool.\n// It panics if the pointer is nil.\nfunc appendBoolPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.BoolPtr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeBool(v))\n\treturn b, nil\n}\n\n// consumeBoolPtr wire decodes a *bool pointer as a Bool.\nfunc consumeBoolPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.BoolPtr()\n\tif *vp == nil {\n\t\t*vp = new(bool)\n\t}\n\t**vp = protowire.DecodeBool(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBoolPtr = pointerCoderFuncs{\n\tsize:      sizeBoolPtr,\n\tmarshal:   appendBoolPtr,\n\tunmarshal: consumeBoolPtr,\n\tmerge:     mergeBoolPtr,\n}\n\n// sizeBoolSlice returns the size of wire encoding a []bool pointer as a repeated Bool.\nfunc sizeBoolSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.BoolSlice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))\n\t}\n\treturn size\n}\n\n// appendBoolSlice encodes a []bool pointer as a repeated Bool.\nfunc appendBoolSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.BoolSlice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeBool(v))\n\t}\n\treturn b, nil\n}\n\n// consumeBoolSlice wire decodes a []bool pointer as a repeated Bool.\nfunc consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.BoolSlice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, protowire.DecodeBool(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, protowire.DecodeBool(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBoolSlice = pointerCoderFuncs{\n\tsize:      sizeBoolSlice,\n\tmarshal:   appendBoolSlice,\n\tunmarshal: consumeBoolSlice,\n\tmerge:     mergeBoolSlice,\n}\n\n// sizeBoolPackedSlice returns the size of wire encoding a []bool pointer as a packed repeated Bool.\nfunc sizeBoolPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.BoolSlice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(protowire.EncodeBool(v))\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendBoolPackedSlice encodes a []bool pointer as a packed repeated Bool.\nfunc appendBoolPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.BoolSlice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(protowire.EncodeBool(v))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, protowire.EncodeBool(v))\n\t}\n\treturn b, nil\n}\n\nvar coderBoolPackedSlice = pointerCoderFuncs{\n\tsize:      sizeBoolPackedSlice,\n\tmarshal:   appendBoolPackedSlice,\n\tunmarshal: consumeBoolSlice,\n\tmerge:     mergeBoolSlice,\n}\n\n// sizeBoolValue returns the size of wire encoding a bool value as a Bool.\nfunc sizeBoolValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool()))\n}\n\n// appendBoolValue encodes a bool value as a Bool.\nfunc appendBoolValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))\n\treturn b, nil\n}\n\n// consumeBoolValue decodes a bool value as a Bool.\nfunc consumeBoolValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfBool(protowire.DecodeBool(v)), out, nil\n}\n\nvar coderBoolValue = valueCoderFuncs{\n\tsize:      sizeBoolValue,\n\tmarshal:   appendBoolValue,\n\tunmarshal: consumeBoolValue,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeBoolSliceValue returns the size of wire encoding a []bool value as a repeated Bool.\nfunc sizeBoolSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool()))\n\t}\n\treturn size\n}\n\n// appendBoolSliceValue encodes a []bool value as a repeated Bool.\nfunc appendBoolSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))\n\t}\n\treturn b, nil\n}\n\n// consumeBoolSliceValue wire decodes a []bool value as a repeated Bool.\nfunc consumeBoolSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderBoolSliceValue = valueCoderFuncs{\n\tsize:      sizeBoolSliceValue,\n\tmarshal:   appendBoolSliceValue,\n\tunmarshal: consumeBoolSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeBoolPackedSliceValue returns the size of wire encoding a []bool value as a packed repeated Bool.\nfunc sizeBoolPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(protowire.EncodeBool(v.Bool()))\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendBoolPackedSliceValue encodes a []bool value as a packed repeated Bool.\nfunc appendBoolPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(protowire.EncodeBool(v.Bool()))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))\n\t}\n\treturn b, nil\n}\n\nvar coderBoolPackedSliceValue = valueCoderFuncs{\n\tsize:      sizeBoolPackedSliceValue,\n\tmarshal:   appendBoolPackedSliceValue,\n\tunmarshal: consumeBoolSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeEnumValue returns the size of wire encoding a  value as a Enum.\nfunc sizeEnumValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(uint64(v.Enum()))\n}\n\n// appendEnumValue encodes a  value as a Enum.\nfunc appendEnumValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, uint64(v.Enum()))\n\treturn b, nil\n}\n\n// consumeEnumValue decodes a  value as a Enum.\nfunc consumeEnumValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), out, nil\n}\n\nvar coderEnumValue = valueCoderFuncs{\n\tsize:      sizeEnumValue,\n\tmarshal:   appendEnumValue,\n\tunmarshal: consumeEnumValue,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeEnumSliceValue returns the size of wire encoding a [] value as a repeated Enum.\nfunc sizeEnumSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(uint64(v.Enum()))\n\t}\n\treturn size\n}\n\n// appendEnumSliceValue encodes a [] value as a repeated Enum.\nfunc appendEnumSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(v.Enum()))\n\t}\n\treturn b, nil\n}\n\n// consumeEnumSliceValue wire decodes a [] value as a repeated Enum.\nfunc consumeEnumSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderEnumSliceValue = valueCoderFuncs{\n\tsize:      sizeEnumSliceValue,\n\tmarshal:   appendEnumSliceValue,\n\tunmarshal: consumeEnumSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeEnumPackedSliceValue returns the size of wire encoding a [] value as a packed repeated Enum.\nfunc sizeEnumPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(v.Enum()))\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendEnumPackedSliceValue encodes a [] value as a packed repeated Enum.\nfunc appendEnumPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(v.Enum()))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, uint64(v.Enum()))\n\t}\n\treturn b, nil\n}\n\nvar coderEnumPackedSliceValue = valueCoderFuncs{\n\tsize:      sizeEnumPackedSliceValue,\n\tmarshal:   appendEnumPackedSliceValue,\n\tunmarshal: consumeEnumSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeInt32 returns the size of wire encoding a int32 pointer as a Int32.\nfunc sizeInt32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int32()\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendInt32 wire encodes a int32 pointer as a Int32.\nfunc appendInt32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int32()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeInt32 wire decodes a int32 pointer as a Int32.\nfunc consumeInt32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Int32() = int32(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderInt32 = pointerCoderFuncs{\n\tsize:      sizeInt32,\n\tmarshal:   appendInt32,\n\tunmarshal: consumeInt32,\n\tmerge:     mergeInt32,\n}\n\n// sizeInt32NoZero returns the size of wire encoding a int32 pointer as a Int32.\n// The zero value is not encoded.\nfunc sizeInt32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int32()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendInt32NoZero wire encodes a int32 pointer as a Int32.\n// The zero value is not encoded.\nfunc appendInt32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int32()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\nvar coderInt32NoZero = pointerCoderFuncs{\n\tsize:      sizeInt32NoZero,\n\tmarshal:   appendInt32NoZero,\n\tunmarshal: consumeInt32,\n\tmerge:     mergeInt32NoZero,\n}\n\n// sizeInt32Ptr returns the size of wire encoding a *int32 pointer as a Int32.\n// It panics if the pointer is nil.\nfunc sizeInt32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.Int32Ptr()\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendInt32Ptr wire encodes a *int32 pointer as a Int32.\n// It panics if the pointer is nil.\nfunc appendInt32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Int32Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeInt32Ptr wire decodes a *int32 pointer as a Int32.\nfunc consumeInt32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Int32Ptr()\n\tif *vp == nil {\n\t\t*vp = new(int32)\n\t}\n\t**vp = int32(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderInt32Ptr = pointerCoderFuncs{\n\tsize:      sizeInt32Ptr,\n\tmarshal:   appendInt32Ptr,\n\tunmarshal: consumeInt32Ptr,\n\tmerge:     mergeInt32Ptr,\n}\n\n// sizeInt32Slice returns the size of wire encoding a []int32 pointer as a repeated Int32.\nfunc sizeInt32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int32Slice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeVarint(uint64(v))\n\t}\n\treturn size\n}\n\n// appendInt32Slice encodes a []int32 pointer as a repeated Int32.\nfunc appendInt32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int32Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\n// consumeInt32Slice wire decodes a []int32 pointer as a repeated Int32.\nfunc consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Int32Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, int32(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, int32(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderInt32Slice = pointerCoderFuncs{\n\tsize:      sizeInt32Slice,\n\tmarshal:   appendInt32Slice,\n\tunmarshal: consumeInt32Slice,\n\tmerge:     mergeInt32Slice,\n}\n\n// sizeInt32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Int32.\nfunc sizeInt32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int32Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(uint64(v))\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendInt32PackedSlice encodes a []int32 pointer as a packed repeated Int32.\nfunc appendInt32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int32Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(uint64(v))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\nvar coderInt32PackedSlice = pointerCoderFuncs{\n\tsize:      sizeInt32PackedSlice,\n\tmarshal:   appendInt32PackedSlice,\n\tunmarshal: consumeInt32Slice,\n\tmerge:     mergeInt32Slice,\n}\n\n// sizeInt32Value returns the size of wire encoding a int32 value as a Int32.\nfunc sizeInt32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(uint64(int32(v.Int())))\n}\n\n// appendInt32Value encodes a int32 value as a Int32.\nfunc appendInt32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, uint64(int32(v.Int())))\n\treturn b, nil\n}\n\n// consumeInt32Value decodes a int32 value as a Int32.\nfunc consumeInt32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfInt32(int32(v)), out, nil\n}\n\nvar coderInt32Value = valueCoderFuncs{\n\tsize:      sizeInt32Value,\n\tmarshal:   appendInt32Value,\n\tunmarshal: consumeInt32Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeInt32SliceValue returns the size of wire encoding a []int32 value as a repeated Int32.\nfunc sizeInt32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(uint64(int32(v.Int())))\n\t}\n\treturn size\n}\n\n// appendInt32SliceValue encodes a []int32 value as a repeated Int32.\nfunc appendInt32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(int32(v.Int())))\n\t}\n\treturn b, nil\n}\n\n// consumeInt32SliceValue wire decodes a []int32 value as a repeated Int32.\nfunc consumeInt32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderInt32SliceValue = valueCoderFuncs{\n\tsize:      sizeInt32SliceValue,\n\tmarshal:   appendInt32SliceValue,\n\tunmarshal: consumeInt32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeInt32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Int32.\nfunc sizeInt32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(int32(v.Int())))\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendInt32PackedSliceValue encodes a []int32 value as a packed repeated Int32.\nfunc appendInt32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(int32(v.Int())))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, uint64(int32(v.Int())))\n\t}\n\treturn b, nil\n}\n\nvar coderInt32PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeInt32PackedSliceValue,\n\tmarshal:   appendInt32PackedSliceValue,\n\tunmarshal: consumeInt32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSint32 returns the size of wire encoding a int32 pointer as a Sint32.\nfunc sizeSint32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int32()\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))\n}\n\n// appendSint32 wire encodes a int32 pointer as a Sint32.\nfunc appendSint32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int32()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))\n\treturn b, nil\n}\n\n// consumeSint32 wire decodes a int32 pointer as a Sint32.\nfunc consumeSint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Int32() = int32(protowire.DecodeZigZag(v & math.MaxUint32))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSint32 = pointerCoderFuncs{\n\tsize:      sizeSint32,\n\tmarshal:   appendSint32,\n\tunmarshal: consumeSint32,\n\tmerge:     mergeInt32,\n}\n\n// sizeSint32NoZero returns the size of wire encoding a int32 pointer as a Sint32.\n// The zero value is not encoded.\nfunc sizeSint32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int32()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))\n}\n\n// appendSint32NoZero wire encodes a int32 pointer as a Sint32.\n// The zero value is not encoded.\nfunc appendSint32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int32()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))\n\treturn b, nil\n}\n\nvar coderSint32NoZero = pointerCoderFuncs{\n\tsize:      sizeSint32NoZero,\n\tmarshal:   appendSint32NoZero,\n\tunmarshal: consumeSint32,\n\tmerge:     mergeInt32NoZero,\n}\n\n// sizeSint32Ptr returns the size of wire encoding a *int32 pointer as a Sint32.\n// It panics if the pointer is nil.\nfunc sizeSint32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.Int32Ptr()\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))\n}\n\n// appendSint32Ptr wire encodes a *int32 pointer as a Sint32.\n// It panics if the pointer is nil.\nfunc appendSint32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Int32Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))\n\treturn b, nil\n}\n\n// consumeSint32Ptr wire decodes a *int32 pointer as a Sint32.\nfunc consumeSint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Int32Ptr()\n\tif *vp == nil {\n\t\t*vp = new(int32)\n\t}\n\t**vp = int32(protowire.DecodeZigZag(v & math.MaxUint32))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSint32Ptr = pointerCoderFuncs{\n\tsize:      sizeSint32Ptr,\n\tmarshal:   appendSint32Ptr,\n\tunmarshal: consumeSint32Ptr,\n\tmerge:     mergeInt32Ptr,\n}\n\n// sizeSint32Slice returns the size of wire encoding a []int32 pointer as a repeated Sint32.\nfunc sizeSint32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int32Slice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))\n\t}\n\treturn size\n}\n\n// appendSint32Slice encodes a []int32 pointer as a repeated Sint32.\nfunc appendSint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int32Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))\n\t}\n\treturn b, nil\n}\n\n// consumeSint32Slice wire decodes a []int32 pointer as a repeated Sint32.\nfunc consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Int32Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, int32(protowire.DecodeZigZag(v&math.MaxUint32)))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, int32(protowire.DecodeZigZag(v&math.MaxUint32)))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSint32Slice = pointerCoderFuncs{\n\tsize:      sizeSint32Slice,\n\tmarshal:   appendSint32Slice,\n\tunmarshal: consumeSint32Slice,\n\tmerge:     mergeInt32Slice,\n}\n\n// sizeSint32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sint32.\nfunc sizeSint32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int32Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendSint32PackedSlice encodes a []int32 pointer as a packed repeated Sint32.\nfunc appendSint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int32Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))\n\t}\n\treturn b, nil\n}\n\nvar coderSint32PackedSlice = pointerCoderFuncs{\n\tsize:      sizeSint32PackedSlice,\n\tmarshal:   appendSint32PackedSlice,\n\tunmarshal: consumeSint32Slice,\n\tmerge:     mergeInt32Slice,\n}\n\n// sizeSint32Value returns the size of wire encoding a int32 value as a Sint32.\nfunc sizeSint32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))\n}\n\n// appendSint32Value encodes a int32 value as a Sint32.\nfunc appendSint32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))\n\treturn b, nil\n}\n\n// consumeSint32Value decodes a int32 value as a Sint32.\nfunc consumeSint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), out, nil\n}\n\nvar coderSint32Value = valueCoderFuncs{\n\tsize:      sizeSint32Value,\n\tmarshal:   appendSint32Value,\n\tunmarshal: consumeSint32Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeSint32SliceValue returns the size of wire encoding a []int32 value as a repeated Sint32.\nfunc sizeSint32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))\n\t}\n\treturn size\n}\n\n// appendSint32SliceValue encodes a []int32 value as a repeated Sint32.\nfunc appendSint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))\n\t}\n\treturn b, nil\n}\n\n// consumeSint32SliceValue wire decodes a []int32 value as a repeated Sint32.\nfunc consumeSint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderSint32SliceValue = valueCoderFuncs{\n\tsize:      sizeSint32SliceValue,\n\tmarshal:   appendSint32SliceValue,\n\tunmarshal: consumeSint32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSint32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Sint32.\nfunc sizeSint32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendSint32PackedSliceValue encodes a []int32 value as a packed repeated Sint32.\nfunc appendSint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))\n\t}\n\treturn b, nil\n}\n\nvar coderSint32PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeSint32PackedSliceValue,\n\tmarshal:   appendSint32PackedSliceValue,\n\tunmarshal: consumeSint32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeUint32 returns the size of wire encoding a uint32 pointer as a Uint32.\nfunc sizeUint32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Uint32()\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendUint32 wire encodes a uint32 pointer as a Uint32.\nfunc appendUint32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint32()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeUint32 wire decodes a uint32 pointer as a Uint32.\nfunc consumeUint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Uint32() = uint32(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderUint32 = pointerCoderFuncs{\n\tsize:      sizeUint32,\n\tmarshal:   appendUint32,\n\tunmarshal: consumeUint32,\n\tmerge:     mergeUint32,\n}\n\n// sizeUint32NoZero returns the size of wire encoding a uint32 pointer as a Uint32.\n// The zero value is not encoded.\nfunc sizeUint32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Uint32()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendUint32NoZero wire encodes a uint32 pointer as a Uint32.\n// The zero value is not encoded.\nfunc appendUint32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint32()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\nvar coderUint32NoZero = pointerCoderFuncs{\n\tsize:      sizeUint32NoZero,\n\tmarshal:   appendUint32NoZero,\n\tunmarshal: consumeUint32,\n\tmerge:     mergeUint32NoZero,\n}\n\n// sizeUint32Ptr returns the size of wire encoding a *uint32 pointer as a Uint32.\n// It panics if the pointer is nil.\nfunc sizeUint32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.Uint32Ptr()\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendUint32Ptr wire encodes a *uint32 pointer as a Uint32.\n// It panics if the pointer is nil.\nfunc appendUint32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Uint32Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeUint32Ptr wire decodes a *uint32 pointer as a Uint32.\nfunc consumeUint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Uint32Ptr()\n\tif *vp == nil {\n\t\t*vp = new(uint32)\n\t}\n\t**vp = uint32(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderUint32Ptr = pointerCoderFuncs{\n\tsize:      sizeUint32Ptr,\n\tmarshal:   appendUint32Ptr,\n\tunmarshal: consumeUint32Ptr,\n\tmerge:     mergeUint32Ptr,\n}\n\n// sizeUint32Slice returns the size of wire encoding a []uint32 pointer as a repeated Uint32.\nfunc sizeUint32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint32Slice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeVarint(uint64(v))\n\t}\n\treturn size\n}\n\n// appendUint32Slice encodes a []uint32 pointer as a repeated Uint32.\nfunc appendUint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint32Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\n// consumeUint32Slice wire decodes a []uint32 pointer as a repeated Uint32.\nfunc consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Uint32Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, uint32(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, uint32(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderUint32Slice = pointerCoderFuncs{\n\tsize:      sizeUint32Slice,\n\tmarshal:   appendUint32Slice,\n\tunmarshal: consumeUint32Slice,\n\tmerge:     mergeUint32Slice,\n}\n\n// sizeUint32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Uint32.\nfunc sizeUint32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint32Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(uint64(v))\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendUint32PackedSlice encodes a []uint32 pointer as a packed repeated Uint32.\nfunc appendUint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint32Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(uint64(v))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\nvar coderUint32PackedSlice = pointerCoderFuncs{\n\tsize:      sizeUint32PackedSlice,\n\tmarshal:   appendUint32PackedSlice,\n\tunmarshal: consumeUint32Slice,\n\tmerge:     mergeUint32Slice,\n}\n\n// sizeUint32Value returns the size of wire encoding a uint32 value as a Uint32.\nfunc sizeUint32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(uint64(uint32(v.Uint())))\n}\n\n// appendUint32Value encodes a uint32 value as a Uint32.\nfunc appendUint32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, uint64(uint32(v.Uint())))\n\treturn b, nil\n}\n\n// consumeUint32Value decodes a uint32 value as a Uint32.\nfunc consumeUint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfUint32(uint32(v)), out, nil\n}\n\nvar coderUint32Value = valueCoderFuncs{\n\tsize:      sizeUint32Value,\n\tmarshal:   appendUint32Value,\n\tunmarshal: consumeUint32Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeUint32SliceValue returns the size of wire encoding a []uint32 value as a repeated Uint32.\nfunc sizeUint32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(uint64(uint32(v.Uint())))\n\t}\n\treturn size\n}\n\n// appendUint32SliceValue encodes a []uint32 value as a repeated Uint32.\nfunc appendUint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(uint32(v.Uint())))\n\t}\n\treturn b, nil\n}\n\n// consumeUint32SliceValue wire decodes a []uint32 value as a repeated Uint32.\nfunc consumeUint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderUint32SliceValue = valueCoderFuncs{\n\tsize:      sizeUint32SliceValue,\n\tmarshal:   appendUint32SliceValue,\n\tunmarshal: consumeUint32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeUint32PackedSliceValue returns the size of wire encoding a []uint32 value as a packed repeated Uint32.\nfunc sizeUint32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(uint32(v.Uint())))\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendUint32PackedSliceValue encodes a []uint32 value as a packed repeated Uint32.\nfunc appendUint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(uint32(v.Uint())))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, uint64(uint32(v.Uint())))\n\t}\n\treturn b, nil\n}\n\nvar coderUint32PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeUint32PackedSliceValue,\n\tmarshal:   appendUint32PackedSliceValue,\n\tunmarshal: consumeUint32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeInt64 returns the size of wire encoding a int64 pointer as a Int64.\nfunc sizeInt64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int64()\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendInt64 wire encodes a int64 pointer as a Int64.\nfunc appendInt64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int64()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeInt64 wire decodes a int64 pointer as a Int64.\nfunc consumeInt64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Int64() = int64(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderInt64 = pointerCoderFuncs{\n\tsize:      sizeInt64,\n\tmarshal:   appendInt64,\n\tunmarshal: consumeInt64,\n\tmerge:     mergeInt64,\n}\n\n// sizeInt64NoZero returns the size of wire encoding a int64 pointer as a Int64.\n// The zero value is not encoded.\nfunc sizeInt64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int64()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendInt64NoZero wire encodes a int64 pointer as a Int64.\n// The zero value is not encoded.\nfunc appendInt64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int64()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\nvar coderInt64NoZero = pointerCoderFuncs{\n\tsize:      sizeInt64NoZero,\n\tmarshal:   appendInt64NoZero,\n\tunmarshal: consumeInt64,\n\tmerge:     mergeInt64NoZero,\n}\n\n// sizeInt64Ptr returns the size of wire encoding a *int64 pointer as a Int64.\n// It panics if the pointer is nil.\nfunc sizeInt64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.Int64Ptr()\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendInt64Ptr wire encodes a *int64 pointer as a Int64.\n// It panics if the pointer is nil.\nfunc appendInt64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Int64Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeInt64Ptr wire decodes a *int64 pointer as a Int64.\nfunc consumeInt64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Int64Ptr()\n\tif *vp == nil {\n\t\t*vp = new(int64)\n\t}\n\t**vp = int64(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderInt64Ptr = pointerCoderFuncs{\n\tsize:      sizeInt64Ptr,\n\tmarshal:   appendInt64Ptr,\n\tunmarshal: consumeInt64Ptr,\n\tmerge:     mergeInt64Ptr,\n}\n\n// sizeInt64Slice returns the size of wire encoding a []int64 pointer as a repeated Int64.\nfunc sizeInt64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int64Slice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeVarint(uint64(v))\n\t}\n\treturn size\n}\n\n// appendInt64Slice encodes a []int64 pointer as a repeated Int64.\nfunc appendInt64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int64Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\n// consumeInt64Slice wire decodes a []int64 pointer as a repeated Int64.\nfunc consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Int64Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, int64(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, int64(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderInt64Slice = pointerCoderFuncs{\n\tsize:      sizeInt64Slice,\n\tmarshal:   appendInt64Slice,\n\tunmarshal: consumeInt64Slice,\n\tmerge:     mergeInt64Slice,\n}\n\n// sizeInt64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Int64.\nfunc sizeInt64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int64Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(uint64(v))\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendInt64PackedSlice encodes a []int64 pointer as a packed repeated Int64.\nfunc appendInt64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int64Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(uint64(v))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\nvar coderInt64PackedSlice = pointerCoderFuncs{\n\tsize:      sizeInt64PackedSlice,\n\tmarshal:   appendInt64PackedSlice,\n\tunmarshal: consumeInt64Slice,\n\tmerge:     mergeInt64Slice,\n}\n\n// sizeInt64Value returns the size of wire encoding a int64 value as a Int64.\nfunc sizeInt64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(uint64(v.Int()))\n}\n\n// appendInt64Value encodes a int64 value as a Int64.\nfunc appendInt64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, uint64(v.Int()))\n\treturn b, nil\n}\n\n// consumeInt64Value decodes a int64 value as a Int64.\nfunc consumeInt64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfInt64(int64(v)), out, nil\n}\n\nvar coderInt64Value = valueCoderFuncs{\n\tsize:      sizeInt64Value,\n\tmarshal:   appendInt64Value,\n\tunmarshal: consumeInt64Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeInt64SliceValue returns the size of wire encoding a []int64 value as a repeated Int64.\nfunc sizeInt64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(uint64(v.Int()))\n\t}\n\treturn size\n}\n\n// appendInt64SliceValue encodes a []int64 value as a repeated Int64.\nfunc appendInt64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(v.Int()))\n\t}\n\treturn b, nil\n}\n\n// consumeInt64SliceValue wire decodes a []int64 value as a repeated Int64.\nfunc consumeInt64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderInt64SliceValue = valueCoderFuncs{\n\tsize:      sizeInt64SliceValue,\n\tmarshal:   appendInt64SliceValue,\n\tunmarshal: consumeInt64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeInt64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Int64.\nfunc sizeInt64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(v.Int()))\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendInt64PackedSliceValue encodes a []int64 value as a packed repeated Int64.\nfunc appendInt64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(v.Int()))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, uint64(v.Int()))\n\t}\n\treturn b, nil\n}\n\nvar coderInt64PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeInt64PackedSliceValue,\n\tmarshal:   appendInt64PackedSliceValue,\n\tunmarshal: consumeInt64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSint64 returns the size of wire encoding a int64 pointer as a Sint64.\nfunc sizeSint64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int64()\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))\n}\n\n// appendSint64 wire encodes a int64 pointer as a Sint64.\nfunc appendSint64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int64()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v))\n\treturn b, nil\n}\n\n// consumeSint64 wire decodes a int64 pointer as a Sint64.\nfunc consumeSint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Int64() = protowire.DecodeZigZag(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSint64 = pointerCoderFuncs{\n\tsize:      sizeSint64,\n\tmarshal:   appendSint64,\n\tunmarshal: consumeSint64,\n\tmerge:     mergeInt64,\n}\n\n// sizeSint64NoZero returns the size of wire encoding a int64 pointer as a Sint64.\n// The zero value is not encoded.\nfunc sizeSint64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int64()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))\n}\n\n// appendSint64NoZero wire encodes a int64 pointer as a Sint64.\n// The zero value is not encoded.\nfunc appendSint64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int64()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v))\n\treturn b, nil\n}\n\nvar coderSint64NoZero = pointerCoderFuncs{\n\tsize:      sizeSint64NoZero,\n\tmarshal:   appendSint64NoZero,\n\tunmarshal: consumeSint64,\n\tmerge:     mergeInt64NoZero,\n}\n\n// sizeSint64Ptr returns the size of wire encoding a *int64 pointer as a Sint64.\n// It panics if the pointer is nil.\nfunc sizeSint64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.Int64Ptr()\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))\n}\n\n// appendSint64Ptr wire encodes a *int64 pointer as a Sint64.\n// It panics if the pointer is nil.\nfunc appendSint64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Int64Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v))\n\treturn b, nil\n}\n\n// consumeSint64Ptr wire decodes a *int64 pointer as a Sint64.\nfunc consumeSint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Int64Ptr()\n\tif *vp == nil {\n\t\t*vp = new(int64)\n\t}\n\t**vp = protowire.DecodeZigZag(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSint64Ptr = pointerCoderFuncs{\n\tsize:      sizeSint64Ptr,\n\tmarshal:   appendSint64Ptr,\n\tunmarshal: consumeSint64Ptr,\n\tmerge:     mergeInt64Ptr,\n}\n\n// sizeSint64Slice returns the size of wire encoding a []int64 pointer as a repeated Sint64.\nfunc sizeSint64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int64Slice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))\n\t}\n\treturn size\n}\n\n// appendSint64Slice encodes a []int64 pointer as a repeated Sint64.\nfunc appendSint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int64Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v))\n\t}\n\treturn b, nil\n}\n\n// consumeSint64Slice wire decodes a []int64 pointer as a repeated Sint64.\nfunc consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Int64Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, protowire.DecodeZigZag(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, protowire.DecodeZigZag(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSint64Slice = pointerCoderFuncs{\n\tsize:      sizeSint64Slice,\n\tmarshal:   appendSint64Slice,\n\tunmarshal: consumeSint64Slice,\n\tmerge:     mergeInt64Slice,\n}\n\n// sizeSint64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sint64.\nfunc sizeSint64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int64Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(v))\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendSint64PackedSlice encodes a []int64 pointer as a packed repeated Sint64.\nfunc appendSint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int64Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(v))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v))\n\t}\n\treturn b, nil\n}\n\nvar coderSint64PackedSlice = pointerCoderFuncs{\n\tsize:      sizeSint64PackedSlice,\n\tmarshal:   appendSint64PackedSlice,\n\tunmarshal: consumeSint64Slice,\n\tmerge:     mergeInt64Slice,\n}\n\n// sizeSint64Value returns the size of wire encoding a int64 value as a Sint64.\nfunc sizeSint64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))\n}\n\n// appendSint64Value encodes a int64 value as a Sint64.\nfunc appendSint64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))\n\treturn b, nil\n}\n\n// consumeSint64Value decodes a int64 value as a Sint64.\nfunc consumeSint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), out, nil\n}\n\nvar coderSint64Value = valueCoderFuncs{\n\tsize:      sizeSint64Value,\n\tmarshal:   appendSint64Value,\n\tunmarshal: consumeSint64Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeSint64SliceValue returns the size of wire encoding a []int64 value as a repeated Sint64.\nfunc sizeSint64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))\n\t}\n\treturn size\n}\n\n// appendSint64SliceValue encodes a []int64 value as a repeated Sint64.\nfunc appendSint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))\n\t}\n\treturn b, nil\n}\n\n// consumeSint64SliceValue wire decodes a []int64 value as a repeated Sint64.\nfunc consumeSint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderSint64SliceValue = valueCoderFuncs{\n\tsize:      sizeSint64SliceValue,\n\tmarshal:   appendSint64SliceValue,\n\tunmarshal: consumeSint64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSint64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Sint64.\nfunc sizeSint64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendSint64PackedSliceValue encodes a []int64 value as a packed repeated Sint64.\nfunc appendSint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))\n\t}\n\treturn b, nil\n}\n\nvar coderSint64PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeSint64PackedSliceValue,\n\tmarshal:   appendSint64PackedSliceValue,\n\tunmarshal: consumeSint64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeUint64 returns the size of wire encoding a uint64 pointer as a Uint64.\nfunc sizeUint64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Uint64()\n\treturn f.tagsize + protowire.SizeVarint(v)\n}\n\n// appendUint64 wire encodes a uint64 pointer as a Uint64.\nfunc appendUint64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint64()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, v)\n\treturn b, nil\n}\n\n// consumeUint64 wire decodes a uint64 pointer as a Uint64.\nfunc consumeUint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Uint64() = v\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderUint64 = pointerCoderFuncs{\n\tsize:      sizeUint64,\n\tmarshal:   appendUint64,\n\tunmarshal: consumeUint64,\n\tmerge:     mergeUint64,\n}\n\n// sizeUint64NoZero returns the size of wire encoding a uint64 pointer as a Uint64.\n// The zero value is not encoded.\nfunc sizeUint64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Uint64()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeVarint(v)\n}\n\n// appendUint64NoZero wire encodes a uint64 pointer as a Uint64.\n// The zero value is not encoded.\nfunc appendUint64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint64()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, v)\n\treturn b, nil\n}\n\nvar coderUint64NoZero = pointerCoderFuncs{\n\tsize:      sizeUint64NoZero,\n\tmarshal:   appendUint64NoZero,\n\tunmarshal: consumeUint64,\n\tmerge:     mergeUint64NoZero,\n}\n\n// sizeUint64Ptr returns the size of wire encoding a *uint64 pointer as a Uint64.\n// It panics if the pointer is nil.\nfunc sizeUint64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.Uint64Ptr()\n\treturn f.tagsize + protowire.SizeVarint(v)\n}\n\n// appendUint64Ptr wire encodes a *uint64 pointer as a Uint64.\n// It panics if the pointer is nil.\nfunc appendUint64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Uint64Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, v)\n\treturn b, nil\n}\n\n// consumeUint64Ptr wire decodes a *uint64 pointer as a Uint64.\nfunc consumeUint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Uint64Ptr()\n\tif *vp == nil {\n\t\t*vp = new(uint64)\n\t}\n\t**vp = v\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderUint64Ptr = pointerCoderFuncs{\n\tsize:      sizeUint64Ptr,\n\tmarshal:   appendUint64Ptr,\n\tunmarshal: consumeUint64Ptr,\n\tmerge:     mergeUint64Ptr,\n}\n\n// sizeUint64Slice returns the size of wire encoding a []uint64 pointer as a repeated Uint64.\nfunc sizeUint64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint64Slice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeVarint(v)\n\t}\n\treturn size\n}\n\n// appendUint64Slice encodes a []uint64 pointer as a repeated Uint64.\nfunc appendUint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint64Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, v)\n\t}\n\treturn b, nil\n}\n\n// consumeUint64Slice wire decodes a []uint64 pointer as a repeated Uint64.\nfunc consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Uint64Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, v)\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderUint64Slice = pointerCoderFuncs{\n\tsize:      sizeUint64Slice,\n\tmarshal:   appendUint64Slice,\n\tunmarshal: consumeUint64Slice,\n\tmerge:     mergeUint64Slice,\n}\n\n// sizeUint64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Uint64.\nfunc sizeUint64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint64Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(v)\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendUint64PackedSlice encodes a []uint64 pointer as a packed repeated Uint64.\nfunc appendUint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint64Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(v)\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, v)\n\t}\n\treturn b, nil\n}\n\nvar coderUint64PackedSlice = pointerCoderFuncs{\n\tsize:      sizeUint64PackedSlice,\n\tmarshal:   appendUint64PackedSlice,\n\tunmarshal: consumeUint64Slice,\n\tmerge:     mergeUint64Slice,\n}\n\n// sizeUint64Value returns the size of wire encoding a uint64 value as a Uint64.\nfunc sizeUint64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(v.Uint())\n}\n\n// appendUint64Value encodes a uint64 value as a Uint64.\nfunc appendUint64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, v.Uint())\n\treturn b, nil\n}\n\n// consumeUint64Value decodes a uint64 value as a Uint64.\nfunc consumeUint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfUint64(v), out, nil\n}\n\nvar coderUint64Value = valueCoderFuncs{\n\tsize:      sizeUint64Value,\n\tmarshal:   appendUint64Value,\n\tunmarshal: consumeUint64Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeUint64SliceValue returns the size of wire encoding a []uint64 value as a repeated Uint64.\nfunc sizeUint64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(v.Uint())\n\t}\n\treturn size\n}\n\n// appendUint64SliceValue encodes a []uint64 value as a repeated Uint64.\nfunc appendUint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, v.Uint())\n\t}\n\treturn b, nil\n}\n\n// consumeUint64SliceValue wire decodes a []uint64 value as a repeated Uint64.\nfunc consumeUint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfUint64(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfUint64(v))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderUint64SliceValue = valueCoderFuncs{\n\tsize:      sizeUint64SliceValue,\n\tmarshal:   appendUint64SliceValue,\n\tunmarshal: consumeUint64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeUint64PackedSliceValue returns the size of wire encoding a []uint64 value as a packed repeated Uint64.\nfunc sizeUint64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(v.Uint())\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendUint64PackedSliceValue encodes a []uint64 value as a packed repeated Uint64.\nfunc appendUint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(v.Uint())\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, v.Uint())\n\t}\n\treturn b, nil\n}\n\nvar coderUint64PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeUint64PackedSliceValue,\n\tmarshal:   appendUint64PackedSliceValue,\n\tunmarshal: consumeUint64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSfixed32 returns the size of wire encoding a int32 pointer as a Sfixed32.\nfunc sizeSfixed32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendSfixed32 wire encodes a int32 pointer as a Sfixed32.\nfunc appendSfixed32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int32()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, uint32(v))\n\treturn b, nil\n}\n\n// consumeSfixed32 wire decodes a int32 pointer as a Sfixed32.\nfunc consumeSfixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Int32() = int32(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSfixed32 = pointerCoderFuncs{\n\tsize:      sizeSfixed32,\n\tmarshal:   appendSfixed32,\n\tunmarshal: consumeSfixed32,\n\tmerge:     mergeInt32,\n}\n\n// sizeSfixed32NoZero returns the size of wire encoding a int32 pointer as a Sfixed32.\n// The zero value is not encoded.\nfunc sizeSfixed32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int32()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendSfixed32NoZero wire encodes a int32 pointer as a Sfixed32.\n// The zero value is not encoded.\nfunc appendSfixed32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int32()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, uint32(v))\n\treturn b, nil\n}\n\nvar coderSfixed32NoZero = pointerCoderFuncs{\n\tsize:      sizeSfixed32NoZero,\n\tmarshal:   appendSfixed32NoZero,\n\tunmarshal: consumeSfixed32,\n\tmerge:     mergeInt32NoZero,\n}\n\n// sizeSfixed32Ptr returns the size of wire encoding a *int32 pointer as a Sfixed32.\n// It panics if the pointer is nil.\nfunc sizeSfixed32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendSfixed32Ptr wire encodes a *int32 pointer as a Sfixed32.\n// It panics if the pointer is nil.\nfunc appendSfixed32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Int32Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, uint32(v))\n\treturn b, nil\n}\n\n// consumeSfixed32Ptr wire decodes a *int32 pointer as a Sfixed32.\nfunc consumeSfixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Int32Ptr()\n\tif *vp == nil {\n\t\t*vp = new(int32)\n\t}\n\t**vp = int32(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSfixed32Ptr = pointerCoderFuncs{\n\tsize:      sizeSfixed32Ptr,\n\tmarshal:   appendSfixed32Ptr,\n\tunmarshal: consumeSfixed32Ptr,\n\tmerge:     mergeInt32Ptr,\n}\n\n// sizeSfixed32Slice returns the size of wire encoding a []int32 pointer as a repeated Sfixed32.\nfunc sizeSfixed32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int32Slice()\n\tsize = len(s) * (f.tagsize + protowire.SizeFixed32())\n\treturn size\n}\n\n// appendSfixed32Slice encodes a []int32 pointer as a repeated Sfixed32.\nfunc appendSfixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int32Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendFixed32(b, uint32(v))\n\t}\n\treturn b, nil\n}\n\n// consumeSfixed32Slice wire decodes a []int32 pointer as a repeated Sfixed32.\nfunc consumeSfixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Int32Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed32(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, int32(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, int32(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSfixed32Slice = pointerCoderFuncs{\n\tsize:      sizeSfixed32Slice,\n\tmarshal:   appendSfixed32Slice,\n\tunmarshal: consumeSfixed32Slice,\n\tmerge:     mergeInt32Slice,\n}\n\n// sizeSfixed32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sfixed32.\nfunc sizeSfixed32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int32Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := len(s) * protowire.SizeFixed32()\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendSfixed32PackedSlice encodes a []int32 pointer as a packed repeated Sfixed32.\nfunc appendSfixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int32Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := len(s) * protowire.SizeFixed32()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendFixed32(b, uint32(v))\n\t}\n\treturn b, nil\n}\n\nvar coderSfixed32PackedSlice = pointerCoderFuncs{\n\tsize:      sizeSfixed32PackedSlice,\n\tmarshal:   appendSfixed32PackedSlice,\n\tunmarshal: consumeSfixed32Slice,\n\tmerge:     mergeInt32Slice,\n}\n\n// sizeSfixed32Value returns the size of wire encoding a int32 value as a Sfixed32.\nfunc sizeSfixed32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeFixed32()\n}\n\n// appendSfixed32Value encodes a int32 value as a Sfixed32.\nfunc appendSfixed32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendFixed32(b, uint32(v.Int()))\n\treturn b, nil\n}\n\n// consumeSfixed32Value decodes a int32 value as a Sfixed32.\nfunc consumeSfixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfInt32(int32(v)), out, nil\n}\n\nvar coderSfixed32Value = valueCoderFuncs{\n\tsize:      sizeSfixed32Value,\n\tmarshal:   appendSfixed32Value,\n\tunmarshal: consumeSfixed32Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeSfixed32SliceValue returns the size of wire encoding a []int32 value as a repeated Sfixed32.\nfunc sizeSfixed32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tsize = list.Len() * (tagsize + protowire.SizeFixed32())\n\treturn size\n}\n\n// appendSfixed32SliceValue encodes a []int32 value as a repeated Sfixed32.\nfunc appendSfixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendFixed32(b, uint32(v.Int()))\n\t}\n\treturn b, nil\n}\n\n// consumeSfixed32SliceValue wire decodes a []int32 value as a repeated Sfixed32.\nfunc consumeSfixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed32(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderSfixed32SliceValue = valueCoderFuncs{\n\tsize:      sizeSfixed32SliceValue,\n\tmarshal:   appendSfixed32SliceValue,\n\tunmarshal: consumeSfixed32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSfixed32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Sfixed32.\nfunc sizeSfixed32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := llen * protowire.SizeFixed32()\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendSfixed32PackedSliceValue encodes a []int32 value as a packed repeated Sfixed32.\nfunc appendSfixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := llen * protowire.SizeFixed32()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendFixed32(b, uint32(v.Int()))\n\t}\n\treturn b, nil\n}\n\nvar coderSfixed32PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeSfixed32PackedSliceValue,\n\tmarshal:   appendSfixed32PackedSliceValue,\n\tunmarshal: consumeSfixed32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeFixed32 returns the size of wire encoding a uint32 pointer as a Fixed32.\nfunc sizeFixed32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendFixed32 wire encodes a uint32 pointer as a Fixed32.\nfunc appendFixed32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint32()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, v)\n\treturn b, nil\n}\n\n// consumeFixed32 wire decodes a uint32 pointer as a Fixed32.\nfunc consumeFixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Uint32() = v\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFixed32 = pointerCoderFuncs{\n\tsize:      sizeFixed32,\n\tmarshal:   appendFixed32,\n\tunmarshal: consumeFixed32,\n\tmerge:     mergeUint32,\n}\n\n// sizeFixed32NoZero returns the size of wire encoding a uint32 pointer as a Fixed32.\n// The zero value is not encoded.\nfunc sizeFixed32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Uint32()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendFixed32NoZero wire encodes a uint32 pointer as a Fixed32.\n// The zero value is not encoded.\nfunc appendFixed32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint32()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, v)\n\treturn b, nil\n}\n\nvar coderFixed32NoZero = pointerCoderFuncs{\n\tsize:      sizeFixed32NoZero,\n\tmarshal:   appendFixed32NoZero,\n\tunmarshal: consumeFixed32,\n\tmerge:     mergeUint32NoZero,\n}\n\n// sizeFixed32Ptr returns the size of wire encoding a *uint32 pointer as a Fixed32.\n// It panics if the pointer is nil.\nfunc sizeFixed32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendFixed32Ptr wire encodes a *uint32 pointer as a Fixed32.\n// It panics if the pointer is nil.\nfunc appendFixed32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Uint32Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, v)\n\treturn b, nil\n}\n\n// consumeFixed32Ptr wire decodes a *uint32 pointer as a Fixed32.\nfunc consumeFixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Uint32Ptr()\n\tif *vp == nil {\n\t\t*vp = new(uint32)\n\t}\n\t**vp = v\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFixed32Ptr = pointerCoderFuncs{\n\tsize:      sizeFixed32Ptr,\n\tmarshal:   appendFixed32Ptr,\n\tunmarshal: consumeFixed32Ptr,\n\tmerge:     mergeUint32Ptr,\n}\n\n// sizeFixed32Slice returns the size of wire encoding a []uint32 pointer as a repeated Fixed32.\nfunc sizeFixed32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint32Slice()\n\tsize = len(s) * (f.tagsize + protowire.SizeFixed32())\n\treturn size\n}\n\n// appendFixed32Slice encodes a []uint32 pointer as a repeated Fixed32.\nfunc appendFixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint32Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendFixed32(b, v)\n\t}\n\treturn b, nil\n}\n\n// consumeFixed32Slice wire decodes a []uint32 pointer as a repeated Fixed32.\nfunc consumeFixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Uint32Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed32(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, v)\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFixed32Slice = pointerCoderFuncs{\n\tsize:      sizeFixed32Slice,\n\tmarshal:   appendFixed32Slice,\n\tunmarshal: consumeFixed32Slice,\n\tmerge:     mergeUint32Slice,\n}\n\n// sizeFixed32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Fixed32.\nfunc sizeFixed32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint32Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := len(s) * protowire.SizeFixed32()\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendFixed32PackedSlice encodes a []uint32 pointer as a packed repeated Fixed32.\nfunc appendFixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint32Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := len(s) * protowire.SizeFixed32()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendFixed32(b, v)\n\t}\n\treturn b, nil\n}\n\nvar coderFixed32PackedSlice = pointerCoderFuncs{\n\tsize:      sizeFixed32PackedSlice,\n\tmarshal:   appendFixed32PackedSlice,\n\tunmarshal: consumeFixed32Slice,\n\tmerge:     mergeUint32Slice,\n}\n\n// sizeFixed32Value returns the size of wire encoding a uint32 value as a Fixed32.\nfunc sizeFixed32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeFixed32()\n}\n\n// appendFixed32Value encodes a uint32 value as a Fixed32.\nfunc appendFixed32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendFixed32(b, uint32(v.Uint()))\n\treturn b, nil\n}\n\n// consumeFixed32Value decodes a uint32 value as a Fixed32.\nfunc consumeFixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfUint32(uint32(v)), out, nil\n}\n\nvar coderFixed32Value = valueCoderFuncs{\n\tsize:      sizeFixed32Value,\n\tmarshal:   appendFixed32Value,\n\tunmarshal: consumeFixed32Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeFixed32SliceValue returns the size of wire encoding a []uint32 value as a repeated Fixed32.\nfunc sizeFixed32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tsize = list.Len() * (tagsize + protowire.SizeFixed32())\n\treturn size\n}\n\n// appendFixed32SliceValue encodes a []uint32 value as a repeated Fixed32.\nfunc appendFixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendFixed32(b, uint32(v.Uint()))\n\t}\n\treturn b, nil\n}\n\n// consumeFixed32SliceValue wire decodes a []uint32 value as a repeated Fixed32.\nfunc consumeFixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed32(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderFixed32SliceValue = valueCoderFuncs{\n\tsize:      sizeFixed32SliceValue,\n\tmarshal:   appendFixed32SliceValue,\n\tunmarshal: consumeFixed32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeFixed32PackedSliceValue returns the size of wire encoding a []uint32 value as a packed repeated Fixed32.\nfunc sizeFixed32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := llen * protowire.SizeFixed32()\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendFixed32PackedSliceValue encodes a []uint32 value as a packed repeated Fixed32.\nfunc appendFixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := llen * protowire.SizeFixed32()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendFixed32(b, uint32(v.Uint()))\n\t}\n\treturn b, nil\n}\n\nvar coderFixed32PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeFixed32PackedSliceValue,\n\tmarshal:   appendFixed32PackedSliceValue,\n\tunmarshal: consumeFixed32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeFloat returns the size of wire encoding a float32 pointer as a Float.\nfunc sizeFloat(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendFloat wire encodes a float32 pointer as a Float.\nfunc appendFloat(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Float32()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, math.Float32bits(v))\n\treturn b, nil\n}\n\n// consumeFloat wire decodes a float32 pointer as a Float.\nfunc consumeFloat(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Float32() = math.Float32frombits(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFloat = pointerCoderFuncs{\n\tsize:      sizeFloat,\n\tmarshal:   appendFloat,\n\tunmarshal: consumeFloat,\n\tmerge:     mergeFloat32,\n}\n\n// sizeFloatNoZero returns the size of wire encoding a float32 pointer as a Float.\n// The zero value is not encoded.\nfunc sizeFloatNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Float32()\n\tif v == 0 && !math.Signbit(float64(v)) {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendFloatNoZero wire encodes a float32 pointer as a Float.\n// The zero value is not encoded.\nfunc appendFloatNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Float32()\n\tif v == 0 && !math.Signbit(float64(v)) {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, math.Float32bits(v))\n\treturn b, nil\n}\n\nvar coderFloatNoZero = pointerCoderFuncs{\n\tsize:      sizeFloatNoZero,\n\tmarshal:   appendFloatNoZero,\n\tunmarshal: consumeFloat,\n\tmerge:     mergeFloat32NoZero,\n}\n\n// sizeFloatPtr returns the size of wire encoding a *float32 pointer as a Float.\n// It panics if the pointer is nil.\nfunc sizeFloatPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendFloatPtr wire encodes a *float32 pointer as a Float.\n// It panics if the pointer is nil.\nfunc appendFloatPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Float32Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, math.Float32bits(v))\n\treturn b, nil\n}\n\n// consumeFloatPtr wire decodes a *float32 pointer as a Float.\nfunc consumeFloatPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Float32Ptr()\n\tif *vp == nil {\n\t\t*vp = new(float32)\n\t}\n\t**vp = math.Float32frombits(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFloatPtr = pointerCoderFuncs{\n\tsize:      sizeFloatPtr,\n\tmarshal:   appendFloatPtr,\n\tunmarshal: consumeFloatPtr,\n\tmerge:     mergeFloat32Ptr,\n}\n\n// sizeFloatSlice returns the size of wire encoding a []float32 pointer as a repeated Float.\nfunc sizeFloatSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Float32Slice()\n\tsize = len(s) * (f.tagsize + protowire.SizeFixed32())\n\treturn size\n}\n\n// appendFloatSlice encodes a []float32 pointer as a repeated Float.\nfunc appendFloatSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Float32Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendFixed32(b, math.Float32bits(v))\n\t}\n\treturn b, nil\n}\n\n// consumeFloatSlice wire decodes a []float32 pointer as a repeated Float.\nfunc consumeFloatSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Float32Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed32(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, math.Float32frombits(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, math.Float32frombits(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFloatSlice = pointerCoderFuncs{\n\tsize:      sizeFloatSlice,\n\tmarshal:   appendFloatSlice,\n\tunmarshal: consumeFloatSlice,\n\tmerge:     mergeFloat32Slice,\n}\n\n// sizeFloatPackedSlice returns the size of wire encoding a []float32 pointer as a packed repeated Float.\nfunc sizeFloatPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Float32Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := len(s) * protowire.SizeFixed32()\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendFloatPackedSlice encodes a []float32 pointer as a packed repeated Float.\nfunc appendFloatPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Float32Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := len(s) * protowire.SizeFixed32()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendFixed32(b, math.Float32bits(v))\n\t}\n\treturn b, nil\n}\n\nvar coderFloatPackedSlice = pointerCoderFuncs{\n\tsize:      sizeFloatPackedSlice,\n\tmarshal:   appendFloatPackedSlice,\n\tunmarshal: consumeFloatSlice,\n\tmerge:     mergeFloat32Slice,\n}\n\n// sizeFloatValue returns the size of wire encoding a float32 value as a Float.\nfunc sizeFloatValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeFixed32()\n}\n\n// appendFloatValue encodes a float32 value as a Float.\nfunc appendFloatValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))\n\treturn b, nil\n}\n\n// consumeFloatValue decodes a float32 value as a Float.\nfunc consumeFloatValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), out, nil\n}\n\nvar coderFloatValue = valueCoderFuncs{\n\tsize:      sizeFloatValue,\n\tmarshal:   appendFloatValue,\n\tunmarshal: consumeFloatValue,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeFloatSliceValue returns the size of wire encoding a []float32 value as a repeated Float.\nfunc sizeFloatSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tsize = list.Len() * (tagsize + protowire.SizeFixed32())\n\treturn size\n}\n\n// appendFloatSliceValue encodes a []float32 value as a repeated Float.\nfunc appendFloatSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))\n\t}\n\treturn b, nil\n}\n\n// consumeFloatSliceValue wire decodes a []float32 value as a repeated Float.\nfunc consumeFloatSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed32(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderFloatSliceValue = valueCoderFuncs{\n\tsize:      sizeFloatSliceValue,\n\tmarshal:   appendFloatSliceValue,\n\tunmarshal: consumeFloatSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeFloatPackedSliceValue returns the size of wire encoding a []float32 value as a packed repeated Float.\nfunc sizeFloatPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := llen * protowire.SizeFixed32()\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendFloatPackedSliceValue encodes a []float32 value as a packed repeated Float.\nfunc appendFloatPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := llen * protowire.SizeFixed32()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))\n\t}\n\treturn b, nil\n}\n\nvar coderFloatPackedSliceValue = valueCoderFuncs{\n\tsize:      sizeFloatPackedSliceValue,\n\tmarshal:   appendFloatPackedSliceValue,\n\tunmarshal: consumeFloatSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSfixed64 returns the size of wire encoding a int64 pointer as a Sfixed64.\nfunc sizeSfixed64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendSfixed64 wire encodes a int64 pointer as a Sfixed64.\nfunc appendSfixed64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int64()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeSfixed64 wire decodes a int64 pointer as a Sfixed64.\nfunc consumeSfixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Int64() = int64(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSfixed64 = pointerCoderFuncs{\n\tsize:      sizeSfixed64,\n\tmarshal:   appendSfixed64,\n\tunmarshal: consumeSfixed64,\n\tmerge:     mergeInt64,\n}\n\n// sizeSfixed64NoZero returns the size of wire encoding a int64 pointer as a Sfixed64.\n// The zero value is not encoded.\nfunc sizeSfixed64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int64()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendSfixed64NoZero wire encodes a int64 pointer as a Sfixed64.\n// The zero value is not encoded.\nfunc appendSfixed64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int64()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, uint64(v))\n\treturn b, nil\n}\n\nvar coderSfixed64NoZero = pointerCoderFuncs{\n\tsize:      sizeSfixed64NoZero,\n\tmarshal:   appendSfixed64NoZero,\n\tunmarshal: consumeSfixed64,\n\tmerge:     mergeInt64NoZero,\n}\n\n// sizeSfixed64Ptr returns the size of wire encoding a *int64 pointer as a Sfixed64.\n// It panics if the pointer is nil.\nfunc sizeSfixed64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendSfixed64Ptr wire encodes a *int64 pointer as a Sfixed64.\n// It panics if the pointer is nil.\nfunc appendSfixed64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Int64Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeSfixed64Ptr wire decodes a *int64 pointer as a Sfixed64.\nfunc consumeSfixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Int64Ptr()\n\tif *vp == nil {\n\t\t*vp = new(int64)\n\t}\n\t**vp = int64(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSfixed64Ptr = pointerCoderFuncs{\n\tsize:      sizeSfixed64Ptr,\n\tmarshal:   appendSfixed64Ptr,\n\tunmarshal: consumeSfixed64Ptr,\n\tmerge:     mergeInt64Ptr,\n}\n\n// sizeSfixed64Slice returns the size of wire encoding a []int64 pointer as a repeated Sfixed64.\nfunc sizeSfixed64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int64Slice()\n\tsize = len(s) * (f.tagsize + protowire.SizeFixed64())\n\treturn size\n}\n\n// appendSfixed64Slice encodes a []int64 pointer as a repeated Sfixed64.\nfunc appendSfixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int64Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendFixed64(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\n// consumeSfixed64Slice wire decodes a []int64 pointer as a repeated Sfixed64.\nfunc consumeSfixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Int64Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed64(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, int64(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, int64(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSfixed64Slice = pointerCoderFuncs{\n\tsize:      sizeSfixed64Slice,\n\tmarshal:   appendSfixed64Slice,\n\tunmarshal: consumeSfixed64Slice,\n\tmerge:     mergeInt64Slice,\n}\n\n// sizeSfixed64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sfixed64.\nfunc sizeSfixed64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int64Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := len(s) * protowire.SizeFixed64()\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendSfixed64PackedSlice encodes a []int64 pointer as a packed repeated Sfixed64.\nfunc appendSfixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int64Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := len(s) * protowire.SizeFixed64()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendFixed64(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\nvar coderSfixed64PackedSlice = pointerCoderFuncs{\n\tsize:      sizeSfixed64PackedSlice,\n\tmarshal:   appendSfixed64PackedSlice,\n\tunmarshal: consumeSfixed64Slice,\n\tmerge:     mergeInt64Slice,\n}\n\n// sizeSfixed64Value returns the size of wire encoding a int64 value as a Sfixed64.\nfunc sizeSfixed64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeFixed64()\n}\n\n// appendSfixed64Value encodes a int64 value as a Sfixed64.\nfunc appendSfixed64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendFixed64(b, uint64(v.Int()))\n\treturn b, nil\n}\n\n// consumeSfixed64Value decodes a int64 value as a Sfixed64.\nfunc consumeSfixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfInt64(int64(v)), out, nil\n}\n\nvar coderSfixed64Value = valueCoderFuncs{\n\tsize:      sizeSfixed64Value,\n\tmarshal:   appendSfixed64Value,\n\tunmarshal: consumeSfixed64Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeSfixed64SliceValue returns the size of wire encoding a []int64 value as a repeated Sfixed64.\nfunc sizeSfixed64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tsize = list.Len() * (tagsize + protowire.SizeFixed64())\n\treturn size\n}\n\n// appendSfixed64SliceValue encodes a []int64 value as a repeated Sfixed64.\nfunc appendSfixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendFixed64(b, uint64(v.Int()))\n\t}\n\treturn b, nil\n}\n\n// consumeSfixed64SliceValue wire decodes a []int64 value as a repeated Sfixed64.\nfunc consumeSfixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed64(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderSfixed64SliceValue = valueCoderFuncs{\n\tsize:      sizeSfixed64SliceValue,\n\tmarshal:   appendSfixed64SliceValue,\n\tunmarshal: consumeSfixed64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSfixed64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Sfixed64.\nfunc sizeSfixed64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := llen * protowire.SizeFixed64()\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendSfixed64PackedSliceValue encodes a []int64 value as a packed repeated Sfixed64.\nfunc appendSfixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := llen * protowire.SizeFixed64()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendFixed64(b, uint64(v.Int()))\n\t}\n\treturn b, nil\n}\n\nvar coderSfixed64PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeSfixed64PackedSliceValue,\n\tmarshal:   appendSfixed64PackedSliceValue,\n\tunmarshal: consumeSfixed64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeFixed64 returns the size of wire encoding a uint64 pointer as a Fixed64.\nfunc sizeFixed64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendFixed64 wire encodes a uint64 pointer as a Fixed64.\nfunc appendFixed64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint64()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, v)\n\treturn b, nil\n}\n\n// consumeFixed64 wire decodes a uint64 pointer as a Fixed64.\nfunc consumeFixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Uint64() = v\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFixed64 = pointerCoderFuncs{\n\tsize:      sizeFixed64,\n\tmarshal:   appendFixed64,\n\tunmarshal: consumeFixed64,\n\tmerge:     mergeUint64,\n}\n\n// sizeFixed64NoZero returns the size of wire encoding a uint64 pointer as a Fixed64.\n// The zero value is not encoded.\nfunc sizeFixed64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Uint64()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendFixed64NoZero wire encodes a uint64 pointer as a Fixed64.\n// The zero value is not encoded.\nfunc appendFixed64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint64()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, v)\n\treturn b, nil\n}\n\nvar coderFixed64NoZero = pointerCoderFuncs{\n\tsize:      sizeFixed64NoZero,\n\tmarshal:   appendFixed64NoZero,\n\tunmarshal: consumeFixed64,\n\tmerge:     mergeUint64NoZero,\n}\n\n// sizeFixed64Ptr returns the size of wire encoding a *uint64 pointer as a Fixed64.\n// It panics if the pointer is nil.\nfunc sizeFixed64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendFixed64Ptr wire encodes a *uint64 pointer as a Fixed64.\n// It panics if the pointer is nil.\nfunc appendFixed64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Uint64Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, v)\n\treturn b, nil\n}\n\n// consumeFixed64Ptr wire decodes a *uint64 pointer as a Fixed64.\nfunc consumeFixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Uint64Ptr()\n\tif *vp == nil {\n\t\t*vp = new(uint64)\n\t}\n\t**vp = v\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFixed64Ptr = pointerCoderFuncs{\n\tsize:      sizeFixed64Ptr,\n\tmarshal:   appendFixed64Ptr,\n\tunmarshal: consumeFixed64Ptr,\n\tmerge:     mergeUint64Ptr,\n}\n\n// sizeFixed64Slice returns the size of wire encoding a []uint64 pointer as a repeated Fixed64.\nfunc sizeFixed64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint64Slice()\n\tsize = len(s) * (f.tagsize + protowire.SizeFixed64())\n\treturn size\n}\n\n// appendFixed64Slice encodes a []uint64 pointer as a repeated Fixed64.\nfunc appendFixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint64Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendFixed64(b, v)\n\t}\n\treturn b, nil\n}\n\n// consumeFixed64Slice wire decodes a []uint64 pointer as a repeated Fixed64.\nfunc consumeFixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Uint64Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed64(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, v)\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFixed64Slice = pointerCoderFuncs{\n\tsize:      sizeFixed64Slice,\n\tmarshal:   appendFixed64Slice,\n\tunmarshal: consumeFixed64Slice,\n\tmerge:     mergeUint64Slice,\n}\n\n// sizeFixed64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Fixed64.\nfunc sizeFixed64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint64Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := len(s) * protowire.SizeFixed64()\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendFixed64PackedSlice encodes a []uint64 pointer as a packed repeated Fixed64.\nfunc appendFixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint64Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := len(s) * protowire.SizeFixed64()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendFixed64(b, v)\n\t}\n\treturn b, nil\n}\n\nvar coderFixed64PackedSlice = pointerCoderFuncs{\n\tsize:      sizeFixed64PackedSlice,\n\tmarshal:   appendFixed64PackedSlice,\n\tunmarshal: consumeFixed64Slice,\n\tmerge:     mergeUint64Slice,\n}\n\n// sizeFixed64Value returns the size of wire encoding a uint64 value as a Fixed64.\nfunc sizeFixed64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeFixed64()\n}\n\n// appendFixed64Value encodes a uint64 value as a Fixed64.\nfunc appendFixed64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendFixed64(b, v.Uint())\n\treturn b, nil\n}\n\n// consumeFixed64Value decodes a uint64 value as a Fixed64.\nfunc consumeFixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfUint64(v), out, nil\n}\n\nvar coderFixed64Value = valueCoderFuncs{\n\tsize:      sizeFixed64Value,\n\tmarshal:   appendFixed64Value,\n\tunmarshal: consumeFixed64Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeFixed64SliceValue returns the size of wire encoding a []uint64 value as a repeated Fixed64.\nfunc sizeFixed64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tsize = list.Len() * (tagsize + protowire.SizeFixed64())\n\treturn size\n}\n\n// appendFixed64SliceValue encodes a []uint64 value as a repeated Fixed64.\nfunc appendFixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendFixed64(b, v.Uint())\n\t}\n\treturn b, nil\n}\n\n// consumeFixed64SliceValue wire decodes a []uint64 value as a repeated Fixed64.\nfunc consumeFixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed64(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfUint64(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfUint64(v))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderFixed64SliceValue = valueCoderFuncs{\n\tsize:      sizeFixed64SliceValue,\n\tmarshal:   appendFixed64SliceValue,\n\tunmarshal: consumeFixed64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeFixed64PackedSliceValue returns the size of wire encoding a []uint64 value as a packed repeated Fixed64.\nfunc sizeFixed64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := llen * protowire.SizeFixed64()\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendFixed64PackedSliceValue encodes a []uint64 value as a packed repeated Fixed64.\nfunc appendFixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := llen * protowire.SizeFixed64()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendFixed64(b, v.Uint())\n\t}\n\treturn b, nil\n}\n\nvar coderFixed64PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeFixed64PackedSliceValue,\n\tmarshal:   appendFixed64PackedSliceValue,\n\tunmarshal: consumeFixed64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeDouble returns the size of wire encoding a float64 pointer as a Double.\nfunc sizeDouble(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendDouble wire encodes a float64 pointer as a Double.\nfunc appendDouble(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Float64()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, math.Float64bits(v))\n\treturn b, nil\n}\n\n// consumeDouble wire decodes a float64 pointer as a Double.\nfunc consumeDouble(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Float64() = math.Float64frombits(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderDouble = pointerCoderFuncs{\n\tsize:      sizeDouble,\n\tmarshal:   appendDouble,\n\tunmarshal: consumeDouble,\n\tmerge:     mergeFloat64,\n}\n\n// sizeDoubleNoZero returns the size of wire encoding a float64 pointer as a Double.\n// The zero value is not encoded.\nfunc sizeDoubleNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Float64()\n\tif v == 0 && !math.Signbit(float64(v)) {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendDoubleNoZero wire encodes a float64 pointer as a Double.\n// The zero value is not encoded.\nfunc appendDoubleNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Float64()\n\tif v == 0 && !math.Signbit(float64(v)) {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, math.Float64bits(v))\n\treturn b, nil\n}\n\nvar coderDoubleNoZero = pointerCoderFuncs{\n\tsize:      sizeDoubleNoZero,\n\tmarshal:   appendDoubleNoZero,\n\tunmarshal: consumeDouble,\n\tmerge:     mergeFloat64NoZero,\n}\n\n// sizeDoublePtr returns the size of wire encoding a *float64 pointer as a Double.\n// It panics if the pointer is nil.\nfunc sizeDoublePtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendDoublePtr wire encodes a *float64 pointer as a Double.\n// It panics if the pointer is nil.\nfunc appendDoublePtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Float64Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, math.Float64bits(v))\n\treturn b, nil\n}\n\n// consumeDoublePtr wire decodes a *float64 pointer as a Double.\nfunc consumeDoublePtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Float64Ptr()\n\tif *vp == nil {\n\t\t*vp = new(float64)\n\t}\n\t**vp = math.Float64frombits(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderDoublePtr = pointerCoderFuncs{\n\tsize:      sizeDoublePtr,\n\tmarshal:   appendDoublePtr,\n\tunmarshal: consumeDoublePtr,\n\tmerge:     mergeFloat64Ptr,\n}\n\n// sizeDoubleSlice returns the size of wire encoding a []float64 pointer as a repeated Double.\nfunc sizeDoubleSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Float64Slice()\n\tsize = len(s) * (f.tagsize + protowire.SizeFixed64())\n\treturn size\n}\n\n// appendDoubleSlice encodes a []float64 pointer as a repeated Double.\nfunc appendDoubleSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Float64Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendFixed64(b, math.Float64bits(v))\n\t}\n\treturn b, nil\n}\n\n// consumeDoubleSlice wire decodes a []float64 pointer as a repeated Double.\nfunc consumeDoubleSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Float64Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed64(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, math.Float64frombits(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, math.Float64frombits(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderDoubleSlice = pointerCoderFuncs{\n\tsize:      sizeDoubleSlice,\n\tmarshal:   appendDoubleSlice,\n\tunmarshal: consumeDoubleSlice,\n\tmerge:     mergeFloat64Slice,\n}\n\n// sizeDoublePackedSlice returns the size of wire encoding a []float64 pointer as a packed repeated Double.\nfunc sizeDoublePackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Float64Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := len(s) * protowire.SizeFixed64()\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendDoublePackedSlice encodes a []float64 pointer as a packed repeated Double.\nfunc appendDoublePackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Float64Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := len(s) * protowire.SizeFixed64()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendFixed64(b, math.Float64bits(v))\n\t}\n\treturn b, nil\n}\n\nvar coderDoublePackedSlice = pointerCoderFuncs{\n\tsize:      sizeDoublePackedSlice,\n\tmarshal:   appendDoublePackedSlice,\n\tunmarshal: consumeDoubleSlice,\n\tmerge:     mergeFloat64Slice,\n}\n\n// sizeDoubleValue returns the size of wire encoding a float64 value as a Double.\nfunc sizeDoubleValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeFixed64()\n}\n\n// appendDoubleValue encodes a float64 value as a Double.\nfunc appendDoubleValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendFixed64(b, math.Float64bits(v.Float()))\n\treturn b, nil\n}\n\n// consumeDoubleValue decodes a float64 value as a Double.\nfunc consumeDoubleValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfFloat64(math.Float64frombits(v)), out, nil\n}\n\nvar coderDoubleValue = valueCoderFuncs{\n\tsize:      sizeDoubleValue,\n\tmarshal:   appendDoubleValue,\n\tunmarshal: consumeDoubleValue,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeDoubleSliceValue returns the size of wire encoding a []float64 value as a repeated Double.\nfunc sizeDoubleSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tsize = list.Len() * (tagsize + protowire.SizeFixed64())\n\treturn size\n}\n\n// appendDoubleSliceValue encodes a []float64 value as a repeated Double.\nfunc appendDoubleSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendFixed64(b, math.Float64bits(v.Float()))\n\t}\n\treturn b, nil\n}\n\n// consumeDoubleSliceValue wire decodes a []float64 value as a repeated Double.\nfunc consumeDoubleSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed64(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderDoubleSliceValue = valueCoderFuncs{\n\tsize:      sizeDoubleSliceValue,\n\tmarshal:   appendDoubleSliceValue,\n\tunmarshal: consumeDoubleSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeDoublePackedSliceValue returns the size of wire encoding a []float64 value as a packed repeated Double.\nfunc sizeDoublePackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := llen * protowire.SizeFixed64()\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendDoublePackedSliceValue encodes a []float64 value as a packed repeated Double.\nfunc appendDoublePackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := llen * protowire.SizeFixed64()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendFixed64(b, math.Float64bits(v.Float()))\n\t}\n\treturn b, nil\n}\n\nvar coderDoublePackedSliceValue = valueCoderFuncs{\n\tsize:      sizeDoublePackedSliceValue,\n\tmarshal:   appendDoublePackedSliceValue,\n\tunmarshal: consumeDoubleSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeString returns the size of wire encoding a string pointer as a String.\nfunc sizeString(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.String()\n\treturn f.tagsize + protowire.SizeBytes(len(v))\n}\n\n// appendString wire encodes a string pointer as a String.\nfunc appendString(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.String()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendString(b, v)\n\treturn b, nil\n}\n\n// consumeString wire decodes a string pointer as a String.\nfunc consumeString(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.String() = string(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderString = pointerCoderFuncs{\n\tsize:      sizeString,\n\tmarshal:   appendString,\n\tunmarshal: consumeString,\n\tmerge:     mergeString,\n}\n\n// appendStringValidateUTF8 wire encodes a string pointer as a String.\nfunc appendStringValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.String()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendString(b, v)\n\tif !utf8.ValidString(v) {\n\t\treturn b, errInvalidUTF8{}\n\t}\n\treturn b, nil\n}\n\n// consumeStringValidateUTF8 wire decodes a string pointer as a String.\nfunc consumeStringValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tif !utf8.Valid(v) {\n\t\treturn out, errInvalidUTF8{}\n\t}\n\t*p.String() = string(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderStringValidateUTF8 = pointerCoderFuncs{\n\tsize:      sizeString,\n\tmarshal:   appendStringValidateUTF8,\n\tunmarshal: consumeStringValidateUTF8,\n\tmerge:     mergeString,\n}\n\n// sizeStringNoZero returns the size of wire encoding a string pointer as a String.\n// The zero value is not encoded.\nfunc sizeStringNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.String()\n\tif len(v) == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeBytes(len(v))\n}\n\n// appendStringNoZero wire encodes a string pointer as a String.\n// The zero value is not encoded.\nfunc appendStringNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.String()\n\tif len(v) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendString(b, v)\n\treturn b, nil\n}\n\nvar coderStringNoZero = pointerCoderFuncs{\n\tsize:      sizeStringNoZero,\n\tmarshal:   appendStringNoZero,\n\tunmarshal: consumeString,\n\tmerge:     mergeStringNoZero,\n}\n\n// appendStringNoZeroValidateUTF8 wire encodes a string pointer as a String.\n// The zero value is not encoded.\nfunc appendStringNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.String()\n\tif len(v) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendString(b, v)\n\tif !utf8.ValidString(v) {\n\t\treturn b, errInvalidUTF8{}\n\t}\n\treturn b, nil\n}\n\nvar coderStringNoZeroValidateUTF8 = pointerCoderFuncs{\n\tsize:      sizeStringNoZero,\n\tmarshal:   appendStringNoZeroValidateUTF8,\n\tunmarshal: consumeStringValidateUTF8,\n\tmerge:     mergeStringNoZero,\n}\n\n// sizeStringPtr returns the size of wire encoding a *string pointer as a String.\n// It panics if the pointer is nil.\nfunc sizeStringPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.StringPtr()\n\treturn f.tagsize + protowire.SizeBytes(len(v))\n}\n\n// appendStringPtr wire encodes a *string pointer as a String.\n// It panics if the pointer is nil.\nfunc appendStringPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.StringPtr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendString(b, v)\n\treturn b, nil\n}\n\n// consumeStringPtr wire decodes a *string pointer as a String.\nfunc consumeStringPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.StringPtr()\n\tif *vp == nil {\n\t\t*vp = new(string)\n\t}\n\t**vp = string(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderStringPtr = pointerCoderFuncs{\n\tsize:      sizeStringPtr,\n\tmarshal:   appendStringPtr,\n\tunmarshal: consumeStringPtr,\n\tmerge:     mergeStringPtr,\n}\n\n// appendStringPtrValidateUTF8 wire encodes a *string pointer as a String.\n// It panics if the pointer is nil.\nfunc appendStringPtrValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.StringPtr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendString(b, v)\n\tif !utf8.ValidString(v) {\n\t\treturn b, errInvalidUTF8{}\n\t}\n\treturn b, nil\n}\n\n// consumeStringPtrValidateUTF8 wire decodes a *string pointer as a String.\nfunc consumeStringPtrValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tif !utf8.Valid(v) {\n\t\treturn out, errInvalidUTF8{}\n\t}\n\tvp := p.StringPtr()\n\tif *vp == nil {\n\t\t*vp = new(string)\n\t}\n\t**vp = string(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderStringPtrValidateUTF8 = pointerCoderFuncs{\n\tsize:      sizeStringPtr,\n\tmarshal:   appendStringPtrValidateUTF8,\n\tunmarshal: consumeStringPtrValidateUTF8,\n\tmerge:     mergeStringPtr,\n}\n\n// sizeStringSlice returns the size of wire encoding a []string pointer as a repeated String.\nfunc sizeStringSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.StringSlice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeBytes(len(v))\n\t}\n\treturn size\n}\n\n// appendStringSlice encodes a []string pointer as a repeated String.\nfunc appendStringSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.StringSlice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendString(b, v)\n\t}\n\treturn b, nil\n}\n\n// consumeStringSlice wire decodes a []string pointer as a repeated String.\nfunc consumeStringSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.StringSlice()\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, string(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderStringSlice = pointerCoderFuncs{\n\tsize:      sizeStringSlice,\n\tmarshal:   appendStringSlice,\n\tunmarshal: consumeStringSlice,\n\tmerge:     mergeStringSlice,\n}\n\n// appendStringSliceValidateUTF8 encodes a []string pointer as a repeated String.\nfunc appendStringSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.StringSlice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendString(b, v)\n\t\tif !utf8.ValidString(v) {\n\t\t\treturn b, errInvalidUTF8{}\n\t\t}\n\t}\n\treturn b, nil\n}\n\n// consumeStringSliceValidateUTF8 wire decodes a []string pointer as a repeated String.\nfunc consumeStringSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tif !utf8.Valid(v) {\n\t\treturn out, errInvalidUTF8{}\n\t}\n\tsp := p.StringSlice()\n\t*sp = append(*sp, string(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderStringSliceValidateUTF8 = pointerCoderFuncs{\n\tsize:      sizeStringSlice,\n\tmarshal:   appendStringSliceValidateUTF8,\n\tunmarshal: consumeStringSliceValidateUTF8,\n\tmerge:     mergeStringSlice,\n}\n\n// sizeStringValue returns the size of wire encoding a string value as a String.\nfunc sizeStringValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeBytes(len(v.String()))\n}\n\n// appendStringValue encodes a string value as a String.\nfunc appendStringValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendString(b, v.String())\n\treturn b, nil\n}\n\n// consumeStringValue decodes a string value as a String.\nfunc consumeStringValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfString(string(v)), out, nil\n}\n\nvar coderStringValue = valueCoderFuncs{\n\tsize:      sizeStringValue,\n\tmarshal:   appendStringValue,\n\tunmarshal: consumeStringValue,\n\tmerge:     mergeScalarValue,\n}\n\n// appendStringValueValidateUTF8 encodes a string value as a String.\nfunc appendStringValueValidateUTF8(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendString(b, v.String())\n\tif !utf8.ValidString(v.String()) {\n\t\treturn b, errInvalidUTF8{}\n\t}\n\treturn b, nil\n}\n\n// consumeStringValueValidateUTF8 decodes a string value as a String.\nfunc consumeStringValueValidateUTF8(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tif !utf8.Valid(v) {\n\t\treturn protoreflect.Value{}, out, errInvalidUTF8{}\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfString(string(v)), out, nil\n}\n\nvar coderStringValueValidateUTF8 = valueCoderFuncs{\n\tsize:      sizeStringValue,\n\tmarshal:   appendStringValueValidateUTF8,\n\tunmarshal: consumeStringValueValidateUTF8,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeStringSliceValue returns the size of wire encoding a []string value as a repeated String.\nfunc sizeStringSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeBytes(len(v.String()))\n\t}\n\treturn size\n}\n\n// appendStringSliceValue encodes a []string value as a repeated String.\nfunc appendStringSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendString(b, v.String())\n\t}\n\treturn b, nil\n}\n\n// consumeStringSliceValue wire decodes a []string value as a repeated String.\nfunc consumeStringSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp != protowire.BytesType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfString(string(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderStringSliceValue = valueCoderFuncs{\n\tsize:      sizeStringSliceValue,\n\tmarshal:   appendStringSliceValue,\n\tunmarshal: consumeStringSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeBytes returns the size of wire encoding a []byte pointer as a Bytes.\nfunc sizeBytes(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Bytes()\n\treturn f.tagsize + protowire.SizeBytes(len(v))\n}\n\n// appendBytes wire encodes a []byte pointer as a Bytes.\nfunc appendBytes(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Bytes()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendBytes(b, v)\n\treturn b, nil\n}\n\n// consumeBytes wire decodes a []byte pointer as a Bytes.\nfunc consumeBytes(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Bytes() = append(emptyBuf[:], v...)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBytes = pointerCoderFuncs{\n\tsize:      sizeBytes,\n\tmarshal:   appendBytes,\n\tunmarshal: consumeBytes,\n\tmerge:     mergeBytes,\n}\n\n// appendBytesValidateUTF8 wire encodes a []byte pointer as a Bytes.\nfunc appendBytesValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Bytes()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendBytes(b, v)\n\tif !utf8.Valid(v) {\n\t\treturn b, errInvalidUTF8{}\n\t}\n\treturn b, nil\n}\n\n// consumeBytesValidateUTF8 wire decodes a []byte pointer as a Bytes.\nfunc consumeBytesValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tif !utf8.Valid(v) {\n\t\treturn out, errInvalidUTF8{}\n\t}\n\t*p.Bytes() = append(emptyBuf[:], v...)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBytesValidateUTF8 = pointerCoderFuncs{\n\tsize:      sizeBytes,\n\tmarshal:   appendBytesValidateUTF8,\n\tunmarshal: consumeBytesValidateUTF8,\n\tmerge:     mergeBytes,\n}\n\n// sizeBytesNoZero returns the size of wire encoding a []byte pointer as a Bytes.\n// The zero value is not encoded.\nfunc sizeBytesNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Bytes()\n\tif len(v) == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeBytes(len(v))\n}\n\n// appendBytesNoZero wire encodes a []byte pointer as a Bytes.\n// The zero value is not encoded.\nfunc appendBytesNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Bytes()\n\tif len(v) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendBytes(b, v)\n\treturn b, nil\n}\n\n// consumeBytesNoZero wire decodes a []byte pointer as a Bytes.\n// The zero value is not decoded.\nfunc consumeBytesNoZero(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Bytes() = append(([]byte)(nil), v...)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBytesNoZero = pointerCoderFuncs{\n\tsize:      sizeBytesNoZero,\n\tmarshal:   appendBytesNoZero,\n\tunmarshal: consumeBytesNoZero,\n\tmerge:     mergeBytesNoZero,\n}\n\n// appendBytesNoZeroValidateUTF8 wire encodes a []byte pointer as a Bytes.\n// The zero value is not encoded.\nfunc appendBytesNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Bytes()\n\tif len(v) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendBytes(b, v)\n\tif !utf8.Valid(v) {\n\t\treturn b, errInvalidUTF8{}\n\t}\n\treturn b, nil\n}\n\n// consumeBytesNoZeroValidateUTF8 wire decodes a []byte pointer as a Bytes.\nfunc consumeBytesNoZeroValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tif !utf8.Valid(v) {\n\t\treturn out, errInvalidUTF8{}\n\t}\n\t*p.Bytes() = append(([]byte)(nil), v...)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBytesNoZeroValidateUTF8 = pointerCoderFuncs{\n\tsize:      sizeBytesNoZero,\n\tmarshal:   appendBytesNoZeroValidateUTF8,\n\tunmarshal: consumeBytesNoZeroValidateUTF8,\n\tmerge:     mergeBytesNoZero,\n}\n\n// sizeBytesSlice returns the size of wire encoding a [][]byte pointer as a repeated Bytes.\nfunc sizeBytesSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.BytesSlice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeBytes(len(v))\n\t}\n\treturn size\n}\n\n// appendBytesSlice encodes a [][]byte pointer as a repeated Bytes.\nfunc appendBytesSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.BytesSlice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendBytes(b, v)\n\t}\n\treturn b, nil\n}\n\n// consumeBytesSlice wire decodes a [][]byte pointer as a repeated Bytes.\nfunc consumeBytesSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.BytesSlice()\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, append(emptyBuf[:], v...))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBytesSlice = pointerCoderFuncs{\n\tsize:      sizeBytesSlice,\n\tmarshal:   appendBytesSlice,\n\tunmarshal: consumeBytesSlice,\n\tmerge:     mergeBytesSlice,\n}\n\n// appendBytesSliceValidateUTF8 encodes a [][]byte pointer as a repeated Bytes.\nfunc appendBytesSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.BytesSlice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendBytes(b, v)\n\t\tif !utf8.Valid(v) {\n\t\t\treturn b, errInvalidUTF8{}\n\t\t}\n\t}\n\treturn b, nil\n}\n\n// consumeBytesSliceValidateUTF8 wire decodes a [][]byte pointer as a repeated Bytes.\nfunc consumeBytesSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tif !utf8.Valid(v) {\n\t\treturn out, errInvalidUTF8{}\n\t}\n\tsp := p.BytesSlice()\n\t*sp = append(*sp, append(emptyBuf[:], v...))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBytesSliceValidateUTF8 = pointerCoderFuncs{\n\tsize:      sizeBytesSlice,\n\tmarshal:   appendBytesSliceValidateUTF8,\n\tunmarshal: consumeBytesSliceValidateUTF8,\n\tmerge:     mergeBytesSlice,\n}\n\n// sizeBytesValue returns the size of wire encoding a []byte value as a Bytes.\nfunc sizeBytesValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeBytes(len(v.Bytes()))\n}\n\n// appendBytesValue encodes a []byte value as a Bytes.\nfunc appendBytesValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendBytes(b, v.Bytes())\n\treturn b, nil\n}\n\n// consumeBytesValue decodes a []byte value as a Bytes.\nfunc consumeBytesValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), out, nil\n}\n\nvar coderBytesValue = valueCoderFuncs{\n\tsize:      sizeBytesValue,\n\tmarshal:   appendBytesValue,\n\tunmarshal: consumeBytesValue,\n\tmerge:     mergeBytesValue,\n}\n\n// sizeBytesSliceValue returns the size of wire encoding a [][]byte value as a repeated Bytes.\nfunc sizeBytesSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeBytes(len(v.Bytes()))\n\t}\n\treturn size\n}\n\n// appendBytesSliceValue encodes a [][]byte value as a repeated Bytes.\nfunc appendBytesSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendBytes(b, v.Bytes())\n\t}\n\treturn b, nil\n}\n\n// consumeBytesSliceValue wire decodes a [][]byte value as a repeated Bytes.\nfunc consumeBytesSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp != protowire.BytesType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfBytes(append(emptyBuf[:], v...)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderBytesSliceValue = valueCoderFuncs{\n\tsize:      sizeBytesSliceValue,\n\tmarshal:   appendBytesSliceValue,\n\tunmarshal: consumeBytesSliceValue,\n\tmerge:     mergeBytesListValue,\n}\n\n// We append to an empty array rather than a nil []byte to get non-nil zero-length byte slices.\nvar emptyBuf [0]byte\n\nvar wireTypes = map[protoreflect.Kind]protowire.Type{\n\tprotoreflect.BoolKind:     protowire.VarintType,\n\tprotoreflect.EnumKind:     protowire.VarintType,\n\tprotoreflect.Int32Kind:    protowire.VarintType,\n\tprotoreflect.Sint32Kind:   protowire.VarintType,\n\tprotoreflect.Uint32Kind:   protowire.VarintType,\n\tprotoreflect.Int64Kind:    protowire.VarintType,\n\tprotoreflect.Sint64Kind:   protowire.VarintType,\n\tprotoreflect.Uint64Kind:   protowire.VarintType,\n\tprotoreflect.Sfixed32Kind: protowire.Fixed32Type,\n\tprotoreflect.Fixed32Kind:  protowire.Fixed32Type,\n\tprotoreflect.FloatKind:    protowire.Fixed32Type,\n\tprotoreflect.Sfixed64Kind: protowire.Fixed64Type,\n\tprotoreflect.Fixed64Kind:  protowire.Fixed64Type,\n\tprotoreflect.DoubleKind:   protowire.Fixed64Type,\n\tprotoreflect.StringKind:   protowire.BytesType,\n\tprotoreflect.BytesKind:    protowire.BytesType,\n\tprotoreflect.MessageKind:  protowire.BytesType,\n\tprotoreflect.GroupKind:    protowire.StartGroupType,\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/codec_map.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 impl\n\nimport (\n\t\"reflect\"\n\t\"sort\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype mapInfo struct {\n\tgoType     reflect.Type\n\tkeyWiretag uint64\n\tvalWiretag uint64\n\tkeyFuncs   valueCoderFuncs\n\tvalFuncs   valueCoderFuncs\n\tkeyZero    pref.Value\n\tkeyKind    pref.Kind\n\tconv       *mapConverter\n}\n\nfunc encoderFuncsForMap(fd pref.FieldDescriptor, ft reflect.Type) (valueMessage *MessageInfo, funcs pointerCoderFuncs) {\n\t// TODO: Consider generating specialized map coders.\n\tkeyField := fd.MapKey()\n\tvalField := fd.MapValue()\n\tkeyWiretag := protowire.EncodeTag(1, wireTypes[keyField.Kind()])\n\tvalWiretag := protowire.EncodeTag(2, wireTypes[valField.Kind()])\n\tkeyFuncs := encoderFuncsForValue(keyField)\n\tvalFuncs := encoderFuncsForValue(valField)\n\tconv := newMapConverter(ft, fd)\n\n\tmapi := &mapInfo{\n\t\tgoType:     ft,\n\t\tkeyWiretag: keyWiretag,\n\t\tvalWiretag: valWiretag,\n\t\tkeyFuncs:   keyFuncs,\n\t\tvalFuncs:   valFuncs,\n\t\tkeyZero:    keyField.Default(),\n\t\tkeyKind:    keyField.Kind(),\n\t\tconv:       conv,\n\t}\n\tif valField.Kind() == pref.MessageKind {\n\t\tvalueMessage = getMessageInfo(ft.Elem())\n\t}\n\n\tfuncs = pointerCoderFuncs{\n\t\tsize: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\t\t\treturn sizeMap(p.AsValueOf(ft).Elem(), mapi, f, opts)\n\t\t},\n\t\tmarshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\t\treturn appendMap(b, p.AsValueOf(ft).Elem(), mapi, f, opts)\n\t\t},\n\t\tunmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\tmp := p.AsValueOf(ft)\n\t\t\tif mp.Elem().IsNil() {\n\t\t\t\tmp.Elem().Set(reflect.MakeMap(mapi.goType))\n\t\t\t}\n\t\t\tif f.mi == nil {\n\t\t\t\treturn consumeMap(b, mp.Elem(), wtyp, mapi, f, opts)\n\t\t\t} else {\n\t\t\t\treturn consumeMapOfMessage(b, mp.Elem(), wtyp, mapi, f, opts)\n\t\t\t}\n\t\t},\n\t}\n\tswitch valField.Kind() {\n\tcase pref.MessageKind:\n\t\tfuncs.merge = mergeMapOfMessage\n\tcase pref.BytesKind:\n\t\tfuncs.merge = mergeMapOfBytes\n\tdefault:\n\t\tfuncs.merge = mergeMap\n\t}\n\tif valFuncs.isInit != nil {\n\t\tfuncs.isInit = func(p pointer, f *coderFieldInfo) error {\n\t\t\treturn isInitMap(p.AsValueOf(ft).Elem(), mapi, f)\n\t\t}\n\t}\n\treturn valueMessage, funcs\n}\n\nconst (\n\tmapKeyTagSize = 1 // field 1, tag size 1.\n\tmapValTagSize = 1 // field 2, tag size 2.\n)\n\nfunc sizeMap(mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) int {\n\tif mapv.Len() == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\titer := mapRange(mapv)\n\tfor iter.Next() {\n\t\tkey := mapi.conv.keyConv.PBValueOf(iter.Key()).MapKey()\n\t\tkeySize := mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)\n\t\tvar valSize int\n\t\tvalue := mapi.conv.valConv.PBValueOf(iter.Value())\n\t\tif f.mi == nil {\n\t\t\tvalSize = mapi.valFuncs.size(value, mapValTagSize, opts)\n\t\t} else {\n\t\t\tp := pointerOfValue(iter.Value())\n\t\t\tvalSize += mapValTagSize\n\t\t\tvalSize += protowire.SizeBytes(f.mi.sizePointer(p, opts))\n\t\t}\n\t\tn += f.tagsize + protowire.SizeBytes(keySize+valSize)\n\t}\n\treturn n\n}\n\nfunc consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tb, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvar (\n\t\tkey = mapi.keyZero\n\t\tval = mapi.conv.valConv.New()\n\t)\n\tfor len(b) > 0 {\n\t\tnum, wtyp, n := protowire.ConsumeTag(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tif num > protowire.MaxValidNumber {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tb = b[n:]\n\t\terr := errUnknown\n\t\tswitch num {\n\t\tcase genid.MapEntry_Key_field_number:\n\t\t\tvar v pref.Value\n\t\t\tvar o unmarshalOutput\n\t\t\tv, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tkey = v\n\t\t\tn = o.n\n\t\tcase genid.MapEntry_Value_field_number:\n\t\t\tvar v pref.Value\n\t\t\tvar o unmarshalOutput\n\t\t\tv, o, err = mapi.valFuncs.unmarshal(b, val, num, wtyp, opts)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tval = v\n\t\t\tn = o.n\n\t\t}\n\t\tif err == errUnknown {\n\t\t\tn = protowire.ConsumeFieldValue(num, wtyp, b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\treturn out, err\n\t\t}\n\t\tb = b[n:]\n\t}\n\tmapv.SetMapIndex(mapi.conv.keyConv.GoValueOf(key), mapi.conv.valConv.GoValueOf(val))\n\tout.n = n\n\treturn out, nil\n}\n\nfunc consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tb, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvar (\n\t\tkey = mapi.keyZero\n\t\tval = reflect.New(f.mi.GoReflectType.Elem())\n\t)\n\tfor len(b) > 0 {\n\t\tnum, wtyp, n := protowire.ConsumeTag(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tif num > protowire.MaxValidNumber {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tb = b[n:]\n\t\terr := errUnknown\n\t\tswitch num {\n\t\tcase 1:\n\t\t\tvar v pref.Value\n\t\t\tvar o unmarshalOutput\n\t\t\tv, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tkey = v\n\t\t\tn = o.n\n\t\tcase 2:\n\t\t\tif wtyp != protowire.BytesType {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tvar v []byte\n\t\t\tv, n = protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\tvar o unmarshalOutput\n\t\t\to, err = f.mi.unmarshalPointer(v, pointerOfValue(val), 0, opts)\n\t\t\tif o.initialized {\n\t\t\t\t// Consider this map item initialized so long as we see\n\t\t\t\t// an initialized value.\n\t\t\t\tout.initialized = true\n\t\t\t}\n\t\t}\n\t\tif err == errUnknown {\n\t\t\tn = protowire.ConsumeFieldValue(num, wtyp, b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\treturn out, err\n\t\t}\n\t\tb = b[n:]\n\t}\n\tmapv.SetMapIndex(mapi.conv.keyConv.GoValueOf(key), val)\n\tout.n = n\n\treturn out, nil\n}\n\nfunc appendMapItem(b []byte, keyrv, valrv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tif f.mi == nil {\n\t\tkey := mapi.conv.keyConv.PBValueOf(keyrv).MapKey()\n\t\tval := mapi.conv.valConv.PBValueOf(valrv)\n\t\tsize := 0\n\t\tsize += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)\n\t\tsize += mapi.valFuncs.size(val, mapValTagSize, opts)\n\t\tb = protowire.AppendVarint(b, uint64(size))\n\t\tb, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn mapi.valFuncs.marshal(b, val, mapi.valWiretag, opts)\n\t} else {\n\t\tkey := mapi.conv.keyConv.PBValueOf(keyrv).MapKey()\n\t\tval := pointerOfValue(valrv)\n\t\tvalSize := f.mi.sizePointer(val, opts)\n\t\tsize := 0\n\t\tsize += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)\n\t\tsize += mapValTagSize + protowire.SizeBytes(valSize)\n\t\tb = protowire.AppendVarint(b, uint64(size))\n\t\tb, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tb = protowire.AppendVarint(b, mapi.valWiretag)\n\t\tb = protowire.AppendVarint(b, uint64(valSize))\n\t\treturn f.mi.marshalAppendPointer(b, val, opts)\n\t}\n}\n\nfunc appendMap(b []byte, mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tif mapv.Len() == 0 {\n\t\treturn b, nil\n\t}\n\tif opts.Deterministic() {\n\t\treturn appendMapDeterministic(b, mapv, mapi, f, opts)\n\t}\n\titer := mapRange(mapv)\n\tfor iter.Next() {\n\t\tvar err error\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb, err = appendMapItem(b, iter.Key(), iter.Value(), mapi, f, opts)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\treturn b, nil\n}\n\nfunc appendMapDeterministic(b []byte, mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tkeys := mapv.MapKeys()\n\tsort.Slice(keys, func(i, j int) bool {\n\t\tswitch keys[i].Kind() {\n\t\tcase reflect.Bool:\n\t\t\treturn !keys[i].Bool() && keys[j].Bool()\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\treturn keys[i].Int() < keys[j].Int()\n\t\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\t\treturn keys[i].Uint() < keys[j].Uint()\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\treturn keys[i].Float() < keys[j].Float()\n\t\tcase reflect.String:\n\t\t\treturn keys[i].String() < keys[j].String()\n\t\tdefault:\n\t\t\tpanic(\"invalid kind: \" + keys[i].Kind().String())\n\t\t}\n\t})\n\tfor _, key := range keys {\n\t\tvar err error\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb, err = appendMapItem(b, key, mapv.MapIndex(key), mapi, f, opts)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\treturn b, nil\n}\n\nfunc isInitMap(mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo) error {\n\tif mi := f.mi; mi != nil {\n\t\tmi.init()\n\t\tif !mi.needsInitCheck {\n\t\t\treturn nil\n\t\t}\n\t\titer := mapRange(mapv)\n\t\tfor iter.Next() {\n\t\t\tval := pointerOfValue(iter.Value())\n\t\t\tif err := mi.checkInitializedPointer(val); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t} else {\n\t\titer := mapRange(mapv)\n\t\tfor iter.Next() {\n\t\t\tval := mapi.conv.valConv.PBValueOf(iter.Value())\n\t\t\tif err := mapi.valFuncs.isInit(val); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc mergeMap(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {\n\tdstm := dst.AsValueOf(f.ft).Elem()\n\tsrcm := src.AsValueOf(f.ft).Elem()\n\tif srcm.Len() == 0 {\n\t\treturn\n\t}\n\tif dstm.IsNil() {\n\t\tdstm.Set(reflect.MakeMap(f.ft))\n\t}\n\titer := mapRange(srcm)\n\tfor iter.Next() {\n\t\tdstm.SetMapIndex(iter.Key(), iter.Value())\n\t}\n}\n\nfunc mergeMapOfBytes(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {\n\tdstm := dst.AsValueOf(f.ft).Elem()\n\tsrcm := src.AsValueOf(f.ft).Elem()\n\tif srcm.Len() == 0 {\n\t\treturn\n\t}\n\tif dstm.IsNil() {\n\t\tdstm.Set(reflect.MakeMap(f.ft))\n\t}\n\titer := mapRange(srcm)\n\tfor iter.Next() {\n\t\tdstm.SetMapIndex(iter.Key(), reflect.ValueOf(append(emptyBuf[:], iter.Value().Bytes()...)))\n\t}\n}\n\nfunc mergeMapOfMessage(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {\n\tdstm := dst.AsValueOf(f.ft).Elem()\n\tsrcm := src.AsValueOf(f.ft).Elem()\n\tif srcm.Len() == 0 {\n\t\treturn\n\t}\n\tif dstm.IsNil() {\n\t\tdstm.Set(reflect.MakeMap(f.ft))\n\t}\n\titer := mapRange(srcm)\n\tfor iter.Next() {\n\t\tval := reflect.New(f.ft.Elem().Elem())\n\t\tif f.mi != nil {\n\t\t\tf.mi.mergePointer(pointerOfValue(val), pointerOfValue(iter.Value()), opts)\n\t\t} else {\n\t\t\topts.Merge(asMessage(val), asMessage(iter.Value()))\n\t\t}\n\t\tdstm.SetMapIndex(iter.Key(), val)\n\t}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/codec_map_go111.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// +build !go1.12\n\npackage impl\n\nimport \"reflect\"\n\ntype mapIter struct {\n\tv    reflect.Value\n\tkeys []reflect.Value\n}\n\n// mapRange provides a less-efficient equivalent to\n// the Go 1.12 reflect.Value.MapRange method.\nfunc mapRange(v reflect.Value) *mapIter {\n\treturn &mapIter{v: v}\n}\n\nfunc (i *mapIter) Next() bool {\n\tif i.keys == nil {\n\t\ti.keys = i.v.MapKeys()\n\t} else {\n\t\ti.keys = i.keys[1:]\n\t}\n\treturn len(i.keys) > 0\n}\n\nfunc (i *mapIter) Key() reflect.Value {\n\treturn i.keys[0]\n}\n\nfunc (i *mapIter) Value() reflect.Value {\n\treturn i.v.MapIndex(i.keys[0])\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/codec_map_go112.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// +build go1.12\n\npackage impl\n\nimport \"reflect\"\n\nfunc mapRange(v reflect.Value) *reflect.MapIter { return v.MapRange() }\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/codec_message.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"sort\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/order\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// coderMessageInfo contains per-message information used by the fast-path functions.\n// This is a different type from MessageInfo to keep MessageInfo as general-purpose as\n// possible.\ntype coderMessageInfo struct {\n\tmethods piface.Methods\n\n\torderedCoderFields []*coderFieldInfo\n\tdenseCoderFields   []*coderFieldInfo\n\tcoderFields        map[protowire.Number]*coderFieldInfo\n\tsizecacheOffset    offset\n\tunknownOffset      offset\n\tunknownPtrKind     bool\n\textensionOffset    offset\n\tneedsInitCheck     bool\n\tisMessageSet       bool\n\tnumRequiredFields  uint8\n}\n\ntype coderFieldInfo struct {\n\tfuncs      pointerCoderFuncs // fast-path per-field functions\n\tmi         *MessageInfo      // field's message\n\tft         reflect.Type\n\tvalidation validationInfo   // information used by message validation\n\tnum        pref.FieldNumber // field number\n\toffset     offset           // struct field offset\n\twiretag    uint64           // field tag (number + wire type)\n\ttagsize    int              // size of the varint-encoded tag\n\tisPointer  bool             // true if IsNil may be called on the struct field\n\tisRequired bool             // true if field is required\n}\n\nfunc (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {\n\tmi.sizecacheOffset = invalidOffset\n\tmi.unknownOffset = invalidOffset\n\tmi.extensionOffset = invalidOffset\n\n\tif si.sizecacheOffset.IsValid() && si.sizecacheType == sizecacheType {\n\t\tmi.sizecacheOffset = si.sizecacheOffset\n\t}\n\tif si.unknownOffset.IsValid() && (si.unknownType == unknownFieldsAType || si.unknownType == unknownFieldsBType) {\n\t\tmi.unknownOffset = si.unknownOffset\n\t\tmi.unknownPtrKind = si.unknownType.Kind() == reflect.Ptr\n\t}\n\tif si.extensionOffset.IsValid() && si.extensionType == extensionFieldsType {\n\t\tmi.extensionOffset = si.extensionOffset\n\t}\n\n\tmi.coderFields = make(map[protowire.Number]*coderFieldInfo)\n\tfields := mi.Desc.Fields()\n\tpreallocFields := make([]coderFieldInfo, fields.Len())\n\tfor i := 0; i < fields.Len(); i++ {\n\t\tfd := fields.Get(i)\n\n\t\tfs := si.fieldsByNumber[fd.Number()]\n\t\tisOneof := fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic()\n\t\tif isOneof {\n\t\t\tfs = si.oneofsByName[fd.ContainingOneof().Name()]\n\t\t}\n\t\tft := fs.Type\n\t\tvar wiretag uint64\n\t\tif !fd.IsPacked() {\n\t\t\twiretag = protowire.EncodeTag(fd.Number(), wireTypes[fd.Kind()])\n\t\t} else {\n\t\t\twiretag = protowire.EncodeTag(fd.Number(), protowire.BytesType)\n\t\t}\n\t\tvar fieldOffset offset\n\t\tvar funcs pointerCoderFuncs\n\t\tvar childMessage *MessageInfo\n\t\tswitch {\n\t\tcase ft == nil:\n\t\t\t// This never occurs for generated message types.\n\t\t\t// It implies that a hand-crafted type has missing Go fields\n\t\t\t// for specific protobuf message fields.\n\t\t\tfuncs = pointerCoderFuncs{\n\t\t\t\tsize: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\t\t\t\t\treturn 0\n\t\t\t\t},\n\t\t\t\tmarshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\t\t\t\treturn nil, nil\n\t\t\t\t},\n\t\t\t\tunmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t\t\t},\n\t\t\t\tisInit: func(p pointer, f *coderFieldInfo) error {\n\t\t\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t\t\t},\n\t\t\t\tmerge: func(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {\n\t\t\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t\t\t},\n\t\t\t}\n\t\tcase isOneof:\n\t\t\tfieldOffset = offsetOf(fs, mi.Exporter)\n\t\tcase fd.IsWeak():\n\t\t\tfieldOffset = si.weakOffset\n\t\t\tfuncs = makeWeakMessageFieldCoder(fd)\n\t\tdefault:\n\t\t\tfieldOffset = offsetOf(fs, mi.Exporter)\n\t\t\tchildMessage, funcs = fieldCoder(fd, ft)\n\t\t}\n\t\tcf := &preallocFields[i]\n\t\t*cf = coderFieldInfo{\n\t\t\tnum:        fd.Number(),\n\t\t\toffset:     fieldOffset,\n\t\t\twiretag:    wiretag,\n\t\t\tft:         ft,\n\t\t\ttagsize:    protowire.SizeVarint(wiretag),\n\t\t\tfuncs:      funcs,\n\t\t\tmi:         childMessage,\n\t\t\tvalidation: newFieldValidationInfo(mi, si, fd, ft),\n\t\t\tisPointer:  fd.Cardinality() == pref.Repeated || fd.HasPresence(),\n\t\t\tisRequired: fd.Cardinality() == pref.Required,\n\t\t}\n\t\tmi.orderedCoderFields = append(mi.orderedCoderFields, cf)\n\t\tmi.coderFields[cf.num] = cf\n\t}\n\tfor i, oneofs := 0, mi.Desc.Oneofs(); i < oneofs.Len(); i++ {\n\t\tif od := oneofs.Get(i); !od.IsSynthetic() {\n\t\t\tmi.initOneofFieldCoders(od, si)\n\t\t}\n\t}\n\tif messageset.IsMessageSet(mi.Desc) {\n\t\tif !mi.extensionOffset.IsValid() {\n\t\t\tpanic(fmt.Sprintf(\"%v: MessageSet with no extensions field\", mi.Desc.FullName()))\n\t\t}\n\t\tif !mi.unknownOffset.IsValid() {\n\t\t\tpanic(fmt.Sprintf(\"%v: MessageSet with no unknown field\", mi.Desc.FullName()))\n\t\t}\n\t\tmi.isMessageSet = true\n\t}\n\tsort.Slice(mi.orderedCoderFields, func(i, j int) bool {\n\t\treturn mi.orderedCoderFields[i].num < mi.orderedCoderFields[j].num\n\t})\n\n\tvar maxDense pref.FieldNumber\n\tfor _, cf := range mi.orderedCoderFields {\n\t\tif cf.num >= 16 && cf.num >= 2*maxDense {\n\t\t\tbreak\n\t\t}\n\t\tmaxDense = cf.num\n\t}\n\tmi.denseCoderFields = make([]*coderFieldInfo, maxDense+1)\n\tfor _, cf := range mi.orderedCoderFields {\n\t\tif int(cf.num) >= len(mi.denseCoderFields) {\n\t\t\tbreak\n\t\t}\n\t\tmi.denseCoderFields[cf.num] = cf\n\t}\n\n\t// To preserve compatibility with historic wire output, marshal oneofs last.\n\tif mi.Desc.Oneofs().Len() > 0 {\n\t\tsort.Slice(mi.orderedCoderFields, func(i, j int) bool {\n\t\t\tfi := fields.ByNumber(mi.orderedCoderFields[i].num)\n\t\t\tfj := fields.ByNumber(mi.orderedCoderFields[j].num)\n\t\t\treturn order.LegacyFieldOrder(fi, fj)\n\t\t})\n\t}\n\n\tmi.needsInitCheck = needsInitCheck(mi.Desc)\n\tif mi.methods.Marshal == nil && mi.methods.Size == nil {\n\t\tmi.methods.Flags |= piface.SupportMarshalDeterministic\n\t\tmi.methods.Marshal = mi.marshal\n\t\tmi.methods.Size = mi.size\n\t}\n\tif mi.methods.Unmarshal == nil {\n\t\tmi.methods.Flags |= piface.SupportUnmarshalDiscardUnknown\n\t\tmi.methods.Unmarshal = mi.unmarshal\n\t}\n\tif mi.methods.CheckInitialized == nil {\n\t\tmi.methods.CheckInitialized = mi.checkInitialized\n\t}\n\tif mi.methods.Merge == nil {\n\t\tmi.methods.Merge = mi.merge\n\t}\n}\n\n// getUnknownBytes returns a *[]byte for the unknown fields.\n// It is the caller's responsibility to check whether the pointer is nil.\n// This function is specially designed to be inlineable.\nfunc (mi *MessageInfo) getUnknownBytes(p pointer) *[]byte {\n\tif mi.unknownPtrKind {\n\t\treturn *p.Apply(mi.unknownOffset).BytesPtr()\n\t} else {\n\t\treturn p.Apply(mi.unknownOffset).Bytes()\n\t}\n}\n\n// mutableUnknownBytes returns a *[]byte for the unknown fields.\n// The returned pointer is guaranteed to not be nil.\nfunc (mi *MessageInfo) mutableUnknownBytes(p pointer) *[]byte {\n\tif mi.unknownPtrKind {\n\t\tbp := p.Apply(mi.unknownOffset).BytesPtr()\n\t\tif *bp == nil {\n\t\t\t*bp = new([]byte)\n\t\t}\n\t\treturn *bp\n\t} else {\n\t\treturn p.Apply(mi.unknownOffset).Bytes()\n\t}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/codec_messageset.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 impl\n\nimport (\n\t\"sort\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n)\n\nfunc sizeMessageSet(mi *MessageInfo, p pointer, opts marshalOptions) (size int) {\n\tif !flags.ProtoLegacy {\n\t\treturn 0\n\t}\n\n\text := *p.Apply(mi.extensionOffset).Extensions()\n\tfor _, x := range ext {\n\t\txi := getExtensionFieldInfo(x.Type())\n\t\tif xi.funcs.size == nil {\n\t\t\tcontinue\n\t\t}\n\t\tnum, _ := protowire.DecodeTag(xi.wiretag)\n\t\tsize += messageset.SizeField(num)\n\t\tsize += xi.funcs.size(x.Value(), protowire.SizeTag(messageset.FieldMessage), opts)\n\t}\n\n\tif u := mi.getUnknownBytes(p); u != nil {\n\t\tsize += messageset.SizeUnknown(*u)\n\t}\n\n\treturn size\n}\n\nfunc marshalMessageSet(mi *MessageInfo, b []byte, p pointer, opts marshalOptions) ([]byte, error) {\n\tif !flags.ProtoLegacy {\n\t\treturn b, errors.New(\"no support for message_set_wire_format\")\n\t}\n\n\text := *p.Apply(mi.extensionOffset).Extensions()\n\tswitch len(ext) {\n\tcase 0:\n\tcase 1:\n\t\t// Fast-path for one extension: Don't bother sorting the keys.\n\t\tfor _, x := range ext {\n\t\t\tvar err error\n\t\t\tb, err = marshalMessageSetField(mi, b, x, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn b, err\n\t\t\t}\n\t\t}\n\tdefault:\n\t\t// Sort the keys to provide a deterministic encoding.\n\t\t// Not sure this is required, but the old code does it.\n\t\tkeys := make([]int, 0, len(ext))\n\t\tfor k := range ext {\n\t\t\tkeys = append(keys, int(k))\n\t\t}\n\t\tsort.Ints(keys)\n\t\tfor _, k := range keys {\n\t\t\tvar err error\n\t\t\tb, err = marshalMessageSetField(mi, b, ext[int32(k)], opts)\n\t\t\tif err != nil {\n\t\t\t\treturn b, err\n\t\t\t}\n\t\t}\n\t}\n\n\tif u := mi.getUnknownBytes(p); u != nil {\n\t\tvar err error\n\t\tb, err = messageset.AppendUnknown(b, *u)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\n\treturn b, nil\n}\n\nfunc marshalMessageSetField(mi *MessageInfo, b []byte, x ExtensionField, opts marshalOptions) ([]byte, error) {\n\txi := getExtensionFieldInfo(x.Type())\n\tnum, _ := protowire.DecodeTag(xi.wiretag)\n\tb = messageset.AppendFieldStart(b, num)\n\tb, err := xi.funcs.marshal(b, x.Value(), protowire.EncodeTag(messageset.FieldMessage, protowire.BytesType), opts)\n\tif err != nil {\n\t\treturn b, err\n\t}\n\tb = messageset.AppendFieldEnd(b)\n\treturn b, nil\n}\n\nfunc unmarshalMessageSet(mi *MessageInfo, b []byte, p pointer, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif !flags.ProtoLegacy {\n\t\treturn out, errors.New(\"no support for message_set_wire_format\")\n\t}\n\n\tep := p.Apply(mi.extensionOffset).Extensions()\n\tif *ep == nil {\n\t\t*ep = make(map[int32]ExtensionField)\n\t}\n\text := *ep\n\tinitialized := true\n\terr = messageset.Unmarshal(b, true, func(num protowire.Number, v []byte) error {\n\t\to, err := mi.unmarshalExtension(v, num, protowire.BytesType, ext, opts)\n\t\tif err == errUnknown {\n\t\t\tu := mi.mutableUnknownBytes(p)\n\t\t\t*u = protowire.AppendTag(*u, num, protowire.BytesType)\n\t\t\t*u = append(*u, v...)\n\t\t\treturn nil\n\t\t}\n\t\tif !o.initialized {\n\t\t\tinitialized = false\n\t\t}\n\t\treturn err\n\t})\n\tout.n = len(b)\n\tout.initialized = initialized\n\treturn out, err\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/codec_reflect.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// +build purego appengine\n\npackage impl\n\nimport (\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n)\n\nfunc sizeEnum(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {\n\tv := p.v.Elem().Int()\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\nfunc appendEnum(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := p.v.Elem().Int()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\nfunc consumeEnum(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeVarint(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tp.v.Elem().SetInt(int64(v))\n\tout.n = n\n\treturn out, nil\n}\n\nfunc mergeEnum(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tdst.v.Elem().Set(src.v.Elem())\n}\n\nvar coderEnum = pointerCoderFuncs{\n\tsize:      sizeEnum,\n\tmarshal:   appendEnum,\n\tunmarshal: consumeEnum,\n\tmerge:     mergeEnum,\n}\n\nfunc sizeEnumNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tif p.v.Elem().Int() == 0 {\n\t\treturn 0\n\t}\n\treturn sizeEnum(p, f, opts)\n}\n\nfunc appendEnumNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tif p.v.Elem().Int() == 0 {\n\t\treturn b, nil\n\t}\n\treturn appendEnum(b, p, f, opts)\n}\n\nfunc mergeEnumNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tif src.v.Elem().Int() != 0 {\n\t\tdst.v.Elem().Set(src.v.Elem())\n\t}\n}\n\nvar coderEnumNoZero = pointerCoderFuncs{\n\tsize:      sizeEnumNoZero,\n\tmarshal:   appendEnumNoZero,\n\tunmarshal: consumeEnum,\n\tmerge:     mergeEnumNoZero,\n}\n\nfunc sizeEnumPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\treturn sizeEnum(pointer{p.v.Elem()}, f, opts)\n}\n\nfunc appendEnumPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\treturn appendEnum(b, pointer{p.v.Elem()}, f, opts)\n}\n\nfunc consumeEnumPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tif p.v.Elem().IsNil() {\n\t\tp.v.Elem().Set(reflect.New(p.v.Elem().Type().Elem()))\n\t}\n\treturn consumeEnum(b, pointer{p.v.Elem()}, wtyp, f, opts)\n}\n\nfunc mergeEnumPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tif !src.v.Elem().IsNil() {\n\t\tv := reflect.New(dst.v.Type().Elem().Elem())\n\t\tv.Elem().Set(src.v.Elem().Elem())\n\t\tdst.v.Elem().Set(v)\n\t}\n}\n\nvar coderEnumPtr = pointerCoderFuncs{\n\tsize:      sizeEnumPtr,\n\tmarshal:   appendEnumPtr,\n\tunmarshal: consumeEnumPtr,\n\tmerge:     mergeEnumPtr,\n}\n\nfunc sizeEnumSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := p.v.Elem()\n\tfor i, llen := 0, s.Len(); i < llen; i++ {\n\t\tsize += protowire.SizeVarint(uint64(s.Index(i).Int())) + f.tagsize\n\t}\n\treturn size\n}\n\nfunc appendEnumSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := p.v.Elem()\n\tfor i, llen := 0, s.Len(); i < llen; i++ {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(s.Index(i).Int()))\n\t}\n\treturn b, nil\n}\n\nfunc consumeEnumSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\ts := p.v.Elem()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeVarint(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\trv := reflect.New(s.Type().Elem()).Elem()\n\t\t\trv.SetInt(int64(v))\n\t\t\ts.Set(reflect.Append(s, rv))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeVarint(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\trv := reflect.New(s.Type().Elem()).Elem()\n\trv.SetInt(int64(v))\n\ts.Set(reflect.Append(s, rv))\n\tout.n = n\n\treturn out, nil\n}\n\nfunc mergeEnumSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tdst.v.Elem().Set(reflect.AppendSlice(dst.v.Elem(), src.v.Elem()))\n}\n\nvar coderEnumSlice = pointerCoderFuncs{\n\tsize:      sizeEnumSlice,\n\tmarshal:   appendEnumSlice,\n\tunmarshal: consumeEnumSlice,\n\tmerge:     mergeEnumSlice,\n}\n\nfunc sizeEnumPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := p.v.Elem()\n\tllen := s.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tn += protowire.SizeVarint(uint64(s.Index(i).Int()))\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\nfunc appendEnumPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := p.v.Elem()\n\tllen := s.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tn += protowire.SizeVarint(uint64(s.Index(i).Int()))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tb = protowire.AppendVarint(b, uint64(s.Index(i).Int()))\n\t}\n\treturn b, nil\n}\n\nvar coderEnumPackedSlice = pointerCoderFuncs{\n\tsize:      sizeEnumPackedSlice,\n\tmarshal:   appendEnumPackedSlice,\n\tunmarshal: consumeEnumSlice,\n\tmerge:     mergeEnumSlice,\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/codec_tables.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// pointerCoderFuncs is a set of pointer encoding functions.\ntype pointerCoderFuncs struct {\n\tmi        *MessageInfo\n\tsize      func(p pointer, f *coderFieldInfo, opts marshalOptions) int\n\tmarshal   func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error)\n\tunmarshal func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error)\n\tisInit    func(p pointer, f *coderFieldInfo) error\n\tmerge     func(dst, src pointer, f *coderFieldInfo, opts mergeOptions)\n}\n\n// valueCoderFuncs is a set of protoreflect.Value encoding functions.\ntype valueCoderFuncs struct {\n\tsize      func(v pref.Value, tagsize int, opts marshalOptions) int\n\tmarshal   func(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error)\n\tunmarshal func(b []byte, v pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error)\n\tisInit    func(v pref.Value) error\n\tmerge     func(dst, src pref.Value, opts mergeOptions) pref.Value\n}\n\n// fieldCoder returns pointer functions for a field, used for operating on\n// struct fields.\nfunc fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointerCoderFuncs) {\n\tswitch {\n\tcase fd.IsMap():\n\t\treturn encoderFuncsForMap(fd, ft)\n\tcase fd.Cardinality() == pref.Repeated && !fd.IsPacked():\n\t\t// Repeated fields (not packed).\n\t\tif ft.Kind() != reflect.Slice {\n\t\t\tbreak\n\t\t}\n\t\tft := ft.Elem()\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\tif ft.Kind() == reflect.Bool {\n\t\t\t\treturn nil, coderBoolSlice\n\t\t\t}\n\t\tcase pref.EnumKind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderEnumSlice\n\t\t\t}\n\t\tcase pref.Int32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderInt32Slice\n\t\t\t}\n\t\tcase pref.Sint32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSint32Slice\n\t\t\t}\n\t\tcase pref.Uint32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderUint32Slice\n\t\t\t}\n\t\tcase pref.Int64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderInt64Slice\n\t\t\t}\n\t\tcase pref.Sint64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSint64Slice\n\t\t\t}\n\t\tcase pref.Uint64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderUint64Slice\n\t\t\t}\n\t\tcase pref.Sfixed32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSfixed32Slice\n\t\t\t}\n\t\tcase pref.Fixed32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderFixed32Slice\n\t\t\t}\n\t\tcase pref.FloatKind:\n\t\t\tif ft.Kind() == reflect.Float32 {\n\t\t\t\treturn nil, coderFloatSlice\n\t\t\t}\n\t\tcase pref.Sfixed64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSfixed64Slice\n\t\t\t}\n\t\tcase pref.Fixed64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderFixed64Slice\n\t\t\t}\n\t\tcase pref.DoubleKind:\n\t\t\tif ft.Kind() == reflect.Float64 {\n\t\t\t\treturn nil, coderDoubleSlice\n\t\t\t}\n\t\tcase pref.StringKind:\n\t\t\tif ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {\n\t\t\t\treturn nil, coderStringSliceValidateUTF8\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderStringSlice\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 && strs.EnforceUTF8(fd) {\n\t\t\t\treturn nil, coderBytesSliceValidateUTF8\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {\n\t\t\t\treturn nil, coderBytesSlice\n\t\t\t}\n\t\tcase pref.BytesKind:\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderStringSlice\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {\n\t\t\t\treturn nil, coderBytesSlice\n\t\t\t}\n\t\tcase pref.MessageKind:\n\t\t\treturn getMessageInfo(ft), makeMessageSliceFieldCoder(fd, ft)\n\t\tcase pref.GroupKind:\n\t\t\treturn getMessageInfo(ft), makeGroupSliceFieldCoder(fd, ft)\n\t\t}\n\tcase fd.Cardinality() == pref.Repeated && fd.IsPacked():\n\t\t// Packed repeated fields.\n\t\t//\n\t\t// Only repeated fields of primitive numeric types\n\t\t// (Varint, Fixed32, or Fixed64 wire type) can be packed.\n\t\tif ft.Kind() != reflect.Slice {\n\t\t\tbreak\n\t\t}\n\t\tft := ft.Elem()\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\tif ft.Kind() == reflect.Bool {\n\t\t\t\treturn nil, coderBoolPackedSlice\n\t\t\t}\n\t\tcase pref.EnumKind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderEnumPackedSlice\n\t\t\t}\n\t\tcase pref.Int32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderInt32PackedSlice\n\t\t\t}\n\t\tcase pref.Sint32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSint32PackedSlice\n\t\t\t}\n\t\tcase pref.Uint32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderUint32PackedSlice\n\t\t\t}\n\t\tcase pref.Int64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderInt64PackedSlice\n\t\t\t}\n\t\tcase pref.Sint64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSint64PackedSlice\n\t\t\t}\n\t\tcase pref.Uint64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderUint64PackedSlice\n\t\t\t}\n\t\tcase pref.Sfixed32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSfixed32PackedSlice\n\t\t\t}\n\t\tcase pref.Fixed32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderFixed32PackedSlice\n\t\t\t}\n\t\tcase pref.FloatKind:\n\t\t\tif ft.Kind() == reflect.Float32 {\n\t\t\t\treturn nil, coderFloatPackedSlice\n\t\t\t}\n\t\tcase pref.Sfixed64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSfixed64PackedSlice\n\t\t\t}\n\t\tcase pref.Fixed64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderFixed64PackedSlice\n\t\t\t}\n\t\tcase pref.DoubleKind:\n\t\t\tif ft.Kind() == reflect.Float64 {\n\t\t\t\treturn nil, coderDoublePackedSlice\n\t\t\t}\n\t\t}\n\tcase fd.Kind() == pref.MessageKind:\n\t\treturn getMessageInfo(ft), makeMessageFieldCoder(fd, ft)\n\tcase fd.Kind() == pref.GroupKind:\n\t\treturn getMessageInfo(ft), makeGroupFieldCoder(fd, ft)\n\tcase fd.Syntax() == pref.Proto3 && fd.ContainingOneof() == nil:\n\t\t// Populated oneof fields always encode even if set to the zero value,\n\t\t// which normally are not encoded in proto3.\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\tif ft.Kind() == reflect.Bool {\n\t\t\t\treturn nil, coderBoolNoZero\n\t\t\t}\n\t\tcase pref.EnumKind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderEnumNoZero\n\t\t\t}\n\t\tcase pref.Int32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderInt32NoZero\n\t\t\t}\n\t\tcase pref.Sint32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSint32NoZero\n\t\t\t}\n\t\tcase pref.Uint32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderUint32NoZero\n\t\t\t}\n\t\tcase pref.Int64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderInt64NoZero\n\t\t\t}\n\t\tcase pref.Sint64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSint64NoZero\n\t\t\t}\n\t\tcase pref.Uint64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderUint64NoZero\n\t\t\t}\n\t\tcase pref.Sfixed32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSfixed32NoZero\n\t\t\t}\n\t\tcase pref.Fixed32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderFixed32NoZero\n\t\t\t}\n\t\tcase pref.FloatKind:\n\t\t\tif ft.Kind() == reflect.Float32 {\n\t\t\t\treturn nil, coderFloatNoZero\n\t\t\t}\n\t\tcase pref.Sfixed64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSfixed64NoZero\n\t\t\t}\n\t\tcase pref.Fixed64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderFixed64NoZero\n\t\t\t}\n\t\tcase pref.DoubleKind:\n\t\t\tif ft.Kind() == reflect.Float64 {\n\t\t\t\treturn nil, coderDoubleNoZero\n\t\t\t}\n\t\tcase pref.StringKind:\n\t\t\tif ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {\n\t\t\t\treturn nil, coderStringNoZeroValidateUTF8\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderStringNoZero\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 && strs.EnforceUTF8(fd) {\n\t\t\t\treturn nil, coderBytesNoZeroValidateUTF8\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {\n\t\t\t\treturn nil, coderBytesNoZero\n\t\t\t}\n\t\tcase pref.BytesKind:\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderStringNoZero\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {\n\t\t\t\treturn nil, coderBytesNoZero\n\t\t\t}\n\t\t}\n\tcase ft.Kind() == reflect.Ptr:\n\t\tft := ft.Elem()\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\tif ft.Kind() == reflect.Bool {\n\t\t\t\treturn nil, coderBoolPtr\n\t\t\t}\n\t\tcase pref.EnumKind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderEnumPtr\n\t\t\t}\n\t\tcase pref.Int32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderInt32Ptr\n\t\t\t}\n\t\tcase pref.Sint32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSint32Ptr\n\t\t\t}\n\t\tcase pref.Uint32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderUint32Ptr\n\t\t\t}\n\t\tcase pref.Int64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderInt64Ptr\n\t\t\t}\n\t\tcase pref.Sint64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSint64Ptr\n\t\t\t}\n\t\tcase pref.Uint64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderUint64Ptr\n\t\t\t}\n\t\tcase pref.Sfixed32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSfixed32Ptr\n\t\t\t}\n\t\tcase pref.Fixed32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderFixed32Ptr\n\t\t\t}\n\t\tcase pref.FloatKind:\n\t\t\tif ft.Kind() == reflect.Float32 {\n\t\t\t\treturn nil, coderFloatPtr\n\t\t\t}\n\t\tcase pref.Sfixed64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSfixed64Ptr\n\t\t\t}\n\t\tcase pref.Fixed64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderFixed64Ptr\n\t\t\t}\n\t\tcase pref.DoubleKind:\n\t\t\tif ft.Kind() == reflect.Float64 {\n\t\t\t\treturn nil, coderDoublePtr\n\t\t\t}\n\t\tcase pref.StringKind:\n\t\t\tif ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {\n\t\t\t\treturn nil, coderStringPtrValidateUTF8\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderStringPtr\n\t\t\t}\n\t\tcase pref.BytesKind:\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderStringPtr\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\tif ft.Kind() == reflect.Bool {\n\t\t\t\treturn nil, coderBool\n\t\t\t}\n\t\tcase pref.EnumKind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderEnum\n\t\t\t}\n\t\tcase pref.Int32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderInt32\n\t\t\t}\n\t\tcase pref.Sint32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSint32\n\t\t\t}\n\t\tcase pref.Uint32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderUint32\n\t\t\t}\n\t\tcase pref.Int64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderInt64\n\t\t\t}\n\t\tcase pref.Sint64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSint64\n\t\t\t}\n\t\tcase pref.Uint64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderUint64\n\t\t\t}\n\t\tcase pref.Sfixed32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSfixed32\n\t\t\t}\n\t\tcase pref.Fixed32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderFixed32\n\t\t\t}\n\t\tcase pref.FloatKind:\n\t\t\tif ft.Kind() == reflect.Float32 {\n\t\t\t\treturn nil, coderFloat\n\t\t\t}\n\t\tcase pref.Sfixed64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSfixed64\n\t\t\t}\n\t\tcase pref.Fixed64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderFixed64\n\t\t\t}\n\t\tcase pref.DoubleKind:\n\t\t\tif ft.Kind() == reflect.Float64 {\n\t\t\t\treturn nil, coderDouble\n\t\t\t}\n\t\tcase pref.StringKind:\n\t\t\tif ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {\n\t\t\t\treturn nil, coderStringValidateUTF8\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderString\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 && strs.EnforceUTF8(fd) {\n\t\t\t\treturn nil, coderBytesValidateUTF8\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {\n\t\t\t\treturn nil, coderBytes\n\t\t\t}\n\t\tcase pref.BytesKind:\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderString\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {\n\t\t\t\treturn nil, coderBytes\n\t\t\t}\n\t\t}\n\t}\n\tpanic(fmt.Sprintf(\"invalid type: no encoder for %v %v %v/%v\", fd.FullName(), fd.Cardinality(), fd.Kind(), ft))\n}\n\n// encoderFuncsForValue returns value functions for a field, used for\n// extension values and map encoding.\nfunc encoderFuncsForValue(fd pref.FieldDescriptor) valueCoderFuncs {\n\tswitch {\n\tcase fd.Cardinality() == pref.Repeated && !fd.IsPacked():\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\treturn coderBoolSliceValue\n\t\tcase pref.EnumKind:\n\t\t\treturn coderEnumSliceValue\n\t\tcase pref.Int32Kind:\n\t\t\treturn coderInt32SliceValue\n\t\tcase pref.Sint32Kind:\n\t\t\treturn coderSint32SliceValue\n\t\tcase pref.Uint32Kind:\n\t\t\treturn coderUint32SliceValue\n\t\tcase pref.Int64Kind:\n\t\t\treturn coderInt64SliceValue\n\t\tcase pref.Sint64Kind:\n\t\t\treturn coderSint64SliceValue\n\t\tcase pref.Uint64Kind:\n\t\t\treturn coderUint64SliceValue\n\t\tcase pref.Sfixed32Kind:\n\t\t\treturn coderSfixed32SliceValue\n\t\tcase pref.Fixed32Kind:\n\t\t\treturn coderFixed32SliceValue\n\t\tcase pref.FloatKind:\n\t\t\treturn coderFloatSliceValue\n\t\tcase pref.Sfixed64Kind:\n\t\t\treturn coderSfixed64SliceValue\n\t\tcase pref.Fixed64Kind:\n\t\t\treturn coderFixed64SliceValue\n\t\tcase pref.DoubleKind:\n\t\t\treturn coderDoubleSliceValue\n\t\tcase pref.StringKind:\n\t\t\t// We don't have a UTF-8 validating coder for repeated string fields.\n\t\t\t// Value coders are used for extensions and maps.\n\t\t\t// Extensions are never proto3, and maps never contain lists.\n\t\t\treturn coderStringSliceValue\n\t\tcase pref.BytesKind:\n\t\t\treturn coderBytesSliceValue\n\t\tcase pref.MessageKind:\n\t\t\treturn coderMessageSliceValue\n\t\tcase pref.GroupKind:\n\t\t\treturn coderGroupSliceValue\n\t\t}\n\tcase fd.Cardinality() == pref.Repeated && fd.IsPacked():\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\treturn coderBoolPackedSliceValue\n\t\tcase pref.EnumKind:\n\t\t\treturn coderEnumPackedSliceValue\n\t\tcase pref.Int32Kind:\n\t\t\treturn coderInt32PackedSliceValue\n\t\tcase pref.Sint32Kind:\n\t\t\treturn coderSint32PackedSliceValue\n\t\tcase pref.Uint32Kind:\n\t\t\treturn coderUint32PackedSliceValue\n\t\tcase pref.Int64Kind:\n\t\t\treturn coderInt64PackedSliceValue\n\t\tcase pref.Sint64Kind:\n\t\t\treturn coderSint64PackedSliceValue\n\t\tcase pref.Uint64Kind:\n\t\t\treturn coderUint64PackedSliceValue\n\t\tcase pref.Sfixed32Kind:\n\t\t\treturn coderSfixed32PackedSliceValue\n\t\tcase pref.Fixed32Kind:\n\t\t\treturn coderFixed32PackedSliceValue\n\t\tcase pref.FloatKind:\n\t\t\treturn coderFloatPackedSliceValue\n\t\tcase pref.Sfixed64Kind:\n\t\t\treturn coderSfixed64PackedSliceValue\n\t\tcase pref.Fixed64Kind:\n\t\t\treturn coderFixed64PackedSliceValue\n\t\tcase pref.DoubleKind:\n\t\t\treturn coderDoublePackedSliceValue\n\t\t}\n\tdefault:\n\t\tswitch fd.Kind() {\n\t\tdefault:\n\t\tcase pref.BoolKind:\n\t\t\treturn coderBoolValue\n\t\tcase pref.EnumKind:\n\t\t\treturn coderEnumValue\n\t\tcase pref.Int32Kind:\n\t\t\treturn coderInt32Value\n\t\tcase pref.Sint32Kind:\n\t\t\treturn coderSint32Value\n\t\tcase pref.Uint32Kind:\n\t\t\treturn coderUint32Value\n\t\tcase pref.Int64Kind:\n\t\t\treturn coderInt64Value\n\t\tcase pref.Sint64Kind:\n\t\t\treturn coderSint64Value\n\t\tcase pref.Uint64Kind:\n\t\t\treturn coderUint64Value\n\t\tcase pref.Sfixed32Kind:\n\t\t\treturn coderSfixed32Value\n\t\tcase pref.Fixed32Kind:\n\t\t\treturn coderFixed32Value\n\t\tcase pref.FloatKind:\n\t\t\treturn coderFloatValue\n\t\tcase pref.Sfixed64Kind:\n\t\t\treturn coderSfixed64Value\n\t\tcase pref.Fixed64Kind:\n\t\t\treturn coderFixed64Value\n\t\tcase pref.DoubleKind:\n\t\t\treturn coderDoubleValue\n\t\tcase pref.StringKind:\n\t\t\tif strs.EnforceUTF8(fd) {\n\t\t\t\treturn coderStringValueValidateUTF8\n\t\t\t}\n\t\t\treturn coderStringValue\n\t\tcase pref.BytesKind:\n\t\t\treturn coderBytesValue\n\t\tcase pref.MessageKind:\n\t\t\treturn coderMessageValue\n\t\tcase pref.GroupKind:\n\t\t\treturn coderGroupValue\n\t\t}\n\t}\n\tpanic(fmt.Sprintf(\"invalid field: no encoder for %v %v %v\", fd.FullName(), fd.Cardinality(), fd.Kind()))\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/codec_unsafe.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// +build !purego,!appengine\n\npackage impl\n\n// When using unsafe pointers, we can just treat enum values as int32s.\n\nvar (\n\tcoderEnumNoZero      = coderInt32NoZero\n\tcoderEnum            = coderInt32\n\tcoderEnumPtr         = coderInt32Ptr\n\tcoderEnumSlice       = coderInt32Slice\n\tcoderEnumPackedSlice = coderInt32PackedSlice\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/convert.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// unwrapper unwraps the value to the underlying value.\n// This is implemented by List and Map.\ntype unwrapper interface {\n\tprotoUnwrap() interface{}\n}\n\n// A Converter coverts to/from Go reflect.Value types and protobuf protoreflect.Value types.\ntype Converter interface {\n\t// PBValueOf converts a reflect.Value to a protoreflect.Value.\n\tPBValueOf(reflect.Value) pref.Value\n\n\t// GoValueOf converts a protoreflect.Value to a reflect.Value.\n\tGoValueOf(pref.Value) reflect.Value\n\n\t// IsValidPB returns whether a protoreflect.Value is compatible with this type.\n\tIsValidPB(pref.Value) bool\n\n\t// IsValidGo returns whether a reflect.Value is compatible with this type.\n\tIsValidGo(reflect.Value) bool\n\n\t// New returns a new field value.\n\t// For scalars, it returns the default value of the field.\n\t// For composite types, it returns a new mutable value.\n\tNew() pref.Value\n\n\t// Zero returns a new field value.\n\t// For scalars, it returns the default value of the field.\n\t// For composite types, it returns an immutable, empty value.\n\tZero() pref.Value\n}\n\n// NewConverter matches a Go type with a protobuf field and returns a Converter\n// that converts between the two. Enums must be a named int32 kind that\n// implements protoreflect.Enum, and messages must be pointer to a named\n// struct type that implements protoreflect.ProtoMessage.\n//\n// This matcher deliberately supports a wider range of Go types than what\n// protoc-gen-go historically generated to be able to automatically wrap some\n// v1 messages generated by other forks of protoc-gen-go.\nfunc NewConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {\n\tswitch {\n\tcase fd.IsList():\n\t\treturn newListConverter(t, fd)\n\tcase fd.IsMap():\n\t\treturn newMapConverter(t, fd)\n\tdefault:\n\t\treturn newSingularConverter(t, fd)\n\t}\n\tpanic(fmt.Sprintf(\"invalid Go type %v for field %v\", t, fd.FullName()))\n}\n\nvar (\n\tboolType    = reflect.TypeOf(bool(false))\n\tint32Type   = reflect.TypeOf(int32(0))\n\tint64Type   = reflect.TypeOf(int64(0))\n\tuint32Type  = reflect.TypeOf(uint32(0))\n\tuint64Type  = reflect.TypeOf(uint64(0))\n\tfloat32Type = reflect.TypeOf(float32(0))\n\tfloat64Type = reflect.TypeOf(float64(0))\n\tstringType  = reflect.TypeOf(string(\"\"))\n\tbytesType   = reflect.TypeOf([]byte(nil))\n\tbyteType    = reflect.TypeOf(byte(0))\n)\n\nvar (\n\tboolZero    = pref.ValueOfBool(false)\n\tint32Zero   = pref.ValueOfInt32(0)\n\tint64Zero   = pref.ValueOfInt64(0)\n\tuint32Zero  = pref.ValueOfUint32(0)\n\tuint64Zero  = pref.ValueOfUint64(0)\n\tfloat32Zero = pref.ValueOfFloat32(0)\n\tfloat64Zero = pref.ValueOfFloat64(0)\n\tstringZero  = pref.ValueOfString(\"\")\n\tbytesZero   = pref.ValueOfBytes(nil)\n)\n\nfunc newSingularConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {\n\tdefVal := func(fd pref.FieldDescriptor, zero pref.Value) pref.Value {\n\t\tif fd.Cardinality() == pref.Repeated {\n\t\t\t// Default isn't defined for repeated fields.\n\t\t\treturn zero\n\t\t}\n\t\treturn fd.Default()\n\t}\n\tswitch fd.Kind() {\n\tcase pref.BoolKind:\n\t\tif t.Kind() == reflect.Bool {\n\t\t\treturn &boolConverter{t, defVal(fd, boolZero)}\n\t\t}\n\tcase pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:\n\t\tif t.Kind() == reflect.Int32 {\n\t\t\treturn &int32Converter{t, defVal(fd, int32Zero)}\n\t\t}\n\tcase pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:\n\t\tif t.Kind() == reflect.Int64 {\n\t\t\treturn &int64Converter{t, defVal(fd, int64Zero)}\n\t\t}\n\tcase pref.Uint32Kind, pref.Fixed32Kind:\n\t\tif t.Kind() == reflect.Uint32 {\n\t\t\treturn &uint32Converter{t, defVal(fd, uint32Zero)}\n\t\t}\n\tcase pref.Uint64Kind, pref.Fixed64Kind:\n\t\tif t.Kind() == reflect.Uint64 {\n\t\t\treturn &uint64Converter{t, defVal(fd, uint64Zero)}\n\t\t}\n\tcase pref.FloatKind:\n\t\tif t.Kind() == reflect.Float32 {\n\t\t\treturn &float32Converter{t, defVal(fd, float32Zero)}\n\t\t}\n\tcase pref.DoubleKind:\n\t\tif t.Kind() == reflect.Float64 {\n\t\t\treturn &float64Converter{t, defVal(fd, float64Zero)}\n\t\t}\n\tcase pref.StringKind:\n\t\tif t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {\n\t\t\treturn &stringConverter{t, defVal(fd, stringZero)}\n\t\t}\n\tcase pref.BytesKind:\n\t\tif t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {\n\t\t\treturn &bytesConverter{t, defVal(fd, bytesZero)}\n\t\t}\n\tcase pref.EnumKind:\n\t\t// Handle enums, which must be a named int32 type.\n\t\tif t.Kind() == reflect.Int32 {\n\t\t\treturn newEnumConverter(t, fd)\n\t\t}\n\tcase pref.MessageKind, pref.GroupKind:\n\t\treturn newMessageConverter(t)\n\t}\n\tpanic(fmt.Sprintf(\"invalid Go type %v for field %v\", t, fd.FullName()))\n}\n\ntype boolConverter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *boolConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfBool(v.Bool())\n}\nfunc (c *boolConverter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(v.Bool()).Convert(c.goType)\n}\nfunc (c *boolConverter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(bool)\n\treturn ok\n}\nfunc (c *boolConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *boolConverter) New() pref.Value  { return c.def }\nfunc (c *boolConverter) Zero() pref.Value { return c.def }\n\ntype int32Converter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *int32Converter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfInt32(int32(v.Int()))\n}\nfunc (c *int32Converter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(int32(v.Int())).Convert(c.goType)\n}\nfunc (c *int32Converter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(int32)\n\treturn ok\n}\nfunc (c *int32Converter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *int32Converter) New() pref.Value  { return c.def }\nfunc (c *int32Converter) Zero() pref.Value { return c.def }\n\ntype int64Converter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *int64Converter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfInt64(int64(v.Int()))\n}\nfunc (c *int64Converter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(int64(v.Int())).Convert(c.goType)\n}\nfunc (c *int64Converter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(int64)\n\treturn ok\n}\nfunc (c *int64Converter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *int64Converter) New() pref.Value  { return c.def }\nfunc (c *int64Converter) Zero() pref.Value { return c.def }\n\ntype uint32Converter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *uint32Converter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfUint32(uint32(v.Uint()))\n}\nfunc (c *uint32Converter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(uint32(v.Uint())).Convert(c.goType)\n}\nfunc (c *uint32Converter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(uint32)\n\treturn ok\n}\nfunc (c *uint32Converter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *uint32Converter) New() pref.Value  { return c.def }\nfunc (c *uint32Converter) Zero() pref.Value { return c.def }\n\ntype uint64Converter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *uint64Converter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfUint64(uint64(v.Uint()))\n}\nfunc (c *uint64Converter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(uint64(v.Uint())).Convert(c.goType)\n}\nfunc (c *uint64Converter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(uint64)\n\treturn ok\n}\nfunc (c *uint64Converter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *uint64Converter) New() pref.Value  { return c.def }\nfunc (c *uint64Converter) Zero() pref.Value { return c.def }\n\ntype float32Converter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *float32Converter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfFloat32(float32(v.Float()))\n}\nfunc (c *float32Converter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(float32(v.Float())).Convert(c.goType)\n}\nfunc (c *float32Converter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(float32)\n\treturn ok\n}\nfunc (c *float32Converter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *float32Converter) New() pref.Value  { return c.def }\nfunc (c *float32Converter) Zero() pref.Value { return c.def }\n\ntype float64Converter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *float64Converter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfFloat64(float64(v.Float()))\n}\nfunc (c *float64Converter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(float64(v.Float())).Convert(c.goType)\n}\nfunc (c *float64Converter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(float64)\n\treturn ok\n}\nfunc (c *float64Converter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *float64Converter) New() pref.Value  { return c.def }\nfunc (c *float64Converter) Zero() pref.Value { return c.def }\n\ntype stringConverter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *stringConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfString(v.Convert(stringType).String())\n}\nfunc (c *stringConverter) GoValueOf(v pref.Value) reflect.Value {\n\t// pref.Value.String never panics, so we go through an interface\n\t// conversion here to check the type.\n\ts := v.Interface().(string)\n\tif c.goType.Kind() == reflect.Slice && s == \"\" {\n\t\treturn reflect.Zero(c.goType) // ensure empty string is []byte(nil)\n\t}\n\treturn reflect.ValueOf(s).Convert(c.goType)\n}\nfunc (c *stringConverter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(string)\n\treturn ok\n}\nfunc (c *stringConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *stringConverter) New() pref.Value  { return c.def }\nfunc (c *stringConverter) Zero() pref.Value { return c.def }\n\ntype bytesConverter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *bytesConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\tif c.goType.Kind() == reflect.String && v.Len() == 0 {\n\t\treturn pref.ValueOfBytes(nil) // ensure empty string is []byte(nil)\n\t}\n\treturn pref.ValueOfBytes(v.Convert(bytesType).Bytes())\n}\nfunc (c *bytesConverter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(v.Bytes()).Convert(c.goType)\n}\nfunc (c *bytesConverter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().([]byte)\n\treturn ok\n}\nfunc (c *bytesConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *bytesConverter) New() pref.Value  { return c.def }\nfunc (c *bytesConverter) Zero() pref.Value { return c.def }\n\ntype enumConverter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc newEnumConverter(goType reflect.Type, fd pref.FieldDescriptor) Converter {\n\tvar def pref.Value\n\tif fd.Cardinality() == pref.Repeated {\n\t\tdef = pref.ValueOfEnum(fd.Enum().Values().Get(0).Number())\n\t} else {\n\t\tdef = fd.Default()\n\t}\n\treturn &enumConverter{goType, def}\n}\n\nfunc (c *enumConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfEnum(pref.EnumNumber(v.Int()))\n}\n\nfunc (c *enumConverter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(v.Enum()).Convert(c.goType)\n}\n\nfunc (c *enumConverter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(pref.EnumNumber)\n\treturn ok\n}\n\nfunc (c *enumConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\n\nfunc (c *enumConverter) New() pref.Value {\n\treturn c.def\n}\n\nfunc (c *enumConverter) Zero() pref.Value {\n\treturn c.def\n}\n\ntype messageConverter struct {\n\tgoType reflect.Type\n}\n\nfunc newMessageConverter(goType reflect.Type) Converter {\n\treturn &messageConverter{goType}\n}\n\nfunc (c *messageConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\tif c.isNonPointer() {\n\t\tif v.CanAddr() {\n\t\t\tv = v.Addr() // T => *T\n\t\t} else {\n\t\t\tv = reflect.Zero(reflect.PtrTo(v.Type()))\n\t\t}\n\t}\n\tif m, ok := v.Interface().(pref.ProtoMessage); ok {\n\t\treturn pref.ValueOfMessage(m.ProtoReflect())\n\t}\n\treturn pref.ValueOfMessage(legacyWrapMessage(v))\n}\n\nfunc (c *messageConverter) GoValueOf(v pref.Value) reflect.Value {\n\tm := v.Message()\n\tvar rv reflect.Value\n\tif u, ok := m.(unwrapper); ok {\n\t\trv = reflect.ValueOf(u.protoUnwrap())\n\t} else {\n\t\trv = reflect.ValueOf(m.Interface())\n\t}\n\tif c.isNonPointer() {\n\t\tif rv.Type() != reflect.PtrTo(c.goType) {\n\t\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", rv.Type(), reflect.PtrTo(c.goType)))\n\t\t}\n\t\tif !rv.IsNil() {\n\t\t\trv = rv.Elem() // *T => T\n\t\t} else {\n\t\t\trv = reflect.Zero(rv.Type().Elem())\n\t\t}\n\t}\n\tif rv.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", rv.Type(), c.goType))\n\t}\n\treturn rv\n}\n\nfunc (c *messageConverter) IsValidPB(v pref.Value) bool {\n\tm := v.Message()\n\tvar rv reflect.Value\n\tif u, ok := m.(unwrapper); ok {\n\t\trv = reflect.ValueOf(u.protoUnwrap())\n\t} else {\n\t\trv = reflect.ValueOf(m.Interface())\n\t}\n\tif c.isNonPointer() {\n\t\treturn rv.Type() == reflect.PtrTo(c.goType)\n\t}\n\treturn rv.Type() == c.goType\n}\n\nfunc (c *messageConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\n\nfunc (c *messageConverter) New() pref.Value {\n\tif c.isNonPointer() {\n\t\treturn c.PBValueOf(reflect.New(c.goType).Elem())\n\t}\n\treturn c.PBValueOf(reflect.New(c.goType.Elem()))\n}\n\nfunc (c *messageConverter) Zero() pref.Value {\n\treturn c.PBValueOf(reflect.Zero(c.goType))\n}\n\n// isNonPointer reports whether the type is a non-pointer type.\n// This never occurs for generated message types.\nfunc (c *messageConverter) isNonPointer() bool {\n\treturn c.goType.Kind() != reflect.Ptr\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/convert_list.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nfunc newListConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {\n\tswitch {\n\tcase t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Slice:\n\t\treturn &listPtrConverter{t, newSingularConverter(t.Elem().Elem(), fd)}\n\tcase t.Kind() == reflect.Slice:\n\t\treturn &listConverter{t, newSingularConverter(t.Elem(), fd)}\n\t}\n\tpanic(fmt.Sprintf(\"invalid Go type %v for field %v\", t, fd.FullName()))\n}\n\ntype listConverter struct {\n\tgoType reflect.Type // []T\n\tc      Converter\n}\n\nfunc (c *listConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\tpv := reflect.New(c.goType)\n\tpv.Elem().Set(v)\n\treturn pref.ValueOfList(&listReflect{pv, c.c})\n}\n\nfunc (c *listConverter) GoValueOf(v pref.Value) reflect.Value {\n\trv := v.List().(*listReflect).v\n\tif rv.IsNil() {\n\t\treturn reflect.Zero(c.goType)\n\t}\n\treturn rv.Elem()\n}\n\nfunc (c *listConverter) IsValidPB(v pref.Value) bool {\n\tlist, ok := v.Interface().(*listReflect)\n\tif !ok {\n\t\treturn false\n\t}\n\treturn list.v.Type().Elem() == c.goType\n}\n\nfunc (c *listConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\n\nfunc (c *listConverter) New() pref.Value {\n\treturn pref.ValueOfList(&listReflect{reflect.New(c.goType), c.c})\n}\n\nfunc (c *listConverter) Zero() pref.Value {\n\treturn pref.ValueOfList(&listReflect{reflect.Zero(reflect.PtrTo(c.goType)), c.c})\n}\n\ntype listPtrConverter struct {\n\tgoType reflect.Type // *[]T\n\tc      Converter\n}\n\nfunc (c *listPtrConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfList(&listReflect{v, c.c})\n}\n\nfunc (c *listPtrConverter) GoValueOf(v pref.Value) reflect.Value {\n\treturn v.List().(*listReflect).v\n}\n\nfunc (c *listPtrConverter) IsValidPB(v pref.Value) bool {\n\tlist, ok := v.Interface().(*listReflect)\n\tif !ok {\n\t\treturn false\n\t}\n\treturn list.v.Type() == c.goType\n}\n\nfunc (c *listPtrConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\n\nfunc (c *listPtrConverter) New() pref.Value {\n\treturn c.PBValueOf(reflect.New(c.goType.Elem()))\n}\n\nfunc (c *listPtrConverter) Zero() pref.Value {\n\treturn c.PBValueOf(reflect.Zero(c.goType))\n}\n\ntype listReflect struct {\n\tv    reflect.Value // *[]T\n\tconv Converter\n}\n\nfunc (ls *listReflect) Len() int {\n\tif ls.v.IsNil() {\n\t\treturn 0\n\t}\n\treturn ls.v.Elem().Len()\n}\nfunc (ls *listReflect) Get(i int) pref.Value {\n\treturn ls.conv.PBValueOf(ls.v.Elem().Index(i))\n}\nfunc (ls *listReflect) Set(i int, v pref.Value) {\n\tls.v.Elem().Index(i).Set(ls.conv.GoValueOf(v))\n}\nfunc (ls *listReflect) Append(v pref.Value) {\n\tls.v.Elem().Set(reflect.Append(ls.v.Elem(), ls.conv.GoValueOf(v)))\n}\nfunc (ls *listReflect) AppendMutable() pref.Value {\n\tif _, ok := ls.conv.(*messageConverter); !ok {\n\t\tpanic(\"invalid AppendMutable on list with non-message type\")\n\t}\n\tv := ls.NewElement()\n\tls.Append(v)\n\treturn v\n}\nfunc (ls *listReflect) Truncate(i int) {\n\tls.v.Elem().Set(ls.v.Elem().Slice(0, i))\n}\nfunc (ls *listReflect) NewElement() pref.Value {\n\treturn ls.conv.New()\n}\nfunc (ls *listReflect) IsValid() bool {\n\treturn !ls.v.IsNil()\n}\nfunc (ls *listReflect) protoUnwrap() interface{} {\n\treturn ls.v.Interface()\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/convert_map.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype mapConverter struct {\n\tgoType           reflect.Type // map[K]V\n\tkeyConv, valConv Converter\n}\n\nfunc newMapConverter(t reflect.Type, fd pref.FieldDescriptor) *mapConverter {\n\tif t.Kind() != reflect.Map {\n\t\tpanic(fmt.Sprintf(\"invalid Go type %v for field %v\", t, fd.FullName()))\n\t}\n\treturn &mapConverter{\n\t\tgoType:  t,\n\t\tkeyConv: newSingularConverter(t.Key(), fd.MapKey()),\n\t\tvalConv: newSingularConverter(t.Elem(), fd.MapValue()),\n\t}\n}\n\nfunc (c *mapConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfMap(&mapReflect{v, c.keyConv, c.valConv})\n}\n\nfunc (c *mapConverter) GoValueOf(v pref.Value) reflect.Value {\n\treturn v.Map().(*mapReflect).v\n}\n\nfunc (c *mapConverter) IsValidPB(v pref.Value) bool {\n\tmapv, ok := v.Interface().(*mapReflect)\n\tif !ok {\n\t\treturn false\n\t}\n\treturn mapv.v.Type() == c.goType\n}\n\nfunc (c *mapConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\n\nfunc (c *mapConverter) New() pref.Value {\n\treturn c.PBValueOf(reflect.MakeMap(c.goType))\n}\n\nfunc (c *mapConverter) Zero() pref.Value {\n\treturn c.PBValueOf(reflect.Zero(c.goType))\n}\n\ntype mapReflect struct {\n\tv       reflect.Value // map[K]V\n\tkeyConv Converter\n\tvalConv Converter\n}\n\nfunc (ms *mapReflect) Len() int {\n\treturn ms.v.Len()\n}\nfunc (ms *mapReflect) Has(k pref.MapKey) bool {\n\trk := ms.keyConv.GoValueOf(k.Value())\n\trv := ms.v.MapIndex(rk)\n\treturn rv.IsValid()\n}\nfunc (ms *mapReflect) Get(k pref.MapKey) pref.Value {\n\trk := ms.keyConv.GoValueOf(k.Value())\n\trv := ms.v.MapIndex(rk)\n\tif !rv.IsValid() {\n\t\treturn pref.Value{}\n\t}\n\treturn ms.valConv.PBValueOf(rv)\n}\nfunc (ms *mapReflect) Set(k pref.MapKey, v pref.Value) {\n\trk := ms.keyConv.GoValueOf(k.Value())\n\trv := ms.valConv.GoValueOf(v)\n\tms.v.SetMapIndex(rk, rv)\n}\nfunc (ms *mapReflect) Clear(k pref.MapKey) {\n\trk := ms.keyConv.GoValueOf(k.Value())\n\tms.v.SetMapIndex(rk, reflect.Value{})\n}\nfunc (ms *mapReflect) Mutable(k pref.MapKey) pref.Value {\n\tif _, ok := ms.valConv.(*messageConverter); !ok {\n\t\tpanic(\"invalid Mutable on map with non-message value type\")\n\t}\n\tv := ms.Get(k)\n\tif !v.IsValid() {\n\t\tv = ms.NewValue()\n\t\tms.Set(k, v)\n\t}\n\treturn v\n}\nfunc (ms *mapReflect) Range(f func(pref.MapKey, pref.Value) bool) {\n\titer := mapRange(ms.v)\n\tfor iter.Next() {\n\t\tk := ms.keyConv.PBValueOf(iter.Key()).MapKey()\n\t\tv := ms.valConv.PBValueOf(iter.Value())\n\t\tif !f(k, v) {\n\t\t\treturn\n\t\t}\n\t}\n}\nfunc (ms *mapReflect) NewValue() pref.Value {\n\treturn ms.valConv.New()\n}\nfunc (ms *mapReflect) IsValid() bool {\n\treturn !ms.v.IsNil()\n}\nfunc (ms *mapReflect) protoUnwrap() interface{} {\n\treturn ms.v.Interface()\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/decode.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 impl\n\nimport (\n\t\"math/bits\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\nvar errDecode = errors.New(\"cannot parse invalid wire-format data\")\n\ntype unmarshalOptions struct {\n\tflags    protoiface.UnmarshalInputFlags\n\tresolver interface {\n\t\tFindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)\n\t\tFindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)\n\t}\n}\n\nfunc (o unmarshalOptions) Options() proto.UnmarshalOptions {\n\treturn proto.UnmarshalOptions{\n\t\tMerge:          true,\n\t\tAllowPartial:   true,\n\t\tDiscardUnknown: o.DiscardUnknown(),\n\t\tResolver:       o.resolver,\n\t}\n}\n\nfunc (o unmarshalOptions) DiscardUnknown() bool { return o.flags&piface.UnmarshalDiscardUnknown != 0 }\n\nfunc (o unmarshalOptions) IsDefault() bool {\n\treturn o.flags == 0 && o.resolver == preg.GlobalTypes\n}\n\nvar lazyUnmarshalOptions = unmarshalOptions{\n\tresolver: preg.GlobalTypes,\n}\n\ntype unmarshalOutput struct {\n\tn           int // number of bytes consumed\n\tinitialized bool\n}\n\n// unmarshal is protoreflect.Methods.Unmarshal.\nfunc (mi *MessageInfo) unmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) {\n\tvar p pointer\n\tif ms, ok := in.Message.(*messageState); ok {\n\t\tp = ms.pointer()\n\t} else {\n\t\tp = in.Message.(*messageReflectWrapper).pointer()\n\t}\n\tout, err := mi.unmarshalPointer(in.Buf, p, 0, unmarshalOptions{\n\t\tflags:    in.Flags,\n\t\tresolver: in.Resolver,\n\t})\n\tvar flags piface.UnmarshalOutputFlags\n\tif out.initialized {\n\t\tflags |= piface.UnmarshalInitialized\n\t}\n\treturn piface.UnmarshalOutput{\n\t\tFlags: flags,\n\t}, err\n}\n\n// errUnknown is returned during unmarshaling to indicate a parse error that\n// should result in a field being placed in the unknown fields section (for example,\n// when the wire type doesn't match) as opposed to the entire unmarshal operation\n// failing (for example, when a field extends past the available input).\n//\n// This is a sentinel error which should never be visible to the user.\nvar errUnknown = errors.New(\"unknown\")\n\nfunc (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tmi.init()\n\tif flags.ProtoLegacy && mi.isMessageSet {\n\t\treturn unmarshalMessageSet(mi, b, p, opts)\n\t}\n\tinitialized := true\n\tvar requiredMask uint64\n\tvar exts *map[int32]ExtensionField\n\tstart := len(b)\n\tfor len(b) > 0 {\n\t\t// Parse the tag (field number and wire type).\n\t\tvar tag uint64\n\t\tif b[0] < 0x80 {\n\t\t\ttag = uint64(b[0])\n\t\t\tb = b[1:]\n\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\ttag = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\tb = b[2:]\n\t\t} else {\n\t\t\tvar n int\n\t\t\ttag, n = protowire.ConsumeVarint(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t}\n\t\tvar num protowire.Number\n\t\tif n := tag >> 3; n < uint64(protowire.MinValidNumber) || n > uint64(protowire.MaxValidNumber) {\n\t\t\treturn out, errDecode\n\t\t} else {\n\t\t\tnum = protowire.Number(n)\n\t\t}\n\t\twtyp := protowire.Type(tag & 7)\n\n\t\tif wtyp == protowire.EndGroupType {\n\t\t\tif num != groupTag {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\tgroupTag = 0\n\t\t\tbreak\n\t\t}\n\n\t\tvar f *coderFieldInfo\n\t\tif int(num) < len(mi.denseCoderFields) {\n\t\t\tf = mi.denseCoderFields[num]\n\t\t} else {\n\t\t\tf = mi.coderFields[num]\n\t\t}\n\t\tvar n int\n\t\terr := errUnknown\n\t\tswitch {\n\t\tcase f != nil:\n\t\t\tif f.funcs.unmarshal == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tvar o unmarshalOutput\n\t\t\to, err = f.funcs.unmarshal(b, p.Apply(f.offset), wtyp, f, opts)\n\t\t\tn = o.n\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\trequiredMask |= f.validation.requiredBit\n\t\t\tif f.funcs.isInit != nil && !o.initialized {\n\t\t\t\tinitialized = false\n\t\t\t}\n\t\tdefault:\n\t\t\t// Possible extension.\n\t\t\tif exts == nil && mi.extensionOffset.IsValid() {\n\t\t\t\texts = p.Apply(mi.extensionOffset).Extensions()\n\t\t\t\tif *exts == nil {\n\t\t\t\t\t*exts = make(map[int32]ExtensionField)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif exts == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tvar o unmarshalOutput\n\t\t\to, err = mi.unmarshalExtension(b, num, wtyp, *exts, opts)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tn = o.n\n\t\t\tif !o.initialized {\n\t\t\t\tinitialized = false\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\tif err != errUnknown {\n\t\t\t\treturn out, err\n\t\t\t}\n\t\t\tn = protowire.ConsumeFieldValue(num, wtyp, b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\tif !opts.DiscardUnknown() && mi.unknownOffset.IsValid() {\n\t\t\t\tu := mi.mutableUnknownBytes(p)\n\t\t\t\t*u = protowire.AppendTag(*u, num, wtyp)\n\t\t\t\t*u = append(*u, b[:n]...)\n\t\t\t}\n\t\t}\n\t\tb = b[n:]\n\t}\n\tif groupTag != 0 {\n\t\treturn out, errDecode\n\t}\n\tif mi.numRequiredFields > 0 && bits.OnesCount64(requiredMask) != int(mi.numRequiredFields) {\n\t\tinitialized = false\n\t}\n\tif initialized {\n\t\tout.initialized = true\n\t}\n\tout.n = start - len(b)\n\treturn out, nil\n}\n\nfunc (mi *MessageInfo) unmarshalExtension(b []byte, num protowire.Number, wtyp protowire.Type, exts map[int32]ExtensionField, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tx := exts[int32(num)]\n\txt := x.Type()\n\tif xt == nil {\n\t\tvar err error\n\t\txt, err = opts.resolver.FindExtensionByNumber(mi.Desc.FullName(), num)\n\t\tif err != nil {\n\t\t\tif err == preg.NotFound {\n\t\t\t\treturn out, errUnknown\n\t\t\t}\n\t\t\treturn out, errors.New(\"%v: unable to resolve extension %v: %v\", mi.Desc.FullName(), num, err)\n\t\t}\n\t}\n\txi := getExtensionFieldInfo(xt)\n\tif xi.funcs.unmarshal == nil {\n\t\treturn out, errUnknown\n\t}\n\tif flags.LazyUnmarshalExtensions {\n\t\tif opts.IsDefault() && x.canLazy(xt) {\n\t\t\tout, valid := skipExtension(b, xi, num, wtyp, opts)\n\t\t\tswitch valid {\n\t\t\tcase ValidationValid:\n\t\t\t\tif out.initialized {\n\t\t\t\t\tx.appendLazyBytes(xt, xi, num, wtyp, b[:out.n])\n\t\t\t\t\texts[int32(num)] = x\n\t\t\t\t\treturn out, nil\n\t\t\t\t}\n\t\t\tcase ValidationInvalid:\n\t\t\t\treturn out, errDecode\n\t\t\tcase ValidationUnknown:\n\t\t\t}\n\t\t}\n\t}\n\tival := x.Value()\n\tif !ival.IsValid() && xi.unmarshalNeedsValue {\n\t\t// Create a new message, list, or map value to fill in.\n\t\t// For enums, create a prototype value to let the unmarshal func know the\n\t\t// concrete type.\n\t\tival = xt.New()\n\t}\n\tv, out, err := xi.funcs.unmarshal(b, ival, num, wtyp, opts)\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tif xi.funcs.isInit == nil {\n\t\tout.initialized = true\n\t}\n\tx.Set(xt, v)\n\texts[int32(num)] = x\n\treturn out, nil\n}\n\nfunc skipExtension(b []byte, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, _ ValidationStatus) {\n\tif xi.validation.mi == nil {\n\t\treturn out, ValidationUnknown\n\t}\n\txi.validation.mi.init()\n\tswitch xi.validation.typ {\n\tcase validationTypeMessage:\n\t\tif wtyp != protowire.BytesType {\n\t\t\treturn out, ValidationUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, ValidationUnknown\n\t\t}\n\t\tout, st := xi.validation.mi.validate(v, 0, opts)\n\t\tout.n = n\n\t\treturn out, st\n\tcase validationTypeGroup:\n\t\tif wtyp != protowire.StartGroupType {\n\t\t\treturn out, ValidationUnknown\n\t\t}\n\t\tout, st := xi.validation.mi.validate(b, num, opts)\n\t\treturn out, st\n\tdefault:\n\t\treturn out, ValidationUnknown\n\t}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/encode.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 impl\n\nimport (\n\t\"math\"\n\t\"sort\"\n\t\"sync/atomic\"\n\n\t\"google.golang.org/protobuf/internal/flags\"\n\tproto \"google.golang.org/protobuf/proto\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\ntype marshalOptions struct {\n\tflags piface.MarshalInputFlags\n}\n\nfunc (o marshalOptions) Options() proto.MarshalOptions {\n\treturn proto.MarshalOptions{\n\t\tAllowPartial:  true,\n\t\tDeterministic: o.Deterministic(),\n\t\tUseCachedSize: o.UseCachedSize(),\n\t}\n}\n\nfunc (o marshalOptions) Deterministic() bool { return o.flags&piface.MarshalDeterministic != 0 }\nfunc (o marshalOptions) UseCachedSize() bool { return o.flags&piface.MarshalUseCachedSize != 0 }\n\n// size is protoreflect.Methods.Size.\nfunc (mi *MessageInfo) size(in piface.SizeInput) piface.SizeOutput {\n\tvar p pointer\n\tif ms, ok := in.Message.(*messageState); ok {\n\t\tp = ms.pointer()\n\t} else {\n\t\tp = in.Message.(*messageReflectWrapper).pointer()\n\t}\n\tsize := mi.sizePointer(p, marshalOptions{\n\t\tflags: in.Flags,\n\t})\n\treturn piface.SizeOutput{Size: size}\n}\n\nfunc (mi *MessageInfo) sizePointer(p pointer, opts marshalOptions) (size int) {\n\tmi.init()\n\tif p.IsNil() {\n\t\treturn 0\n\t}\n\tif opts.UseCachedSize() && mi.sizecacheOffset.IsValid() {\n\t\tif size := atomic.LoadInt32(p.Apply(mi.sizecacheOffset).Int32()); size >= 0 {\n\t\t\treturn int(size)\n\t\t}\n\t}\n\treturn mi.sizePointerSlow(p, opts)\n}\n\nfunc (mi *MessageInfo) sizePointerSlow(p pointer, opts marshalOptions) (size int) {\n\tif flags.ProtoLegacy && mi.isMessageSet {\n\t\tsize = sizeMessageSet(mi, p, opts)\n\t\tif mi.sizecacheOffset.IsValid() {\n\t\t\tatomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size))\n\t\t}\n\t\treturn size\n\t}\n\tif mi.extensionOffset.IsValid() {\n\t\te := p.Apply(mi.extensionOffset).Extensions()\n\t\tsize += mi.sizeExtensions(e, opts)\n\t}\n\tfor _, f := range mi.orderedCoderFields {\n\t\tif f.funcs.size == nil {\n\t\t\tcontinue\n\t\t}\n\t\tfptr := p.Apply(f.offset)\n\t\tif f.isPointer && fptr.Elem().IsNil() {\n\t\t\tcontinue\n\t\t}\n\t\tsize += f.funcs.size(fptr, f, opts)\n\t}\n\tif mi.unknownOffset.IsValid() {\n\t\tif u := mi.getUnknownBytes(p); u != nil {\n\t\t\tsize += len(*u)\n\t\t}\n\t}\n\tif mi.sizecacheOffset.IsValid() {\n\t\tif size > math.MaxInt32 {\n\t\t\t// The size is too large for the int32 sizecache field.\n\t\t\t// We will need to recompute the size when encoding;\n\t\t\t// unfortunately expensive, but better than invalid output.\n\t\t\tatomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), -1)\n\t\t} else {\n\t\t\tatomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size))\n\t\t}\n\t}\n\treturn size\n}\n\n// marshal is protoreflect.Methods.Marshal.\nfunc (mi *MessageInfo) marshal(in piface.MarshalInput) (out piface.MarshalOutput, err error) {\n\tvar p pointer\n\tif ms, ok := in.Message.(*messageState); ok {\n\t\tp = ms.pointer()\n\t} else {\n\t\tp = in.Message.(*messageReflectWrapper).pointer()\n\t}\n\tb, err := mi.marshalAppendPointer(in.Buf, p, marshalOptions{\n\t\tflags: in.Flags,\n\t})\n\treturn piface.MarshalOutput{Buf: b}, err\n}\n\nfunc (mi *MessageInfo) marshalAppendPointer(b []byte, p pointer, opts marshalOptions) ([]byte, error) {\n\tmi.init()\n\tif p.IsNil() {\n\t\treturn b, nil\n\t}\n\tif flags.ProtoLegacy && mi.isMessageSet {\n\t\treturn marshalMessageSet(mi, b, p, opts)\n\t}\n\tvar err error\n\t// The old marshaler encodes extensions at beginning.\n\tif mi.extensionOffset.IsValid() {\n\t\te := p.Apply(mi.extensionOffset).Extensions()\n\t\t// TODO: Special handling for MessageSet?\n\t\tb, err = mi.appendExtensions(b, e, opts)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\tfor _, f := range mi.orderedCoderFields {\n\t\tif f.funcs.marshal == nil {\n\t\t\tcontinue\n\t\t}\n\t\tfptr := p.Apply(f.offset)\n\t\tif f.isPointer && fptr.Elem().IsNil() {\n\t\t\tcontinue\n\t\t}\n\t\tb, err = f.funcs.marshal(b, fptr, f, opts)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\tif mi.unknownOffset.IsValid() && !mi.isMessageSet {\n\t\tif u := mi.getUnknownBytes(p); u != nil {\n\t\t\tb = append(b, (*u)...)\n\t\t}\n\t}\n\treturn b, nil\n}\n\nfunc (mi *MessageInfo) sizeExtensions(ext *map[int32]ExtensionField, opts marshalOptions) (n int) {\n\tif ext == nil {\n\t\treturn 0\n\t}\n\tfor _, x := range *ext {\n\t\txi := getExtensionFieldInfo(x.Type())\n\t\tif xi.funcs.size == nil {\n\t\t\tcontinue\n\t\t}\n\t\tn += xi.funcs.size(x.Value(), xi.tagsize, opts)\n\t}\n\treturn n\n}\n\nfunc (mi *MessageInfo) appendExtensions(b []byte, ext *map[int32]ExtensionField, opts marshalOptions) ([]byte, error) {\n\tif ext == nil {\n\t\treturn b, nil\n\t}\n\n\tswitch len(*ext) {\n\tcase 0:\n\t\treturn b, nil\n\tcase 1:\n\t\t// Fast-path for one extension: Don't bother sorting the keys.\n\t\tvar err error\n\t\tfor _, x := range *ext {\n\t\t\txi := getExtensionFieldInfo(x.Type())\n\t\t\tb, err = xi.funcs.marshal(b, x.Value(), xi.wiretag, opts)\n\t\t}\n\t\treturn b, err\n\tdefault:\n\t\t// Sort the keys to provide a deterministic encoding.\n\t\t// Not sure this is required, but the old code does it.\n\t\tkeys := make([]int, 0, len(*ext))\n\t\tfor k := range *ext {\n\t\t\tkeys = append(keys, int(k))\n\t\t}\n\t\tsort.Ints(keys)\n\t\tvar err error\n\t\tfor _, k := range keys {\n\t\t\tx := (*ext)[int32(k)]\n\t\t\txi := getExtensionFieldInfo(x.Type())\n\t\t\tb, err = xi.funcs.marshal(b, x.Value(), xi.wiretag, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn b, err\n\t\t\t}\n\t\t}\n\t\treturn b, nil\n\t}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/enum.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 impl\n\nimport (\n\t\"reflect\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype EnumInfo struct {\n\tGoReflectType reflect.Type // int32 kind\n\tDesc          pref.EnumDescriptor\n}\n\nfunc (t *EnumInfo) New(n pref.EnumNumber) pref.Enum {\n\treturn reflect.ValueOf(n).Convert(t.GoReflectType).Interface().(pref.Enum)\n}\nfunc (t *EnumInfo) Descriptor() pref.EnumDescriptor { return t.Desc }\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/extension.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 impl\n\nimport (\n\t\"reflect\"\n\t\"sync\"\n\t\"sync/atomic\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// ExtensionInfo implements ExtensionType.\n//\n// This type contains a number of exported fields for legacy compatibility.\n// The only non-deprecated use of this type is through the methods of the\n// ExtensionType interface.\ntype ExtensionInfo struct {\n\t// An ExtensionInfo may exist in several stages of initialization.\n\t//\n\t// extensionInfoUninitialized: Some or all of the legacy exported\n\t// fields may be set, but none of the unexported fields have been\n\t// initialized. This is the starting state for an ExtensionInfo\n\t// in legacy generated code.\n\t//\n\t// extensionInfoDescInit: The desc field is set, but other unexported fields\n\t// may not be initialized. Legacy exported fields may or may not be set.\n\t// This is the starting state for an ExtensionInfo in newly generated code.\n\t//\n\t// extensionInfoFullInit: The ExtensionInfo is fully initialized.\n\t// This state is only entered after lazy initialization is complete.\n\tinit uint32\n\tmu   sync.Mutex\n\n\tgoType reflect.Type\n\tdesc   extensionTypeDescriptor\n\tconv   Converter\n\tinfo   *extensionFieldInfo // for fast-path method implementations\n\n\t// ExtendedType is a typed nil-pointer to the parent message type that\n\t// is being extended. It is possible for this to be unpopulated in v2\n\t// since the message may no longer implement the MessageV1 interface.\n\t//\n\t// Deprecated: Use the ExtendedType method instead.\n\tExtendedType piface.MessageV1\n\n\t// ExtensionType is the zero value of the extension type.\n\t//\n\t// For historical reasons, reflect.TypeOf(ExtensionType) and the\n\t// type returned by InterfaceOf may not be identical.\n\t//\n\t// Deprecated: Use InterfaceOf(xt.Zero()) instead.\n\tExtensionType interface{}\n\n\t// Field is the field number of the extension.\n\t//\n\t// Deprecated: Use the Descriptor().Number method instead.\n\tField int32\n\n\t// Name is the fully qualified name of extension.\n\t//\n\t// Deprecated: Use the Descriptor().FullName method instead.\n\tName string\n\n\t// Tag is the protobuf struct tag used in the v1 API.\n\t//\n\t// Deprecated: Do not use.\n\tTag string\n\n\t// Filename is the proto filename in which the extension is defined.\n\t//\n\t// Deprecated: Use Descriptor().ParentFile().Path() instead.\n\tFilename string\n}\n\n// Stages of initialization: See the ExtensionInfo.init field.\nconst (\n\textensionInfoUninitialized = 0\n\textensionInfoDescInit      = 1\n\textensionInfoFullInit      = 2\n)\n\nfunc InitExtensionInfo(xi *ExtensionInfo, xd pref.ExtensionDescriptor, goType reflect.Type) {\n\txi.goType = goType\n\txi.desc = extensionTypeDescriptor{xd, xi}\n\txi.init = extensionInfoDescInit\n}\n\nfunc (xi *ExtensionInfo) New() pref.Value {\n\treturn xi.lazyInit().New()\n}\nfunc (xi *ExtensionInfo) Zero() pref.Value {\n\treturn xi.lazyInit().Zero()\n}\nfunc (xi *ExtensionInfo) ValueOf(v interface{}) pref.Value {\n\treturn xi.lazyInit().PBValueOf(reflect.ValueOf(v))\n}\nfunc (xi *ExtensionInfo) InterfaceOf(v pref.Value) interface{} {\n\treturn xi.lazyInit().GoValueOf(v).Interface()\n}\nfunc (xi *ExtensionInfo) IsValidValue(v pref.Value) bool {\n\treturn xi.lazyInit().IsValidPB(v)\n}\nfunc (xi *ExtensionInfo) IsValidInterface(v interface{}) bool {\n\treturn xi.lazyInit().IsValidGo(reflect.ValueOf(v))\n}\nfunc (xi *ExtensionInfo) TypeDescriptor() pref.ExtensionTypeDescriptor {\n\tif atomic.LoadUint32(&xi.init) < extensionInfoDescInit {\n\t\txi.lazyInitSlow()\n\t}\n\treturn &xi.desc\n}\n\nfunc (xi *ExtensionInfo) lazyInit() Converter {\n\tif atomic.LoadUint32(&xi.init) < extensionInfoFullInit {\n\t\txi.lazyInitSlow()\n\t}\n\treturn xi.conv\n}\n\nfunc (xi *ExtensionInfo) lazyInitSlow() {\n\txi.mu.Lock()\n\tdefer xi.mu.Unlock()\n\n\tif xi.init == extensionInfoFullInit {\n\t\treturn\n\t}\n\tdefer atomic.StoreUint32(&xi.init, extensionInfoFullInit)\n\n\tif xi.desc.ExtensionDescriptor == nil {\n\t\txi.initFromLegacy()\n\t}\n\tif !xi.desc.ExtensionDescriptor.IsPlaceholder() {\n\t\tif xi.ExtensionType == nil {\n\t\t\txi.initToLegacy()\n\t\t}\n\t\txi.conv = NewConverter(xi.goType, xi.desc.ExtensionDescriptor)\n\t\txi.info = makeExtensionFieldInfo(xi.desc.ExtensionDescriptor)\n\t\txi.info.validation = newValidationInfo(xi.desc.ExtensionDescriptor, xi.goType)\n\t}\n}\n\ntype extensionTypeDescriptor struct {\n\tpref.ExtensionDescriptor\n\txi *ExtensionInfo\n}\n\nfunc (xtd *extensionTypeDescriptor) Type() pref.ExtensionType {\n\treturn xtd.xi\n}\nfunc (xtd *extensionTypeDescriptor) Descriptor() pref.ExtensionDescriptor {\n\treturn xtd.ExtensionDescriptor\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/legacy_enum.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// legacyEnumName returns the name of enums used in legacy code.\n// It is neither the protobuf full name nor the qualified Go name,\n// but rather an odd hybrid of both.\nfunc legacyEnumName(ed pref.EnumDescriptor) string {\n\tvar protoPkg string\n\tenumName := string(ed.FullName())\n\tif fd := ed.ParentFile(); fd != nil {\n\t\tprotoPkg = string(fd.Package())\n\t\tenumName = strings.TrimPrefix(enumName, protoPkg+\".\")\n\t}\n\tif protoPkg == \"\" {\n\t\treturn strs.GoCamelCase(enumName)\n\t}\n\treturn protoPkg + \".\" + strs.GoCamelCase(enumName)\n}\n\n// legacyWrapEnum wraps v as a protoreflect.Enum,\n// where v must be a int32 kind and not implement the v2 API already.\nfunc legacyWrapEnum(v reflect.Value) pref.Enum {\n\tet := legacyLoadEnumType(v.Type())\n\treturn et.New(pref.EnumNumber(v.Int()))\n}\n\nvar legacyEnumTypeCache sync.Map // map[reflect.Type]protoreflect.EnumType\n\n// legacyLoadEnumType dynamically loads a protoreflect.EnumType for t,\n// where t must be an int32 kind and not implement the v2 API already.\nfunc legacyLoadEnumType(t reflect.Type) pref.EnumType {\n\t// Fast-path: check if a EnumType is cached for this concrete type.\n\tif et, ok := legacyEnumTypeCache.Load(t); ok {\n\t\treturn et.(pref.EnumType)\n\t}\n\n\t// Slow-path: derive enum descriptor and initialize EnumType.\n\tvar et pref.EnumType\n\ted := LegacyLoadEnumDesc(t)\n\tet = &legacyEnumType{\n\t\tdesc:   ed,\n\t\tgoType: t,\n\t}\n\tif et, ok := legacyEnumTypeCache.LoadOrStore(t, et); ok {\n\t\treturn et.(pref.EnumType)\n\t}\n\treturn et\n}\n\ntype legacyEnumType struct {\n\tdesc   pref.EnumDescriptor\n\tgoType reflect.Type\n\tm      sync.Map // map[protoreflect.EnumNumber]proto.Enum\n}\n\nfunc (t *legacyEnumType) New(n pref.EnumNumber) pref.Enum {\n\tif e, ok := t.m.Load(n); ok {\n\t\treturn e.(pref.Enum)\n\t}\n\te := &legacyEnumWrapper{num: n, pbTyp: t, goTyp: t.goType}\n\tt.m.Store(n, e)\n\treturn e\n}\nfunc (t *legacyEnumType) Descriptor() pref.EnumDescriptor {\n\treturn t.desc\n}\n\ntype legacyEnumWrapper struct {\n\tnum   pref.EnumNumber\n\tpbTyp pref.EnumType\n\tgoTyp reflect.Type\n}\n\nfunc (e *legacyEnumWrapper) Descriptor() pref.EnumDescriptor {\n\treturn e.pbTyp.Descriptor()\n}\nfunc (e *legacyEnumWrapper) Type() pref.EnumType {\n\treturn e.pbTyp\n}\nfunc (e *legacyEnumWrapper) Number() pref.EnumNumber {\n\treturn e.num\n}\nfunc (e *legacyEnumWrapper) ProtoReflect() pref.Enum {\n\treturn e\n}\nfunc (e *legacyEnumWrapper) protoUnwrap() interface{} {\n\tv := reflect.New(e.goTyp).Elem()\n\tv.SetInt(int64(e.num))\n\treturn v.Interface()\n}\n\nvar (\n\t_ pref.Enum = (*legacyEnumWrapper)(nil)\n\t_ unwrapper = (*legacyEnumWrapper)(nil)\n)\n\nvar legacyEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor\n\n// LegacyLoadEnumDesc returns an EnumDescriptor derived from the Go type,\n// which must be an int32 kind and not implement the v2 API already.\n//\n// This is exported for testing purposes.\nfunc LegacyLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {\n\t// Fast-path: check if an EnumDescriptor is cached for this concrete type.\n\tif ed, ok := legacyEnumDescCache.Load(t); ok {\n\t\treturn ed.(pref.EnumDescriptor)\n\t}\n\n\t// Slow-path: initialize EnumDescriptor from the raw descriptor.\n\tev := reflect.Zero(t).Interface()\n\tif _, ok := ev.(pref.Enum); ok {\n\t\tpanic(fmt.Sprintf(\"%v already implements proto.Enum\", t))\n\t}\n\tedV1, ok := ev.(enumV1)\n\tif !ok {\n\t\treturn aberrantLoadEnumDesc(t)\n\t}\n\tb, idxs := edV1.EnumDescriptor()\n\n\tvar ed pref.EnumDescriptor\n\tif len(idxs) == 1 {\n\t\ted = legacyLoadFileDesc(b).Enums().Get(idxs[0])\n\t} else {\n\t\tmd := legacyLoadFileDesc(b).Messages().Get(idxs[0])\n\t\tfor _, i := range idxs[1 : len(idxs)-1] {\n\t\t\tmd = md.Messages().Get(i)\n\t\t}\n\t\ted = md.Enums().Get(idxs[len(idxs)-1])\n\t}\n\tif ed, ok := legacyEnumDescCache.LoadOrStore(t, ed); ok {\n\t\treturn ed.(protoreflect.EnumDescriptor)\n\t}\n\treturn ed\n}\n\nvar aberrantEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor\n\n// aberrantLoadEnumDesc returns an EnumDescriptor derived from the Go type,\n// which must not implement protoreflect.Enum or enumV1.\n//\n// If the type does not implement enumV1, then there is no reliable\n// way to derive the original protobuf type information.\n// We are unable to use the global enum registry since it is\n// unfortunately keyed by the protobuf full name, which we also do not know.\n// Thus, this produces some bogus enum descriptor based on the Go type name.\nfunc aberrantLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {\n\t// Fast-path: check if an EnumDescriptor is cached for this concrete type.\n\tif ed, ok := aberrantEnumDescCache.Load(t); ok {\n\t\treturn ed.(pref.EnumDescriptor)\n\t}\n\n\t// Slow-path: construct a bogus, but unique EnumDescriptor.\n\ted := &filedesc.Enum{L2: new(filedesc.EnumL2)}\n\ted.L0.FullName = AberrantDeriveFullName(t) // e.g., github_com.user.repo.MyEnum\n\ted.L0.ParentFile = filedesc.SurrogateProto3\n\ted.L2.Values.List = append(ed.L2.Values.List, filedesc.EnumValue{})\n\n\t// TODO: Use the presence of a UnmarshalJSON method to determine proto2?\n\n\tvd := &ed.L2.Values.List[0]\n\tvd.L0.FullName = ed.L0.FullName + \"_UNKNOWN\" // e.g., github_com.user.repo.MyEnum_UNKNOWN\n\tvd.L0.ParentFile = ed.L0.ParentFile\n\tvd.L0.Parent = ed\n\n\t// TODO: We could use the String method to obtain some enum value names by\n\t// starting at 0 and print the enum until it produces invalid identifiers.\n\t// An exhaustive query is clearly impractical, but can be best-effort.\n\n\tif ed, ok := aberrantEnumDescCache.LoadOrStore(t, ed); ok {\n\t\treturn ed.(pref.EnumDescriptor)\n\t}\n\treturn ed\n}\n\n// AberrantDeriveFullName derives a fully qualified protobuf name for the given Go type\n// The provided name is not guaranteed to be stable nor universally unique.\n// It should be sufficiently unique within a program.\n//\n// This is exported for testing purposes.\nfunc AberrantDeriveFullName(t reflect.Type) pref.FullName {\n\tsanitize := func(r rune) rune {\n\t\tswitch {\n\t\tcase r == '/':\n\t\t\treturn '.'\n\t\tcase 'a' <= r && r <= 'z', 'A' <= r && r <= 'Z', '0' <= r && r <= '9':\n\t\t\treturn r\n\t\tdefault:\n\t\t\treturn '_'\n\t\t}\n\t}\n\tprefix := strings.Map(sanitize, t.PkgPath())\n\tsuffix := strings.Map(sanitize, t.Name())\n\tif suffix == \"\" {\n\t\tsuffix = fmt.Sprintf(\"UnknownX%X\", reflect.ValueOf(t).Pointer())\n\t}\n\n\tss := append(strings.Split(prefix, \".\"), suffix)\n\tfor i, s := range ss {\n\t\tif s == \"\" || ('0' <= s[0] && s[0] <= '9') {\n\t\t\tss[i] = \"x\" + s\n\t\t}\n\t}\n\treturn pref.FullName(strings.Join(ss, \".\"))\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/legacy_export.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 impl\n\nimport (\n\t\"encoding/binary\"\n\t\"encoding/json\"\n\t\"hash/crc32\"\n\t\"math\"\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/internal/errors\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// These functions exist to support exported APIs in generated protobufs.\n// While these are deprecated, they cannot be removed for compatibility reasons.\n\n// LegacyEnumName returns the name of enums used in legacy code.\nfunc (Export) LegacyEnumName(ed pref.EnumDescriptor) string {\n\treturn legacyEnumName(ed)\n}\n\n// LegacyMessageTypeOf returns the protoreflect.MessageType for m,\n// with name used as the message name if necessary.\nfunc (Export) LegacyMessageTypeOf(m piface.MessageV1, name pref.FullName) pref.MessageType {\n\tif mv := (Export{}).protoMessageV2Of(m); mv != nil {\n\t\treturn mv.ProtoReflect().Type()\n\t}\n\treturn legacyLoadMessageType(reflect.TypeOf(m), name)\n}\n\n// UnmarshalJSONEnum unmarshals an enum from a JSON-encoded input.\n// The input can either be a string representing the enum value by name,\n// or a number representing the enum number itself.\nfunc (Export) UnmarshalJSONEnum(ed pref.EnumDescriptor, b []byte) (pref.EnumNumber, error) {\n\tif b[0] == '\"' {\n\t\tvar name pref.Name\n\t\tif err := json.Unmarshal(b, &name); err != nil {\n\t\t\treturn 0, errors.New(\"invalid input for enum %v: %s\", ed.FullName(), b)\n\t\t}\n\t\tev := ed.Values().ByName(name)\n\t\tif ev == nil {\n\t\t\treturn 0, errors.New(\"invalid value for enum %v: %s\", ed.FullName(), name)\n\t\t}\n\t\treturn ev.Number(), nil\n\t} else {\n\t\tvar num pref.EnumNumber\n\t\tif err := json.Unmarshal(b, &num); err != nil {\n\t\t\treturn 0, errors.New(\"invalid input for enum %v: %s\", ed.FullName(), b)\n\t\t}\n\t\treturn num, nil\n\t}\n}\n\n// CompressGZIP compresses the input as a GZIP-encoded file.\n// The current implementation does no compression.\nfunc (Export) CompressGZIP(in []byte) (out []byte) {\n\t// RFC 1952, section 2.3.1.\n\tvar gzipHeader = [10]byte{0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff}\n\n\t// RFC 1951, section 3.2.4.\n\tvar blockHeader [5]byte\n\tconst maxBlockSize = math.MaxUint16\n\tnumBlocks := 1 + len(in)/maxBlockSize\n\n\t// RFC 1952, section 2.3.1.\n\tvar gzipFooter [8]byte\n\tbinary.LittleEndian.PutUint32(gzipFooter[0:4], crc32.ChecksumIEEE(in))\n\tbinary.LittleEndian.PutUint32(gzipFooter[4:8], uint32(len(in)))\n\n\t// Encode the input without compression using raw DEFLATE blocks.\n\tout = make([]byte, 0, len(gzipHeader)+len(blockHeader)*numBlocks+len(in)+len(gzipFooter))\n\tout = append(out, gzipHeader[:]...)\n\tfor blockHeader[0] == 0 {\n\t\tblockSize := maxBlockSize\n\t\tif blockSize > len(in) {\n\t\t\tblockHeader[0] = 0x01 // final bit per RFC 1951, section 3.2.3.\n\t\t\tblockSize = len(in)\n\t\t}\n\t\tbinary.LittleEndian.PutUint16(blockHeader[1:3], uint16(blockSize)^0x0000)\n\t\tbinary.LittleEndian.PutUint16(blockHeader[3:5], uint16(blockSize)^0xffff)\n\t\tout = append(out, blockHeader[:]...)\n\t\tout = append(out, in[:blockSize]...)\n\t\tin = in[blockSize:]\n\t}\n\tout = append(out, gzipFooter[:]...)\n\treturn out\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/legacy_extension.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 impl\n\nimport (\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/internal/descopts\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\tptag \"google.golang.org/protobuf/internal/encoding/tag\"\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\nfunc (xi *ExtensionInfo) initToLegacy() {\n\txd := xi.desc\n\tvar parent piface.MessageV1\n\tmessageName := xd.ContainingMessage().FullName()\n\tif mt, _ := preg.GlobalTypes.FindMessageByName(messageName); mt != nil {\n\t\t// Create a new parent message and unwrap it if possible.\n\t\tmv := mt.New().Interface()\n\t\tt := reflect.TypeOf(mv)\n\t\tif mv, ok := mv.(unwrapper); ok {\n\t\t\tt = reflect.TypeOf(mv.protoUnwrap())\n\t\t}\n\n\t\t// Check whether the message implements the legacy v1 Message interface.\n\t\tmz := reflect.Zero(t).Interface()\n\t\tif mz, ok := mz.(piface.MessageV1); ok {\n\t\t\tparent = mz\n\t\t}\n\t}\n\n\t// Determine the v1 extension type, which is unfortunately not the same as\n\t// the v2 ExtensionType.GoType.\n\textType := xi.goType\n\tswitch extType.Kind() {\n\tcase reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String:\n\t\textType = reflect.PtrTo(extType) // T -> *T for singular scalar fields\n\t}\n\n\t// Reconstruct the legacy enum full name.\n\tvar enumName string\n\tif xd.Kind() == pref.EnumKind {\n\t\tenumName = legacyEnumName(xd.Enum())\n\t}\n\n\t// Derive the proto file that the extension was declared within.\n\tvar filename string\n\tif fd := xd.ParentFile(); fd != nil {\n\t\tfilename = fd.Path()\n\t}\n\n\t// For MessageSet extensions, the name used is the parent message.\n\tname := xd.FullName()\n\tif messageset.IsMessageSetExtension(xd) {\n\t\tname = name.Parent()\n\t}\n\n\txi.ExtendedType = parent\n\txi.ExtensionType = reflect.Zero(extType).Interface()\n\txi.Field = int32(xd.Number())\n\txi.Name = string(name)\n\txi.Tag = ptag.Marshal(xd, enumName)\n\txi.Filename = filename\n}\n\n// initFromLegacy initializes an ExtensionInfo from\n// the contents of the deprecated exported fields of the type.\nfunc (xi *ExtensionInfo) initFromLegacy() {\n\t// The v1 API returns \"type incomplete\" descriptors where only the\n\t// field number is specified. In such a case, use a placeholder.\n\tif xi.ExtendedType == nil || xi.ExtensionType == nil {\n\t\txd := placeholderExtension{\n\t\t\tname:   pref.FullName(xi.Name),\n\t\t\tnumber: pref.FieldNumber(xi.Field),\n\t\t}\n\t\txi.desc = extensionTypeDescriptor{xd, xi}\n\t\treturn\n\t}\n\n\t// Resolve enum or message dependencies.\n\tvar ed pref.EnumDescriptor\n\tvar md pref.MessageDescriptor\n\tt := reflect.TypeOf(xi.ExtensionType)\n\tisOptional := t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct\n\tisRepeated := t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8\n\tif isOptional || isRepeated {\n\t\tt = t.Elem()\n\t}\n\tswitch v := reflect.Zero(t).Interface().(type) {\n\tcase pref.Enum:\n\t\ted = v.Descriptor()\n\tcase enumV1:\n\t\ted = LegacyLoadEnumDesc(t)\n\tcase pref.ProtoMessage:\n\t\tmd = v.ProtoReflect().Descriptor()\n\tcase messageV1:\n\t\tmd = LegacyLoadMessageDesc(t)\n\t}\n\n\t// Derive basic field information from the struct tag.\n\tvar evs pref.EnumValueDescriptors\n\tif ed != nil {\n\t\tevs = ed.Values()\n\t}\n\tfd := ptag.Unmarshal(xi.Tag, t, evs).(*filedesc.Field)\n\n\t// Construct a v2 ExtensionType.\n\txd := &filedesc.Extension{L2: new(filedesc.ExtensionL2)}\n\txd.L0.ParentFile = filedesc.SurrogateProto2\n\txd.L0.FullName = pref.FullName(xi.Name)\n\txd.L1.Number = pref.FieldNumber(xi.Field)\n\txd.L1.Cardinality = fd.L1.Cardinality\n\txd.L1.Kind = fd.L1.Kind\n\txd.L2.IsPacked = fd.L1.IsPacked\n\txd.L2.Default = fd.L1.Default\n\txd.L1.Extendee = Export{}.MessageDescriptorOf(xi.ExtendedType)\n\txd.L2.Enum = ed\n\txd.L2.Message = md\n\n\t// Derive real extension field name for MessageSets.\n\tif messageset.IsMessageSet(xd.L1.Extendee) && md.FullName() == xd.L0.FullName {\n\t\txd.L0.FullName = xd.L0.FullName.Append(messageset.ExtensionName)\n\t}\n\n\ttt := reflect.TypeOf(xi.ExtensionType)\n\tif isOptional {\n\t\ttt = tt.Elem()\n\t}\n\txi.goType = tt\n\txi.desc = extensionTypeDescriptor{xd, xi}\n}\n\ntype placeholderExtension struct {\n\tname   pref.FullName\n\tnumber pref.FieldNumber\n}\n\nfunc (x placeholderExtension) ParentFile() pref.FileDescriptor            { return nil }\nfunc (x placeholderExtension) Parent() pref.Descriptor                    { return nil }\nfunc (x placeholderExtension) Index() int                                 { return 0 }\nfunc (x placeholderExtension) Syntax() pref.Syntax                        { return 0 }\nfunc (x placeholderExtension) Name() pref.Name                            { return x.name.Name() }\nfunc (x placeholderExtension) FullName() pref.FullName                    { return x.name }\nfunc (x placeholderExtension) IsPlaceholder() bool                        { return true }\nfunc (x placeholderExtension) Options() pref.ProtoMessage                 { return descopts.Field }\nfunc (x placeholderExtension) Number() pref.FieldNumber                   { return x.number }\nfunc (x placeholderExtension) Cardinality() pref.Cardinality              { return 0 }\nfunc (x placeholderExtension) Kind() pref.Kind                            { return 0 }\nfunc (x placeholderExtension) HasJSONName() bool                          { return false }\nfunc (x placeholderExtension) JSONName() string                           { return \"[\" + string(x.name) + \"]\" }\nfunc (x placeholderExtension) TextName() string                           { return \"[\" + string(x.name) + \"]\" }\nfunc (x placeholderExtension) HasPresence() bool                          { return false }\nfunc (x placeholderExtension) HasOptionalKeyword() bool                   { return false }\nfunc (x placeholderExtension) IsExtension() bool                          { return true }\nfunc (x placeholderExtension) IsWeak() bool                               { return false }\nfunc (x placeholderExtension) IsPacked() bool                             { return false }\nfunc (x placeholderExtension) IsList() bool                               { return false }\nfunc (x placeholderExtension) IsMap() bool                                { return false }\nfunc (x placeholderExtension) MapKey() pref.FieldDescriptor               { return nil }\nfunc (x placeholderExtension) MapValue() pref.FieldDescriptor             { return nil }\nfunc (x placeholderExtension) HasDefault() bool                           { return false }\nfunc (x placeholderExtension) Default() pref.Value                        { return pref.Value{} }\nfunc (x placeholderExtension) DefaultEnumValue() pref.EnumValueDescriptor { return nil }\nfunc (x placeholderExtension) ContainingOneof() pref.OneofDescriptor      { return nil }\nfunc (x placeholderExtension) ContainingMessage() pref.MessageDescriptor  { return nil }\nfunc (x placeholderExtension) Enum() pref.EnumDescriptor                  { return nil }\nfunc (x placeholderExtension) Message() pref.MessageDescriptor            { return nil }\nfunc (x placeholderExtension) ProtoType(pref.FieldDescriptor)             { return }\nfunc (x placeholderExtension) ProtoInternal(pragma.DoNotImplement)        { return }\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/legacy_file.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 impl\n\nimport (\n\t\"bytes\"\n\t\"compress/gzip\"\n\t\"io/ioutil\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// Every enum and message type generated by protoc-gen-go since commit 2fc053c5\n// on February 25th, 2016 has had a method to get the raw descriptor.\n// Types that were not generated by protoc-gen-go or were generated prior\n// to that version are not supported.\n//\n// The []byte returned is the encoded form of a FileDescriptorProto message\n// compressed using GZIP. The []int is the path from the top-level file\n// to the specific message or enum declaration.\ntype (\n\tenumV1 interface {\n\t\tEnumDescriptor() ([]byte, []int)\n\t}\n\tmessageV1 interface {\n\t\tDescriptor() ([]byte, []int)\n\t}\n)\n\nvar legacyFileDescCache sync.Map // map[*byte]protoreflect.FileDescriptor\n\n// legacyLoadFileDesc unmarshals b as a compressed FileDescriptorProto message.\n//\n// This assumes that b is immutable and that b does not refer to part of a\n// concatenated series of GZIP files (which would require shenanigans that\n// rely on the concatenation properties of both protobufs and GZIP).\n// File descriptors generated by protoc-gen-go do not rely on that property.\nfunc legacyLoadFileDesc(b []byte) protoreflect.FileDescriptor {\n\t// Fast-path: check whether we already have a cached file descriptor.\n\tif fd, ok := legacyFileDescCache.Load(&b[0]); ok {\n\t\treturn fd.(protoreflect.FileDescriptor)\n\t}\n\n\t// Slow-path: decompress and unmarshal the file descriptor proto.\n\tzr, err := gzip.NewReader(bytes.NewReader(b))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tb2, err := ioutil.ReadAll(zr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfd := filedesc.Builder{\n\t\tRawDescriptor: b2,\n\t\tFileRegistry:  resolverOnly{protoregistry.GlobalFiles}, // do not register back to global registry\n\t}.Build().File\n\tif fd, ok := legacyFileDescCache.LoadOrStore(&b[0], fd); ok {\n\t\treturn fd.(protoreflect.FileDescriptor)\n\t}\n\treturn fd\n}\n\ntype resolverOnly struct {\n\treg *protoregistry.Files\n}\n\nfunc (r resolverOnly) FindFileByPath(path string) (protoreflect.FileDescriptor, error) {\n\treturn r.reg.FindFileByPath(path)\n}\nfunc (r resolverOnly) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) {\n\treturn r.reg.FindDescriptorByName(name)\n}\nfunc (resolverOnly) RegisterFile(protoreflect.FileDescriptor) error {\n\treturn nil\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/legacy_message.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/descopts\"\n\tptag \"google.golang.org/protobuf/internal/encoding/tag\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// legacyWrapMessage wraps v as a protoreflect.Message,\n// where v must be a *struct kind and not implement the v2 API already.\nfunc legacyWrapMessage(v reflect.Value) pref.Message {\n\tt := v.Type()\n\tif t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {\n\t\treturn aberrantMessage{v: v}\n\t}\n\tmt := legacyLoadMessageInfo(t, \"\")\n\treturn mt.MessageOf(v.Interface())\n}\n\n// legacyLoadMessageType dynamically loads a protoreflect.Type for t,\n// where t must be not implement the v2 API already.\n// The provided name is used if it cannot be determined from the message.\nfunc legacyLoadMessageType(t reflect.Type, name pref.FullName) protoreflect.MessageType {\n\tif t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {\n\t\treturn aberrantMessageType{t}\n\t}\n\treturn legacyLoadMessageInfo(t, name)\n}\n\nvar legacyMessageTypeCache sync.Map // map[reflect.Type]*MessageInfo\n\n// legacyLoadMessageInfo dynamically loads a *MessageInfo for t,\n// where t must be a *struct kind and not implement the v2 API already.\n// The provided name is used if it cannot be determined from the message.\nfunc legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo {\n\t// Fast-path: check if a MessageInfo is cached for this concrete type.\n\tif mt, ok := legacyMessageTypeCache.Load(t); ok {\n\t\treturn mt.(*MessageInfo)\n\t}\n\n\t// Slow-path: derive message descriptor and initialize MessageInfo.\n\tmi := &MessageInfo{\n\t\tDesc:          legacyLoadMessageDesc(t, name),\n\t\tGoReflectType: t,\n\t}\n\n\tvar hasMarshal, hasUnmarshal bool\n\tv := reflect.Zero(t).Interface()\n\tif _, hasMarshal = v.(legacyMarshaler); hasMarshal {\n\t\tmi.methods.Marshal = legacyMarshal\n\n\t\t// We have no way to tell whether the type's Marshal method\n\t\t// supports deterministic serialization or not, but this\n\t\t// preserves the v1 implementation's behavior of always\n\t\t// calling Marshal methods when present.\n\t\tmi.methods.Flags |= piface.SupportMarshalDeterministic\n\t}\n\tif _, hasUnmarshal = v.(legacyUnmarshaler); hasUnmarshal {\n\t\tmi.methods.Unmarshal = legacyUnmarshal\n\t}\n\tif _, hasMerge := v.(legacyMerger); hasMerge || (hasMarshal && hasUnmarshal) {\n\t\tmi.methods.Merge = legacyMerge\n\t}\n\n\tif mi, ok := legacyMessageTypeCache.LoadOrStore(t, mi); ok {\n\t\treturn mi.(*MessageInfo)\n\t}\n\treturn mi\n}\n\nvar legacyMessageDescCache sync.Map // map[reflect.Type]protoreflect.MessageDescriptor\n\n// LegacyLoadMessageDesc returns an MessageDescriptor derived from the Go type,\n// which should be a *struct kind and must not implement the v2 API already.\n//\n// This is exported for testing purposes.\nfunc LegacyLoadMessageDesc(t reflect.Type) pref.MessageDescriptor {\n\treturn legacyLoadMessageDesc(t, \"\")\n}\nfunc legacyLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescriptor {\n\t// Fast-path: check if a MessageDescriptor is cached for this concrete type.\n\tif mi, ok := legacyMessageDescCache.Load(t); ok {\n\t\treturn mi.(pref.MessageDescriptor)\n\t}\n\n\t// Slow-path: initialize MessageDescriptor from the raw descriptor.\n\tmv := reflect.Zero(t).Interface()\n\tif _, ok := mv.(pref.ProtoMessage); ok {\n\t\tpanic(fmt.Sprintf(\"%v already implements proto.Message\", t))\n\t}\n\tmdV1, ok := mv.(messageV1)\n\tif !ok {\n\t\treturn aberrantLoadMessageDesc(t, name)\n\t}\n\n\t// If this is a dynamic message type where there isn't a 1-1 mapping between\n\t// Go and protobuf types, calling the Descriptor method on the zero value of\n\t// the message type isn't likely to work. If it panics, swallow the panic and\n\t// continue as if the Descriptor method wasn't present.\n\tb, idxs := func() ([]byte, []int) {\n\t\tdefer func() {\n\t\t\trecover()\n\t\t}()\n\t\treturn mdV1.Descriptor()\n\t}()\n\tif b == nil {\n\t\treturn aberrantLoadMessageDesc(t, name)\n\t}\n\n\t// If the Go type has no fields, then this might be a proto3 empty message\n\t// from before the size cache was added. If there are any fields, check to\n\t// see that at least one of them looks like something we generated.\n\tif t.Elem().Kind() == reflect.Struct {\n\t\tif nfield := t.Elem().NumField(); nfield > 0 {\n\t\t\thasProtoField := false\n\t\t\tfor i := 0; i < nfield; i++ {\n\t\t\t\tf := t.Elem().Field(i)\n\t\t\t\tif f.Tag.Get(\"protobuf\") != \"\" || f.Tag.Get(\"protobuf_oneof\") != \"\" || strings.HasPrefix(f.Name, \"XXX_\") {\n\t\t\t\t\thasProtoField = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !hasProtoField {\n\t\t\t\treturn aberrantLoadMessageDesc(t, name)\n\t\t\t}\n\t\t}\n\t}\n\n\tmd := legacyLoadFileDesc(b).Messages().Get(idxs[0])\n\tfor _, i := range idxs[1:] {\n\t\tmd = md.Messages().Get(i)\n\t}\n\tif name != \"\" && md.FullName() != name {\n\t\tpanic(fmt.Sprintf(\"mismatching message name: got %v, want %v\", md.FullName(), name))\n\t}\n\tif md, ok := legacyMessageDescCache.LoadOrStore(t, md); ok {\n\t\treturn md.(protoreflect.MessageDescriptor)\n\t}\n\treturn md\n}\n\nvar (\n\taberrantMessageDescLock  sync.Mutex\n\taberrantMessageDescCache map[reflect.Type]protoreflect.MessageDescriptor\n)\n\n// aberrantLoadMessageDesc returns an MessageDescriptor derived from the Go type,\n// which must not implement protoreflect.ProtoMessage or messageV1.\n//\n// This is a best-effort derivation of the message descriptor using the protobuf\n// tags on the struct fields.\nfunc aberrantLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescriptor {\n\taberrantMessageDescLock.Lock()\n\tdefer aberrantMessageDescLock.Unlock()\n\tif aberrantMessageDescCache == nil {\n\t\taberrantMessageDescCache = make(map[reflect.Type]protoreflect.MessageDescriptor)\n\t}\n\treturn aberrantLoadMessageDescReentrant(t, name)\n}\nfunc aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.MessageDescriptor {\n\t// Fast-path: check if an MessageDescriptor is cached for this concrete type.\n\tif md, ok := aberrantMessageDescCache[t]; ok {\n\t\treturn md\n\t}\n\n\t// Slow-path: construct a descriptor from the Go struct type (best-effort).\n\t// Cache the MessageDescriptor early on so that we can resolve internal\n\t// cyclic references.\n\tmd := &filedesc.Message{L2: new(filedesc.MessageL2)}\n\tmd.L0.FullName = aberrantDeriveMessageName(t, name)\n\tmd.L0.ParentFile = filedesc.SurrogateProto2\n\taberrantMessageDescCache[t] = md\n\n\tif t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {\n\t\treturn md\n\t}\n\n\t// Try to determine if the message is using proto3 by checking scalars.\n\tfor i := 0; i < t.Elem().NumField(); i++ {\n\t\tf := t.Elem().Field(i)\n\t\tif tag := f.Tag.Get(\"protobuf\"); tag != \"\" {\n\t\t\tswitch f.Type.Kind() {\n\t\t\tcase reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String:\n\t\t\t\tmd.L0.ParentFile = filedesc.SurrogateProto3\n\t\t\t}\n\t\t\tfor _, s := range strings.Split(tag, \",\") {\n\t\t\t\tif s == \"proto3\" {\n\t\t\t\t\tmd.L0.ParentFile = filedesc.SurrogateProto3\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Obtain a list of oneof wrapper types.\n\tvar oneofWrappers []reflect.Type\n\tfor _, method := range []string{\"XXX_OneofFuncs\", \"XXX_OneofWrappers\"} {\n\t\tif fn, ok := t.MethodByName(method); ok {\n\t\t\tfor _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {\n\t\t\t\tif vs, ok := v.Interface().([]interface{}); ok {\n\t\t\t\t\tfor _, v := range vs {\n\t\t\t\t\t\toneofWrappers = append(oneofWrappers, reflect.TypeOf(v))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Obtain a list of the extension ranges.\n\tif fn, ok := t.MethodByName(\"ExtensionRangeArray\"); ok {\n\t\tvs := fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0]\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\tv := vs.Index(i)\n\t\t\tmd.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, [2]pref.FieldNumber{\n\t\t\t\tpref.FieldNumber(v.FieldByName(\"Start\").Int()),\n\t\t\t\tpref.FieldNumber(v.FieldByName(\"End\").Int() + 1),\n\t\t\t})\n\t\t\tmd.L2.ExtensionRangeOptions = append(md.L2.ExtensionRangeOptions, nil)\n\t\t}\n\t}\n\n\t// Derive the message fields by inspecting the struct fields.\n\tfor i := 0; i < t.Elem().NumField(); i++ {\n\t\tf := t.Elem().Field(i)\n\t\tif tag := f.Tag.Get(\"protobuf\"); tag != \"\" {\n\t\t\ttagKey := f.Tag.Get(\"protobuf_key\")\n\t\t\ttagVal := f.Tag.Get(\"protobuf_val\")\n\t\t\taberrantAppendField(md, f.Type, tag, tagKey, tagVal)\n\t\t}\n\t\tif tag := f.Tag.Get(\"protobuf_oneof\"); tag != \"\" {\n\t\t\tn := len(md.L2.Oneofs.List)\n\t\t\tmd.L2.Oneofs.List = append(md.L2.Oneofs.List, filedesc.Oneof{})\n\t\t\tod := &md.L2.Oneofs.List[n]\n\t\t\tod.L0.FullName = md.FullName().Append(pref.Name(tag))\n\t\t\tod.L0.ParentFile = md.L0.ParentFile\n\t\t\tod.L0.Parent = md\n\t\t\tod.L0.Index = n\n\n\t\t\tfor _, t := range oneofWrappers {\n\t\t\t\tif t.Implements(f.Type) {\n\t\t\t\t\tf := t.Elem().Field(0)\n\t\t\t\t\tif tag := f.Tag.Get(\"protobuf\"); tag != \"\" {\n\t\t\t\t\t\taberrantAppendField(md, f.Type, tag, \"\", \"\")\n\t\t\t\t\t\tfd := &md.L2.Fields.List[len(md.L2.Fields.List)-1]\n\t\t\t\t\t\tfd.L1.ContainingOneof = od\n\t\t\t\t\t\tod.L1.Fields.List = append(od.L1.Fields.List, fd)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn md\n}\n\nfunc aberrantDeriveMessageName(t reflect.Type, name pref.FullName) pref.FullName {\n\tif name.IsValid() {\n\t\treturn name\n\t}\n\tfunc() {\n\t\tdefer func() { recover() }() // swallow possible nil panics\n\t\tif m, ok := reflect.Zero(t).Interface().(interface{ XXX_MessageName() string }); ok {\n\t\t\tname = pref.FullName(m.XXX_MessageName())\n\t\t}\n\t}()\n\tif name.IsValid() {\n\t\treturn name\n\t}\n\tif t.Kind() == reflect.Ptr {\n\t\tt = t.Elem()\n\t}\n\treturn AberrantDeriveFullName(t)\n}\n\nfunc aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey, tagVal string) {\n\tt := goType\n\tisOptional := t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct\n\tisRepeated := t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8\n\tif isOptional || isRepeated {\n\t\tt = t.Elem()\n\t}\n\tfd := ptag.Unmarshal(tag, t, placeholderEnumValues{}).(*filedesc.Field)\n\n\t// Append field descriptor to the message.\n\tn := len(md.L2.Fields.List)\n\tmd.L2.Fields.List = append(md.L2.Fields.List, *fd)\n\tfd = &md.L2.Fields.List[n]\n\tfd.L0.FullName = md.FullName().Append(fd.Name())\n\tfd.L0.ParentFile = md.L0.ParentFile\n\tfd.L0.Parent = md\n\tfd.L0.Index = n\n\n\tif fd.L1.IsWeak || fd.L1.HasPacked {\n\t\tfd.L1.Options = func() pref.ProtoMessage {\n\t\t\topts := descopts.Field.ProtoReflect().New()\n\t\t\tif fd.L1.IsWeak {\n\t\t\t\topts.Set(opts.Descriptor().Fields().ByName(\"weak\"), protoreflect.ValueOfBool(true))\n\t\t\t}\n\t\t\tif fd.L1.HasPacked {\n\t\t\t\topts.Set(opts.Descriptor().Fields().ByName(\"packed\"), protoreflect.ValueOfBool(fd.L1.IsPacked))\n\t\t\t}\n\t\t\treturn opts.Interface()\n\t\t}\n\t}\n\n\t// Populate Enum and Message.\n\tif fd.Enum() == nil && fd.Kind() == pref.EnumKind {\n\t\tswitch v := reflect.Zero(t).Interface().(type) {\n\t\tcase pref.Enum:\n\t\t\tfd.L1.Enum = v.Descriptor()\n\t\tdefault:\n\t\t\tfd.L1.Enum = LegacyLoadEnumDesc(t)\n\t\t}\n\t}\n\tif fd.Message() == nil && (fd.Kind() == pref.MessageKind || fd.Kind() == pref.GroupKind) {\n\t\tswitch v := reflect.Zero(t).Interface().(type) {\n\t\tcase pref.ProtoMessage:\n\t\t\tfd.L1.Message = v.ProtoReflect().Descriptor()\n\t\tcase messageV1:\n\t\t\tfd.L1.Message = LegacyLoadMessageDesc(t)\n\t\tdefault:\n\t\t\tif t.Kind() == reflect.Map {\n\t\t\t\tn := len(md.L1.Messages.List)\n\t\t\t\tmd.L1.Messages.List = append(md.L1.Messages.List, filedesc.Message{L2: new(filedesc.MessageL2)})\n\t\t\t\tmd2 := &md.L1.Messages.List[n]\n\t\t\t\tmd2.L0.FullName = md.FullName().Append(pref.Name(strs.MapEntryName(string(fd.Name()))))\n\t\t\t\tmd2.L0.ParentFile = md.L0.ParentFile\n\t\t\t\tmd2.L0.Parent = md\n\t\t\t\tmd2.L0.Index = n\n\n\t\t\t\tmd2.L1.IsMapEntry = true\n\t\t\t\tmd2.L2.Options = func() pref.ProtoMessage {\n\t\t\t\t\topts := descopts.Message.ProtoReflect().New()\n\t\t\t\t\topts.Set(opts.Descriptor().Fields().ByName(\"map_entry\"), protoreflect.ValueOfBool(true))\n\t\t\t\t\treturn opts.Interface()\n\t\t\t\t}\n\n\t\t\t\taberrantAppendField(md2, t.Key(), tagKey, \"\", \"\")\n\t\t\t\taberrantAppendField(md2, t.Elem(), tagVal, \"\", \"\")\n\n\t\t\t\tfd.L1.Message = md2\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfd.L1.Message = aberrantLoadMessageDescReentrant(t, \"\")\n\t\t}\n\t}\n}\n\ntype placeholderEnumValues struct {\n\tprotoreflect.EnumValueDescriptors\n}\n\nfunc (placeholderEnumValues) ByNumber(n pref.EnumNumber) pref.EnumValueDescriptor {\n\treturn filedesc.PlaceholderEnumValue(pref.FullName(fmt.Sprintf(\"UNKNOWN_%d\", n)))\n}\n\n// legacyMarshaler is the proto.Marshaler interface superseded by protoiface.Methoder.\ntype legacyMarshaler interface {\n\tMarshal() ([]byte, error)\n}\n\n// legacyUnmarshaler is the proto.Unmarshaler interface superseded by protoiface.Methoder.\ntype legacyUnmarshaler interface {\n\tUnmarshal([]byte) error\n}\n\n// legacyMerger is the proto.Merger interface superseded by protoiface.Methoder.\ntype legacyMerger interface {\n\tMerge(protoiface.MessageV1)\n}\n\nvar aberrantProtoMethods = &piface.Methods{\n\tMarshal:   legacyMarshal,\n\tUnmarshal: legacyUnmarshal,\n\tMerge:     legacyMerge,\n\n\t// We have no way to tell whether the type's Marshal method\n\t// supports deterministic serialization or not, but this\n\t// preserves the v1 implementation's behavior of always\n\t// calling Marshal methods when present.\n\tFlags: piface.SupportMarshalDeterministic,\n}\n\nfunc legacyMarshal(in piface.MarshalInput) (piface.MarshalOutput, error) {\n\tv := in.Message.(unwrapper).protoUnwrap()\n\tmarshaler, ok := v.(legacyMarshaler)\n\tif !ok {\n\t\treturn piface.MarshalOutput{}, errors.New(\"%T does not implement Marshal\", v)\n\t}\n\tout, err := marshaler.Marshal()\n\tif in.Buf != nil {\n\t\tout = append(in.Buf, out...)\n\t}\n\treturn piface.MarshalOutput{\n\t\tBuf: out,\n\t}, err\n}\n\nfunc legacyUnmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) {\n\tv := in.Message.(unwrapper).protoUnwrap()\n\tunmarshaler, ok := v.(legacyUnmarshaler)\n\tif !ok {\n\t\treturn piface.UnmarshalOutput{}, errors.New(\"%T does not implement Unmarshal\", v)\n\t}\n\treturn piface.UnmarshalOutput{}, unmarshaler.Unmarshal(in.Buf)\n}\n\nfunc legacyMerge(in piface.MergeInput) piface.MergeOutput {\n\t// Check whether this supports the legacy merger.\n\tdstv := in.Destination.(unwrapper).protoUnwrap()\n\tmerger, ok := dstv.(legacyMerger)\n\tif ok {\n\t\tmerger.Merge(Export{}.ProtoMessageV1Of(in.Source))\n\t\treturn piface.MergeOutput{Flags: piface.MergeComplete}\n\t}\n\n\t// If legacy merger is unavailable, implement merge in terms of\n\t// a marshal and unmarshal operation.\n\tsrcv := in.Source.(unwrapper).protoUnwrap()\n\tmarshaler, ok := srcv.(legacyMarshaler)\n\tif !ok {\n\t\treturn piface.MergeOutput{}\n\t}\n\tdstv = in.Destination.(unwrapper).protoUnwrap()\n\tunmarshaler, ok := dstv.(legacyUnmarshaler)\n\tif !ok {\n\t\treturn piface.MergeOutput{}\n\t}\n\tb, err := marshaler.Marshal()\n\tif err != nil {\n\t\treturn piface.MergeOutput{}\n\t}\n\terr = unmarshaler.Unmarshal(b)\n\tif err != nil {\n\t\treturn piface.MergeOutput{}\n\t}\n\treturn piface.MergeOutput{Flags: piface.MergeComplete}\n}\n\n// aberrantMessageType implements MessageType for all types other than pointer-to-struct.\ntype aberrantMessageType struct {\n\tt reflect.Type\n}\n\nfunc (mt aberrantMessageType) New() pref.Message {\n\tif mt.t.Kind() == reflect.Ptr {\n\t\treturn aberrantMessage{reflect.New(mt.t.Elem())}\n\t}\n\treturn aberrantMessage{reflect.Zero(mt.t)}\n}\nfunc (mt aberrantMessageType) Zero() pref.Message {\n\treturn aberrantMessage{reflect.Zero(mt.t)}\n}\nfunc (mt aberrantMessageType) GoType() reflect.Type {\n\treturn mt.t\n}\nfunc (mt aberrantMessageType) Descriptor() pref.MessageDescriptor {\n\treturn LegacyLoadMessageDesc(mt.t)\n}\n\n// aberrantMessage implements Message for all types other than pointer-to-struct.\n//\n// When the underlying type implements legacyMarshaler or legacyUnmarshaler,\n// the aberrant Message can be marshaled or unmarshaled. Otherwise, there is\n// not much that can be done with values of this type.\ntype aberrantMessage struct {\n\tv reflect.Value\n}\n\n// Reset implements the v1 proto.Message.Reset method.\nfunc (m aberrantMessage) Reset() {\n\tif mr, ok := m.v.Interface().(interface{ Reset() }); ok {\n\t\tmr.Reset()\n\t\treturn\n\t}\n\tif m.v.Kind() == reflect.Ptr && !m.v.IsNil() {\n\t\tm.v.Elem().Set(reflect.Zero(m.v.Type().Elem()))\n\t}\n}\n\nfunc (m aberrantMessage) ProtoReflect() pref.Message {\n\treturn m\n}\n\nfunc (m aberrantMessage) Descriptor() pref.MessageDescriptor {\n\treturn LegacyLoadMessageDesc(m.v.Type())\n}\nfunc (m aberrantMessage) Type() pref.MessageType {\n\treturn aberrantMessageType{m.v.Type()}\n}\nfunc (m aberrantMessage) New() pref.Message {\n\tif m.v.Type().Kind() == reflect.Ptr {\n\t\treturn aberrantMessage{reflect.New(m.v.Type().Elem())}\n\t}\n\treturn aberrantMessage{reflect.Zero(m.v.Type())}\n}\nfunc (m aberrantMessage) Interface() pref.ProtoMessage {\n\treturn m\n}\nfunc (m aberrantMessage) Range(f func(pref.FieldDescriptor, pref.Value) bool) {\n\treturn\n}\nfunc (m aberrantMessage) Has(pref.FieldDescriptor) bool {\n\treturn false\n}\nfunc (m aberrantMessage) Clear(pref.FieldDescriptor) {\n\tpanic(\"invalid Message.Clear on \" + string(m.Descriptor().FullName()))\n}\nfunc (m aberrantMessage) Get(fd pref.FieldDescriptor) pref.Value {\n\tif fd.Default().IsValid() {\n\t\treturn fd.Default()\n\t}\n\tpanic(\"invalid Message.Get on \" + string(m.Descriptor().FullName()))\n}\nfunc (m aberrantMessage) Set(pref.FieldDescriptor, pref.Value) {\n\tpanic(\"invalid Message.Set on \" + string(m.Descriptor().FullName()))\n}\nfunc (m aberrantMessage) Mutable(pref.FieldDescriptor) pref.Value {\n\tpanic(\"invalid Message.Mutable on \" + string(m.Descriptor().FullName()))\n}\nfunc (m aberrantMessage) NewField(pref.FieldDescriptor) pref.Value {\n\tpanic(\"invalid Message.NewField on \" + string(m.Descriptor().FullName()))\n}\nfunc (m aberrantMessage) WhichOneof(pref.OneofDescriptor) pref.FieldDescriptor {\n\tpanic(\"invalid Message.WhichOneof descriptor on \" + string(m.Descriptor().FullName()))\n}\nfunc (m aberrantMessage) GetUnknown() pref.RawFields {\n\treturn nil\n}\nfunc (m aberrantMessage) SetUnknown(pref.RawFields) {\n\t// SetUnknown discards its input on messages which don't support unknown field storage.\n}\nfunc (m aberrantMessage) IsValid() bool {\n\tif m.v.Kind() == reflect.Ptr {\n\t\treturn !m.v.IsNil()\n\t}\n\treturn false\n}\nfunc (m aberrantMessage) ProtoMethods() *piface.Methods {\n\treturn aberrantProtoMethods\n}\nfunc (m aberrantMessage) protoUnwrap() interface{} {\n\treturn m.v.Interface()\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/merge.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/proto\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\ntype mergeOptions struct{}\n\nfunc (o mergeOptions) Merge(dst, src proto.Message) {\n\tproto.Merge(dst, src)\n}\n\n// merge is protoreflect.Methods.Merge.\nfunc (mi *MessageInfo) merge(in piface.MergeInput) piface.MergeOutput {\n\tdp, ok := mi.getPointer(in.Destination)\n\tif !ok {\n\t\treturn piface.MergeOutput{}\n\t}\n\tsp, ok := mi.getPointer(in.Source)\n\tif !ok {\n\t\treturn piface.MergeOutput{}\n\t}\n\tmi.mergePointer(dp, sp, mergeOptions{})\n\treturn piface.MergeOutput{Flags: piface.MergeComplete}\n}\n\nfunc (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) {\n\tmi.init()\n\tif dst.IsNil() {\n\t\tpanic(fmt.Sprintf(\"invalid value: merging into nil message\"))\n\t}\n\tif src.IsNil() {\n\t\treturn\n\t}\n\tfor _, f := range mi.orderedCoderFields {\n\t\tif f.funcs.merge == nil {\n\t\t\tcontinue\n\t\t}\n\t\tsfptr := src.Apply(f.offset)\n\t\tif f.isPointer && sfptr.Elem().IsNil() {\n\t\t\tcontinue\n\t\t}\n\t\tf.funcs.merge(dst.Apply(f.offset), sfptr, f, opts)\n\t}\n\tif mi.extensionOffset.IsValid() {\n\t\tsext := src.Apply(mi.extensionOffset).Extensions()\n\t\tdext := dst.Apply(mi.extensionOffset).Extensions()\n\t\tif *dext == nil {\n\t\t\t*dext = make(map[int32]ExtensionField)\n\t\t}\n\t\tfor num, sx := range *sext {\n\t\t\txt := sx.Type()\n\t\t\txi := getExtensionFieldInfo(xt)\n\t\t\tif xi.funcs.merge == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdx := (*dext)[num]\n\t\t\tvar dv pref.Value\n\t\t\tif dx.Type() == sx.Type() {\n\t\t\t\tdv = dx.Value()\n\t\t\t}\n\t\t\tif !dv.IsValid() && xi.unmarshalNeedsValue {\n\t\t\t\tdv = xt.New()\n\t\t\t}\n\t\t\tdv = xi.funcs.merge(dv, sx.Value(), opts)\n\t\t\tdx.Set(sx.Type(), dv)\n\t\t\t(*dext)[num] = dx\n\t\t}\n\t}\n\tif mi.unknownOffset.IsValid() {\n\t\tsu := mi.getUnknownBytes(src)\n\t\tif su != nil && len(*su) > 0 {\n\t\t\tdu := mi.mutableUnknownBytes(dst)\n\t\t\t*du = append(*du, *su...)\n\t\t}\n\t}\n}\n\nfunc mergeScalarValue(dst, src pref.Value, opts mergeOptions) pref.Value {\n\treturn src\n}\n\nfunc mergeBytesValue(dst, src pref.Value, opts mergeOptions) pref.Value {\n\treturn pref.ValueOfBytes(append(emptyBuf[:], src.Bytes()...))\n}\n\nfunc mergeListValue(dst, src pref.Value, opts mergeOptions) pref.Value {\n\tdstl := dst.List()\n\tsrcl := src.List()\n\tfor i, llen := 0, srcl.Len(); i < llen; i++ {\n\t\tdstl.Append(srcl.Get(i))\n\t}\n\treturn dst\n}\n\nfunc mergeBytesListValue(dst, src pref.Value, opts mergeOptions) pref.Value {\n\tdstl := dst.List()\n\tsrcl := src.List()\n\tfor i, llen := 0, srcl.Len(); i < llen; i++ {\n\t\tsb := srcl.Get(i).Bytes()\n\t\tdb := append(emptyBuf[:], sb...)\n\t\tdstl.Append(pref.ValueOfBytes(db))\n\t}\n\treturn dst\n}\n\nfunc mergeMessageListValue(dst, src pref.Value, opts mergeOptions) pref.Value {\n\tdstl := dst.List()\n\tsrcl := src.List()\n\tfor i, llen := 0, srcl.Len(); i < llen; i++ {\n\t\tsm := srcl.Get(i).Message()\n\t\tdm := proto.Clone(sm.Interface()).ProtoReflect()\n\t\tdstl.Append(pref.ValueOfMessage(dm))\n\t}\n\treturn dst\n}\n\nfunc mergeMessageValue(dst, src pref.Value, opts mergeOptions) pref.Value {\n\topts.Merge(dst.Message().Interface(), src.Message().Interface())\n\treturn dst\n}\n\nfunc mergeMessage(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {\n\tif f.mi != nil {\n\t\tif dst.Elem().IsNil() {\n\t\t\tdst.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem())))\n\t\t}\n\t\tf.mi.mergePointer(dst.Elem(), src.Elem(), opts)\n\t} else {\n\t\tdm := dst.AsValueOf(f.ft).Elem()\n\t\tsm := src.AsValueOf(f.ft).Elem()\n\t\tif dm.IsNil() {\n\t\t\tdm.Set(reflect.New(f.ft.Elem()))\n\t\t}\n\t\topts.Merge(asMessage(dm), asMessage(sm))\n\t}\n}\n\nfunc mergeMessageSlice(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {\n\tfor _, sp := range src.PointerSlice() {\n\t\tdm := reflect.New(f.ft.Elem().Elem())\n\t\tif f.mi != nil {\n\t\t\tf.mi.mergePointer(pointerOfValue(dm), sp, opts)\n\t\t} else {\n\t\t\topts.Merge(asMessage(dm), asMessage(sp.AsValueOf(f.ft.Elem().Elem())))\n\t\t}\n\t\tdst.AppendPointerSlice(pointerOfValue(dm))\n\t}\n}\n\nfunc mergeBytes(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Bytes() = append(emptyBuf[:], *src.Bytes()...)\n}\n\nfunc mergeBytesNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Bytes()\n\tif len(v) > 0 {\n\t\t*dst.Bytes() = append(emptyBuf[:], v...)\n\t}\n}\n\nfunc mergeBytesSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.BytesSlice()\n\tfor _, v := range *src.BytesSlice() {\n\t\t*ds = append(*ds, append(emptyBuf[:], v...))\n\t}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/merge_gen.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// Code generated by generate-types. DO NOT EDIT.\n\npackage impl\n\nimport ()\n\nfunc mergeBool(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Bool() = *src.Bool()\n}\n\nfunc mergeBoolNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Bool()\n\tif v != false {\n\t\t*dst.Bool() = v\n\t}\n}\n\nfunc mergeBoolPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.BoolPtr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.BoolPtr() = &v\n\t}\n}\n\nfunc mergeBoolSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.BoolSlice()\n\tss := src.BoolSlice()\n\t*ds = append(*ds, *ss...)\n}\n\nfunc mergeInt32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Int32() = *src.Int32()\n}\n\nfunc mergeInt32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Int32()\n\tif v != 0 {\n\t\t*dst.Int32() = v\n\t}\n}\n\nfunc mergeInt32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.Int32Ptr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.Int32Ptr() = &v\n\t}\n}\n\nfunc mergeInt32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.Int32Slice()\n\tss := src.Int32Slice()\n\t*ds = append(*ds, *ss...)\n}\n\nfunc mergeUint32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Uint32() = *src.Uint32()\n}\n\nfunc mergeUint32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Uint32()\n\tif v != 0 {\n\t\t*dst.Uint32() = v\n\t}\n}\n\nfunc mergeUint32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.Uint32Ptr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.Uint32Ptr() = &v\n\t}\n}\n\nfunc mergeUint32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.Uint32Slice()\n\tss := src.Uint32Slice()\n\t*ds = append(*ds, *ss...)\n}\n\nfunc mergeInt64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Int64() = *src.Int64()\n}\n\nfunc mergeInt64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Int64()\n\tif v != 0 {\n\t\t*dst.Int64() = v\n\t}\n}\n\nfunc mergeInt64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.Int64Ptr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.Int64Ptr() = &v\n\t}\n}\n\nfunc mergeInt64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.Int64Slice()\n\tss := src.Int64Slice()\n\t*ds = append(*ds, *ss...)\n}\n\nfunc mergeUint64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Uint64() = *src.Uint64()\n}\n\nfunc mergeUint64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Uint64()\n\tif v != 0 {\n\t\t*dst.Uint64() = v\n\t}\n}\n\nfunc mergeUint64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.Uint64Ptr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.Uint64Ptr() = &v\n\t}\n}\n\nfunc mergeUint64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.Uint64Slice()\n\tss := src.Uint64Slice()\n\t*ds = append(*ds, *ss...)\n}\n\nfunc mergeFloat32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Float32() = *src.Float32()\n}\n\nfunc mergeFloat32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Float32()\n\tif v != 0 {\n\t\t*dst.Float32() = v\n\t}\n}\n\nfunc mergeFloat32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.Float32Ptr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.Float32Ptr() = &v\n\t}\n}\n\nfunc mergeFloat32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.Float32Slice()\n\tss := src.Float32Slice()\n\t*ds = append(*ds, *ss...)\n}\n\nfunc mergeFloat64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Float64() = *src.Float64()\n}\n\nfunc mergeFloat64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Float64()\n\tif v != 0 {\n\t\t*dst.Float64() = v\n\t}\n}\n\nfunc mergeFloat64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.Float64Ptr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.Float64Ptr() = &v\n\t}\n}\n\nfunc mergeFloat64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.Float64Slice()\n\tss := src.Float64Slice()\n\t*ds = append(*ds, *ss...)\n}\n\nfunc mergeString(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.String() = *src.String()\n}\n\nfunc mergeStringNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.String()\n\tif v != \"\" {\n\t\t*dst.String() = v\n\t}\n}\n\nfunc mergeStringPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.StringPtr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.StringPtr() = &v\n\t}\n}\n\nfunc mergeStringSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.StringSlice()\n\tss := src.StringSlice()\n\t*ds = append(*ds, *ss...)\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/message.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\t\"sync\"\n\t\"sync/atomic\"\n\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// MessageInfo provides protobuf related functionality for a given Go type\n// that represents a message. A given instance of MessageInfo is tied to\n// exactly one Go type, which must be a pointer to a struct type.\n//\n// The exported fields must be populated before any methods are called\n// and cannot be mutated after set.\ntype MessageInfo struct {\n\t// GoReflectType is the underlying message Go type and must be populated.\n\tGoReflectType reflect.Type // pointer to struct\n\n\t// Desc is the underlying message descriptor type and must be populated.\n\tDesc pref.MessageDescriptor\n\n\t// Exporter must be provided in a purego environment in order to provide\n\t// access to unexported fields.\n\tExporter exporter\n\n\t// OneofWrappers is list of pointers to oneof wrapper struct types.\n\tOneofWrappers []interface{}\n\n\tinitMu   sync.Mutex // protects all unexported fields\n\tinitDone uint32\n\n\treflectMessageInfo // for reflection implementation\n\tcoderMessageInfo   // for fast-path method implementations\n}\n\n// exporter is a function that returns a reference to the ith field of v,\n// where v is a pointer to a struct. It returns nil if it does not support\n// exporting the requested field (e.g., already exported).\ntype exporter func(v interface{}, i int) interface{}\n\n// getMessageInfo returns the MessageInfo for any message type that\n// is generated by our implementation of protoc-gen-go (for v2 and on).\n// If it is unable to obtain a MessageInfo, it returns nil.\nfunc getMessageInfo(mt reflect.Type) *MessageInfo {\n\tm, ok := reflect.Zero(mt).Interface().(pref.ProtoMessage)\n\tif !ok {\n\t\treturn nil\n\t}\n\tmr, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *MessageInfo })\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn mr.ProtoMessageInfo()\n}\n\nfunc (mi *MessageInfo) init() {\n\t// This function is called in the hot path. Inline the sync.Once logic,\n\t// since allocating a closure for Once.Do is expensive.\n\t// Keep init small to ensure that it can be inlined.\n\tif atomic.LoadUint32(&mi.initDone) == 0 {\n\t\tmi.initOnce()\n\t}\n}\n\nfunc (mi *MessageInfo) initOnce() {\n\tmi.initMu.Lock()\n\tdefer mi.initMu.Unlock()\n\tif mi.initDone == 1 {\n\t\treturn\n\t}\n\n\tt := mi.GoReflectType\n\tif t.Kind() != reflect.Ptr && t.Elem().Kind() != reflect.Struct {\n\t\tpanic(fmt.Sprintf(\"got %v, want *struct kind\", t))\n\t}\n\tt = t.Elem()\n\n\tsi := mi.makeStructInfo(t)\n\tmi.makeReflectFuncs(t, si)\n\tmi.makeCoderMethods(t, si)\n\n\tatomic.StoreUint32(&mi.initDone, 1)\n}\n\n// getPointer returns the pointer for a message, which should be of\n// the type of the MessageInfo. If the message is of a different type,\n// it returns ok==false.\nfunc (mi *MessageInfo) getPointer(m pref.Message) (p pointer, ok bool) {\n\tswitch m := m.(type) {\n\tcase *messageState:\n\t\treturn m.pointer(), m.messageInfo() == mi\n\tcase *messageReflectWrapper:\n\t\treturn m.pointer(), m.messageInfo() == mi\n\t}\n\treturn pointer{}, false\n}\n\ntype (\n\tSizeCache       = int32\n\tWeakFields      = map[int32]protoreflect.ProtoMessage\n\tUnknownFields   = unknownFieldsA // TODO: switch to unknownFieldsB\n\tunknownFieldsA  = []byte\n\tunknownFieldsB  = *[]byte\n\tExtensionFields = map[int32]ExtensionField\n)\n\nvar (\n\tsizecacheType       = reflect.TypeOf(SizeCache(0))\n\tweakFieldsType      = reflect.TypeOf(WeakFields(nil))\n\tunknownFieldsAType  = reflect.TypeOf(unknownFieldsA(nil))\n\tunknownFieldsBType  = reflect.TypeOf(unknownFieldsB(nil))\n\textensionFieldsType = reflect.TypeOf(ExtensionFields(nil))\n)\n\ntype structInfo struct {\n\tsizecacheOffset offset\n\tsizecacheType   reflect.Type\n\tweakOffset      offset\n\tweakType        reflect.Type\n\tunknownOffset   offset\n\tunknownType     reflect.Type\n\textensionOffset offset\n\textensionType   reflect.Type\n\n\tfieldsByNumber        map[pref.FieldNumber]reflect.StructField\n\toneofsByName          map[pref.Name]reflect.StructField\n\toneofWrappersByType   map[reflect.Type]pref.FieldNumber\n\toneofWrappersByNumber map[pref.FieldNumber]reflect.Type\n}\n\nfunc (mi *MessageInfo) makeStructInfo(t reflect.Type) structInfo {\n\tsi := structInfo{\n\t\tsizecacheOffset: invalidOffset,\n\t\tweakOffset:      invalidOffset,\n\t\tunknownOffset:   invalidOffset,\n\t\textensionOffset: invalidOffset,\n\n\t\tfieldsByNumber:        map[pref.FieldNumber]reflect.StructField{},\n\t\toneofsByName:          map[pref.Name]reflect.StructField{},\n\t\toneofWrappersByType:   map[reflect.Type]pref.FieldNumber{},\n\t\toneofWrappersByNumber: map[pref.FieldNumber]reflect.Type{},\n\t}\n\nfieldLoop:\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tswitch f := t.Field(i); f.Name {\n\t\tcase genid.SizeCache_goname, genid.SizeCacheA_goname:\n\t\t\tif f.Type == sizecacheType {\n\t\t\t\tsi.sizecacheOffset = offsetOf(f, mi.Exporter)\n\t\t\t\tsi.sizecacheType = f.Type\n\t\t\t}\n\t\tcase genid.WeakFields_goname, genid.WeakFieldsA_goname:\n\t\t\tif f.Type == weakFieldsType {\n\t\t\t\tsi.weakOffset = offsetOf(f, mi.Exporter)\n\t\t\t\tsi.weakType = f.Type\n\t\t\t}\n\t\tcase genid.UnknownFields_goname, genid.UnknownFieldsA_goname:\n\t\t\tif f.Type == unknownFieldsAType || f.Type == unknownFieldsBType {\n\t\t\t\tsi.unknownOffset = offsetOf(f, mi.Exporter)\n\t\t\t\tsi.unknownType = f.Type\n\t\t\t}\n\t\tcase genid.ExtensionFields_goname, genid.ExtensionFieldsA_goname, genid.ExtensionFieldsB_goname:\n\t\t\tif f.Type == extensionFieldsType {\n\t\t\t\tsi.extensionOffset = offsetOf(f, mi.Exporter)\n\t\t\t\tsi.extensionType = f.Type\n\t\t\t}\n\t\tdefault:\n\t\t\tfor _, s := range strings.Split(f.Tag.Get(\"protobuf\"), \",\") {\n\t\t\t\tif len(s) > 0 && strings.Trim(s, \"0123456789\") == \"\" {\n\t\t\t\t\tn, _ := strconv.ParseUint(s, 10, 64)\n\t\t\t\t\tsi.fieldsByNumber[pref.FieldNumber(n)] = f\n\t\t\t\t\tcontinue fieldLoop\n\t\t\t\t}\n\t\t\t}\n\t\t\tif s := f.Tag.Get(\"protobuf_oneof\"); len(s) > 0 {\n\t\t\t\tsi.oneofsByName[pref.Name(s)] = f\n\t\t\t\tcontinue fieldLoop\n\t\t\t}\n\t\t}\n\t}\n\n\t// Derive a mapping of oneof wrappers to fields.\n\toneofWrappers := mi.OneofWrappers\n\tfor _, method := range []string{\"XXX_OneofFuncs\", \"XXX_OneofWrappers\"} {\n\t\tif fn, ok := reflect.PtrTo(t).MethodByName(method); ok {\n\t\t\tfor _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {\n\t\t\t\tif vs, ok := v.Interface().([]interface{}); ok {\n\t\t\t\t\toneofWrappers = vs\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfor _, v := range oneofWrappers {\n\t\ttf := reflect.TypeOf(v).Elem()\n\t\tf := tf.Field(0)\n\t\tfor _, s := range strings.Split(f.Tag.Get(\"protobuf\"), \",\") {\n\t\t\tif len(s) > 0 && strings.Trim(s, \"0123456789\") == \"\" {\n\t\t\t\tn, _ := strconv.ParseUint(s, 10, 64)\n\t\t\t\tsi.oneofWrappersByType[tf] = pref.FieldNumber(n)\n\t\t\t\tsi.oneofWrappersByNumber[pref.FieldNumber(n)] = tf\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn si\n}\n\nfunc (mi *MessageInfo) New() protoreflect.Message {\n\treturn mi.MessageOf(reflect.New(mi.GoReflectType.Elem()).Interface())\n}\nfunc (mi *MessageInfo) Zero() protoreflect.Message {\n\treturn mi.MessageOf(reflect.Zero(mi.GoReflectType).Interface())\n}\nfunc (mi *MessageInfo) Descriptor() protoreflect.MessageDescriptor {\n\treturn mi.Desc\n}\nfunc (mi *MessageInfo) Enum(i int) protoreflect.EnumType {\n\tmi.init()\n\tfd := mi.Desc.Fields().Get(i)\n\treturn Export{}.EnumTypeOf(mi.fieldTypes[fd.Number()])\n}\nfunc (mi *MessageInfo) Message(i int) protoreflect.MessageType {\n\tmi.init()\n\tfd := mi.Desc.Fields().Get(i)\n\tswitch {\n\tcase fd.IsWeak():\n\t\tmt, _ := preg.GlobalTypes.FindMessageByName(fd.Message().FullName())\n\t\treturn mt\n\tcase fd.IsMap():\n\t\treturn mapEntryType{fd.Message(), mi.fieldTypes[fd.Number()]}\n\tdefault:\n\t\treturn Export{}.MessageTypeOf(mi.fieldTypes[fd.Number()])\n\t}\n}\n\ntype mapEntryType struct {\n\tdesc    protoreflect.MessageDescriptor\n\tvalType interface{} // zero value of enum or message type\n}\n\nfunc (mt mapEntryType) New() protoreflect.Message {\n\treturn nil\n}\nfunc (mt mapEntryType) Zero() protoreflect.Message {\n\treturn nil\n}\nfunc (mt mapEntryType) Descriptor() protoreflect.MessageDescriptor {\n\treturn mt.desc\n}\nfunc (mt mapEntryType) Enum(i int) protoreflect.EnumType {\n\tfd := mt.desc.Fields().Get(i)\n\tif fd.Enum() == nil {\n\t\treturn nil\n\t}\n\treturn Export{}.EnumTypeOf(mt.valType)\n}\nfunc (mt mapEntryType) Message(i int) protoreflect.MessageType {\n\tfd := mt.desc.Fields().Get(i)\n\tif fd.Message() == nil {\n\t\treturn nil\n\t}\n\treturn Export{}.MessageTypeOf(mt.valType)\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/message_reflect.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/internal/detrand\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype reflectMessageInfo struct {\n\tfields map[pref.FieldNumber]*fieldInfo\n\toneofs map[pref.Name]*oneofInfo\n\n\t// fieldTypes contains the zero value of an enum or message field.\n\t// For lists, it contains the element type.\n\t// For maps, it contains the entry value type.\n\tfieldTypes map[pref.FieldNumber]interface{}\n\n\t// denseFields is a subset of fields where:\n\t//\t0 < fieldDesc.Number() < len(denseFields)\n\t// It provides faster access to the fieldInfo, but may be incomplete.\n\tdenseFields []*fieldInfo\n\n\t// rangeInfos is a list of all fields (not belonging to a oneof) and oneofs.\n\trangeInfos []interface{} // either *fieldInfo or *oneofInfo\n\n\tgetUnknown   func(pointer) pref.RawFields\n\tsetUnknown   func(pointer, pref.RawFields)\n\textensionMap func(pointer) *extensionMap\n\n\tnilMessage atomicNilMessage\n}\n\n// makeReflectFuncs generates the set of functions to support reflection.\nfunc (mi *MessageInfo) makeReflectFuncs(t reflect.Type, si structInfo) {\n\tmi.makeKnownFieldsFunc(si)\n\tmi.makeUnknownFieldsFunc(t, si)\n\tmi.makeExtensionFieldsFunc(t, si)\n\tmi.makeFieldTypes(si)\n}\n\n// makeKnownFieldsFunc generates functions for operations that can be performed\n// on each protobuf message field. It takes in a reflect.Type representing the\n// Go struct and matches message fields with struct fields.\n//\n// This code assumes that the struct is well-formed and panics if there are\n// any discrepancies.\nfunc (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) {\n\tmi.fields = map[pref.FieldNumber]*fieldInfo{}\n\tmd := mi.Desc\n\tfds := md.Fields()\n\tfor i := 0; i < fds.Len(); i++ {\n\t\tfd := fds.Get(i)\n\t\tfs := si.fieldsByNumber[fd.Number()]\n\t\tisOneof := fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic()\n\t\tif isOneof {\n\t\t\tfs = si.oneofsByName[fd.ContainingOneof().Name()]\n\t\t}\n\t\tvar fi fieldInfo\n\t\tswitch {\n\t\tcase fs.Type == nil:\n\t\t\tfi = fieldInfoForMissing(fd) // never occurs for officially generated message types\n\t\tcase isOneof:\n\t\t\tfi = fieldInfoForOneof(fd, fs, mi.Exporter, si.oneofWrappersByNumber[fd.Number()])\n\t\tcase fd.IsMap():\n\t\t\tfi = fieldInfoForMap(fd, fs, mi.Exporter)\n\t\tcase fd.IsList():\n\t\t\tfi = fieldInfoForList(fd, fs, mi.Exporter)\n\t\tcase fd.IsWeak():\n\t\t\tfi = fieldInfoForWeakMessage(fd, si.weakOffset)\n\t\tcase fd.Message() != nil:\n\t\t\tfi = fieldInfoForMessage(fd, fs, mi.Exporter)\n\t\tdefault:\n\t\t\tfi = fieldInfoForScalar(fd, fs, mi.Exporter)\n\t\t}\n\t\tmi.fields[fd.Number()] = &fi\n\t}\n\n\tmi.oneofs = map[pref.Name]*oneofInfo{}\n\tfor i := 0; i < md.Oneofs().Len(); i++ {\n\t\tod := md.Oneofs().Get(i)\n\t\tmi.oneofs[od.Name()] = makeOneofInfo(od, si, mi.Exporter)\n\t}\n\n\tmi.denseFields = make([]*fieldInfo, fds.Len()*2)\n\tfor i := 0; i < fds.Len(); i++ {\n\t\tif fd := fds.Get(i); int(fd.Number()) < len(mi.denseFields) {\n\t\t\tmi.denseFields[fd.Number()] = mi.fields[fd.Number()]\n\t\t}\n\t}\n\n\tfor i := 0; i < fds.Len(); {\n\t\tfd := fds.Get(i)\n\t\tif od := fd.ContainingOneof(); od != nil && !od.IsSynthetic() {\n\t\t\tmi.rangeInfos = append(mi.rangeInfos, mi.oneofs[od.Name()])\n\t\t\ti += od.Fields().Len()\n\t\t} else {\n\t\t\tmi.rangeInfos = append(mi.rangeInfos, mi.fields[fd.Number()])\n\t\t\ti++\n\t\t}\n\t}\n\n\t// Introduce instability to iteration order, but keep it deterministic.\n\tif len(mi.rangeInfos) > 1 && detrand.Bool() {\n\t\ti := detrand.Intn(len(mi.rangeInfos) - 1)\n\t\tmi.rangeInfos[i], mi.rangeInfos[i+1] = mi.rangeInfos[i+1], mi.rangeInfos[i]\n\t}\n}\n\nfunc (mi *MessageInfo) makeUnknownFieldsFunc(t reflect.Type, si structInfo) {\n\tswitch {\n\tcase si.unknownOffset.IsValid() && si.unknownType == unknownFieldsAType:\n\t\t// Handle as []byte.\n\t\tmi.getUnknown = func(p pointer) pref.RawFields {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn *p.Apply(mi.unknownOffset).Bytes()\n\t\t}\n\t\tmi.setUnknown = func(p pointer, b pref.RawFields) {\n\t\t\tif p.IsNil() {\n\t\t\t\tpanic(\"invalid SetUnknown on nil Message\")\n\t\t\t}\n\t\t\t*p.Apply(mi.unknownOffset).Bytes() = b\n\t\t}\n\tcase si.unknownOffset.IsValid() && si.unknownType == unknownFieldsBType:\n\t\t// Handle as *[]byte.\n\t\tmi.getUnknown = func(p pointer) pref.RawFields {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tbp := p.Apply(mi.unknownOffset).BytesPtr()\n\t\t\tif *bp == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn **bp\n\t\t}\n\t\tmi.setUnknown = func(p pointer, b pref.RawFields) {\n\t\t\tif p.IsNil() {\n\t\t\t\tpanic(\"invalid SetUnknown on nil Message\")\n\t\t\t}\n\t\t\tbp := p.Apply(mi.unknownOffset).BytesPtr()\n\t\t\tif *bp == nil {\n\t\t\t\t*bp = new([]byte)\n\t\t\t}\n\t\t\t**bp = b\n\t\t}\n\tdefault:\n\t\tmi.getUnknown = func(pointer) pref.RawFields {\n\t\t\treturn nil\n\t\t}\n\t\tmi.setUnknown = func(p pointer, _ pref.RawFields) {\n\t\t\tif p.IsNil() {\n\t\t\t\tpanic(\"invalid SetUnknown on nil Message\")\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc (mi *MessageInfo) makeExtensionFieldsFunc(t reflect.Type, si structInfo) {\n\tif si.extensionOffset.IsValid() {\n\t\tmi.extensionMap = func(p pointer) *extensionMap {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn (*extensionMap)(nil)\n\t\t\t}\n\t\t\tv := p.Apply(si.extensionOffset).AsValueOf(extensionFieldsType)\n\t\t\treturn (*extensionMap)(v.Interface().(*map[int32]ExtensionField))\n\t\t}\n\t} else {\n\t\tmi.extensionMap = func(pointer) *extensionMap {\n\t\t\treturn (*extensionMap)(nil)\n\t\t}\n\t}\n}\nfunc (mi *MessageInfo) makeFieldTypes(si structInfo) {\n\tmd := mi.Desc\n\tfds := md.Fields()\n\tfor i := 0; i < fds.Len(); i++ {\n\t\tvar ft reflect.Type\n\t\tfd := fds.Get(i)\n\t\tfs := si.fieldsByNumber[fd.Number()]\n\t\tisOneof := fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic()\n\t\tif isOneof {\n\t\t\tfs = si.oneofsByName[fd.ContainingOneof().Name()]\n\t\t}\n\t\tvar isMessage bool\n\t\tswitch {\n\t\tcase fs.Type == nil:\n\t\t\tcontinue // never occurs for officially generated message types\n\t\tcase isOneof:\n\t\t\tif fd.Enum() != nil || fd.Message() != nil {\n\t\t\t\tft = si.oneofWrappersByNumber[fd.Number()].Field(0).Type\n\t\t\t}\n\t\tcase fd.IsMap():\n\t\t\tif fd.MapValue().Enum() != nil || fd.MapValue().Message() != nil {\n\t\t\t\tft = fs.Type.Elem()\n\t\t\t}\n\t\t\tisMessage = fd.MapValue().Message() != nil\n\t\tcase fd.IsList():\n\t\t\tif fd.Enum() != nil || fd.Message() != nil {\n\t\t\t\tft = fs.Type.Elem()\n\t\t\t}\n\t\t\tisMessage = fd.Message() != nil\n\t\tcase fd.Enum() != nil:\n\t\t\tft = fs.Type\n\t\t\tif fd.HasPresence() && ft.Kind() == reflect.Ptr {\n\t\t\t\tft = ft.Elem()\n\t\t\t}\n\t\tcase fd.Message() != nil:\n\t\t\tft = fs.Type\n\t\t\tif fd.IsWeak() {\n\t\t\t\tft = nil\n\t\t\t}\n\t\t\tisMessage = true\n\t\t}\n\t\tif isMessage && ft != nil && ft.Kind() != reflect.Ptr {\n\t\t\tft = reflect.PtrTo(ft) // never occurs for officially generated message types\n\t\t}\n\t\tif ft != nil {\n\t\t\tif mi.fieldTypes == nil {\n\t\t\t\tmi.fieldTypes = make(map[pref.FieldNumber]interface{})\n\t\t\t}\n\t\t\tmi.fieldTypes[fd.Number()] = reflect.Zero(ft).Interface()\n\t\t}\n\t}\n}\n\ntype extensionMap map[int32]ExtensionField\n\nfunc (m *extensionMap) Range(f func(pref.FieldDescriptor, pref.Value) bool) {\n\tif m != nil {\n\t\tfor _, x := range *m {\n\t\t\txd := x.Type().TypeDescriptor()\n\t\t\tv := x.Value()\n\t\t\tif xd.IsList() && v.List().Len() == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !f(xd, v) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}\nfunc (m *extensionMap) Has(xt pref.ExtensionType) (ok bool) {\n\tif m == nil {\n\t\treturn false\n\t}\n\txd := xt.TypeDescriptor()\n\tx, ok := (*m)[int32(xd.Number())]\n\tif !ok {\n\t\treturn false\n\t}\n\tswitch {\n\tcase xd.IsList():\n\t\treturn x.Value().List().Len() > 0\n\tcase xd.IsMap():\n\t\treturn x.Value().Map().Len() > 0\n\tcase xd.Message() != nil:\n\t\treturn x.Value().Message().IsValid()\n\t}\n\treturn true\n}\nfunc (m *extensionMap) Clear(xt pref.ExtensionType) {\n\tdelete(*m, int32(xt.TypeDescriptor().Number()))\n}\nfunc (m *extensionMap) Get(xt pref.ExtensionType) pref.Value {\n\txd := xt.TypeDescriptor()\n\tif m != nil {\n\t\tif x, ok := (*m)[int32(xd.Number())]; ok {\n\t\t\treturn x.Value()\n\t\t}\n\t}\n\treturn xt.Zero()\n}\nfunc (m *extensionMap) Set(xt pref.ExtensionType, v pref.Value) {\n\txd := xt.TypeDescriptor()\n\tisValid := true\n\tswitch {\n\tcase !xt.IsValidValue(v):\n\t\tisValid = false\n\tcase xd.IsList():\n\t\tisValid = v.List().IsValid()\n\tcase xd.IsMap():\n\t\tisValid = v.Map().IsValid()\n\tcase xd.Message() != nil:\n\t\tisValid = v.Message().IsValid()\n\t}\n\tif !isValid {\n\t\tpanic(fmt.Sprintf(\"%v: assigning invalid value\", xt.TypeDescriptor().FullName()))\n\t}\n\n\tif *m == nil {\n\t\t*m = make(map[int32]ExtensionField)\n\t}\n\tvar x ExtensionField\n\tx.Set(xt, v)\n\t(*m)[int32(xd.Number())] = x\n}\nfunc (m *extensionMap) Mutable(xt pref.ExtensionType) pref.Value {\n\txd := xt.TypeDescriptor()\n\tif xd.Kind() != pref.MessageKind && xd.Kind() != pref.GroupKind && !xd.IsList() && !xd.IsMap() {\n\t\tpanic(\"invalid Mutable on field with non-composite type\")\n\t}\n\tif x, ok := (*m)[int32(xd.Number())]; ok {\n\t\treturn x.Value()\n\t}\n\tv := xt.New()\n\tm.Set(xt, v)\n\treturn v\n}\n\n// MessageState is a data structure that is nested as the first field in a\n// concrete message. It provides a way to implement the ProtoReflect method\n// in an allocation-free way without needing to have a shadow Go type generated\n// for every message type. This technique only works using unsafe.\n//\n//\n// Example generated code:\n//\n//\ttype M struct {\n//\t\tstate protoimpl.MessageState\n//\n//\t\tField1 int32\n//\t\tField2 string\n//\t\tField3 *BarMessage\n//\t\t...\n//\t}\n//\n//\tfunc (m *M) ProtoReflect() protoreflect.Message {\n//\t\tmi := &file_fizz_buzz_proto_msgInfos[5]\n//\t\tif protoimpl.UnsafeEnabled && m != nil {\n//\t\t\tms := protoimpl.X.MessageStateOf(Pointer(m))\n//\t\t\tif ms.LoadMessageInfo() == nil {\n//\t\t\t\tms.StoreMessageInfo(mi)\n//\t\t\t}\n//\t\t\treturn ms\n//\t\t}\n//\t\treturn mi.MessageOf(m)\n//\t}\n//\n// The MessageState type holds a *MessageInfo, which must be atomically set to\n// the message info associated with a given message instance.\n// By unsafely converting a *M into a *MessageState, the MessageState object\n// has access to all the information needed to implement protobuf reflection.\n// It has access to the message info as its first field, and a pointer to the\n// MessageState is identical to a pointer to the concrete message value.\n//\n//\n// Requirements:\n//\t• The type M must implement protoreflect.ProtoMessage.\n//\t• The address of m must not be nil.\n//\t• The address of m and the address of m.state must be equal,\n//\teven though they are different Go types.\ntype MessageState struct {\n\tpragma.NoUnkeyedLiterals\n\tpragma.DoNotCompare\n\tpragma.DoNotCopy\n\n\tatomicMessageInfo *MessageInfo\n}\n\ntype messageState MessageState\n\nvar (\n\t_ pref.Message = (*messageState)(nil)\n\t_ unwrapper    = (*messageState)(nil)\n)\n\n// messageDataType is a tuple of a pointer to the message data and\n// a pointer to the message type. It is a generalized way of providing a\n// reflective view over a message instance. The disadvantage of this approach\n// is the need to allocate this tuple of 16B.\ntype messageDataType struct {\n\tp  pointer\n\tmi *MessageInfo\n}\n\ntype (\n\tmessageReflectWrapper messageDataType\n\tmessageIfaceWrapper   messageDataType\n)\n\nvar (\n\t_ pref.Message      = (*messageReflectWrapper)(nil)\n\t_ unwrapper         = (*messageReflectWrapper)(nil)\n\t_ pref.ProtoMessage = (*messageIfaceWrapper)(nil)\n\t_ unwrapper         = (*messageIfaceWrapper)(nil)\n)\n\n// MessageOf returns a reflective view over a message. The input must be a\n// pointer to a named Go struct. If the provided type has a ProtoReflect method,\n// it must be implemented by calling this method.\nfunc (mi *MessageInfo) MessageOf(m interface{}) pref.Message {\n\tif reflect.TypeOf(m) != mi.GoReflectType {\n\t\tpanic(fmt.Sprintf(\"type mismatch: got %T, want %v\", m, mi.GoReflectType))\n\t}\n\tp := pointerOfIface(m)\n\tif p.IsNil() {\n\t\treturn mi.nilMessage.Init(mi)\n\t}\n\treturn &messageReflectWrapper{p, mi}\n}\n\nfunc (m *messageReflectWrapper) pointer() pointer          { return m.p }\nfunc (m *messageReflectWrapper) messageInfo() *MessageInfo { return m.mi }\n\n// Reset implements the v1 proto.Message.Reset method.\nfunc (m *messageIfaceWrapper) Reset() {\n\tif mr, ok := m.protoUnwrap().(interface{ Reset() }); ok {\n\t\tmr.Reset()\n\t\treturn\n\t}\n\trv := reflect.ValueOf(m.protoUnwrap())\n\tif rv.Kind() == reflect.Ptr && !rv.IsNil() {\n\t\trv.Elem().Set(reflect.Zero(rv.Type().Elem()))\n\t}\n}\nfunc (m *messageIfaceWrapper) ProtoReflect() pref.Message {\n\treturn (*messageReflectWrapper)(m)\n}\nfunc (m *messageIfaceWrapper) protoUnwrap() interface{} {\n\treturn m.p.AsIfaceOf(m.mi.GoReflectType.Elem())\n}\n\n// checkField verifies that the provided field descriptor is valid.\n// Exactly one of the returned values is populated.\nfunc (mi *MessageInfo) checkField(fd pref.FieldDescriptor) (*fieldInfo, pref.ExtensionType) {\n\tvar fi *fieldInfo\n\tif n := fd.Number(); 0 < n && int(n) < len(mi.denseFields) {\n\t\tfi = mi.denseFields[n]\n\t} else {\n\t\tfi = mi.fields[n]\n\t}\n\tif fi != nil {\n\t\tif fi.fieldDesc != fd {\n\t\t\tif got, want := fd.FullName(), fi.fieldDesc.FullName(); got != want {\n\t\t\t\tpanic(fmt.Sprintf(\"mismatching field: got %v, want %v\", got, want))\n\t\t\t}\n\t\t\tpanic(fmt.Sprintf(\"mismatching field: %v\", fd.FullName()))\n\t\t}\n\t\treturn fi, nil\n\t}\n\n\tif fd.IsExtension() {\n\t\tif got, want := fd.ContainingMessage().FullName(), mi.Desc.FullName(); got != want {\n\t\t\t// TODO: Should this be exact containing message descriptor match?\n\t\t\tpanic(fmt.Sprintf(\"extension %v has mismatching containing message: got %v, want %v\", fd.FullName(), got, want))\n\t\t}\n\t\tif !mi.Desc.ExtensionRanges().Has(fd.Number()) {\n\t\t\tpanic(fmt.Sprintf(\"extension %v extends %v outside the extension range\", fd.FullName(), mi.Desc.FullName()))\n\t\t}\n\t\txtd, ok := fd.(pref.ExtensionTypeDescriptor)\n\t\tif !ok {\n\t\t\tpanic(fmt.Sprintf(\"extension %v does not implement protoreflect.ExtensionTypeDescriptor\", fd.FullName()))\n\t\t}\n\t\treturn nil, xtd.Type()\n\t}\n\tpanic(fmt.Sprintf(\"field %v is invalid\", fd.FullName()))\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/message_reflect_field.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 impl\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\t\"reflect\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/flags\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\ntype fieldInfo struct {\n\tfieldDesc pref.FieldDescriptor\n\n\t// These fields are used for protobuf reflection support.\n\thas        func(pointer) bool\n\tclear      func(pointer)\n\tget        func(pointer) pref.Value\n\tset        func(pointer, pref.Value)\n\tmutable    func(pointer) pref.Value\n\tnewMessage func() pref.Message\n\tnewField   func() pref.Value\n}\n\nfunc fieldInfoForMissing(fd pref.FieldDescriptor) fieldInfo {\n\t// This never occurs for generated message types.\n\t// It implies that a hand-crafted type has missing Go fields\n\t// for specific protobuf message fields.\n\treturn fieldInfo{\n\t\tfieldDesc: fd,\n\t\thas: func(p pointer) bool {\n\t\t\treturn false\n\t\t},\n\t\tclear: func(p pointer) {\n\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t},\n\t\tget: func(p pointer) pref.Value {\n\t\t\treturn fd.Default()\n\t\t},\n\t\tset: func(p pointer, v pref.Value) {\n\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t},\n\t\tmutable: func(p pointer) pref.Value {\n\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t},\n\t\tnewMessage: func() pref.Message {\n\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t},\n\t\tnewField: func() pref.Value {\n\t\t\tif v := fd.Default(); v.IsValid() {\n\t\t\t\treturn v\n\t\t\t}\n\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t},\n\t}\n}\n\nfunc fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x exporter, ot reflect.Type) fieldInfo {\n\tft := fs.Type\n\tif ft.Kind() != reflect.Interface {\n\t\tpanic(fmt.Sprintf(\"field %v has invalid type: got %v, want interface kind\", fd.FullName(), ft))\n\t}\n\tif ot.Kind() != reflect.Struct {\n\t\tpanic(fmt.Sprintf(\"field %v has invalid type: got %v, want struct kind\", fd.FullName(), ot))\n\t}\n\tif !reflect.PtrTo(ot).Implements(ft) {\n\t\tpanic(fmt.Sprintf(\"field %v has invalid type: %v does not implement %v\", fd.FullName(), ot, ft))\n\t}\n\tconv := NewConverter(ot.Field(0).Type, fd)\n\tisMessage := fd.Message() != nil\n\n\t// TODO: Implement unsafe fast path?\n\tfieldOffset := offsetOf(fs, x)\n\treturn fieldInfo{\n\t\t// NOTE: The logic below intentionally assumes that oneof fields are\n\t\t// well-formatted. That is, the oneof interface never contains a\n\t\t// typed nil pointer to one of the wrapper structs.\n\n\t\tfieldDesc: fd,\n\t\thas: func(p pointer) bool {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\t\tclear: func(p pointer) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.IsNil() || rv.Elem().Type().Elem() != ot {\n\t\t\t\t// NOTE: We intentionally don't check for rv.Elem().IsNil()\n\t\t\t\t// so that (*OneofWrapperType)(nil) gets cleared to nil.\n\t\t\t\treturn\n\t\t\t}\n\t\t\trv.Set(reflect.Zero(rv.Type()))\n\t\t},\n\t\tget: func(p pointer) pref.Value {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\trv = rv.Elem().Elem().Field(0)\n\t\t\treturn conv.PBValueOf(rv)\n\t\t},\n\t\tset: func(p pointer, v pref.Value) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {\n\t\t\t\trv.Set(reflect.New(ot))\n\t\t\t}\n\t\t\trv = rv.Elem().Elem().Field(0)\n\t\t\trv.Set(conv.GoValueOf(v))\n\t\t},\n\t\tmutable: func(p pointer) pref.Value {\n\t\t\tif !isMessage {\n\t\t\t\tpanic(fmt.Sprintf(\"field %v with invalid Mutable call on field with non-composite type\", fd.FullName()))\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {\n\t\t\t\trv.Set(reflect.New(ot))\n\t\t\t}\n\t\t\trv = rv.Elem().Elem().Field(0)\n\t\t\tif rv.Kind() == reflect.Ptr && rv.IsNil() {\n\t\t\t\trv.Set(conv.GoValueOf(pref.ValueOfMessage(conv.New().Message())))\n\t\t\t}\n\t\t\treturn conv.PBValueOf(rv)\n\t\t},\n\t\tnewMessage: func() pref.Message {\n\t\t\treturn conv.New().Message()\n\t\t},\n\t\tnewField: func() pref.Value {\n\t\t\treturn conv.New()\n\t\t},\n\t}\n}\n\nfunc fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {\n\tft := fs.Type\n\tif ft.Kind() != reflect.Map {\n\t\tpanic(fmt.Sprintf(\"field %v has invalid type: got %v, want map kind\", fd.FullName(), ft))\n\t}\n\tconv := NewConverter(ft, fd)\n\n\t// TODO: Implement unsafe fast path?\n\tfieldOffset := offsetOf(fs, x)\n\treturn fieldInfo{\n\t\tfieldDesc: fd,\n\t\thas: func(p pointer) bool {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\treturn rv.Len() > 0\n\t\t},\n\t\tclear: func(p pointer) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\trv.Set(reflect.Zero(rv.Type()))\n\t\t},\n\t\tget: func(p pointer) pref.Value {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.Len() == 0 {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\treturn conv.PBValueOf(rv)\n\t\t},\n\t\tset: func(p pointer, v pref.Value) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tpv := conv.GoValueOf(v)\n\t\t\tif pv.IsNil() {\n\t\t\t\tpanic(fmt.Sprintf(\"map field %v cannot be set with read-only value\", fd.FullName()))\n\t\t\t}\n\t\t\trv.Set(pv)\n\t\t},\n\t\tmutable: func(p pointer) pref.Value {\n\t\t\tv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif v.IsNil() {\n\t\t\t\tv.Set(reflect.MakeMap(fs.Type))\n\t\t\t}\n\t\t\treturn conv.PBValueOf(v)\n\t\t},\n\t\tnewField: func() pref.Value {\n\t\t\treturn conv.New()\n\t\t},\n\t}\n}\n\nfunc fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {\n\tft := fs.Type\n\tif ft.Kind() != reflect.Slice {\n\t\tpanic(fmt.Sprintf(\"field %v has invalid type: got %v, want slice kind\", fd.FullName(), ft))\n\t}\n\tconv := NewConverter(reflect.PtrTo(ft), fd)\n\n\t// TODO: Implement unsafe fast path?\n\tfieldOffset := offsetOf(fs, x)\n\treturn fieldInfo{\n\t\tfieldDesc: fd,\n\t\thas: func(p pointer) bool {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\treturn rv.Len() > 0\n\t\t},\n\t\tclear: func(p pointer) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\trv.Set(reflect.Zero(rv.Type()))\n\t\t},\n\t\tget: func(p pointer) pref.Value {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type)\n\t\t\tif rv.Elem().Len() == 0 {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\treturn conv.PBValueOf(rv)\n\t\t},\n\t\tset: func(p pointer, v pref.Value) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tpv := conv.GoValueOf(v)\n\t\t\tif pv.IsNil() {\n\t\t\t\tpanic(fmt.Sprintf(\"list field %v cannot be set with read-only value\", fd.FullName()))\n\t\t\t}\n\t\t\trv.Set(pv.Elem())\n\t\t},\n\t\tmutable: func(p pointer) pref.Value {\n\t\t\tv := p.Apply(fieldOffset).AsValueOf(fs.Type)\n\t\t\treturn conv.PBValueOf(v)\n\t\t},\n\t\tnewField: func() pref.Value {\n\t\t\treturn conv.New()\n\t\t},\n\t}\n}\n\nvar (\n\tnilBytes   = reflect.ValueOf([]byte(nil))\n\temptyBytes = reflect.ValueOf([]byte{})\n)\n\nfunc fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {\n\tft := fs.Type\n\tnullable := fd.HasPresence()\n\tisBytes := ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8\n\tif nullable {\n\t\tif ft.Kind() != reflect.Ptr && ft.Kind() != reflect.Slice {\n\t\t\t// This never occurs for generated message types.\n\t\t\t// Despite the protobuf type system specifying presence,\n\t\t\t// the Go field type cannot represent it.\n\t\t\tnullable = false\n\t\t}\n\t\tif ft.Kind() == reflect.Ptr {\n\t\t\tft = ft.Elem()\n\t\t}\n\t}\n\tconv := NewConverter(ft, fd)\n\n\t// TODO: Implement unsafe fast path?\n\tfieldOffset := offsetOf(fs, x)\n\treturn fieldInfo{\n\t\tfieldDesc: fd,\n\t\thas: func(p pointer) bool {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif nullable {\n\t\t\t\treturn !rv.IsNil()\n\t\t\t}\n\t\t\tswitch rv.Kind() {\n\t\t\tcase reflect.Bool:\n\t\t\t\treturn rv.Bool()\n\t\t\tcase reflect.Int32, reflect.Int64:\n\t\t\t\treturn rv.Int() != 0\n\t\t\tcase reflect.Uint32, reflect.Uint64:\n\t\t\t\treturn rv.Uint() != 0\n\t\t\tcase reflect.Float32, reflect.Float64:\n\t\t\t\treturn rv.Float() != 0 || math.Signbit(rv.Float())\n\t\t\tcase reflect.String, reflect.Slice:\n\t\t\t\treturn rv.Len() > 0\n\t\t\tdefault:\n\t\t\t\tpanic(fmt.Sprintf(\"field %v has invalid type: %v\", fd.FullName(), rv.Type())) // should never happen\n\t\t\t}\n\t\t},\n\t\tclear: func(p pointer) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\trv.Set(reflect.Zero(rv.Type()))\n\t\t},\n\t\tget: func(p pointer) pref.Value {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif nullable {\n\t\t\t\tif rv.IsNil() {\n\t\t\t\t\treturn conv.Zero()\n\t\t\t\t}\n\t\t\t\tif rv.Kind() == reflect.Ptr {\n\t\t\t\t\trv = rv.Elem()\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn conv.PBValueOf(rv)\n\t\t},\n\t\tset: func(p pointer, v pref.Value) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif nullable && rv.Kind() == reflect.Ptr {\n\t\t\t\tif rv.IsNil() {\n\t\t\t\t\trv.Set(reflect.New(ft))\n\t\t\t\t}\n\t\t\t\trv = rv.Elem()\n\t\t\t}\n\t\t\trv.Set(conv.GoValueOf(v))\n\t\t\tif isBytes && rv.Len() == 0 {\n\t\t\t\tif nullable {\n\t\t\t\t\trv.Set(emptyBytes) // preserve presence\n\t\t\t\t} else {\n\t\t\t\t\trv.Set(nilBytes) // do not preserve presence\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tnewField: func() pref.Value {\n\t\t\treturn conv.New()\n\t\t},\n\t}\n}\n\nfunc fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldInfo {\n\tif !flags.ProtoLegacy {\n\t\tpanic(\"no support for proto1 weak fields\")\n\t}\n\n\tvar once sync.Once\n\tvar messageType pref.MessageType\n\tlazyInit := func() {\n\t\tonce.Do(func() {\n\t\t\tmessageName := fd.Message().FullName()\n\t\t\tmessageType, _ = preg.GlobalTypes.FindMessageByName(messageName)\n\t\t\tif messageType == nil {\n\t\t\t\tpanic(fmt.Sprintf(\"weak message %v for field %v is not linked in\", messageName, fd.FullName()))\n\t\t\t}\n\t\t})\n\t}\n\n\tnum := fd.Number()\n\treturn fieldInfo{\n\t\tfieldDesc: fd,\n\t\thas: func(p pointer) bool {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\t_, ok := p.Apply(weakOffset).WeakFields().get(num)\n\t\t\treturn ok\n\t\t},\n\t\tclear: func(p pointer) {\n\t\t\tp.Apply(weakOffset).WeakFields().clear(num)\n\t\t},\n\t\tget: func(p pointer) pref.Value {\n\t\t\tlazyInit()\n\t\t\tif p.IsNil() {\n\t\t\t\treturn pref.ValueOfMessage(messageType.Zero())\n\t\t\t}\n\t\t\tm, ok := p.Apply(weakOffset).WeakFields().get(num)\n\t\t\tif !ok {\n\t\t\t\treturn pref.ValueOfMessage(messageType.Zero())\n\t\t\t}\n\t\t\treturn pref.ValueOfMessage(m.ProtoReflect())\n\t\t},\n\t\tset: func(p pointer, v pref.Value) {\n\t\t\tlazyInit()\n\t\t\tm := v.Message()\n\t\t\tif m.Descriptor() != messageType.Descriptor() {\n\t\t\t\tif got, want := m.Descriptor().FullName(), messageType.Descriptor().FullName(); got != want {\n\t\t\t\t\tpanic(fmt.Sprintf(\"field %v has mismatching message descriptor: got %v, want %v\", fd.FullName(), got, want))\n\t\t\t\t}\n\t\t\t\tpanic(fmt.Sprintf(\"field %v has mismatching message descriptor: %v\", fd.FullName(), m.Descriptor().FullName()))\n\t\t\t}\n\t\t\tp.Apply(weakOffset).WeakFields().set(num, m.Interface())\n\t\t},\n\t\tmutable: func(p pointer) pref.Value {\n\t\t\tlazyInit()\n\t\t\tfs := p.Apply(weakOffset).WeakFields()\n\t\t\tm, ok := fs.get(num)\n\t\t\tif !ok {\n\t\t\t\tm = messageType.New().Interface()\n\t\t\t\tfs.set(num, m)\n\t\t\t}\n\t\t\treturn pref.ValueOfMessage(m.ProtoReflect())\n\t\t},\n\t\tnewMessage: func() pref.Message {\n\t\t\tlazyInit()\n\t\t\treturn messageType.New()\n\t\t},\n\t\tnewField: func() pref.Value {\n\t\t\tlazyInit()\n\t\t\treturn pref.ValueOfMessage(messageType.New())\n\t\t},\n\t}\n}\n\nfunc fieldInfoForMessage(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {\n\tft := fs.Type\n\tconv := NewConverter(ft, fd)\n\n\t// TODO: Implement unsafe fast path?\n\tfieldOffset := offsetOf(fs, x)\n\treturn fieldInfo{\n\t\tfieldDesc: fd,\n\t\thas: func(p pointer) bool {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif fs.Type.Kind() != reflect.Ptr {\n\t\t\t\treturn !isZero(rv)\n\t\t\t}\n\t\t\treturn !rv.IsNil()\n\t\t},\n\t\tclear: func(p pointer) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\trv.Set(reflect.Zero(rv.Type()))\n\t\t},\n\t\tget: func(p pointer) pref.Value {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\treturn conv.PBValueOf(rv)\n\t\t},\n\t\tset: func(p pointer, v pref.Value) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\trv.Set(conv.GoValueOf(v))\n\t\t\tif fs.Type.Kind() == reflect.Ptr && rv.IsNil() {\n\t\t\t\tpanic(fmt.Sprintf(\"field %v has invalid nil pointer\", fd.FullName()))\n\t\t\t}\n\t\t},\n\t\tmutable: func(p pointer) pref.Value {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif fs.Type.Kind() == reflect.Ptr && rv.IsNil() {\n\t\t\t\trv.Set(conv.GoValueOf(conv.New()))\n\t\t\t}\n\t\t\treturn conv.PBValueOf(rv)\n\t\t},\n\t\tnewMessage: func() pref.Message {\n\t\t\treturn conv.New().Message()\n\t\t},\n\t\tnewField: func() pref.Value {\n\t\t\treturn conv.New()\n\t\t},\n\t}\n}\n\ntype oneofInfo struct {\n\toneofDesc pref.OneofDescriptor\n\twhich     func(pointer) pref.FieldNumber\n}\n\nfunc makeOneofInfo(od pref.OneofDescriptor, si structInfo, x exporter) *oneofInfo {\n\toi := &oneofInfo{oneofDesc: od}\n\tif od.IsSynthetic() {\n\t\tfs := si.fieldsByNumber[od.Fields().Get(0).Number()]\n\t\tfieldOffset := offsetOf(fs, x)\n\t\toi.which = func(p pointer) pref.FieldNumber {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.IsNil() { // valid on either *T or []byte\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\treturn od.Fields().Get(0).Number()\n\t\t}\n\t} else {\n\t\tfs := si.oneofsByName[od.Name()]\n\t\tfieldOffset := offsetOf(fs, x)\n\t\toi.which = func(p pointer) pref.FieldNumber {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.IsNil() {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\trv = rv.Elem()\n\t\t\tif rv.IsNil() {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\treturn si.oneofWrappersByType[rv.Type().Elem()]\n\t\t}\n\t}\n\treturn oi\n}\n\n// isZero is identical to reflect.Value.IsZero.\n// TODO: Remove this when Go1.13 is the minimally supported Go version.\nfunc isZero(v reflect.Value) bool {\n\tswitch v.Kind() {\n\tcase reflect.Bool:\n\t\treturn !v.Bool()\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn v.Int() == 0\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn v.Uint() == 0\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn math.Float64bits(v.Float()) == 0\n\tcase reflect.Complex64, reflect.Complex128:\n\t\tc := v.Complex()\n\t\treturn math.Float64bits(real(c)) == 0 && math.Float64bits(imag(c)) == 0\n\tcase reflect.Array:\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tif !isZero(v.Index(i)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\tcase reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice, reflect.UnsafePointer:\n\t\treturn v.IsNil()\n\tcase reflect.String:\n\t\treturn v.Len() == 0\n\tcase reflect.Struct:\n\t\tfor i := 0; i < v.NumField(); i++ {\n\t\t\tif !isZero(v.Field(i)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\tdefault:\n\t\tpanic(&reflect.ValueError{\"reflect.Value.IsZero\", v.Kind()})\n\t}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/message_reflect_gen.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// Code generated by generate-types. DO NOT EDIT.\n\npackage impl\n\nimport (\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n)\n\nfunc (m *messageState) Descriptor() protoreflect.MessageDescriptor {\n\treturn m.messageInfo().Desc\n}\nfunc (m *messageState) Type() protoreflect.MessageType {\n\treturn m.messageInfo()\n}\nfunc (m *messageState) New() protoreflect.Message {\n\treturn m.messageInfo().New()\n}\nfunc (m *messageState) Interface() protoreflect.ProtoMessage {\n\treturn m.protoUnwrap().(protoreflect.ProtoMessage)\n}\nfunc (m *messageState) protoUnwrap() interface{} {\n\treturn m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())\n}\nfunc (m *messageState) ProtoMethods() *protoiface.Methods {\n\tm.messageInfo().init()\n\treturn &m.messageInfo().methods\n}\n\n// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code\n// to be able to retrieve a v2 MessageInfo struct.\n//\n// WARNING: This method is exempt from the compatibility promise and\n// may be removed in the future without warning.\nfunc (m *messageState) ProtoMessageInfo() *MessageInfo {\n\treturn m.messageInfo()\n}\n\nfunc (m *messageState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {\n\tm.messageInfo().init()\n\tfor _, ri := range m.messageInfo().rangeInfos {\n\t\tswitch ri := ri.(type) {\n\t\tcase *fieldInfo:\n\t\t\tif ri.has(m.pointer()) {\n\t\t\t\tif !f(ri.fieldDesc, ri.get(m.pointer())) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\tcase *oneofInfo:\n\t\t\tif n := ri.which(m.pointer()); n > 0 {\n\t\t\t\tfi := m.messageInfo().fields[n]\n\t\t\t\tif !f(fi.fieldDesc, fi.get(m.pointer())) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tm.messageInfo().extensionMap(m.pointer()).Range(f)\n}\nfunc (m *messageState) Has(fd protoreflect.FieldDescriptor) bool {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.has(m.pointer())\n\t} else {\n\t\treturn m.messageInfo().extensionMap(m.pointer()).Has(xt)\n\t}\n}\nfunc (m *messageState) Clear(fd protoreflect.FieldDescriptor) {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\tfi.clear(m.pointer())\n\t} else {\n\t\tm.messageInfo().extensionMap(m.pointer()).Clear(xt)\n\t}\n}\nfunc (m *messageState) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.get(m.pointer())\n\t} else {\n\t\treturn m.messageInfo().extensionMap(m.pointer()).Get(xt)\n\t}\n}\nfunc (m *messageState) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\tfi.set(m.pointer(), v)\n\t} else {\n\t\tm.messageInfo().extensionMap(m.pointer()).Set(xt, v)\n\t}\n}\nfunc (m *messageState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.mutable(m.pointer())\n\t} else {\n\t\treturn m.messageInfo().extensionMap(m.pointer()).Mutable(xt)\n\t}\n}\nfunc (m *messageState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.newField()\n\t} else {\n\t\treturn xt.New()\n\t}\n}\nfunc (m *messageState) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {\n\tm.messageInfo().init()\n\tif oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {\n\t\treturn od.Fields().ByNumber(oi.which(m.pointer()))\n\t}\n\tpanic(\"invalid oneof descriptor \" + string(od.FullName()) + \" for message \" + string(m.Descriptor().FullName()))\n}\nfunc (m *messageState) GetUnknown() protoreflect.RawFields {\n\tm.messageInfo().init()\n\treturn m.messageInfo().getUnknown(m.pointer())\n}\nfunc (m *messageState) SetUnknown(b protoreflect.RawFields) {\n\tm.messageInfo().init()\n\tm.messageInfo().setUnknown(m.pointer(), b)\n}\nfunc (m *messageState) IsValid() bool {\n\treturn !m.pointer().IsNil()\n}\n\nfunc (m *messageReflectWrapper) Descriptor() protoreflect.MessageDescriptor {\n\treturn m.messageInfo().Desc\n}\nfunc (m *messageReflectWrapper) Type() protoreflect.MessageType {\n\treturn m.messageInfo()\n}\nfunc (m *messageReflectWrapper) New() protoreflect.Message {\n\treturn m.messageInfo().New()\n}\nfunc (m *messageReflectWrapper) Interface() protoreflect.ProtoMessage {\n\tif m, ok := m.protoUnwrap().(protoreflect.ProtoMessage); ok {\n\t\treturn m\n\t}\n\treturn (*messageIfaceWrapper)(m)\n}\nfunc (m *messageReflectWrapper) protoUnwrap() interface{} {\n\treturn m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())\n}\nfunc (m *messageReflectWrapper) ProtoMethods() *protoiface.Methods {\n\tm.messageInfo().init()\n\treturn &m.messageInfo().methods\n}\n\n// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code\n// to be able to retrieve a v2 MessageInfo struct.\n//\n// WARNING: This method is exempt from the compatibility promise and\n// may be removed in the future without warning.\nfunc (m *messageReflectWrapper) ProtoMessageInfo() *MessageInfo {\n\treturn m.messageInfo()\n}\n\nfunc (m *messageReflectWrapper) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {\n\tm.messageInfo().init()\n\tfor _, ri := range m.messageInfo().rangeInfos {\n\t\tswitch ri := ri.(type) {\n\t\tcase *fieldInfo:\n\t\t\tif ri.has(m.pointer()) {\n\t\t\t\tif !f(ri.fieldDesc, ri.get(m.pointer())) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\tcase *oneofInfo:\n\t\t\tif n := ri.which(m.pointer()); n > 0 {\n\t\t\t\tfi := m.messageInfo().fields[n]\n\t\t\t\tif !f(fi.fieldDesc, fi.get(m.pointer())) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tm.messageInfo().extensionMap(m.pointer()).Range(f)\n}\nfunc (m *messageReflectWrapper) Has(fd protoreflect.FieldDescriptor) bool {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.has(m.pointer())\n\t} else {\n\t\treturn m.messageInfo().extensionMap(m.pointer()).Has(xt)\n\t}\n}\nfunc (m *messageReflectWrapper) Clear(fd protoreflect.FieldDescriptor) {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\tfi.clear(m.pointer())\n\t} else {\n\t\tm.messageInfo().extensionMap(m.pointer()).Clear(xt)\n\t}\n}\nfunc (m *messageReflectWrapper) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.get(m.pointer())\n\t} else {\n\t\treturn m.messageInfo().extensionMap(m.pointer()).Get(xt)\n\t}\n}\nfunc (m *messageReflectWrapper) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\tfi.set(m.pointer(), v)\n\t} else {\n\t\tm.messageInfo().extensionMap(m.pointer()).Set(xt, v)\n\t}\n}\nfunc (m *messageReflectWrapper) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.mutable(m.pointer())\n\t} else {\n\t\treturn m.messageInfo().extensionMap(m.pointer()).Mutable(xt)\n\t}\n}\nfunc (m *messageReflectWrapper) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.newField()\n\t} else {\n\t\treturn xt.New()\n\t}\n}\nfunc (m *messageReflectWrapper) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {\n\tm.messageInfo().init()\n\tif oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {\n\t\treturn od.Fields().ByNumber(oi.which(m.pointer()))\n\t}\n\tpanic(\"invalid oneof descriptor \" + string(od.FullName()) + \" for message \" + string(m.Descriptor().FullName()))\n}\nfunc (m *messageReflectWrapper) GetUnknown() protoreflect.RawFields {\n\tm.messageInfo().init()\n\treturn m.messageInfo().getUnknown(m.pointer())\n}\nfunc (m *messageReflectWrapper) SetUnknown(b protoreflect.RawFields) {\n\tm.messageInfo().init()\n\tm.messageInfo().setUnknown(m.pointer(), b)\n}\nfunc (m *messageReflectWrapper) IsValid() bool {\n\treturn !m.pointer().IsNil()\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/pointer_reflect.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// +build purego appengine\n\npackage impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"sync\"\n)\n\nconst UnsafeEnabled = false\n\n// Pointer is an opaque pointer type.\ntype Pointer interface{}\n\n// offset represents the offset to a struct field, accessible from a pointer.\n// The offset is the field index into a struct.\ntype offset struct {\n\tindex  int\n\texport exporter\n}\n\n// offsetOf returns a field offset for the struct field.\nfunc offsetOf(f reflect.StructField, x exporter) offset {\n\tif len(f.Index) != 1 {\n\t\tpanic(\"embedded structs are not supported\")\n\t}\n\tif f.PkgPath == \"\" {\n\t\treturn offset{index: f.Index[0]} // field is already exported\n\t}\n\tif x == nil {\n\t\tpanic(\"exporter must be provided for unexported field\")\n\t}\n\treturn offset{index: f.Index[0], export: x}\n}\n\n// IsValid reports whether the offset is valid.\nfunc (f offset) IsValid() bool { return f.index >= 0 }\n\n// invalidOffset is an invalid field offset.\nvar invalidOffset = offset{index: -1}\n\n// zeroOffset is a noop when calling pointer.Apply.\nvar zeroOffset = offset{index: 0}\n\n// pointer is an abstract representation of a pointer to a struct or field.\ntype pointer struct{ v reflect.Value }\n\n// pointerOf returns p as a pointer.\nfunc pointerOf(p Pointer) pointer {\n\treturn pointerOfIface(p)\n}\n\n// pointerOfValue returns v as a pointer.\nfunc pointerOfValue(v reflect.Value) pointer {\n\treturn pointer{v: v}\n}\n\n// pointerOfIface returns the pointer portion of an interface.\nfunc pointerOfIface(v interface{}) pointer {\n\treturn pointer{v: reflect.ValueOf(v)}\n}\n\n// IsNil reports whether the pointer is nil.\nfunc (p pointer) IsNil() bool {\n\treturn p.v.IsNil()\n}\n\n// Apply adds an offset to the pointer to derive a new pointer\n// to a specified field. The current pointer must be pointing at a struct.\nfunc (p pointer) Apply(f offset) pointer {\n\tif f.export != nil {\n\t\tif v := reflect.ValueOf(f.export(p.v.Interface(), f.index)); v.IsValid() {\n\t\t\treturn pointer{v: v}\n\t\t}\n\t}\n\treturn pointer{v: p.v.Elem().Field(f.index).Addr()}\n}\n\n// AsValueOf treats p as a pointer to an object of type t and returns the value.\n// It is equivalent to reflect.ValueOf(p.AsIfaceOf(t))\nfunc (p pointer) AsValueOf(t reflect.Type) reflect.Value {\n\tif got := p.v.Type().Elem(); got != t {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", got, t))\n\t}\n\treturn p.v\n}\n\n// AsIfaceOf treats p as a pointer to an object of type t and returns the value.\n// It is equivalent to p.AsValueOf(t).Interface()\nfunc (p pointer) AsIfaceOf(t reflect.Type) interface{} {\n\treturn p.AsValueOf(t).Interface()\n}\n\nfunc (p pointer) Bool() *bool              { return p.v.Interface().(*bool) }\nfunc (p pointer) BoolPtr() **bool          { return p.v.Interface().(**bool) }\nfunc (p pointer) BoolSlice() *[]bool       { return p.v.Interface().(*[]bool) }\nfunc (p pointer) Int32() *int32            { return p.v.Interface().(*int32) }\nfunc (p pointer) Int32Ptr() **int32        { return p.v.Interface().(**int32) }\nfunc (p pointer) Int32Slice() *[]int32     { return p.v.Interface().(*[]int32) }\nfunc (p pointer) Int64() *int64            { return p.v.Interface().(*int64) }\nfunc (p pointer) Int64Ptr() **int64        { return p.v.Interface().(**int64) }\nfunc (p pointer) Int64Slice() *[]int64     { return p.v.Interface().(*[]int64) }\nfunc (p pointer) Uint32() *uint32          { return p.v.Interface().(*uint32) }\nfunc (p pointer) Uint32Ptr() **uint32      { return p.v.Interface().(**uint32) }\nfunc (p pointer) Uint32Slice() *[]uint32   { return p.v.Interface().(*[]uint32) }\nfunc (p pointer) Uint64() *uint64          { return p.v.Interface().(*uint64) }\nfunc (p pointer) Uint64Ptr() **uint64      { return p.v.Interface().(**uint64) }\nfunc (p pointer) Uint64Slice() *[]uint64   { return p.v.Interface().(*[]uint64) }\nfunc (p pointer) Float32() *float32        { return p.v.Interface().(*float32) }\nfunc (p pointer) Float32Ptr() **float32    { return p.v.Interface().(**float32) }\nfunc (p pointer) Float32Slice() *[]float32 { return p.v.Interface().(*[]float32) }\nfunc (p pointer) Float64() *float64        { return p.v.Interface().(*float64) }\nfunc (p pointer) Float64Ptr() **float64    { return p.v.Interface().(**float64) }\nfunc (p pointer) Float64Slice() *[]float64 { return p.v.Interface().(*[]float64) }\nfunc (p pointer) String() *string          { return p.v.Interface().(*string) }\nfunc (p pointer) StringPtr() **string      { return p.v.Interface().(**string) }\nfunc (p pointer) StringSlice() *[]string   { return p.v.Interface().(*[]string) }\nfunc (p pointer) Bytes() *[]byte           { return p.v.Interface().(*[]byte) }\nfunc (p pointer) BytesPtr() **[]byte       { return p.v.Interface().(**[]byte) }\nfunc (p pointer) BytesSlice() *[][]byte    { return p.v.Interface().(*[][]byte) }\nfunc (p pointer) WeakFields() *weakFields  { return (*weakFields)(p.v.Interface().(*WeakFields)) }\nfunc (p pointer) Extensions() *map[int32]ExtensionField {\n\treturn p.v.Interface().(*map[int32]ExtensionField)\n}\n\nfunc (p pointer) Elem() pointer {\n\treturn pointer{v: p.v.Elem()}\n}\n\n// PointerSlice copies []*T from p as a new []pointer.\n// This behavior differs from the implementation in pointer_unsafe.go.\nfunc (p pointer) PointerSlice() []pointer {\n\t// TODO: reconsider this\n\tif p.v.IsNil() {\n\t\treturn nil\n\t}\n\tn := p.v.Elem().Len()\n\ts := make([]pointer, n)\n\tfor i := 0; i < n; i++ {\n\t\ts[i] = pointer{v: p.v.Elem().Index(i)}\n\t}\n\treturn s\n}\n\n// AppendPointerSlice appends v to p, which must be a []*T.\nfunc (p pointer) AppendPointerSlice(v pointer) {\n\tsp := p.v.Elem()\n\tsp.Set(reflect.Append(sp, v.v))\n}\n\n// SetPointer sets *p to v.\nfunc (p pointer) SetPointer(v pointer) {\n\tp.v.Elem().Set(v.v)\n}\n\nfunc (Export) MessageStateOf(p Pointer) *messageState     { panic(\"not supported\") }\nfunc (ms *messageState) pointer() pointer                 { panic(\"not supported\") }\nfunc (ms *messageState) messageInfo() *MessageInfo        { panic(\"not supported\") }\nfunc (ms *messageState) LoadMessageInfo() *MessageInfo    { panic(\"not supported\") }\nfunc (ms *messageState) StoreMessageInfo(mi *MessageInfo) { panic(\"not supported\") }\n\ntype atomicNilMessage struct {\n\tonce sync.Once\n\tm    messageReflectWrapper\n}\n\nfunc (m *atomicNilMessage) Init(mi *MessageInfo) *messageReflectWrapper {\n\tm.once.Do(func() {\n\t\tm.m.p = pointerOfIface(reflect.Zero(mi.GoReflectType).Interface())\n\t\tm.m.mi = mi\n\t})\n\treturn &m.m\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/pointer_unsafe.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// +build !purego,!appengine\n\npackage impl\n\nimport (\n\t\"reflect\"\n\t\"sync/atomic\"\n\t\"unsafe\"\n)\n\nconst UnsafeEnabled = true\n\n// Pointer is an opaque pointer type.\ntype Pointer unsafe.Pointer\n\n// offset represents the offset to a struct field, accessible from a pointer.\n// The offset is the byte offset to the field from the start of the struct.\ntype offset uintptr\n\n// offsetOf returns a field offset for the struct field.\nfunc offsetOf(f reflect.StructField, x exporter) offset {\n\treturn offset(f.Offset)\n}\n\n// IsValid reports whether the offset is valid.\nfunc (f offset) IsValid() bool { return f != invalidOffset }\n\n// invalidOffset is an invalid field offset.\nvar invalidOffset = ^offset(0)\n\n// zeroOffset is a noop when calling pointer.Apply.\nvar zeroOffset = offset(0)\n\n// pointer is a pointer to a message struct or field.\ntype pointer struct{ p unsafe.Pointer }\n\n// pointerOf returns p as a pointer.\nfunc pointerOf(p Pointer) pointer {\n\treturn pointer{p: unsafe.Pointer(p)}\n}\n\n// pointerOfValue returns v as a pointer.\nfunc pointerOfValue(v reflect.Value) pointer {\n\treturn pointer{p: unsafe.Pointer(v.Pointer())}\n}\n\n// pointerOfIface returns the pointer portion of an interface.\nfunc pointerOfIface(v interface{}) pointer {\n\ttype ifaceHeader struct {\n\t\tType unsafe.Pointer\n\t\tData unsafe.Pointer\n\t}\n\treturn pointer{p: (*ifaceHeader)(unsafe.Pointer(&v)).Data}\n}\n\n// IsNil reports whether the pointer is nil.\nfunc (p pointer) IsNil() bool {\n\treturn p.p == nil\n}\n\n// Apply adds an offset to the pointer to derive a new pointer\n// to a specified field. The pointer must be valid and pointing at a struct.\nfunc (p pointer) Apply(f offset) pointer {\n\tif p.IsNil() {\n\t\tpanic(\"invalid nil pointer\")\n\t}\n\treturn pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))}\n}\n\n// AsValueOf treats p as a pointer to an object of type t and returns the value.\n// It is equivalent to reflect.ValueOf(p.AsIfaceOf(t))\nfunc (p pointer) AsValueOf(t reflect.Type) reflect.Value {\n\treturn reflect.NewAt(t, p.p)\n}\n\n// AsIfaceOf treats p as a pointer to an object of type t and returns the value.\n// It is equivalent to p.AsValueOf(t).Interface()\nfunc (p pointer) AsIfaceOf(t reflect.Type) interface{} {\n\t// TODO: Use tricky unsafe magic to directly create ifaceHeader.\n\treturn p.AsValueOf(t).Interface()\n}\n\nfunc (p pointer) Bool() *bool                           { return (*bool)(p.p) }\nfunc (p pointer) BoolPtr() **bool                       { return (**bool)(p.p) }\nfunc (p pointer) BoolSlice() *[]bool                    { return (*[]bool)(p.p) }\nfunc (p pointer) Int32() *int32                         { return (*int32)(p.p) }\nfunc (p pointer) Int32Ptr() **int32                     { return (**int32)(p.p) }\nfunc (p pointer) Int32Slice() *[]int32                  { return (*[]int32)(p.p) }\nfunc (p pointer) Int64() *int64                         { return (*int64)(p.p) }\nfunc (p pointer) Int64Ptr() **int64                     { return (**int64)(p.p) }\nfunc (p pointer) Int64Slice() *[]int64                  { return (*[]int64)(p.p) }\nfunc (p pointer) Uint32() *uint32                       { return (*uint32)(p.p) }\nfunc (p pointer) Uint32Ptr() **uint32                   { return (**uint32)(p.p) }\nfunc (p pointer) Uint32Slice() *[]uint32                { return (*[]uint32)(p.p) }\nfunc (p pointer) Uint64() *uint64                       { return (*uint64)(p.p) }\nfunc (p pointer) Uint64Ptr() **uint64                   { return (**uint64)(p.p) }\nfunc (p pointer) Uint64Slice() *[]uint64                { return (*[]uint64)(p.p) }\nfunc (p pointer) Float32() *float32                     { return (*float32)(p.p) }\nfunc (p pointer) Float32Ptr() **float32                 { return (**float32)(p.p) }\nfunc (p pointer) Float32Slice() *[]float32              { return (*[]float32)(p.p) }\nfunc (p pointer) Float64() *float64                     { return (*float64)(p.p) }\nfunc (p pointer) Float64Ptr() **float64                 { return (**float64)(p.p) }\nfunc (p pointer) Float64Slice() *[]float64              { return (*[]float64)(p.p) }\nfunc (p pointer) String() *string                       { return (*string)(p.p) }\nfunc (p pointer) StringPtr() **string                   { return (**string)(p.p) }\nfunc (p pointer) StringSlice() *[]string                { return (*[]string)(p.p) }\nfunc (p pointer) Bytes() *[]byte                        { return (*[]byte)(p.p) }\nfunc (p pointer) BytesPtr() **[]byte                    { return (**[]byte)(p.p) }\nfunc (p pointer) BytesSlice() *[][]byte                 { return (*[][]byte)(p.p) }\nfunc (p pointer) WeakFields() *weakFields               { return (*weakFields)(p.p) }\nfunc (p pointer) Extensions() *map[int32]ExtensionField { return (*map[int32]ExtensionField)(p.p) }\n\nfunc (p pointer) Elem() pointer {\n\treturn pointer{p: *(*unsafe.Pointer)(p.p)}\n}\n\n// PointerSlice loads []*T from p as a []pointer.\n// The value returned is aliased with the original slice.\n// This behavior differs from the implementation in pointer_reflect.go.\nfunc (p pointer) PointerSlice() []pointer {\n\t// Super-tricky - p should point to a []*T where T is a\n\t// message type. We load it as []pointer.\n\treturn *(*[]pointer)(p.p)\n}\n\n// AppendPointerSlice appends v to p, which must be a []*T.\nfunc (p pointer) AppendPointerSlice(v pointer) {\n\t*(*[]pointer)(p.p) = append(*(*[]pointer)(p.p), v)\n}\n\n// SetPointer sets *p to v.\nfunc (p pointer) SetPointer(v pointer) {\n\t*(*unsafe.Pointer)(p.p) = (unsafe.Pointer)(v.p)\n}\n\n// Static check that MessageState does not exceed the size of a pointer.\nconst _ = uint(unsafe.Sizeof(unsafe.Pointer(nil)) - unsafe.Sizeof(MessageState{}))\n\nfunc (Export) MessageStateOf(p Pointer) *messageState {\n\t// Super-tricky - see documentation on MessageState.\n\treturn (*messageState)(unsafe.Pointer(p))\n}\nfunc (ms *messageState) pointer() pointer {\n\t// Super-tricky - see documentation on MessageState.\n\treturn pointer{p: unsafe.Pointer(ms)}\n}\nfunc (ms *messageState) messageInfo() *MessageInfo {\n\tmi := ms.LoadMessageInfo()\n\tif mi == nil {\n\t\tpanic(\"invalid nil message info; this suggests memory corruption due to a race or shallow copy on the message struct\")\n\t}\n\treturn mi\n}\nfunc (ms *messageState) LoadMessageInfo() *MessageInfo {\n\treturn (*MessageInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&ms.atomicMessageInfo))))\n}\nfunc (ms *messageState) StoreMessageInfo(mi *MessageInfo) {\n\tatomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&ms.atomicMessageInfo)), unsafe.Pointer(mi))\n}\n\ntype atomicNilMessage struct{ p unsafe.Pointer } // p is a *messageReflectWrapper\n\nfunc (m *atomicNilMessage) Init(mi *MessageInfo) *messageReflectWrapper {\n\tif p := atomic.LoadPointer(&m.p); p != nil {\n\t\treturn (*messageReflectWrapper)(p)\n\t}\n\tw := &messageReflectWrapper{mi: mi}\n\tatomic.CompareAndSwapPointer(&m.p, nil, (unsafe.Pointer)(w))\n\treturn (*messageReflectWrapper)(atomic.LoadPointer(&m.p))\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/validate.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 impl\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\t\"math/bits\"\n\t\"reflect\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// ValidationStatus is the result of validating the wire-format encoding of a message.\ntype ValidationStatus int\n\nconst (\n\t// ValidationUnknown indicates that unmarshaling the message might succeed or fail.\n\t// The validator was unable to render a judgement.\n\t//\n\t// The only causes of this status are an aberrant message type appearing somewhere\n\t// in the message or a failure in the extension resolver.\n\tValidationUnknown ValidationStatus = iota + 1\n\n\t// ValidationInvalid indicates that unmarshaling the message will fail.\n\tValidationInvalid\n\n\t// ValidationValid indicates that unmarshaling the message will succeed.\n\tValidationValid\n)\n\nfunc (v ValidationStatus) String() string {\n\tswitch v {\n\tcase ValidationUnknown:\n\t\treturn \"ValidationUnknown\"\n\tcase ValidationInvalid:\n\t\treturn \"ValidationInvalid\"\n\tcase ValidationValid:\n\t\treturn \"ValidationValid\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"ValidationStatus(%d)\", int(v))\n\t}\n}\n\n// Validate determines whether the contents of the buffer are a valid wire encoding\n// of the message type.\n//\n// This function is exposed for testing.\nfunc Validate(mt pref.MessageType, in piface.UnmarshalInput) (out piface.UnmarshalOutput, _ ValidationStatus) {\n\tmi, ok := mt.(*MessageInfo)\n\tif !ok {\n\t\treturn out, ValidationUnknown\n\t}\n\tif in.Resolver == nil {\n\t\tin.Resolver = preg.GlobalTypes\n\t}\n\to, st := mi.validate(in.Buf, 0, unmarshalOptions{\n\t\tflags:    in.Flags,\n\t\tresolver: in.Resolver,\n\t})\n\tif o.initialized {\n\t\tout.Flags |= piface.UnmarshalInitialized\n\t}\n\treturn out, st\n}\n\ntype validationInfo struct {\n\tmi               *MessageInfo\n\ttyp              validationType\n\tkeyType, valType validationType\n\n\t// For non-required fields, requiredBit is 0.\n\t//\n\t// For required fields, requiredBit's nth bit is set, where n is a\n\t// unique index in the range [0, MessageInfo.numRequiredFields).\n\t//\n\t// If there are more than 64 required fields, requiredBit is 0.\n\trequiredBit uint64\n}\n\ntype validationType uint8\n\nconst (\n\tvalidationTypeOther validationType = iota\n\tvalidationTypeMessage\n\tvalidationTypeGroup\n\tvalidationTypeMap\n\tvalidationTypeRepeatedVarint\n\tvalidationTypeRepeatedFixed32\n\tvalidationTypeRepeatedFixed64\n\tvalidationTypeVarint\n\tvalidationTypeFixed32\n\tvalidationTypeFixed64\n\tvalidationTypeBytes\n\tvalidationTypeUTF8String\n\tvalidationTypeMessageSetItem\n)\n\nfunc newFieldValidationInfo(mi *MessageInfo, si structInfo, fd pref.FieldDescriptor, ft reflect.Type) validationInfo {\n\tvar vi validationInfo\n\tswitch {\n\tcase fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():\n\t\tswitch fd.Kind() {\n\t\tcase pref.MessageKind:\n\t\t\tvi.typ = validationTypeMessage\n\t\t\tif ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {\n\t\t\t\tvi.mi = getMessageInfo(ot.Field(0).Type)\n\t\t\t}\n\t\tcase pref.GroupKind:\n\t\t\tvi.typ = validationTypeGroup\n\t\t\tif ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {\n\t\t\t\tvi.mi = getMessageInfo(ot.Field(0).Type)\n\t\t\t}\n\t\tcase pref.StringKind:\n\t\t\tif strs.EnforceUTF8(fd) {\n\t\t\t\tvi.typ = validationTypeUTF8String\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tvi = newValidationInfo(fd, ft)\n\t}\n\tif fd.Cardinality() == pref.Required {\n\t\t// Avoid overflow. The required field check is done with a 64-bit mask, with\n\t\t// any message containing more than 64 required fields always reported as\n\t\t// potentially uninitialized, so it is not important to get a precise count\n\t\t// of the required fields past 64.\n\t\tif mi.numRequiredFields < math.MaxUint8 {\n\t\t\tmi.numRequiredFields++\n\t\t\tvi.requiredBit = 1 << (mi.numRequiredFields - 1)\n\t\t}\n\t}\n\treturn vi\n}\n\nfunc newValidationInfo(fd pref.FieldDescriptor, ft reflect.Type) validationInfo {\n\tvar vi validationInfo\n\tswitch {\n\tcase fd.IsList():\n\t\tswitch fd.Kind() {\n\t\tcase pref.MessageKind:\n\t\t\tvi.typ = validationTypeMessage\n\t\t\tif ft.Kind() == reflect.Slice {\n\t\t\t\tvi.mi = getMessageInfo(ft.Elem())\n\t\t\t}\n\t\tcase pref.GroupKind:\n\t\t\tvi.typ = validationTypeGroup\n\t\t\tif ft.Kind() == reflect.Slice {\n\t\t\t\tvi.mi = getMessageInfo(ft.Elem())\n\t\t\t}\n\t\tcase pref.StringKind:\n\t\t\tvi.typ = validationTypeBytes\n\t\t\tif strs.EnforceUTF8(fd) {\n\t\t\t\tvi.typ = validationTypeUTF8String\n\t\t\t}\n\t\tdefault:\n\t\t\tswitch wireTypes[fd.Kind()] {\n\t\t\tcase protowire.VarintType:\n\t\t\t\tvi.typ = validationTypeRepeatedVarint\n\t\t\tcase protowire.Fixed32Type:\n\t\t\t\tvi.typ = validationTypeRepeatedFixed32\n\t\t\tcase protowire.Fixed64Type:\n\t\t\t\tvi.typ = validationTypeRepeatedFixed64\n\t\t\t}\n\t\t}\n\tcase fd.IsMap():\n\t\tvi.typ = validationTypeMap\n\t\tswitch fd.MapKey().Kind() {\n\t\tcase pref.StringKind:\n\t\t\tif strs.EnforceUTF8(fd) {\n\t\t\t\tvi.keyType = validationTypeUTF8String\n\t\t\t}\n\t\t}\n\t\tswitch fd.MapValue().Kind() {\n\t\tcase pref.MessageKind:\n\t\t\tvi.valType = validationTypeMessage\n\t\t\tif ft.Kind() == reflect.Map {\n\t\t\t\tvi.mi = getMessageInfo(ft.Elem())\n\t\t\t}\n\t\tcase pref.StringKind:\n\t\t\tif strs.EnforceUTF8(fd) {\n\t\t\t\tvi.valType = validationTypeUTF8String\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tswitch fd.Kind() {\n\t\tcase pref.MessageKind:\n\t\t\tvi.typ = validationTypeMessage\n\t\t\tif !fd.IsWeak() {\n\t\t\t\tvi.mi = getMessageInfo(ft)\n\t\t\t}\n\t\tcase pref.GroupKind:\n\t\t\tvi.typ = validationTypeGroup\n\t\t\tvi.mi = getMessageInfo(ft)\n\t\tcase pref.StringKind:\n\t\t\tvi.typ = validationTypeBytes\n\t\t\tif strs.EnforceUTF8(fd) {\n\t\t\t\tvi.typ = validationTypeUTF8String\n\t\t\t}\n\t\tdefault:\n\t\t\tswitch wireTypes[fd.Kind()] {\n\t\t\tcase protowire.VarintType:\n\t\t\t\tvi.typ = validationTypeVarint\n\t\t\tcase protowire.Fixed32Type:\n\t\t\t\tvi.typ = validationTypeFixed32\n\t\t\tcase protowire.Fixed64Type:\n\t\t\t\tvi.typ = validationTypeFixed64\n\t\t\tcase protowire.BytesType:\n\t\t\t\tvi.typ = validationTypeBytes\n\t\t\t}\n\t\t}\n\t}\n\treturn vi\n}\n\nfunc (mi *MessageInfo) validate(b []byte, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, result ValidationStatus) {\n\tmi.init()\n\ttype validationState struct {\n\t\ttyp              validationType\n\t\tkeyType, valType validationType\n\t\tendGroup         protowire.Number\n\t\tmi               *MessageInfo\n\t\ttail             []byte\n\t\trequiredMask     uint64\n\t}\n\n\t// Pre-allocate some slots to avoid repeated slice reallocation.\n\tstates := make([]validationState, 0, 16)\n\tstates = append(states, validationState{\n\t\ttyp: validationTypeMessage,\n\t\tmi:  mi,\n\t})\n\tif groupTag > 0 {\n\t\tstates[0].typ = validationTypeGroup\n\t\tstates[0].endGroup = groupTag\n\t}\n\tinitialized := true\n\tstart := len(b)\nState:\n\tfor len(states) > 0 {\n\t\tst := &states[len(states)-1]\n\t\tfor len(b) > 0 {\n\t\t\t// Parse the tag (field number and wire type).\n\t\t\tvar tag uint64\n\t\t\tif b[0] < 0x80 {\n\t\t\t\ttag = uint64(b[0])\n\t\t\t\tb = b[1:]\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\ttag = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tb = b[2:]\n\t\t\t} else {\n\t\t\t\tvar n int\n\t\t\t\ttag, n = protowire.ConsumeVarint(b)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t}\n\t\t\t\tb = b[n:]\n\t\t\t}\n\t\t\tvar num protowire.Number\n\t\t\tif n := tag >> 3; n < uint64(protowire.MinValidNumber) || n > uint64(protowire.MaxValidNumber) {\n\t\t\t\treturn out, ValidationInvalid\n\t\t\t} else {\n\t\t\t\tnum = protowire.Number(n)\n\t\t\t}\n\t\t\twtyp := protowire.Type(tag & 7)\n\n\t\t\tif wtyp == protowire.EndGroupType {\n\t\t\t\tif st.endGroup == num {\n\t\t\t\t\tgoto PopState\n\t\t\t\t}\n\t\t\t\treturn out, ValidationInvalid\n\t\t\t}\n\t\t\tvar vi validationInfo\n\t\t\tswitch {\n\t\t\tcase st.typ == validationTypeMap:\n\t\t\t\tswitch num {\n\t\t\t\tcase genid.MapEntry_Key_field_number:\n\t\t\t\t\tvi.typ = st.keyType\n\t\t\t\tcase genid.MapEntry_Value_field_number:\n\t\t\t\t\tvi.typ = st.valType\n\t\t\t\t\tvi.mi = st.mi\n\t\t\t\t\tvi.requiredBit = 1\n\t\t\t\t}\n\t\t\tcase flags.ProtoLegacy && st.mi.isMessageSet:\n\t\t\t\tswitch num {\n\t\t\t\tcase messageset.FieldItem:\n\t\t\t\t\tvi.typ = validationTypeMessageSetItem\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tvar f *coderFieldInfo\n\t\t\t\tif int(num) < len(st.mi.denseCoderFields) {\n\t\t\t\t\tf = st.mi.denseCoderFields[num]\n\t\t\t\t} else {\n\t\t\t\t\tf = st.mi.coderFields[num]\n\t\t\t\t}\n\t\t\t\tif f != nil {\n\t\t\t\t\tvi = f.validation\n\t\t\t\t\tif vi.typ == validationTypeMessage && vi.mi == nil {\n\t\t\t\t\t\t// Probable weak field.\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// TODO: Consider storing the results of this lookup somewhere\n\t\t\t\t\t\t// rather than recomputing it on every validation.\n\t\t\t\t\t\tfd := st.mi.Desc.Fields().ByNumber(num)\n\t\t\t\t\t\tif fd == nil || !fd.IsWeak() {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmessageName := fd.Message().FullName()\n\t\t\t\t\t\tmessageType, err := preg.GlobalTypes.FindMessageByName(messageName)\n\t\t\t\t\t\tswitch err {\n\t\t\t\t\t\tcase nil:\n\t\t\t\t\t\t\tvi.mi, _ = messageType.(*MessageInfo)\n\t\t\t\t\t\tcase preg.NotFound:\n\t\t\t\t\t\t\tvi.typ = validationTypeBytes\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn out, ValidationUnknown\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\t// Possible extension field.\n\t\t\t\t//\n\t\t\t\t// TODO: We should return ValidationUnknown when:\n\t\t\t\t//   1. The resolver is not frozen. (More extensions may be added to it.)\n\t\t\t\t//   2. The resolver returns preg.NotFound.\n\t\t\t\t// In this case, a type added to the resolver in the future could cause\n\t\t\t\t// unmarshaling to begin failing. Supporting this requires some way to\n\t\t\t\t// determine if the resolver is frozen.\n\t\t\t\txt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), num)\n\t\t\t\tif err != nil && err != preg.NotFound {\n\t\t\t\t\treturn out, ValidationUnknown\n\t\t\t\t}\n\t\t\t\tif err == nil {\n\t\t\t\t\tvi = getExtensionFieldInfo(xt).validation\n\t\t\t\t}\n\t\t\t}\n\t\t\tif vi.requiredBit != 0 {\n\t\t\t\t// Check that the field has a compatible wire type.\n\t\t\t\t// We only need to consider non-repeated field types,\n\t\t\t\t// since repeated fields (and maps) can never be required.\n\t\t\t\tok := false\n\t\t\t\tswitch vi.typ {\n\t\t\t\tcase validationTypeVarint:\n\t\t\t\t\tok = wtyp == protowire.VarintType\n\t\t\t\tcase validationTypeFixed32:\n\t\t\t\t\tok = wtyp == protowire.Fixed32Type\n\t\t\t\tcase validationTypeFixed64:\n\t\t\t\t\tok = wtyp == protowire.Fixed64Type\n\t\t\t\tcase validationTypeBytes, validationTypeUTF8String, validationTypeMessage:\n\t\t\t\t\tok = wtyp == protowire.BytesType\n\t\t\t\tcase validationTypeGroup:\n\t\t\t\t\tok = wtyp == protowire.StartGroupType\n\t\t\t\t}\n\t\t\t\tif ok {\n\t\t\t\t\tst.requiredMask |= vi.requiredBit\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tswitch wtyp {\n\t\t\tcase protowire.VarintType:\n\t\t\t\tif len(b) >= 10 {\n\t\t\t\t\tswitch {\n\t\t\t\t\tcase b[0] < 0x80:\n\t\t\t\t\t\tb = b[1:]\n\t\t\t\t\tcase b[1] < 0x80:\n\t\t\t\t\t\tb = b[2:]\n\t\t\t\t\tcase b[2] < 0x80:\n\t\t\t\t\t\tb = b[3:]\n\t\t\t\t\tcase b[3] < 0x80:\n\t\t\t\t\t\tb = b[4:]\n\t\t\t\t\tcase b[4] < 0x80:\n\t\t\t\t\t\tb = b[5:]\n\t\t\t\t\tcase b[5] < 0x80:\n\t\t\t\t\t\tb = b[6:]\n\t\t\t\t\tcase b[6] < 0x80:\n\t\t\t\t\t\tb = b[7:]\n\t\t\t\t\tcase b[7] < 0x80:\n\t\t\t\t\t\tb = b[8:]\n\t\t\t\t\tcase b[8] < 0x80:\n\t\t\t\t\t\tb = b[9:]\n\t\t\t\t\tcase b[9] < 0x80 && b[9] < 2:\n\t\t\t\t\t\tb = b[10:]\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tswitch {\n\t\t\t\t\tcase len(b) > 0 && b[0] < 0x80:\n\t\t\t\t\t\tb = b[1:]\n\t\t\t\t\tcase len(b) > 1 && b[1] < 0x80:\n\t\t\t\t\t\tb = b[2:]\n\t\t\t\t\tcase len(b) > 2 && b[2] < 0x80:\n\t\t\t\t\t\tb = b[3:]\n\t\t\t\t\tcase len(b) > 3 && b[3] < 0x80:\n\t\t\t\t\t\tb = b[4:]\n\t\t\t\t\tcase len(b) > 4 && b[4] < 0x80:\n\t\t\t\t\t\tb = b[5:]\n\t\t\t\t\tcase len(b) > 5 && b[5] < 0x80:\n\t\t\t\t\t\tb = b[6:]\n\t\t\t\t\tcase len(b) > 6 && b[6] < 0x80:\n\t\t\t\t\t\tb = b[7:]\n\t\t\t\t\tcase len(b) > 7 && b[7] < 0x80:\n\t\t\t\t\t\tb = b[8:]\n\t\t\t\t\tcase len(b) > 8 && b[8] < 0x80:\n\t\t\t\t\t\tb = b[9:]\n\t\t\t\t\tcase len(b) > 9 && b[9] < 2:\n\t\t\t\t\t\tb = b[10:]\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue State\n\t\t\tcase protowire.BytesType:\n\t\t\t\tvar size uint64\n\t\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\t\tsize = uint64(b[0])\n\t\t\t\t\tb = b[1:]\n\t\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\t\tsize = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\t\tb = b[2:]\n\t\t\t\t} else {\n\t\t\t\t\tvar n int\n\t\t\t\t\tsize, n = protowire.ConsumeVarint(b)\n\t\t\t\t\tif n < 0 {\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\t\tb = b[n:]\n\t\t\t\t}\n\t\t\t\tif size > uint64(len(b)) {\n\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t}\n\t\t\t\tv := b[:size]\n\t\t\t\tb = b[size:]\n\t\t\t\tswitch vi.typ {\n\t\t\t\tcase validationTypeMessage:\n\t\t\t\t\tif vi.mi == nil {\n\t\t\t\t\t\treturn out, ValidationUnknown\n\t\t\t\t\t}\n\t\t\t\t\tvi.mi.init()\n\t\t\t\t\tfallthrough\n\t\t\t\tcase validationTypeMap:\n\t\t\t\t\tif vi.mi != nil {\n\t\t\t\t\t\tvi.mi.init()\n\t\t\t\t\t}\n\t\t\t\t\tstates = append(states, validationState{\n\t\t\t\t\t\ttyp:     vi.typ,\n\t\t\t\t\t\tkeyType: vi.keyType,\n\t\t\t\t\t\tvalType: vi.valType,\n\t\t\t\t\t\tmi:      vi.mi,\n\t\t\t\t\t\ttail:    b,\n\t\t\t\t\t})\n\t\t\t\t\tb = v\n\t\t\t\t\tcontinue State\n\t\t\t\tcase validationTypeRepeatedVarint:\n\t\t\t\t\t// Packed field.\n\t\t\t\t\tfor len(v) > 0 {\n\t\t\t\t\t\t_, n := protowire.ConsumeVarint(v)\n\t\t\t\t\t\tif n < 0 {\n\t\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t\t}\n\t\t\t\t\t\tv = v[n:]\n\t\t\t\t\t}\n\t\t\t\tcase validationTypeRepeatedFixed32:\n\t\t\t\t\t// Packed field.\n\t\t\t\t\tif len(v)%4 != 0 {\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\tcase validationTypeRepeatedFixed64:\n\t\t\t\t\t// Packed field.\n\t\t\t\t\tif len(v)%8 != 0 {\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\tcase validationTypeUTF8String:\n\t\t\t\t\tif !utf8.Valid(v) {\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase protowire.Fixed32Type:\n\t\t\t\tif len(b) < 4 {\n\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t}\n\t\t\t\tb = b[4:]\n\t\t\tcase protowire.Fixed64Type:\n\t\t\t\tif len(b) < 8 {\n\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t}\n\t\t\t\tb = b[8:]\n\t\t\tcase protowire.StartGroupType:\n\t\t\t\tswitch {\n\t\t\t\tcase vi.typ == validationTypeGroup:\n\t\t\t\t\tif vi.mi == nil {\n\t\t\t\t\t\treturn out, ValidationUnknown\n\t\t\t\t\t}\n\t\t\t\t\tvi.mi.init()\n\t\t\t\t\tstates = append(states, validationState{\n\t\t\t\t\t\ttyp:      validationTypeGroup,\n\t\t\t\t\t\tmi:       vi.mi,\n\t\t\t\t\t\tendGroup: num,\n\t\t\t\t\t})\n\t\t\t\t\tcontinue State\n\t\t\t\tcase flags.ProtoLegacy && vi.typ == validationTypeMessageSetItem:\n\t\t\t\t\ttypeid, v, n, err := messageset.ConsumeFieldValue(b, false)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\t\txt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), typeid)\n\t\t\t\t\tswitch {\n\t\t\t\t\tcase err == preg.NotFound:\n\t\t\t\t\t\tb = b[n:]\n\t\t\t\t\tcase err != nil:\n\t\t\t\t\t\treturn out, ValidationUnknown\n\t\t\t\t\tdefault:\n\t\t\t\t\t\txvi := getExtensionFieldInfo(xt).validation\n\t\t\t\t\t\tif xvi.mi != nil {\n\t\t\t\t\t\t\txvi.mi.init()\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstates = append(states, validationState{\n\t\t\t\t\t\t\ttyp:  xvi.typ,\n\t\t\t\t\t\t\tmi:   xvi.mi,\n\t\t\t\t\t\t\ttail: b[n:],\n\t\t\t\t\t\t})\n\t\t\t\t\t\tb = v\n\t\t\t\t\t\tcontinue State\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tn := protowire.ConsumeFieldValue(num, wtyp, b)\n\t\t\t\t\tif n < 0 {\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\t\tb = b[n:]\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn out, ValidationInvalid\n\t\t\t}\n\t\t}\n\t\tif st.endGroup != 0 {\n\t\t\treturn out, ValidationInvalid\n\t\t}\n\t\tif len(b) != 0 {\n\t\t\treturn out, ValidationInvalid\n\t\t}\n\t\tb = st.tail\n\tPopState:\n\t\tnumRequiredFields := 0\n\t\tswitch st.typ {\n\t\tcase validationTypeMessage, validationTypeGroup:\n\t\t\tnumRequiredFields = int(st.mi.numRequiredFields)\n\t\tcase validationTypeMap:\n\t\t\t// If this is a map field with a message value that contains\n\t\t\t// required fields, require that the value be present.\n\t\t\tif st.mi != nil && st.mi.numRequiredFields > 0 {\n\t\t\t\tnumRequiredFields = 1\n\t\t\t}\n\t\t}\n\t\t// If there are more than 64 required fields, this check will\n\t\t// always fail and we will report that the message is potentially\n\t\t// uninitialized.\n\t\tif numRequiredFields > 0 && bits.OnesCount64(st.requiredMask) != numRequiredFields {\n\t\t\tinitialized = false\n\t\t}\n\t\tstates = states[:len(states)-1]\n\t}\n\tout.n = start - len(b)\n\tif initialized {\n\t\tout.initialized = true\n\t}\n\treturn out, ValidationValid\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/impl/weak.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 impl\n\nimport (\n\t\"fmt\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// weakFields adds methods to the exported WeakFields type for internal use.\n//\n// The exported type is an alias to an unnamed type, so methods can't be\n// defined directly on it.\ntype weakFields WeakFields\n\nfunc (w weakFields) get(num pref.FieldNumber) (pref.ProtoMessage, bool) {\n\tm, ok := w[int32(num)]\n\treturn m, ok\n}\n\nfunc (w *weakFields) set(num pref.FieldNumber, m pref.ProtoMessage) {\n\tif *w == nil {\n\t\t*w = make(weakFields)\n\t}\n\t(*w)[int32(num)] = m\n}\n\nfunc (w *weakFields) clear(num pref.FieldNumber) {\n\tdelete(*w, int32(num))\n}\n\nfunc (Export) HasWeak(w WeakFields, num pref.FieldNumber) bool {\n\t_, ok := w[int32(num)]\n\treturn ok\n}\n\nfunc (Export) ClearWeak(w *WeakFields, num pref.FieldNumber) {\n\tdelete(*w, int32(num))\n}\n\nfunc (Export) GetWeak(w WeakFields, num pref.FieldNumber, name pref.FullName) pref.ProtoMessage {\n\tif m, ok := w[int32(num)]; ok {\n\t\treturn m\n\t}\n\tmt, _ := protoregistry.GlobalTypes.FindMessageByName(name)\n\tif mt == nil {\n\t\tpanic(fmt.Sprintf(\"message %v for weak field is not linked in\", name))\n\t}\n\treturn mt.Zero().Interface()\n}\n\nfunc (Export) SetWeak(w *WeakFields, num pref.FieldNumber, name pref.FullName, m pref.ProtoMessage) {\n\tif m != nil {\n\t\tmt, _ := protoregistry.GlobalTypes.FindMessageByName(name)\n\t\tif mt == nil {\n\t\t\tpanic(fmt.Sprintf(\"message %v for weak field is not linked in\", name))\n\t\t}\n\t\tif mt != m.ProtoReflect().Type() {\n\t\t\tpanic(fmt.Sprintf(\"invalid message type for weak field: got %T, want %T\", m, mt.Zero().Interface()))\n\t\t}\n\t}\n\tif m == nil || !m.ProtoReflect().IsValid() {\n\t\tdelete(*w, int32(num))\n\t\treturn\n\t}\n\tif *w == nil {\n\t\t*w = make(weakFields)\n\t}\n\t(*w)[int32(num)] = m\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/order/order.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 order\n\nimport (\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// FieldOrder specifies the ordering to visit message fields.\n// It is a function that reports whether x is ordered before y.\ntype FieldOrder func(x, y pref.FieldDescriptor) bool\n\nvar (\n\t// AnyFieldOrder specifies no specific field ordering.\n\tAnyFieldOrder FieldOrder = nil\n\n\t// LegacyFieldOrder sorts fields in the same ordering as emitted by\n\t// wire serialization in the github.com/golang/protobuf implementation.\n\tLegacyFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {\n\t\tox, oy := x.ContainingOneof(), y.ContainingOneof()\n\t\tinOneof := func(od pref.OneofDescriptor) bool {\n\t\t\treturn od != nil && !od.IsSynthetic()\n\t\t}\n\n\t\t// Extension fields sort before non-extension fields.\n\t\tif x.IsExtension() != y.IsExtension() {\n\t\t\treturn x.IsExtension() && !y.IsExtension()\n\t\t}\n\t\t// Fields not within a oneof sort before those within a oneof.\n\t\tif inOneof(ox) != inOneof(oy) {\n\t\t\treturn !inOneof(ox) && inOneof(oy)\n\t\t}\n\t\t// Fields in disjoint oneof sets are sorted by declaration index.\n\t\tif ox != nil && oy != nil && ox != oy {\n\t\t\treturn ox.Index() < oy.Index()\n\t\t}\n\t\t// Fields sorted by field number.\n\t\treturn x.Number() < y.Number()\n\t}\n\n\t// NumberFieldOrder sorts fields by their field number.\n\tNumberFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {\n\t\treturn x.Number() < y.Number()\n\t}\n\n\t// IndexNameFieldOrder sorts non-extension fields before extension fields.\n\t// Non-extensions are sorted according to their declaration index.\n\t// Extensions are sorted according to their full name.\n\tIndexNameFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {\n\t\t// Non-extension fields sort before extension fields.\n\t\tif x.IsExtension() != y.IsExtension() {\n\t\t\treturn !x.IsExtension() && y.IsExtension()\n\t\t}\n\t\t// Extensions sorted by fullname.\n\t\tif x.IsExtension() && y.IsExtension() {\n\t\t\treturn x.FullName() < y.FullName()\n\t\t}\n\t\t// Non-extensions sorted by declaration index.\n\t\treturn x.Index() < y.Index()\n\t}\n)\n\n// KeyOrder specifies the ordering to visit map entries.\n// It is a function that reports whether x is ordered before y.\ntype KeyOrder func(x, y pref.MapKey) bool\n\nvar (\n\t// AnyKeyOrder specifies no specific key ordering.\n\tAnyKeyOrder KeyOrder = nil\n\n\t// GenericKeyOrder sorts false before true, numeric keys in ascending order,\n\t// and strings in lexicographical ordering according to UTF-8 codepoints.\n\tGenericKeyOrder KeyOrder = func(x, y pref.MapKey) bool {\n\t\tswitch x.Interface().(type) {\n\t\tcase bool:\n\t\t\treturn !x.Bool() && y.Bool()\n\t\tcase int32, int64:\n\t\t\treturn x.Int() < y.Int()\n\t\tcase uint32, uint64:\n\t\t\treturn x.Uint() < y.Uint()\n\t\tcase string:\n\t\t\treturn x.String() < y.String()\n\t\tdefault:\n\t\t\tpanic(\"invalid map key type\")\n\t\t}\n\t}\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/order/range.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\n// Package order provides ordered access to messages and maps.\npackage order\n\nimport (\n\t\"sort\"\n\t\"sync\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype messageField struct {\n\tfd pref.FieldDescriptor\n\tv  pref.Value\n}\n\nvar messageFieldPool = sync.Pool{\n\tNew: func() interface{} { return new([]messageField) },\n}\n\ntype (\n\t// FieldRnger is an interface for visiting all fields in a message.\n\t// The protoreflect.Message type implements this interface.\n\tFieldRanger interface{ Range(VisitField) }\n\t// VisitField is called everytime a message field is visited.\n\tVisitField = func(pref.FieldDescriptor, pref.Value) bool\n)\n\n// RangeFields iterates over the fields of fs according to the specified order.\nfunc RangeFields(fs FieldRanger, less FieldOrder, fn VisitField) {\n\tif less == nil {\n\t\tfs.Range(fn)\n\t\treturn\n\t}\n\n\t// Obtain a pre-allocated scratch buffer.\n\tp := messageFieldPool.Get().(*[]messageField)\n\tfields := (*p)[:0]\n\tdefer func() {\n\t\tif cap(fields) < 1024 {\n\t\t\t*p = fields\n\t\t\tmessageFieldPool.Put(p)\n\t\t}\n\t}()\n\n\t// Collect all fields in the message and sort them.\n\tfs.Range(func(fd pref.FieldDescriptor, v pref.Value) bool {\n\t\tfields = append(fields, messageField{fd, v})\n\t\treturn true\n\t})\n\tsort.Slice(fields, func(i, j int) bool {\n\t\treturn less(fields[i].fd, fields[j].fd)\n\t})\n\n\t// Visit the fields in the specified ordering.\n\tfor _, f := range fields {\n\t\tif !fn(f.fd, f.v) {\n\t\t\treturn\n\t\t}\n\t}\n}\n\ntype mapEntry struct {\n\tk pref.MapKey\n\tv pref.Value\n}\n\nvar mapEntryPool = sync.Pool{\n\tNew: func() interface{} { return new([]mapEntry) },\n}\n\ntype (\n\t// EntryRanger is an interface for visiting all fields in a message.\n\t// The protoreflect.Map type implements this interface.\n\tEntryRanger interface{ Range(VisitEntry) }\n\t// VisitEntry is called everytime a map entry is visited.\n\tVisitEntry = func(pref.MapKey, pref.Value) bool\n)\n\n// RangeEntries iterates over the entries of es according to the specified order.\nfunc RangeEntries(es EntryRanger, less KeyOrder, fn VisitEntry) {\n\tif less == nil {\n\t\tes.Range(fn)\n\t\treturn\n\t}\n\n\t// Obtain a pre-allocated scratch buffer.\n\tp := mapEntryPool.Get().(*[]mapEntry)\n\tentries := (*p)[:0]\n\tdefer func() {\n\t\tif cap(entries) < 1024 {\n\t\t\t*p = entries\n\t\t\tmapEntryPool.Put(p)\n\t\t}\n\t}()\n\n\t// Collect all entries in the map and sort them.\n\tes.Range(func(k pref.MapKey, v pref.Value) bool {\n\t\tentries = append(entries, mapEntry{k, v})\n\t\treturn true\n\t})\n\tsort.Slice(entries, func(i, j int) bool {\n\t\treturn less(entries[i].k, entries[j].k)\n\t})\n\n\t// Visit the entries in the specified ordering.\n\tfor _, e := range entries {\n\t\tif !fn(e.k, e.v) {\n\t\t\treturn\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/pragma/pragma.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 pragma provides types that can be embedded into a struct to\n// statically enforce or prevent certain language properties.\npackage pragma\n\nimport \"sync\"\n\n// NoUnkeyedLiterals can be embedded in a struct to prevent unkeyed literals.\ntype NoUnkeyedLiterals struct{}\n\n// DoNotImplement can be embedded in an interface to prevent trivial\n// implementations of the interface.\n//\n// This is useful to prevent unauthorized implementations of an interface\n// so that it can be extended in the future for any protobuf language changes.\ntype DoNotImplement interface{ ProtoInternal(DoNotImplement) }\n\n// DoNotCompare can be embedded in a struct to prevent comparability.\ntype DoNotCompare [0]func()\n\n// DoNotCopy can be embedded in a struct to help prevent shallow copies.\n// This does not rely on a Go language feature, but rather a special case\n// within the vet checker.\n//\n// See https://golang.org/issues/8005.\ntype DoNotCopy [0]sync.Mutex\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/set/ints.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 set provides simple set data structures for uint64s.\npackage set\n\nimport \"math/bits\"\n\n// int64s represents a set of integers within the range of 0..63.\ntype int64s uint64\n\nfunc (bs *int64s) Len() int {\n\treturn bits.OnesCount64(uint64(*bs))\n}\nfunc (bs *int64s) Has(n uint64) bool {\n\treturn uint64(*bs)&(uint64(1)<<n) > 0\n}\nfunc (bs *int64s) Set(n uint64) {\n\t*(*uint64)(bs) |= uint64(1) << n\n}\nfunc (bs *int64s) Clear(n uint64) {\n\t*(*uint64)(bs) &^= uint64(1) << n\n}\n\n// Ints represents a set of integers within the range of 0..math.MaxUint64.\ntype Ints struct {\n\tlo int64s\n\thi map[uint64]struct{}\n}\n\nfunc (bs *Ints) Len() int {\n\treturn bs.lo.Len() + len(bs.hi)\n}\nfunc (bs *Ints) Has(n uint64) bool {\n\tif n < 64 {\n\t\treturn bs.lo.Has(n)\n\t}\n\t_, ok := bs.hi[n]\n\treturn ok\n}\nfunc (bs *Ints) Set(n uint64) {\n\tif n < 64 {\n\t\tbs.lo.Set(n)\n\t\treturn\n\t}\n\tif bs.hi == nil {\n\t\tbs.hi = make(map[uint64]struct{})\n\t}\n\tbs.hi[n] = struct{}{}\n}\nfunc (bs *Ints) Clear(n uint64) {\n\tif n < 64 {\n\t\tbs.lo.Clear(n)\n\t\treturn\n\t}\n\tdelete(bs.hi, n)\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/strs/strings.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 strs provides string manipulation functionality specific to protobuf.\npackage strs\n\nimport (\n\t\"go/token\"\n\t\"strings\"\n\t\"unicode\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// EnforceUTF8 reports whether to enforce strict UTF-8 validation.\nfunc EnforceUTF8(fd protoreflect.FieldDescriptor) bool {\n\tif flags.ProtoLegacy {\n\t\tif fd, ok := fd.(interface{ EnforceUTF8() bool }); ok {\n\t\t\treturn fd.EnforceUTF8()\n\t\t}\n\t}\n\treturn fd.Syntax() == protoreflect.Proto3\n}\n\n// GoCamelCase camel-cases a protobuf name for use as a Go identifier.\n//\n// If there is an interior underscore followed by a lower case letter,\n// drop the underscore and convert the letter to upper case.\nfunc GoCamelCase(s string) string {\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\tvar b []byte\n\tfor i := 0; i < len(s); i++ {\n\t\tc := s[i]\n\t\tswitch {\n\t\tcase c == '.' && i+1 < len(s) && isASCIILower(s[i+1]):\n\t\t\t// Skip over '.' in \".{{lowercase}}\".\n\t\tcase c == '.':\n\t\t\tb = append(b, '_') // convert '.' to '_'\n\t\tcase c == '_' && (i == 0 || s[i-1] == '.'):\n\t\t\t// Convert initial '_' to ensure we start with a capital letter.\n\t\t\t// Do the same for '_' after '.' to match historic behavior.\n\t\t\tb = append(b, 'X') // convert '_' to 'X'\n\t\tcase c == '_' && i+1 < len(s) && isASCIILower(s[i+1]):\n\t\t\t// Skip over '_' in \"_{{lowercase}}\".\n\t\tcase isASCIIDigit(c):\n\t\t\tb = append(b, c)\n\t\tdefault:\n\t\t\t// Assume we have a letter now - if not, it's a bogus identifier.\n\t\t\t// The next word is a sequence of characters that must start upper case.\n\t\t\tif isASCIILower(c) {\n\t\t\t\tc -= 'a' - 'A' // convert lowercase to uppercase\n\t\t\t}\n\t\t\tb = append(b, c)\n\n\t\t\t// Accept lower case sequence that follows.\n\t\t\tfor ; i+1 < len(s) && isASCIILower(s[i+1]); i++ {\n\t\t\t\tb = append(b, s[i+1])\n\t\t\t}\n\t\t}\n\t}\n\treturn string(b)\n}\n\n// GoSanitized converts a string to a valid Go identifier.\nfunc GoSanitized(s string) string {\n\t// Sanitize the input to the set of valid characters,\n\t// which must be '_' or be in the Unicode L or N categories.\n\ts = strings.Map(func(r rune) rune {\n\t\tif unicode.IsLetter(r) || unicode.IsDigit(r) {\n\t\t\treturn r\n\t\t}\n\t\treturn '_'\n\t}, s)\n\n\t// Prepend '_' in the event of a Go keyword conflict or if\n\t// the identifier is invalid (does not start in the Unicode L category).\n\tr, _ := utf8.DecodeRuneInString(s)\n\tif token.Lookup(s).IsKeyword() || !unicode.IsLetter(r) {\n\t\treturn \"_\" + s\n\t}\n\treturn s\n}\n\n// JSONCamelCase converts a snake_case identifier to a camelCase identifier,\n// according to the protobuf JSON specification.\nfunc JSONCamelCase(s string) string {\n\tvar b []byte\n\tvar wasUnderscore bool\n\tfor i := 0; i < len(s); i++ { // proto identifiers are always ASCII\n\t\tc := s[i]\n\t\tif c != '_' {\n\t\t\tif wasUnderscore && isASCIILower(c) {\n\t\t\t\tc -= 'a' - 'A' // convert to uppercase\n\t\t\t}\n\t\t\tb = append(b, c)\n\t\t}\n\t\twasUnderscore = c == '_'\n\t}\n\treturn string(b)\n}\n\n// JSONSnakeCase converts a camelCase identifier to a snake_case identifier,\n// according to the protobuf JSON specification.\nfunc JSONSnakeCase(s string) string {\n\tvar b []byte\n\tfor i := 0; i < len(s); i++ { // proto identifiers are always ASCII\n\t\tc := s[i]\n\t\tif isASCIIUpper(c) {\n\t\t\tb = append(b, '_')\n\t\t\tc += 'a' - 'A' // convert to lowercase\n\t\t}\n\t\tb = append(b, c)\n\t}\n\treturn string(b)\n}\n\n// MapEntryName derives the name of the map entry message given the field name.\n// See protoc v3.8.0: src/google/protobuf/descriptor.cc:254-276,6057\nfunc MapEntryName(s string) string {\n\tvar b []byte\n\tupperNext := true\n\tfor _, c := range s {\n\t\tswitch {\n\t\tcase c == '_':\n\t\t\tupperNext = true\n\t\tcase upperNext:\n\t\t\tb = append(b, byte(unicode.ToUpper(c)))\n\t\t\tupperNext = false\n\t\tdefault:\n\t\t\tb = append(b, byte(c))\n\t\t}\n\t}\n\tb = append(b, \"Entry\"...)\n\treturn string(b)\n}\n\n// EnumValueName derives the camel-cased enum value name.\n// See protoc v3.8.0: src/google/protobuf/descriptor.cc:297-313\nfunc EnumValueName(s string) string {\n\tvar b []byte\n\tupperNext := true\n\tfor _, c := range s {\n\t\tswitch {\n\t\tcase c == '_':\n\t\t\tupperNext = true\n\t\tcase upperNext:\n\t\t\tb = append(b, byte(unicode.ToUpper(c)))\n\t\t\tupperNext = false\n\t\tdefault:\n\t\t\tb = append(b, byte(unicode.ToLower(c)))\n\t\t\tupperNext = false\n\t\t}\n\t}\n\treturn string(b)\n}\n\n// TrimEnumPrefix trims the enum name prefix from an enum value name,\n// where the prefix is all lowercase without underscores.\n// See protoc v3.8.0: src/google/protobuf/descriptor.cc:330-375\nfunc TrimEnumPrefix(s, prefix string) string {\n\ts0 := s // original input\n\tfor len(s) > 0 && len(prefix) > 0 {\n\t\tif s[0] == '_' {\n\t\t\ts = s[1:]\n\t\t\tcontinue\n\t\t}\n\t\tif unicode.ToLower(rune(s[0])) != rune(prefix[0]) {\n\t\t\treturn s0 // no prefix match\n\t\t}\n\t\ts, prefix = s[1:], prefix[1:]\n\t}\n\tif len(prefix) > 0 {\n\t\treturn s0 // no prefix match\n\t}\n\ts = strings.TrimLeft(s, \"_\")\n\tif len(s) == 0 {\n\t\treturn s0 // avoid returning empty string\n\t}\n\treturn s\n}\n\nfunc isASCIILower(c byte) bool {\n\treturn 'a' <= c && c <= 'z'\n}\nfunc isASCIIUpper(c byte) bool {\n\treturn 'A' <= c && c <= 'Z'\n}\nfunc isASCIIDigit(c byte) bool {\n\treturn '0' <= c && c <= '9'\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/strs/strings_pure.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// +build purego appengine\n\npackage strs\n\nimport pref \"google.golang.org/protobuf/reflect/protoreflect\"\n\nfunc UnsafeString(b []byte) string {\n\treturn string(b)\n}\n\nfunc UnsafeBytes(s string) []byte {\n\treturn []byte(s)\n}\n\ntype Builder struct{}\n\nfunc (*Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.FullName {\n\treturn prefix.Append(name)\n}\n\nfunc (*Builder) MakeString(b []byte) string {\n\treturn string(b)\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/strs/strings_unsafe.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// +build !purego,!appengine\n\npackage strs\n\nimport (\n\t\"unsafe\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype (\n\tstringHeader struct {\n\t\tData unsafe.Pointer\n\t\tLen  int\n\t}\n\tsliceHeader struct {\n\t\tData unsafe.Pointer\n\t\tLen  int\n\t\tCap  int\n\t}\n)\n\n// UnsafeString returns an unsafe string reference of b.\n// The caller must treat the input slice as immutable.\n//\n// WARNING: Use carefully. The returned result must not leak to the end user\n// unless the input slice is provably immutable.\nfunc UnsafeString(b []byte) (s string) {\n\tsrc := (*sliceHeader)(unsafe.Pointer(&b))\n\tdst := (*stringHeader)(unsafe.Pointer(&s))\n\tdst.Data = src.Data\n\tdst.Len = src.Len\n\treturn s\n}\n\n// UnsafeBytes returns an unsafe bytes slice reference of s.\n// The caller must treat returned slice as immutable.\n//\n// WARNING: Use carefully. The returned result must not leak to the end user.\nfunc UnsafeBytes(s string) (b []byte) {\n\tsrc := (*stringHeader)(unsafe.Pointer(&s))\n\tdst := (*sliceHeader)(unsafe.Pointer(&b))\n\tdst.Data = src.Data\n\tdst.Len = src.Len\n\tdst.Cap = src.Len\n\treturn b\n}\n\n// Builder builds a set of strings with shared lifetime.\n// This differs from strings.Builder, which is for building a single string.\ntype Builder struct {\n\tbuf []byte\n}\n\n// AppendFullName is equivalent to protoreflect.FullName.Append,\n// but optimized for large batches where each name has a shared lifetime.\nfunc (sb *Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.FullName {\n\tn := len(prefix) + len(\".\") + len(name)\n\tif len(prefix) == 0 {\n\t\tn -= len(\".\")\n\t}\n\tsb.grow(n)\n\tsb.buf = append(sb.buf, prefix...)\n\tsb.buf = append(sb.buf, '.')\n\tsb.buf = append(sb.buf, name...)\n\treturn pref.FullName(sb.last(n))\n}\n\n// MakeString is equivalent to string(b), but optimized for large batches\n// with a shared lifetime.\nfunc (sb *Builder) MakeString(b []byte) string {\n\tsb.grow(len(b))\n\tsb.buf = append(sb.buf, b...)\n\treturn sb.last(len(b))\n}\n\nfunc (sb *Builder) grow(n int) {\n\tif cap(sb.buf)-len(sb.buf) >= n {\n\t\treturn\n\t}\n\n\t// Unlike strings.Builder, we do not need to copy over the contents\n\t// of the old buffer since our builder provides no API for\n\t// retrieving previously created strings.\n\tsb.buf = make([]byte, 2*(cap(sb.buf)+n))\n}\n\nfunc (sb *Builder) last(n int) string {\n\treturn UnsafeString(sb.buf[len(sb.buf)-n:])\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/internal/version/version.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 version records versioning information about this module.\npackage version\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n)\n\n// These constants determine the current version of this module.\n//\n//\n// For our release process, we enforce the following rules:\n//\t* Tagged releases use a tag that is identical to String.\n//\t* Tagged releases never reference a commit where the String\n//\tcontains \"devel\".\n//\t* The set of all commits in this repository where String\n//\tdoes not contain \"devel\" must have a unique String.\n//\n//\n// Steps for tagging a new release:\n//\t1. Create a new CL.\n//\n//\t2. Update Minor, Patch, and/or PreRelease as necessary.\n//\tPreRelease must not contain the string \"devel\".\n//\n//\t3. Since the last released minor version, have there been any changes to\n//\tgenerator that relies on new functionality in the runtime?\n//\tIf yes, then increment RequiredGenerated.\n//\n//\t4. Since the last released minor version, have there been any changes to\n//\tthe runtime that removes support for old .pb.go source code?\n//\tIf yes, then increment SupportMinimum.\n//\n//\t5. Send out the CL for review and submit it.\n//\tNote that the next CL in step 8 must be submitted after this CL\n//\twithout any other CLs in-between.\n//\n//\t6. Tag a new version, where the tag is is the current String.\n//\n//\t7. Write release notes for all notable changes\n//\tbetween this release and the last release.\n//\n//\t8. Create a new CL.\n//\n//\t9. Update PreRelease to include the string \"devel\".\n//\tFor example: \"\" -> \"devel\" or \"rc.1\" -> \"rc.1.devel\"\n//\n//\t10. Send out the CL for review and submit it.\nconst (\n\tMajor      = 1\n\tMinor      = 26\n\tPatch      = 0\n\tPreRelease = \"devel\"\n)\n\n// String formats the version string for this module in semver format.\n//\n// Examples:\n//\tv1.20.1\n//\tv1.21.0-rc.1\nfunc String() string {\n\tv := fmt.Sprintf(\"v%d.%d.%d\", Major, Minor, Patch)\n\tif PreRelease != \"\" {\n\t\tv += \"-\" + PreRelease\n\n\t\t// TODO: Add metadata about the commit or build hash.\n\t\t// See https://golang.org/issue/29814\n\t\t// See https://golang.org/issue/33533\n\t\tvar metadata string\n\t\tif strings.Contains(PreRelease, \"devel\") && metadata != \"\" {\n\t\t\tv += \"+\" + metadata\n\t\t}\n\t}\n\treturn v\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/checkinit.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/internal/errors\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// CheckInitialized returns an error if any required fields in m are not set.\nfunc CheckInitialized(m Message) error {\n\t// Treat a nil message interface as an \"untyped\" empty message,\n\t// which we assume to have no required fields.\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\treturn checkInitialized(m.ProtoReflect())\n}\n\n// CheckInitialized returns an error if any required fields in m are not set.\nfunc checkInitialized(m protoreflect.Message) error {\n\tif methods := protoMethods(m); methods != nil && methods.CheckInitialized != nil {\n\t\t_, err := methods.CheckInitialized(protoiface.CheckInitializedInput{\n\t\t\tMessage: m,\n\t\t})\n\t\treturn err\n\t}\n\treturn checkInitializedSlow(m)\n}\n\nfunc checkInitializedSlow(m protoreflect.Message) error {\n\tmd := m.Descriptor()\n\tfds := md.Fields()\n\tfor i, nums := 0, md.RequiredNumbers(); i < nums.Len(); i++ {\n\t\tfd := fds.ByNumber(nums.Get(i))\n\t\tif !m.Has(fd) {\n\t\t\treturn errors.RequiredNotSet(string(fd.FullName()))\n\t\t}\n\t}\n\tvar err error\n\tm.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tswitch {\n\t\tcase fd.IsList():\n\t\t\tif fd.Message() == nil {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tfor i, list := 0, v.List(); i < list.Len() && err == nil; i++ {\n\t\t\t\terr = checkInitialized(list.Get(i).Message())\n\t\t\t}\n\t\tcase fd.IsMap():\n\t\t\tif fd.MapValue().Message() == nil {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tv.Map().Range(func(key protoreflect.MapKey, v protoreflect.Value) bool {\n\t\t\t\terr = checkInitialized(v.Message())\n\t\t\t\treturn err == nil\n\t\t\t})\n\t\tdefault:\n\t\t\tif fd.Message() == nil {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\terr = checkInitialized(v.Message())\n\t\t}\n\t\treturn err == nil\n\t})\n\treturn err\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/decode.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\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/pragma\"\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)\n\n// UnmarshalOptions configures the unmarshaler.\n//\n// Example usage:\n//   err := UnmarshalOptions{DiscardUnknown: true}.Unmarshal(b, m)\ntype UnmarshalOptions struct {\n\tpragma.NoUnkeyedLiterals\n\n\t// Merge merges the input into the destination message.\n\t// The default behavior is to always reset the message before unmarshaling,\n\t// unless Merge is specified.\n\tMerge bool\n\n\t// AllowPartial accepts input for messages that will result in missing\n\t// required fields. If AllowPartial is false (the default), Unmarshal will\n\t// return an error if there are any missing required fields.\n\tAllowPartial bool\n\n\t// If DiscardUnknown is set, unknown fields are ignored.\n\tDiscardUnknown bool\n\n\t// Resolver is used for looking up types when unmarshaling extension fields.\n\t// If nil, this defaults to using protoregistry.GlobalTypes.\n\tResolver interface {\n\t\tFindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)\n\t\tFindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)\n\t}\n}\n\n// Unmarshal parses the wire-format message in b and places the result in m.\n// The provided message must be mutable (e.g., a non-nil pointer to a message).\nfunc Unmarshal(b []byte, m Message) error {\n\t_, err := UnmarshalOptions{}.unmarshal(b, m.ProtoReflect())\n\treturn err\n}\n\n// Unmarshal parses the wire-format message in b and places the result in m.\n// The provided message must be mutable (e.g., a non-nil pointer to a message).\nfunc (o UnmarshalOptions) Unmarshal(b []byte, m Message) error {\n\t_, err := o.unmarshal(b, m.ProtoReflect())\n\treturn err\n}\n\n// UnmarshalState parses a wire-format message and places the result in m.\n//\n// This method permits fine-grained control over the unmarshaler.\n// Most users should use Unmarshal instead.\nfunc (o UnmarshalOptions) UnmarshalState(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\treturn o.unmarshal(in.Buf, in.Message)\n}\n\n// unmarshal is a centralized function that all unmarshal operations go through.\n// For profiling purposes, avoid changing the name of this function or\n// introducing other code paths for unmarshal that do not go through this.\nfunc (o UnmarshalOptions) unmarshal(b []byte, m protoreflect.Message) (out protoiface.UnmarshalOutput, err error) {\n\tif o.Resolver == nil {\n\t\to.Resolver = protoregistry.GlobalTypes\n\t}\n\tif !o.Merge {\n\t\tReset(m.Interface())\n\t}\n\tallowPartial := o.AllowPartial\n\to.Merge = true\n\to.AllowPartial = true\n\tmethods := protoMethods(m)\n\tif methods != nil && methods.Unmarshal != nil &&\n\t\t!(o.DiscardUnknown && methods.Flags&protoiface.SupportUnmarshalDiscardUnknown == 0) {\n\t\tin := protoiface.UnmarshalInput{\n\t\t\tMessage:  m,\n\t\t\tBuf:      b,\n\t\t\tResolver: o.Resolver,\n\t\t}\n\t\tif o.DiscardUnknown {\n\t\t\tin.Flags |= protoiface.UnmarshalDiscardUnknown\n\t\t}\n\t\tout, err = methods.Unmarshal(in)\n\t} else {\n\t\terr = o.unmarshalMessageSlow(b, m)\n\t}\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tif allowPartial || (out.Flags&protoiface.UnmarshalInitialized != 0) {\n\t\treturn out, nil\n\t}\n\treturn out, checkInitialized(m)\n}\n\nfunc (o UnmarshalOptions) unmarshalMessage(b []byte, m protoreflect.Message) error {\n\t_, err := o.unmarshal(b, m)\n\treturn err\n}\n\nfunc (o UnmarshalOptions) unmarshalMessageSlow(b []byte, m protoreflect.Message) error {\n\tmd := m.Descriptor()\n\tif messageset.IsMessageSet(md) {\n\t\treturn o.unmarshalMessageSet(b, m)\n\t}\n\tfields := md.Fields()\n\tfor len(b) > 0 {\n\t\t// Parse the tag (field number and wire type).\n\t\tnum, wtyp, tagLen := protowire.ConsumeTag(b)\n\t\tif tagLen < 0 {\n\t\t\treturn errDecode\n\t\t}\n\t\tif num > protowire.MaxValidNumber {\n\t\t\treturn errDecode\n\t\t}\n\n\t\t// Find the field descriptor for this field number.\n\t\tfd := fields.ByNumber(num)\n\t\tif fd == nil && md.ExtensionRanges().Has(num) {\n\t\t\textType, err := o.Resolver.FindExtensionByNumber(md.FullName(), num)\n\t\t\tif err != nil && err != protoregistry.NotFound {\n\t\t\t\treturn errors.New(\"%v: unable to resolve extension %v: %v\", md.FullName(), num, err)\n\t\t\t}\n\t\t\tif extType != nil {\n\t\t\t\tfd = extType.TypeDescriptor()\n\t\t\t}\n\t\t}\n\t\tvar err error\n\t\tif fd == nil {\n\t\t\terr = errUnknown\n\t\t} else if flags.ProtoLegacy {\n\t\t\tif fd.IsWeak() && fd.Message().IsPlaceholder() {\n\t\t\t\terr = errUnknown // weak referent is not linked in\n\t\t\t}\n\t\t}\n\n\t\t// Parse the field value.\n\t\tvar valLen int\n\t\tswitch {\n\t\tcase err != nil:\n\t\tcase fd.IsList():\n\t\t\tvalLen, err = o.unmarshalList(b[tagLen:], wtyp, m.Mutable(fd).List(), fd)\n\t\tcase fd.IsMap():\n\t\t\tvalLen, err = o.unmarshalMap(b[tagLen:], wtyp, m.Mutable(fd).Map(), fd)\n\t\tdefault:\n\t\t\tvalLen, err = o.unmarshalSingular(b[tagLen:], wtyp, m, fd)\n\t\t}\n\t\tif err != nil {\n\t\t\tif err != errUnknown {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tvalLen = protowire.ConsumeFieldValue(num, wtyp, b[tagLen:])\n\t\t\tif valLen < 0 {\n\t\t\t\treturn errDecode\n\t\t\t}\n\t\t\tif !o.DiscardUnknown {\n\t\t\t\tm.SetUnknown(append(m.GetUnknown(), b[:tagLen+valLen]...))\n\t\t\t}\n\t\t}\n\t\tb = b[tagLen+valLen:]\n\t}\n\treturn nil\n}\n\nfunc (o UnmarshalOptions) unmarshalSingular(b []byte, wtyp protowire.Type, m protoreflect.Message, fd protoreflect.FieldDescriptor) (n int, err error) {\n\tv, n, err := o.unmarshalScalar(b, wtyp, fd)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tswitch fd.Kind() {\n\tcase protoreflect.GroupKind, protoreflect.MessageKind:\n\t\tm2 := m.Mutable(fd).Message()\n\t\tif err := o.unmarshalMessage(v.Bytes(), m2); err != nil {\n\t\t\treturn n, err\n\t\t}\n\tdefault:\n\t\t// Non-message scalars replace the previous value.\n\t\tm.Set(fd, v)\n\t}\n\treturn n, nil\n}\n\nfunc (o UnmarshalOptions) unmarshalMap(b []byte, wtyp protowire.Type, mapv protoreflect.Map, fd protoreflect.FieldDescriptor) (n int, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn 0, errUnknown\n\t}\n\tb, n = protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn 0, errDecode\n\t}\n\tvar (\n\t\tkeyField = fd.MapKey()\n\t\tvalField = fd.MapValue()\n\t\tkey      protoreflect.Value\n\t\tval      protoreflect.Value\n\t\thaveKey  bool\n\t\thaveVal  bool\n\t)\n\tswitch valField.Kind() {\n\tcase protoreflect.GroupKind, protoreflect.MessageKind:\n\t\tval = mapv.NewValue()\n\t}\n\t// Map entries are represented as a two-element message with fields\n\t// containing the key and value.\n\tfor len(b) > 0 {\n\t\tnum, wtyp, n := protowire.ConsumeTag(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tif num > protowire.MaxValidNumber {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tb = b[n:]\n\t\terr = errUnknown\n\t\tswitch num {\n\t\tcase genid.MapEntry_Key_field_number:\n\t\t\tkey, n, err = o.unmarshalScalar(b, wtyp, keyField)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\thaveKey = true\n\t\tcase genid.MapEntry_Value_field_number:\n\t\t\tvar v protoreflect.Value\n\t\t\tv, n, err = o.unmarshalScalar(b, wtyp, valField)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tswitch valField.Kind() {\n\t\t\tcase protoreflect.GroupKind, protoreflect.MessageKind:\n\t\t\t\tif err := o.unmarshalMessage(v.Bytes(), val.Message()); err != nil {\n\t\t\t\t\treturn 0, err\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tval = v\n\t\t\t}\n\t\t\thaveVal = true\n\t\t}\n\t\tif err == errUnknown {\n\t\t\tn = protowire.ConsumeFieldValue(num, wtyp, b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tb = b[n:]\n\t}\n\t// Every map entry should have entries for key and value, but this is not strictly required.\n\tif !haveKey {\n\t\tkey = keyField.Default()\n\t}\n\tif !haveVal {\n\t\tswitch valField.Kind() {\n\t\tcase protoreflect.GroupKind, protoreflect.MessageKind:\n\t\tdefault:\n\t\t\tval = valField.Default()\n\t\t}\n\t}\n\tmapv.Set(key.MapKey(), val)\n\treturn n, nil\n}\n\n// errUnknown is used internally to indicate fields which should be added\n// to the unknown field set of a message. It is never returned from an exported\n// function.\nvar errUnknown = errors.New(\"BUG: internal error (unknown)\")\n\nvar errDecode = errors.New(\"cannot parse invalid wire-format data\")\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/decode_gen.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// Code generated by generate-types. DO NOT EDIT.\n\npackage proto\n\nimport (\n\t\"math\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// unmarshalScalar decodes a value of the given kind.\n//\n// Message values are decoded into a []byte which aliases the input data.\nfunc (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd protoreflect.FieldDescriptor) (val protoreflect.Value, n int, err error) {\n\tswitch fd.Kind() {\n\tcase protoreflect.BoolKind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfBool(protowire.DecodeBool(v)), n, nil\n\tcase protoreflect.EnumKind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), n, nil\n\tcase protoreflect.Int32Kind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfInt32(int32(v)), n, nil\n\tcase protoreflect.Sint32Kind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), n, nil\n\tcase protoreflect.Uint32Kind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfUint32(uint32(v)), n, nil\n\tcase protoreflect.Int64Kind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfInt64(int64(v)), n, nil\n\tcase protoreflect.Sint64Kind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), n, nil\n\tcase protoreflect.Uint64Kind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfUint64(v), n, nil\n\tcase protoreflect.Sfixed32Kind:\n\t\tif wtyp != protowire.Fixed32Type {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed32(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfInt32(int32(v)), n, nil\n\tcase protoreflect.Fixed32Kind:\n\t\tif wtyp != protowire.Fixed32Type {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed32(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfUint32(uint32(v)), n, nil\n\tcase protoreflect.FloatKind:\n\t\tif wtyp != protowire.Fixed32Type {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed32(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), n, nil\n\tcase protoreflect.Sfixed64Kind:\n\t\tif wtyp != protowire.Fixed64Type {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed64(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfInt64(int64(v)), n, nil\n\tcase protoreflect.Fixed64Kind:\n\t\tif wtyp != protowire.Fixed64Type {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed64(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfUint64(v), n, nil\n\tcase protoreflect.DoubleKind:\n\t\tif wtyp != protowire.Fixed64Type {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed64(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfFloat64(math.Float64frombits(v)), n, nil\n\tcase protoreflect.StringKind:\n\t\tif wtyp != protowire.BytesType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\tif strs.EnforceUTF8(fd) && !utf8.Valid(v) {\n\t\t\treturn protoreflect.Value{}, 0, errors.InvalidUTF8(string(fd.FullName()))\n\t\t}\n\t\treturn protoreflect.ValueOfString(string(v)), n, nil\n\tcase protoreflect.BytesKind:\n\t\tif wtyp != protowire.BytesType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), n, nil\n\tcase protoreflect.MessageKind:\n\t\tif wtyp != protowire.BytesType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfBytes(v), n, nil\n\tcase protoreflect.GroupKind:\n\t\tif wtyp != protowire.StartGroupType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeGroup(fd.Number(), b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfBytes(v), n, nil\n\tdefault:\n\t\treturn val, 0, errUnknown\n\t}\n}\n\nfunc (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list protoreflect.List, fd protoreflect.FieldDescriptor) (n int, err error) {\n\tswitch fd.Kind() {\n\tcase protoreflect.BoolKind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))\n\t\treturn n, nil\n\tcase protoreflect.EnumKind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))\n\t\treturn n, nil\n\tcase protoreflect.Int32Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\t\treturn n, nil\n\tcase protoreflect.Sint32Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))\n\t\treturn n, nil\n\tcase protoreflect.Uint32Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\t\treturn n, nil\n\tcase protoreflect.Int64Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\t\treturn n, nil\n\tcase protoreflect.Sint64Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))\n\t\treturn n, nil\n\tcase protoreflect.Uint64Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfUint64(v))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfUint64(v))\n\t\treturn n, nil\n\tcase protoreflect.Sfixed32Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeFixed32(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.Fixed32Type {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed32(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\t\treturn n, nil\n\tcase protoreflect.Fixed32Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeFixed32(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.Fixed32Type {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed32(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\t\treturn n, nil\n\tcase protoreflect.FloatKind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeFixed32(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.Fixed32Type {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed32(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))\n\t\treturn n, nil\n\tcase protoreflect.Sfixed64Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeFixed64(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.Fixed64Type {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed64(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\t\treturn n, nil\n\tcase protoreflect.Fixed64Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeFixed64(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfUint64(v))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.Fixed64Type {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed64(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfUint64(v))\n\t\treturn n, nil\n\tcase protoreflect.DoubleKind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeFixed64(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.Fixed64Type {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed64(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))\n\t\treturn n, nil\n\tcase protoreflect.StringKind:\n\t\tif wtyp != protowire.BytesType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tif strs.EnforceUTF8(fd) && !utf8.Valid(v) {\n\t\t\treturn 0, errors.InvalidUTF8(string(fd.FullName()))\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfString(string(v)))\n\t\treturn n, nil\n\tcase protoreflect.BytesKind:\n\t\tif wtyp != protowire.BytesType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfBytes(append(emptyBuf[:], v...)))\n\t\treturn n, nil\n\tcase protoreflect.MessageKind:\n\t\tif wtyp != protowire.BytesType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tm := list.NewElement()\n\t\tif err := o.unmarshalMessage(v, m.Message()); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tlist.Append(m)\n\t\treturn n, nil\n\tcase protoreflect.GroupKind:\n\t\tif wtyp != protowire.StartGroupType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeGroup(fd.Number(), b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tm := list.NewElement()\n\t\tif err := o.unmarshalMessage(v, m.Message()); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tlist.Append(m)\n\t\treturn n, nil\n\tdefault:\n\t\treturn 0, errUnknown\n\t}\n}\n\n// We append to an empty array rather than a nil []byte to get non-nil zero-length byte slices.\nvar emptyBuf [0]byte\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/doc.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 functions operating on protocol buffer messages.\n//\n// For documentation on protocol buffers in general, see:\n//\n//   https://developers.google.com/protocol-buffers\n//\n// For a tutorial on using protocol buffers with Go, see:\n//\n//   https://developers.google.com/protocol-buffers/docs/gotutorial\n//\n// For a guide to generated Go protocol buffer code, see:\n//\n//   https://developers.google.com/protocol-buffers/docs/reference/go-generated\n//\n//\n// Binary serialization\n//\n// This package contains functions to convert to and from the wire format,\n// an efficient binary serialization of protocol buffers.\n//\n// • Size reports the size of a message in the wire format.\n//\n// • Marshal converts a message to the wire format.\n// The MarshalOptions type provides more control over wire marshaling.\n//\n// • Unmarshal converts a message from the wire format.\n// The UnmarshalOptions type provides more control over wire unmarshaling.\n//\n//\n// Basic message operations\n//\n// • Clone makes a deep copy of a message.\n//\n// • Merge merges the content of a message into another.\n//\n// • Equal compares two messages. For more control over comparisons\n// and detailed reporting of differences, see package\n// \"google.golang.org/protobuf/testing/protocmp\".\n//\n// • Reset clears the content of a message.\n//\n// • CheckInitialized reports whether all required fields in a message are set.\n//\n//\n// Optional scalar constructors\n//\n// The API for some generated messages represents optional scalar fields\n// as pointers to a value. For example, an optional string field has the\n// Go type *string.\n//\n// • Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, and String\n// take a value and return a pointer to a new instance of it,\n// to simplify construction of optional field values.\n//\n// Generated enum types usually have an Enum method which performs the\n// same operation.\n//\n// Optional scalar fields are only supported in proto2.\n//\n//\n// Extension accessors\n//\n// • HasExtension, GetExtension, SetExtension, and ClearExtension\n// access extension field values in a protocol buffer message.\n//\n// Extension fields are only supported in proto2.\n//\n//\n// Related packages\n//\n// • Package \"google.golang.org/protobuf/encoding/protojson\" converts messages to\n// and from JSON.\n//\n// • Package \"google.golang.org/protobuf/encoding/prototext\" converts messages to\n// and from the text format.\n//\n// • Package \"google.golang.org/protobuf/reflect/protoreflect\" provides a\n// reflection interface for protocol buffer data types.\n//\n// • Package \"google.golang.org/protobuf/testing/protocmp\" provides features\n// to compare protocol buffer messages with the \"github.com/google/go-cmp/cmp\"\n// package.\n//\n// • Package \"google.golang.org/protobuf/types/dynamicpb\" provides a dynamic\n// message type, suitable for working with messages where the protocol buffer\n// type is only known at runtime.\n//\n// This module contains additional packages for more specialized use cases.\n// Consult the individual package documentation for details.\npackage proto\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/encode.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/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/order\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// MarshalOptions configures the marshaler.\n//\n// Example usage:\n//   b, err := MarshalOptions{Deterministic: true}.Marshal(m)\ntype MarshalOptions struct {\n\tpragma.NoUnkeyedLiterals\n\n\t// AllowPartial allows messages that have missing required fields to marshal\n\t// without returning an error. If AllowPartial is false (the default),\n\t// Marshal will return an error if there are any missing required fields.\n\tAllowPartial bool\n\n\t// Deterministic controls whether the same message will always be\n\t// serialized to the same bytes within the same binary.\n\t//\n\t// Setting this option guarantees that repeated serialization of\n\t// the same message will return the same bytes, and that different\n\t// processes of the same binary (which may be executing on different\n\t// machines) will serialize equal messages to the same bytes.\n\t// It has no effect on the resulting size of the encoded message compared\n\t// to a non-deterministic marshal.\n\t//\n\t// Note that the deterministic serialization is NOT canonical across\n\t// languages. It is not guaranteed to remain stable over time. It is\n\t// unstable across different builds with schema changes due to unknown\n\t// fields. Users who need canonical serialization (e.g., persistent\n\t// storage in a canonical form, fingerprinting, etc.) must define\n\t// their own canonicalization specification and implement their own\n\t// serializer rather than relying on this API.\n\t//\n\t// If deterministic serialization is requested, map entries will be\n\t// sorted by keys in lexographical order. This is an implementation\n\t// detail and subject to change.\n\tDeterministic bool\n\n\t// UseCachedSize indicates that the result of a previous Size call\n\t// may be reused.\n\t//\n\t// Setting this option asserts that:\n\t//\n\t// 1. Size has previously been called on this message with identical\n\t// options (except for UseCachedSize itself).\n\t//\n\t// 2. The message and all its submessages have not changed in any\n\t// way since the Size call.\n\t//\n\t// If either of these invariants is violated,\n\t// the results are undefined and may include panics or corrupted output.\n\t//\n\t// Implementations MAY take this option into account to provide\n\t// better performance, but there is no guarantee that they will do so.\n\t// There is absolutely no guarantee that Size followed by Marshal with\n\t// UseCachedSize set will perform equivalently to Marshal alone.\n\tUseCachedSize bool\n}\n\n// Marshal returns the wire-format encoding of m.\nfunc Marshal(m Message) ([]byte, error) {\n\t// Treat nil message interface as an empty message; nothing to output.\n\tif m == nil {\n\t\treturn nil, nil\n\t}\n\n\tout, err := MarshalOptions{}.marshal(nil, m.ProtoReflect())\n\tif len(out.Buf) == 0 && err == nil {\n\t\tout.Buf = emptyBytesForMessage(m)\n\t}\n\treturn out.Buf, err\n}\n\n// Marshal returns the wire-format encoding of m.\nfunc (o MarshalOptions) Marshal(m Message) ([]byte, error) {\n\t// Treat nil message interface as an empty message; nothing to output.\n\tif m == nil {\n\t\treturn nil, nil\n\t}\n\n\tout, err := o.marshal(nil, m.ProtoReflect())\n\tif len(out.Buf) == 0 && err == nil {\n\t\tout.Buf = emptyBytesForMessage(m)\n\t}\n\treturn out.Buf, err\n}\n\n// emptyBytesForMessage returns a nil buffer if and only if m is invalid,\n// otherwise it returns a non-nil empty buffer.\n//\n// This is to assist the edge-case where user-code does the following:\n//\tm1.OptionalBytes, _ = proto.Marshal(m2)\n// where they expect the proto2 \"optional_bytes\" field to be populated\n// if any only if m2 is a valid message.\nfunc emptyBytesForMessage(m Message) []byte {\n\tif m == nil || !m.ProtoReflect().IsValid() {\n\t\treturn nil\n\t}\n\treturn emptyBuf[:]\n}\n\n// MarshalAppend appends the wire-format encoding of m to b,\n// returning the result.\nfunc (o MarshalOptions) MarshalAppend(b []byte, m Message) ([]byte, error) {\n\t// Treat nil message interface as an empty message; nothing to append.\n\tif m == nil {\n\t\treturn b, nil\n\t}\n\n\tout, err := o.marshal(b, m.ProtoReflect())\n\treturn out.Buf, err\n}\n\n// MarshalState returns the wire-format encoding of a message.\n//\n// This method permits fine-grained control over the marshaler.\n// Most users should use Marshal instead.\nfunc (o MarshalOptions) MarshalState(in protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\treturn o.marshal(in.Buf, in.Message)\n}\n\n// marshal is a centralized function that all marshal operations go through.\n// For profiling purposes, avoid changing the name of this function or\n// introducing other code paths for marshal that do not go through this.\nfunc (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoiface.MarshalOutput, err error) {\n\tallowPartial := o.AllowPartial\n\to.AllowPartial = true\n\tif methods := protoMethods(m); methods != nil && methods.Marshal != nil &&\n\t\t!(o.Deterministic && methods.Flags&protoiface.SupportMarshalDeterministic == 0) {\n\t\tin := protoiface.MarshalInput{\n\t\t\tMessage: m,\n\t\t\tBuf:     b,\n\t\t}\n\t\tif o.Deterministic {\n\t\t\tin.Flags |= protoiface.MarshalDeterministic\n\t\t}\n\t\tif o.UseCachedSize {\n\t\t\tin.Flags |= protoiface.MarshalUseCachedSize\n\t\t}\n\t\tif methods.Size != nil {\n\t\t\tsout := methods.Size(protoiface.SizeInput{\n\t\t\t\tMessage: m,\n\t\t\t\tFlags:   in.Flags,\n\t\t\t})\n\t\t\tif cap(b) < len(b)+sout.Size {\n\t\t\t\tin.Buf = make([]byte, len(b), growcap(cap(b), len(b)+sout.Size))\n\t\t\t\tcopy(in.Buf, b)\n\t\t\t}\n\t\t\tin.Flags |= protoiface.MarshalUseCachedSize\n\t\t}\n\t\tout, err = methods.Marshal(in)\n\t} else {\n\t\tout.Buf, err = o.marshalMessageSlow(b, m)\n\t}\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tif allowPartial {\n\t\treturn out, nil\n\t}\n\treturn out, checkInitialized(m)\n}\n\nfunc (o MarshalOptions) marshalMessage(b []byte, m protoreflect.Message) ([]byte, error) {\n\tout, err := o.marshal(b, m)\n\treturn out.Buf, err\n}\n\n// growcap scales up the capacity of a slice.\n//\n// Given a slice with a current capacity of oldcap and a desired\n// capacity of wantcap, growcap returns a new capacity >= wantcap.\n//\n// The algorithm is mostly identical to the one used by append as of Go 1.14.\nfunc growcap(oldcap, wantcap int) (newcap int) {\n\tif wantcap > oldcap*2 {\n\t\tnewcap = wantcap\n\t} else if oldcap < 1024 {\n\t\t// The Go 1.14 runtime takes this case when len(s) < 1024,\n\t\t// not when cap(s) < 1024. The difference doesn't seem\n\t\t// significant here.\n\t\tnewcap = oldcap * 2\n\t} else {\n\t\tnewcap = oldcap\n\t\tfor 0 < newcap && newcap < wantcap {\n\t\t\tnewcap += newcap / 4\n\t\t}\n\t\tif newcap <= 0 {\n\t\t\tnewcap = wantcap\n\t\t}\n\t}\n\treturn newcap\n}\n\nfunc (o MarshalOptions) marshalMessageSlow(b []byte, m protoreflect.Message) ([]byte, error) {\n\tif messageset.IsMessageSet(m.Descriptor()) {\n\t\treturn o.marshalMessageSet(b, m)\n\t}\n\tfieldOrder := order.AnyFieldOrder\n\tif o.Deterministic {\n\t\t// TODO: This should use a more natural ordering like NumberFieldOrder,\n\t\t// but doing so breaks golden tests that make invalid assumption about\n\t\t// output stability of this implementation.\n\t\tfieldOrder = order.LegacyFieldOrder\n\t}\n\tvar err error\n\torder.RangeFields(m, fieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tb, err = o.marshalField(b, fd, v)\n\t\treturn err == nil\n\t})\n\tif err != nil {\n\t\treturn b, err\n\t}\n\tb = append(b, m.GetUnknown()...)\n\treturn b, nil\n}\n\nfunc (o MarshalOptions) marshalField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) {\n\tswitch {\n\tcase fd.IsList():\n\t\treturn o.marshalList(b, fd, value.List())\n\tcase fd.IsMap():\n\t\treturn o.marshalMap(b, fd, value.Map())\n\tdefault:\n\t\tb = protowire.AppendTag(b, fd.Number(), wireTypes[fd.Kind()])\n\t\treturn o.marshalSingular(b, fd, value)\n\t}\n}\n\nfunc (o MarshalOptions) marshalList(b []byte, fd protoreflect.FieldDescriptor, list protoreflect.List) ([]byte, error) {\n\tif fd.IsPacked() && list.Len() > 0 {\n\t\tb = protowire.AppendTag(b, fd.Number(), protowire.BytesType)\n\t\tb, pos := appendSpeculativeLength(b)\n\t\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\t\tvar err error\n\t\t\tb, err = o.marshalSingular(b, fd, list.Get(i))\n\t\t\tif err != nil {\n\t\t\t\treturn b, err\n\t\t\t}\n\t\t}\n\t\tb = finishSpeculativeLength(b, pos)\n\t\treturn b, nil\n\t}\n\n\tkind := fd.Kind()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tvar err error\n\t\tb = protowire.AppendTag(b, fd.Number(), wireTypes[kind])\n\t\tb, err = o.marshalSingular(b, fd, list.Get(i))\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\treturn b, nil\n}\n\nfunc (o MarshalOptions) marshalMap(b []byte, fd protoreflect.FieldDescriptor, mapv protoreflect.Map) ([]byte, error) {\n\tkeyf := fd.MapKey()\n\tvalf := fd.MapValue()\n\tkeyOrder := order.AnyKeyOrder\n\tif o.Deterministic {\n\t\tkeyOrder = order.GenericKeyOrder\n\t}\n\tvar err error\n\torder.RangeEntries(mapv, keyOrder, func(key protoreflect.MapKey, value protoreflect.Value) bool {\n\t\tb = protowire.AppendTag(b, fd.Number(), protowire.BytesType)\n\t\tvar pos int\n\t\tb, pos = appendSpeculativeLength(b)\n\n\t\tb, err = o.marshalField(b, keyf, key.Value())\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tb, err = o.marshalField(b, valf, value)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tb = finishSpeculativeLength(b, pos)\n\t\treturn true\n\t})\n\treturn b, err\n}\n\n// When encoding length-prefixed fields, we speculatively set aside some number of bytes\n// for the length, encode the data, and then encode the length (shifting the data if necessary\n// to make room).\nconst speculativeLength = 1\n\nfunc appendSpeculativeLength(b []byte) ([]byte, int) {\n\tpos := len(b)\n\tb = append(b, \"\\x00\\x00\\x00\\x00\"[:speculativeLength]...)\n\treturn b, pos\n}\n\nfunc finishSpeculativeLength(b []byte, pos int) []byte {\n\tmlen := len(b) - pos - speculativeLength\n\tmsiz := protowire.SizeVarint(uint64(mlen))\n\tif msiz != speculativeLength {\n\t\tfor i := 0; i < msiz-speculativeLength; i++ {\n\t\t\tb = append(b, 0)\n\t\t}\n\t\tcopy(b[pos+msiz:], b[pos+speculativeLength:])\n\t\tb = b[:pos+msiz+mlen]\n\t}\n\tprotowire.AppendVarint(b[:pos], uint64(mlen))\n\treturn b\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/encode_gen.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// Code generated by generate-types. DO NOT EDIT.\n\npackage proto\n\nimport (\n\t\"math\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nvar wireTypes = map[protoreflect.Kind]protowire.Type{\n\tprotoreflect.BoolKind:     protowire.VarintType,\n\tprotoreflect.EnumKind:     protowire.VarintType,\n\tprotoreflect.Int32Kind:    protowire.VarintType,\n\tprotoreflect.Sint32Kind:   protowire.VarintType,\n\tprotoreflect.Uint32Kind:   protowire.VarintType,\n\tprotoreflect.Int64Kind:    protowire.VarintType,\n\tprotoreflect.Sint64Kind:   protowire.VarintType,\n\tprotoreflect.Uint64Kind:   protowire.VarintType,\n\tprotoreflect.Sfixed32Kind: protowire.Fixed32Type,\n\tprotoreflect.Fixed32Kind:  protowire.Fixed32Type,\n\tprotoreflect.FloatKind:    protowire.Fixed32Type,\n\tprotoreflect.Sfixed64Kind: protowire.Fixed64Type,\n\tprotoreflect.Fixed64Kind:  protowire.Fixed64Type,\n\tprotoreflect.DoubleKind:   protowire.Fixed64Type,\n\tprotoreflect.StringKind:   protowire.BytesType,\n\tprotoreflect.BytesKind:    protowire.BytesType,\n\tprotoreflect.MessageKind:  protowire.BytesType,\n\tprotoreflect.GroupKind:    protowire.StartGroupType,\n}\n\nfunc (o MarshalOptions) marshalSingular(b []byte, fd protoreflect.FieldDescriptor, v protoreflect.Value) ([]byte, error) {\n\tswitch fd.Kind() {\n\tcase protoreflect.BoolKind:\n\t\tb = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))\n\tcase protoreflect.EnumKind:\n\t\tb = protowire.AppendVarint(b, uint64(v.Enum()))\n\tcase protoreflect.Int32Kind:\n\t\tb = protowire.AppendVarint(b, uint64(int32(v.Int())))\n\tcase protoreflect.Sint32Kind:\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))\n\tcase protoreflect.Uint32Kind:\n\t\tb = protowire.AppendVarint(b, uint64(uint32(v.Uint())))\n\tcase protoreflect.Int64Kind:\n\t\tb = protowire.AppendVarint(b, uint64(v.Int()))\n\tcase protoreflect.Sint64Kind:\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))\n\tcase protoreflect.Uint64Kind:\n\t\tb = protowire.AppendVarint(b, v.Uint())\n\tcase protoreflect.Sfixed32Kind:\n\t\tb = protowire.AppendFixed32(b, uint32(v.Int()))\n\tcase protoreflect.Fixed32Kind:\n\t\tb = protowire.AppendFixed32(b, uint32(v.Uint()))\n\tcase protoreflect.FloatKind:\n\t\tb = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))\n\tcase protoreflect.Sfixed64Kind:\n\t\tb = protowire.AppendFixed64(b, uint64(v.Int()))\n\tcase protoreflect.Fixed64Kind:\n\t\tb = protowire.AppendFixed64(b, v.Uint())\n\tcase protoreflect.DoubleKind:\n\t\tb = protowire.AppendFixed64(b, math.Float64bits(v.Float()))\n\tcase protoreflect.StringKind:\n\t\tif strs.EnforceUTF8(fd) && !utf8.ValidString(v.String()) {\n\t\t\treturn b, errors.InvalidUTF8(string(fd.FullName()))\n\t\t}\n\t\tb = protowire.AppendString(b, v.String())\n\tcase protoreflect.BytesKind:\n\t\tb = protowire.AppendBytes(b, v.Bytes())\n\tcase protoreflect.MessageKind:\n\t\tvar pos int\n\t\tvar err error\n\t\tb, pos = appendSpeculativeLength(b)\n\t\tb, err = o.marshalMessage(b, v.Message())\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t\tb = finishSpeculativeLength(b, pos)\n\tcase protoreflect.GroupKind:\n\t\tvar err error\n\t\tb, err = o.marshalMessage(b, v.Message())\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t\tb = protowire.AppendVarint(b, protowire.EncodeTag(fd.Number(), protowire.EndGroupType))\n\tdefault:\n\t\treturn b, errors.New(\"invalid kind %v\", fd.Kind())\n\t}\n\treturn b, nil\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/equal.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\"math\"\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\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 belong to the same message descriptor,\n// have the same set of populated known and extension field values,\n// and the same set of unknown fields values. If either of the top-level\n// messages are invalid, then Equal reports true only if both are invalid.\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\tif x == nil || y == nil {\n\t\treturn x == nil && y == nil\n\t}\n\tmx := x.ProtoReflect()\n\tmy := y.ProtoReflect()\n\tif mx.IsValid() != my.IsValid() {\n\t\treturn false\n\t}\n\treturn equalMessage(mx, my)\n}\n\n// equalMessage compares two messages.\nfunc equalMessage(mx, my pref.Message) bool {\n\tif mx.Descriptor() != my.Descriptor() {\n\t\treturn false\n\t}\n\n\tnx := 0\n\tequal := true\n\tmx.Range(func(fd pref.FieldDescriptor, vx pref.Value) bool {\n\t\tnx++\n\t\tvy := my.Get(fd)\n\t\tequal = my.Has(fd) && equalField(fd, vx, vy)\n\t\treturn equal\n\t})\n\tif !equal {\n\t\treturn false\n\t}\n\tny := 0\n\tmy.Range(func(fd pref.FieldDescriptor, vx pref.Value) bool {\n\t\tny++\n\t\treturn true\n\t})\n\tif nx != ny {\n\t\treturn false\n\t}\n\n\treturn equalUnknown(mx.GetUnknown(), my.GetUnknown())\n}\n\n// equalField compares two fields.\nfunc equalField(fd pref.FieldDescriptor, x, y pref.Value) bool {\n\tswitch {\n\tcase fd.IsList():\n\t\treturn equalList(fd, x.List(), y.List())\n\tcase fd.IsMap():\n\t\treturn equalMap(fd, x.Map(), y.Map())\n\tdefault:\n\t\treturn equalValue(fd, x, y)\n\t}\n}\n\n// equalMap compares two maps.\nfunc equalMap(fd pref.FieldDescriptor, x, y pref.Map) bool {\n\tif x.Len() != y.Len() {\n\t\treturn false\n\t}\n\tequal := true\n\tx.Range(func(k pref.MapKey, vx pref.Value) bool {\n\t\tvy := y.Get(k)\n\t\tequal = y.Has(k) && equalValue(fd.MapValue(), vx, vy)\n\t\treturn equal\n\t})\n\treturn equal\n}\n\n// equalList compares two lists.\nfunc equalList(fd pref.FieldDescriptor, x, y pref.List) bool {\n\tif x.Len() != y.Len() {\n\t\treturn false\n\t}\n\tfor i := x.Len() - 1; i >= 0; i-- {\n\t\tif !equalValue(fd, x.Get(i), y.Get(i)) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\n// equalValue compares two singular values.\nfunc equalValue(fd pref.FieldDescriptor, x, y pref.Value) bool {\n\tswitch fd.Kind() {\n\tcase pref.BoolKind:\n\t\treturn x.Bool() == y.Bool()\n\tcase pref.EnumKind:\n\t\treturn x.Enum() == y.Enum()\n\tcase pref.Int32Kind, pref.Sint32Kind,\n\t\tpref.Int64Kind, pref.Sint64Kind,\n\t\tpref.Sfixed32Kind, pref.Sfixed64Kind:\n\t\treturn x.Int() == y.Int()\n\tcase pref.Uint32Kind, pref.Uint64Kind,\n\t\tpref.Fixed32Kind, pref.Fixed64Kind:\n\t\treturn x.Uint() == y.Uint()\n\tcase pref.FloatKind, pref.DoubleKind:\n\t\tfx := x.Float()\n\t\tfy := y.Float()\n\t\tif math.IsNaN(fx) || math.IsNaN(fy) {\n\t\t\treturn math.IsNaN(fx) && math.IsNaN(fy)\n\t\t}\n\t\treturn fx == fy\n\tcase pref.StringKind:\n\t\treturn x.String() == y.String()\n\tcase pref.BytesKind:\n\t\treturn bytes.Equal(x.Bytes(), y.Bytes())\n\tcase pref.MessageKind, pref.GroupKind:\n\t\treturn equalMessage(x.Message(), y.Message())\n\tdefault:\n\t\treturn x.Interface() == y.Interface()\n\t}\n}\n\n// equalUnknown compares unknown fields by direct comparison on the raw bytes\n// of each individual field number.\nfunc equalUnknown(x, y pref.RawFields) bool {\n\tif len(x) != len(y) {\n\t\treturn false\n\t}\n\tif bytes.Equal([]byte(x), []byte(y)) {\n\t\treturn true\n\t}\n\n\tmx := make(map[pref.FieldNumber]pref.RawFields)\n\tmy := make(map[pref.FieldNumber]pref.RawFields)\n\tfor len(x) > 0 {\n\t\tfnum, _, n := protowire.ConsumeField(x)\n\t\tmx[fnum] = append(mx[fnum], x[:n]...)\n\t\tx = x[n:]\n\t}\n\tfor len(y) > 0 {\n\t\tfnum, _, n := protowire.ConsumeField(y)\n\t\tmy[fnum] = append(my[fnum], y[:n]...)\n\t\ty = y[n:]\n\t}\n\treturn reflect.DeepEqual(mx, my)\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/extension.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// HasExtension reports whether an extension field is populated.\n// It returns false if m is invalid or if xt does not extend m.\nfunc HasExtension(m Message, xt protoreflect.ExtensionType) bool {\n\t// Treat nil message interface as an empty message; no populated fields.\n\tif m == nil {\n\t\treturn false\n\t}\n\n\t// As a special-case, we reports invalid or mismatching descriptors\n\t// as always not being populated (since they aren't).\n\tif xt == nil || m.ProtoReflect().Descriptor() != xt.TypeDescriptor().ContainingMessage() {\n\t\treturn false\n\t}\n\n\treturn m.ProtoReflect().Has(xt.TypeDescriptor())\n}\n\n// ClearExtension clears an extension field such that subsequent\n// HasExtension calls return false.\n// It panics if m is invalid or if xt does not extend m.\nfunc ClearExtension(m Message, xt protoreflect.ExtensionType) {\n\tm.ProtoReflect().Clear(xt.TypeDescriptor())\n}\n\n// GetExtension retrieves the value for an extension field.\n// If the field is unpopulated, it returns the default value for\n// scalars and an immutable, empty value for lists or messages.\n// It panics if xt does not extend m.\nfunc GetExtension(m Message, xt protoreflect.ExtensionType) interface{} {\n\t// Treat nil message interface as an empty message; return the default.\n\tif m == nil {\n\t\treturn xt.InterfaceOf(xt.Zero())\n\t}\n\n\treturn xt.InterfaceOf(m.ProtoReflect().Get(xt.TypeDescriptor()))\n}\n\n// SetExtension stores the value of an extension field.\n// It panics if m is invalid, xt does not extend m, or if type of v\n// is invalid for the specified extension field.\nfunc SetExtension(m Message, xt protoreflect.ExtensionType, v interface{}) {\n\txd := xt.TypeDescriptor()\n\tpv := xt.ValueOf(v)\n\n\t// Specially treat an invalid list, map, or message as clear.\n\tisValid := true\n\tswitch {\n\tcase xd.IsList():\n\t\tisValid = pv.List().IsValid()\n\tcase xd.IsMap():\n\t\tisValid = pv.Map().IsValid()\n\tcase xd.Message() != nil:\n\t\tisValid = pv.Message().IsValid()\n\t}\n\tif !isValid {\n\t\tm.ProtoReflect().Clear(xd)\n\t\treturn\n\t}\n\n\tm.ProtoReflect().Set(xd, pv)\n}\n\n// RangeExtensions iterates over every populated extension field in m in an\n// undefined order, calling f for each extension type and value encountered.\n// It returns immediately if f returns false.\n// While iterating, mutating operations may only be performed\n// on the current extension field.\nfunc RangeExtensions(m Message, f func(protoreflect.ExtensionType, interface{}) bool) {\n\t// Treat nil message interface as an empty message; nothing to range over.\n\tif m == nil {\n\t\treturn\n\t}\n\n\tm.ProtoReflect().Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tif fd.IsExtension() {\n\t\t\txt := fd.(protoreflect.ExtensionTypeDescriptor).Type()\n\t\t\tvi := xt.InterfaceOf(v)\n\t\t\treturn f(xt, vi)\n\t\t}\n\t\treturn true\n\t})\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/merge.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\"fmt\"\n\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// Merge merges src into dst, which must be a message with the same descriptor.\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.\n//\n// It is semantically equivalent to unmarshaling the encoded form of src\n// into dst with the UnmarshalOptions.Merge option specified.\nfunc Merge(dst, src Message) {\n\t// TODO: Should nil src be treated as semantically equivalent to a\n\t// untyped, read-only, empty message? What about a nil dst?\n\n\tdstMsg, srcMsg := dst.ProtoReflect(), src.ProtoReflect()\n\tif dstMsg.Descriptor() != srcMsg.Descriptor() {\n\t\tif got, want := dstMsg.Descriptor().FullName(), srcMsg.Descriptor().FullName(); got != want {\n\t\t\tpanic(fmt.Sprintf(\"descriptor mismatch: %v != %v\", got, want))\n\t\t}\n\t\tpanic(\"descriptor mismatch\")\n\t}\n\tmergeOptions{}.mergeMessage(dstMsg, srcMsg)\n}\n\n// Clone returns a deep copy of m.\n// If the top-level message is invalid, it returns an invalid message as well.\nfunc Clone(m Message) Message {\n\t// NOTE: Most usages of Clone assume the following properties:\n\t//\tt := reflect.TypeOf(m)\n\t//\tt == reflect.TypeOf(m.ProtoReflect().New().Interface())\n\t//\tt == reflect.TypeOf(m.ProtoReflect().Type().Zero().Interface())\n\t//\n\t// Embedding protobuf messages breaks this since the parent type will have\n\t// a forwarded ProtoReflect method, but the Interface method will return\n\t// the underlying embedded message type.\n\tif m == nil {\n\t\treturn nil\n\t}\n\tsrc := m.ProtoReflect()\n\tif !src.IsValid() {\n\t\treturn src.Type().Zero().Interface()\n\t}\n\tdst := src.New()\n\tmergeOptions{}.mergeMessage(dst, src)\n\treturn dst.Interface()\n}\n\n// mergeOptions provides a namespace for merge functions, and can be\n// exported in the future if we add user-visible merge options.\ntype mergeOptions struct{}\n\nfunc (o mergeOptions) mergeMessage(dst, src protoreflect.Message) {\n\tmethods := protoMethods(dst)\n\tif methods != nil && methods.Merge != nil {\n\t\tin := protoiface.MergeInput{\n\t\t\tDestination: dst,\n\t\t\tSource:      src,\n\t\t}\n\t\tout := methods.Merge(in)\n\t\tif out.Flags&protoiface.MergeComplete != 0 {\n\t\t\treturn\n\t\t}\n\t}\n\n\tif !dst.IsValid() {\n\t\tpanic(fmt.Sprintf(\"cannot merge into invalid %v message\", dst.Descriptor().FullName()))\n\t}\n\n\tsrc.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tswitch {\n\t\tcase fd.IsList():\n\t\t\to.mergeList(dst.Mutable(fd).List(), v.List(), fd)\n\t\tcase fd.IsMap():\n\t\t\to.mergeMap(dst.Mutable(fd).Map(), v.Map(), fd.MapValue())\n\t\tcase fd.Message() != nil:\n\t\t\to.mergeMessage(dst.Mutable(fd).Message(), v.Message())\n\t\tcase fd.Kind() == protoreflect.BytesKind:\n\t\t\tdst.Set(fd, o.cloneBytes(v))\n\t\tdefault:\n\t\t\tdst.Set(fd, v)\n\t\t}\n\t\treturn true\n\t})\n\n\tif len(src.GetUnknown()) > 0 {\n\t\tdst.SetUnknown(append(dst.GetUnknown(), src.GetUnknown()...))\n\t}\n}\n\nfunc (o mergeOptions) mergeList(dst, src protoreflect.List, fd protoreflect.FieldDescriptor) {\n\t// Merge semantics appends to the end of the existing list.\n\tfor i, n := 0, src.Len(); i < n; i++ {\n\t\tswitch v := src.Get(i); {\n\t\tcase fd.Message() != nil:\n\t\t\tdstv := dst.NewElement()\n\t\t\to.mergeMessage(dstv.Message(), v.Message())\n\t\t\tdst.Append(dstv)\n\t\tcase fd.Kind() == protoreflect.BytesKind:\n\t\t\tdst.Append(o.cloneBytes(v))\n\t\tdefault:\n\t\t\tdst.Append(v)\n\t\t}\n\t}\n}\n\nfunc (o mergeOptions) mergeMap(dst, src protoreflect.Map, fd protoreflect.FieldDescriptor) {\n\t// Merge semantics replaces, rather than merges into existing entries.\n\tsrc.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {\n\t\tswitch {\n\t\tcase fd.Message() != nil:\n\t\t\tdstv := dst.NewValue()\n\t\t\to.mergeMessage(dstv.Message(), v.Message())\n\t\t\tdst.Set(k, dstv)\n\t\tcase fd.Kind() == protoreflect.BytesKind:\n\t\t\tdst.Set(k, o.cloneBytes(v))\n\t\tdefault:\n\t\t\tdst.Set(k, v)\n\t\t}\n\t\treturn true\n\t})\n}\n\nfunc (o mergeOptions) cloneBytes(v protoreflect.Value) protoreflect.Value {\n\treturn protoreflect.ValueOfBytes(append([]byte{}, v.Bytes()...))\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/messageset.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/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/internal/order\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\nfunc (o MarshalOptions) sizeMessageSet(m protoreflect.Message) (size int) {\n\tm.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tsize += messageset.SizeField(fd.Number())\n\t\tsize += protowire.SizeTag(messageset.FieldMessage)\n\t\tsize += protowire.SizeBytes(o.size(v.Message()))\n\t\treturn true\n\t})\n\tsize += messageset.SizeUnknown(m.GetUnknown())\n\treturn size\n}\n\nfunc (o MarshalOptions) marshalMessageSet(b []byte, m protoreflect.Message) ([]byte, error) {\n\tif !flags.ProtoLegacy {\n\t\treturn b, errors.New(\"no support for message_set_wire_format\")\n\t}\n\tfieldOrder := order.AnyFieldOrder\n\tif o.Deterministic {\n\t\tfieldOrder = order.NumberFieldOrder\n\t}\n\tvar err error\n\torder.RangeFields(m, fieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tb, err = o.marshalMessageSetField(b, fd, v)\n\t\treturn err == nil\n\t})\n\tif err != nil {\n\t\treturn b, err\n\t}\n\treturn messageset.AppendUnknown(b, m.GetUnknown())\n}\n\nfunc (o MarshalOptions) marshalMessageSetField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) {\n\tb = messageset.AppendFieldStart(b, fd.Number())\n\tb = protowire.AppendTag(b, messageset.FieldMessage, protowire.BytesType)\n\tb = protowire.AppendVarint(b, uint64(o.Size(value.Message().Interface())))\n\tb, err := o.marshalMessage(b, value.Message())\n\tif err != nil {\n\t\treturn b, err\n\t}\n\tb = messageset.AppendFieldEnd(b)\n\treturn b, nil\n}\n\nfunc (o UnmarshalOptions) unmarshalMessageSet(b []byte, m protoreflect.Message) error {\n\tif !flags.ProtoLegacy {\n\t\treturn errors.New(\"no support for message_set_wire_format\")\n\t}\n\treturn messageset.Unmarshal(b, false, func(num protowire.Number, v []byte) error {\n\t\terr := o.unmarshalMessageSetField(m, num, v)\n\t\tif err == errUnknown {\n\t\t\tunknown := m.GetUnknown()\n\t\t\tunknown = protowire.AppendTag(unknown, num, protowire.BytesType)\n\t\t\tunknown = protowire.AppendBytes(unknown, v)\n\t\t\tm.SetUnknown(unknown)\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t})\n}\n\nfunc (o UnmarshalOptions) unmarshalMessageSetField(m protoreflect.Message, num protowire.Number, v []byte) error {\n\tmd := m.Descriptor()\n\tif !md.ExtensionRanges().Has(num) {\n\t\treturn errUnknown\n\t}\n\txt, err := o.Resolver.FindExtensionByNumber(md.FullName(), num)\n\tif err == protoregistry.NotFound {\n\t\treturn errUnknown\n\t}\n\tif err != nil {\n\t\treturn errors.New(\"%v: unable to resolve extension %v: %v\", md.FullName(), num, err)\n\t}\n\txd := xt.TypeDescriptor()\n\tif err := o.unmarshalMessage(v, m.Mutable(xd).Message()); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/proto.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\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// Message is the top-level interface that all messages must implement.\n// It provides access to a reflective view of a message.\n// Any implementation of this interface may be used with all functions in the\n// protobuf module that accept a Message, except where otherwise specified.\n//\n// This is the v2 interface definition for protobuf messages.\n// The v1 interface definition is \"github.com/golang/protobuf/proto\".Message.\n//\n// To convert a v1 message to a v2 message,\n// use \"github.com/golang/protobuf/proto\".MessageV2.\n// To convert a v2 message to a v1 message,\n// use \"github.com/golang/protobuf/proto\".MessageV1.\ntype Message = protoreflect.ProtoMessage\n\n// Error matches all errors produced by packages in the protobuf module.\n//\n// That is, errors.Is(err, Error) reports whether an error is produced\n// by this module.\nvar Error error\n\nfunc init() {\n\tError = errors.Error\n}\n\n// MessageName returns the full name of m.\n// If m is nil, it returns an empty string.\nfunc MessageName(m Message) protoreflect.FullName {\n\tif m == nil {\n\t\treturn \"\"\n\t}\n\treturn m.ProtoReflect().Descriptor().FullName()\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/proto_methods.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// The protoreflect build tag disables use of fast-path methods.\n// +build !protoreflect\n\npackage proto\n\nimport (\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n)\n\nconst hasProtoMethods = true\n\nfunc protoMethods(m protoreflect.Message) *protoiface.Methods {\n\treturn m.ProtoMethods()\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/proto_reflect.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// The protoreflect build tag disables use of fast-path methods.\n// +build protoreflect\n\npackage proto\n\nimport (\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n)\n\nconst hasProtoMethods = false\n\nfunc protoMethods(m protoreflect.Message) *protoiface.Methods {\n\treturn nil\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/reset.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\"fmt\"\n\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// Reset clears every field in the message.\n// The resulting message shares no observable memory with its previous state\n// other than the memory for the message itself.\nfunc Reset(m Message) {\n\tif mr, ok := m.(interface{ Reset() }); ok && hasProtoMethods {\n\t\tmr.Reset()\n\t\treturn\n\t}\n\tresetMessage(m.ProtoReflect())\n}\n\nfunc resetMessage(m protoreflect.Message) {\n\tif !m.IsValid() {\n\t\tpanic(fmt.Sprintf(\"cannot reset invalid %v message\", m.Descriptor().FullName()))\n\t}\n\n\t// Clear all known fields.\n\tfds := m.Descriptor().Fields()\n\tfor i := 0; i < fds.Len(); i++ {\n\t\tm.Clear(fds.Get(i))\n\t}\n\n\t// Clear extension fields.\n\tm.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {\n\t\tm.Clear(fd)\n\t\treturn true\n\t})\n\n\t// Clear unknown fields.\n\tm.SetUnknown(nil)\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/size.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/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\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\treturn MarshalOptions{}.Size(m)\n}\n\n// Size returns the size in bytes of the wire-format encoding of m.\nfunc (o MarshalOptions) Size(m Message) int {\n\t// Treat a nil message interface as an empty message; nothing to output.\n\tif m == nil {\n\t\treturn 0\n\t}\n\n\treturn o.size(m.ProtoReflect())\n}\n\n// size is a centralized function that all size operations go through.\n// For profiling purposes, avoid changing the name of this function or\n// introducing other code paths for size that do not go through this.\nfunc (o MarshalOptions) size(m protoreflect.Message) (size int) {\n\tmethods := protoMethods(m)\n\tif methods != nil && methods.Size != nil {\n\t\tout := methods.Size(protoiface.SizeInput{\n\t\t\tMessage: m,\n\t\t})\n\t\treturn out.Size\n\t}\n\tif methods != nil && methods.Marshal != nil {\n\t\t// This is not efficient, but we don't have any choice.\n\t\t// This case is mainly used for legacy types with a Marshal method.\n\t\tout, _ := methods.Marshal(protoiface.MarshalInput{\n\t\t\tMessage: m,\n\t\t})\n\t\treturn len(out.Buf)\n\t}\n\treturn o.sizeMessageSlow(m)\n}\n\nfunc (o MarshalOptions) sizeMessageSlow(m protoreflect.Message) (size int) {\n\tif messageset.IsMessageSet(m.Descriptor()) {\n\t\treturn o.sizeMessageSet(m)\n\t}\n\tm.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tsize += o.sizeField(fd, v)\n\t\treturn true\n\t})\n\tsize += len(m.GetUnknown())\n\treturn size\n}\n\nfunc (o MarshalOptions) sizeField(fd protoreflect.FieldDescriptor, value protoreflect.Value) (size int) {\n\tnum := fd.Number()\n\tswitch {\n\tcase fd.IsList():\n\t\treturn o.sizeList(num, fd, value.List())\n\tcase fd.IsMap():\n\t\treturn o.sizeMap(num, fd, value.Map())\n\tdefault:\n\t\treturn protowire.SizeTag(num) + o.sizeSingular(num, fd.Kind(), value)\n\t}\n}\n\nfunc (o MarshalOptions) sizeList(num protowire.Number, fd protoreflect.FieldDescriptor, list protoreflect.List) (size int) {\n\tif fd.IsPacked() && list.Len() > 0 {\n\t\tcontent := 0\n\t\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\t\tcontent += o.sizeSingular(num, fd.Kind(), list.Get(i))\n\t\t}\n\t\treturn protowire.SizeTag(num) + protowire.SizeBytes(content)\n\t}\n\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tsize += protowire.SizeTag(num) + o.sizeSingular(num, fd.Kind(), list.Get(i))\n\t}\n\treturn size\n}\n\nfunc (o MarshalOptions) sizeMap(num protowire.Number, fd protoreflect.FieldDescriptor, mapv protoreflect.Map) (size int) {\n\tmapv.Range(func(key protoreflect.MapKey, value protoreflect.Value) bool {\n\t\tsize += protowire.SizeTag(num)\n\t\tsize += protowire.SizeBytes(o.sizeField(fd.MapKey(), key.Value()) + o.sizeField(fd.MapValue(), value))\n\t\treturn true\n\t})\n\treturn size\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/proto/size_gen.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// Code generated by generate-types. DO NOT EDIT.\n\npackage proto\n\nimport (\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nfunc (o MarshalOptions) sizeSingular(num protowire.Number, kind protoreflect.Kind, v protoreflect.Value) int {\n\tswitch kind {\n\tcase protoreflect.BoolKind:\n\t\treturn protowire.SizeVarint(protowire.EncodeBool(v.Bool()))\n\tcase protoreflect.EnumKind:\n\t\treturn protowire.SizeVarint(uint64(v.Enum()))\n\tcase protoreflect.Int32Kind:\n\t\treturn protowire.SizeVarint(uint64(int32(v.Int())))\n\tcase protoreflect.Sint32Kind:\n\t\treturn protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))\n\tcase protoreflect.Uint32Kind:\n\t\treturn protowire.SizeVarint(uint64(uint32(v.Uint())))\n\tcase protoreflect.Int64Kind:\n\t\treturn protowire.SizeVarint(uint64(v.Int()))\n\tcase protoreflect.Sint64Kind:\n\t\treturn protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))\n\tcase protoreflect.Uint64Kind:\n\t\treturn protowire.SizeVarint(v.Uint())\n\tcase protoreflect.Sfixed32Kind:\n\t\treturn protowire.SizeFixed32()\n\tcase protoreflect.Fixed32Kind:\n\t\treturn protowire.SizeFixed32()\n\tcase protoreflect.FloatKind:\n\t\treturn protowire.SizeFixed32()\n\tcase protoreflect.Sfixed64Kind:\n\t\treturn protowire.SizeFixed64()\n\tcase protoreflect.Fixed64Kind:\n\t\treturn protowire.SizeFixed64()\n\tcase protoreflect.DoubleKind:\n\t\treturn protowire.SizeFixed64()\n\tcase protoreflect.StringKind:\n\t\treturn protowire.SizeBytes(len(v.String()))\n\tcase protoreflect.BytesKind:\n\t\treturn protowire.SizeBytes(len(v.Bytes()))\n\tcase protoreflect.MessageKind:\n\t\treturn protowire.SizeBytes(o.size(v.Message()))\n\tcase protoreflect.GroupKind:\n\t\treturn protowire.SizeGroup(num, o.size(v.Message()))\n\tdefault:\n\t\treturn 0\n\t}\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/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// 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// 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// 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// String stores v in a new string value and returns a pointer to it.\nfunc String(v string) *string { return &v }\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protodesc/desc.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 protodesc provides functionality for converting\n// FileDescriptorProto messages to/from protoreflect.FileDescriptor values.\n//\n// The google.protobuf.FileDescriptorProto is a protobuf message that describes\n// the type information for a .proto file in a form that is easily serializable.\n// The protoreflect.FileDescriptor is a more structured representation of\n// the FileDescriptorProto message where references and remote dependencies\n// can be directly followed.\npackage protodesc\n\nimport (\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/internal/strs\"\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\t\"google.golang.org/protobuf/types/descriptorpb\"\n)\n\n// Resolver is the resolver used by NewFile to resolve dependencies.\n// The enums and messages provided must belong to some parent file,\n// which is also registered.\n//\n// It is implemented by protoregistry.Files.\ntype Resolver interface {\n\tFindFileByPath(string) (protoreflect.FileDescriptor, error)\n\tFindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error)\n}\n\n// FileOptions configures the construction of file descriptors.\ntype FileOptions struct {\n\tpragma.NoUnkeyedLiterals\n\n\t// AllowUnresolvable configures New to permissively allow unresolvable\n\t// file, enum, or message dependencies. Unresolved dependencies are replaced\n\t// by placeholder equivalents.\n\t//\n\t// The following dependencies may be left unresolved:\n\t//\t• Resolving an imported file.\n\t//\t• Resolving the type for a message field or extension field.\n\t//\tIf the kind of the field is unknown, then a placeholder is used for both\n\t//\tthe Enum and Message accessors on the protoreflect.FieldDescriptor.\n\t//\t• Resolving an enum value set as the default for an optional enum field.\n\t//\tIf unresolvable, the protoreflect.FieldDescriptor.Default is set to the\n\t//\tfirst value in the associated enum (or zero if the also enum dependency\n\t//\tis also unresolvable). The protoreflect.FieldDescriptor.DefaultEnumValue\n\t//\tis populated with a placeholder.\n\t//\t• Resolving the extended message type for an extension field.\n\t//\t• Resolving the input or output message type for a service method.\n\t//\n\t// If the unresolved dependency uses a relative name,\n\t// then the placeholder will contain an invalid FullName with a \"*.\" prefix,\n\t// indicating that the starting prefix of the full name is unknown.\n\tAllowUnresolvable bool\n}\n\n// NewFile creates a new protoreflect.FileDescriptor from the provided\n// file descriptor message. See FileOptions.New for more information.\nfunc NewFile(fd *descriptorpb.FileDescriptorProto, r Resolver) (protoreflect.FileDescriptor, error) {\n\treturn FileOptions{}.New(fd, r)\n}\n\n// NewFiles creates a new protoregistry.Files from the provided\n// FileDescriptorSet message. See FileOptions.NewFiles for more information.\nfunc NewFiles(fd *descriptorpb.FileDescriptorSet) (*protoregistry.Files, error) {\n\treturn FileOptions{}.NewFiles(fd)\n}\n\n// New creates a new protoreflect.FileDescriptor from the provided\n// file descriptor message. The file must represent a valid proto file according\n// to protobuf semantics. The returned descriptor is a deep copy of the input.\n//\n// Any imported files, enum types, or message types referenced in the file are\n// resolved using the provided registry. When looking up an import file path,\n// the path must be unique. The newly created file descriptor is not registered\n// back into the provided file registry.\nfunc (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (protoreflect.FileDescriptor, error) {\n\tif r == nil {\n\t\tr = (*protoregistry.Files)(nil) // empty resolver\n\t}\n\n\t// Handle the file descriptor content.\n\tf := &filedesc.File{L2: &filedesc.FileL2{}}\n\tswitch fd.GetSyntax() {\n\tcase \"proto2\", \"\":\n\t\tf.L1.Syntax = protoreflect.Proto2\n\tcase \"proto3\":\n\t\tf.L1.Syntax = protoreflect.Proto3\n\tdefault:\n\t\treturn nil, errors.New(\"invalid syntax: %q\", fd.GetSyntax())\n\t}\n\tf.L1.Path = fd.GetName()\n\tif f.L1.Path == \"\" {\n\t\treturn nil, errors.New(\"file path must be populated\")\n\t}\n\tf.L1.Package = protoreflect.FullName(fd.GetPackage())\n\tif !f.L1.Package.IsValid() && f.L1.Package != \"\" {\n\t\treturn nil, errors.New(\"invalid package: %q\", f.L1.Package)\n\t}\n\tif opts := fd.GetOptions(); opts != nil {\n\t\topts = proto.Clone(opts).(*descriptorpb.FileOptions)\n\t\tf.L2.Options = func() protoreflect.ProtoMessage { return opts }\n\t}\n\n\tf.L2.Imports = make(filedesc.FileImports, len(fd.GetDependency()))\n\tfor _, i := range fd.GetPublicDependency() {\n\t\tif !(0 <= i && int(i) < len(f.L2.Imports)) || f.L2.Imports[i].IsPublic {\n\t\t\treturn nil, errors.New(\"invalid or duplicate public import index: %d\", i)\n\t\t}\n\t\tf.L2.Imports[i].IsPublic = true\n\t}\n\tfor _, i := range fd.GetWeakDependency() {\n\t\tif !(0 <= i && int(i) < len(f.L2.Imports)) || f.L2.Imports[i].IsWeak {\n\t\t\treturn nil, errors.New(\"invalid or duplicate weak import index: %d\", i)\n\t\t}\n\t\tf.L2.Imports[i].IsWeak = true\n\t}\n\timps := importSet{f.Path(): true}\n\tfor i, path := range fd.GetDependency() {\n\t\timp := &f.L2.Imports[i]\n\t\tf, err := r.FindFileByPath(path)\n\t\tif err == protoregistry.NotFound && (o.AllowUnresolvable || imp.IsWeak) {\n\t\t\tf = filedesc.PlaceholderFile(path)\n\t\t} else if err != nil {\n\t\t\treturn nil, errors.New(\"could not resolve import %q: %v\", path, err)\n\t\t}\n\t\timp.FileDescriptor = f\n\n\t\tif imps[imp.Path()] {\n\t\t\treturn nil, errors.New(\"already imported %q\", path)\n\t\t}\n\t\timps[imp.Path()] = true\n\t}\n\tfor i := range fd.GetDependency() {\n\t\timp := &f.L2.Imports[i]\n\t\timps.importPublic(imp.Imports())\n\t}\n\n\t// Handle source locations.\n\tf.L2.Locations.File = f\n\tfor _, loc := range fd.GetSourceCodeInfo().GetLocation() {\n\t\tvar l protoreflect.SourceLocation\n\t\t// TODO: Validate that the path points to an actual declaration?\n\t\tl.Path = protoreflect.SourcePath(loc.GetPath())\n\t\ts := loc.GetSpan()\n\t\tswitch len(s) {\n\t\tcase 3:\n\t\t\tl.StartLine, l.StartColumn, l.EndLine, l.EndColumn = int(s[0]), int(s[1]), int(s[0]), int(s[2])\n\t\tcase 4:\n\t\t\tl.StartLine, l.StartColumn, l.EndLine, l.EndColumn = int(s[0]), int(s[1]), int(s[2]), int(s[3])\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"invalid span: %v\", s)\n\t\t}\n\t\t// TODO: Validate that the span information is sensible?\n\t\t// See https://github.com/protocolbuffers/protobuf/issues/6378.\n\t\tif false && (l.EndLine < l.StartLine || l.StartLine < 0 || l.StartColumn < 0 || l.EndColumn < 0 ||\n\t\t\t(l.StartLine == l.EndLine && l.EndColumn <= l.StartColumn)) {\n\t\t\treturn nil, errors.New(\"invalid span: %v\", s)\n\t\t}\n\t\tl.LeadingDetachedComments = loc.GetLeadingDetachedComments()\n\t\tl.LeadingComments = loc.GetLeadingComments()\n\t\tl.TrailingComments = loc.GetTrailingComments()\n\t\tf.L2.Locations.List = append(f.L2.Locations.List, l)\n\t}\n\n\t// Step 1: Allocate and derive the names for all declarations.\n\t// This copies all fields from the descriptor proto except:\n\t//\tgoogle.protobuf.FieldDescriptorProto.type_name\n\t//\tgoogle.protobuf.FieldDescriptorProto.default_value\n\t//\tgoogle.protobuf.FieldDescriptorProto.oneof_index\n\t//\tgoogle.protobuf.FieldDescriptorProto.extendee\n\t//\tgoogle.protobuf.MethodDescriptorProto.input\n\t//\tgoogle.protobuf.MethodDescriptorProto.output\n\tvar err error\n\tsb := new(strs.Builder)\n\tr1 := make(descsByName)\n\tif f.L1.Enums.List, err = r1.initEnumDeclarations(fd.GetEnumType(), f, sb); err != nil {\n\t\treturn nil, err\n\t}\n\tif f.L1.Messages.List, err = r1.initMessagesDeclarations(fd.GetMessageType(), f, sb); err != nil {\n\t\treturn nil, err\n\t}\n\tif f.L1.Extensions.List, err = r1.initExtensionDeclarations(fd.GetExtension(), f, sb); err != nil {\n\t\treturn nil, err\n\t}\n\tif f.L1.Services.List, err = r1.initServiceDeclarations(fd.GetService(), f, sb); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Step 2: Resolve every dependency reference not handled by step 1.\n\tr2 := &resolver{local: r1, remote: r, imports: imps, allowUnresolvable: o.AllowUnresolvable}\n\tif err := r2.resolveMessageDependencies(f.L1.Messages.List, fd.GetMessageType()); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := r2.resolveExtensionDependencies(f.L1.Extensions.List, fd.GetExtension()); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := r2.resolveServiceDependencies(f.L1.Services.List, fd.GetService()); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Step 3: Validate every enum, message, and extension declaration.\n\tif err := validateEnumDeclarations(f.L1.Enums.List, fd.GetEnumType()); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := validateMessageDeclarations(f.L1.Messages.List, fd.GetMessageType()); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := validateExtensionDeclarations(f.L1.Extensions.List, fd.GetExtension()); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn f, nil\n}\n\ntype importSet map[string]bool\n\nfunc (is importSet) importPublic(imps protoreflect.FileImports) {\n\tfor i := 0; i < imps.Len(); i++ {\n\t\tif imp := imps.Get(i); imp.IsPublic {\n\t\t\tis[imp.Path()] = true\n\t\t\tis.importPublic(imp.Imports())\n\t\t}\n\t}\n}\n\n// NewFiles creates a new protoregistry.Files from the provided\n// FileDescriptorSet message. The descriptor set must include only\n// valid files according to protobuf semantics. The returned descriptors\n// are a deep copy of the input.\nfunc (o FileOptions) NewFiles(fds *descriptorpb.FileDescriptorSet) (*protoregistry.Files, error) {\n\tfiles := make(map[string]*descriptorpb.FileDescriptorProto)\n\tfor _, fd := range fds.File {\n\t\tif _, ok := files[fd.GetName()]; ok {\n\t\t\treturn nil, errors.New(\"file appears multiple times: %q\", fd.GetName())\n\t\t}\n\t\tfiles[fd.GetName()] = fd\n\t}\n\tr := &protoregistry.Files{}\n\tfor _, fd := range files {\n\t\tif err := o.addFileDeps(r, fd, files); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn r, nil\n}\nfunc (o FileOptions) addFileDeps(r *protoregistry.Files, fd *descriptorpb.FileDescriptorProto, files map[string]*descriptorpb.FileDescriptorProto) error {\n\t// Set the entry to nil while descending into a file's dependencies to detect cycles.\n\tfiles[fd.GetName()] = nil\n\tfor _, dep := range fd.Dependency {\n\t\tdepfd, ok := files[dep]\n\t\tif depfd == nil {\n\t\t\tif ok {\n\t\t\t\treturn errors.New(\"import cycle in file: %q\", dep)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif err := o.addFileDeps(r, depfd, files); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Delete the entry once dependencies are processed.\n\tdelete(files, fd.GetName())\n\tf, err := o.New(fd, r)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn r.RegisterFile(f)\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protodesc/desc_init.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 protodesc\n\nimport (\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\n\t\"google.golang.org/protobuf/types/descriptorpb\"\n)\n\ntype descsByName map[protoreflect.FullName]protoreflect.Descriptor\n\nfunc (r descsByName) initEnumDeclarations(eds []*descriptorpb.EnumDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (es []filedesc.Enum, err error) {\n\tes = make([]filedesc.Enum, len(eds)) // allocate up-front to ensure stable pointers\n\tfor i, ed := range eds {\n\t\te := &es[i]\n\t\te.L2 = new(filedesc.EnumL2)\n\t\tif e.L0, err = r.makeBase(e, parent, ed.GetName(), i, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif opts := ed.GetOptions(); opts != nil {\n\t\t\topts = proto.Clone(opts).(*descriptorpb.EnumOptions)\n\t\t\te.L2.Options = func() protoreflect.ProtoMessage { return opts }\n\t\t}\n\t\tfor _, s := range ed.GetReservedName() {\n\t\t\te.L2.ReservedNames.List = append(e.L2.ReservedNames.List, protoreflect.Name(s))\n\t\t}\n\t\tfor _, rr := range ed.GetReservedRange() {\n\t\t\te.L2.ReservedRanges.List = append(e.L2.ReservedRanges.List, [2]protoreflect.EnumNumber{\n\t\t\t\tprotoreflect.EnumNumber(rr.GetStart()),\n\t\t\t\tprotoreflect.EnumNumber(rr.GetEnd()),\n\t\t\t})\n\t\t}\n\t\tif e.L2.Values.List, err = r.initEnumValuesFromDescriptorProto(ed.GetValue(), e, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn es, nil\n}\n\nfunc (r descsByName) initEnumValuesFromDescriptorProto(vds []*descriptorpb.EnumValueDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (vs []filedesc.EnumValue, err error) {\n\tvs = make([]filedesc.EnumValue, len(vds)) // allocate up-front to ensure stable pointers\n\tfor i, vd := range vds {\n\t\tv := &vs[i]\n\t\tif v.L0, err = r.makeBase(v, parent, vd.GetName(), i, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif opts := vd.GetOptions(); opts != nil {\n\t\t\topts = proto.Clone(opts).(*descriptorpb.EnumValueOptions)\n\t\t\tv.L1.Options = func() protoreflect.ProtoMessage { return opts }\n\t\t}\n\t\tv.L1.Number = protoreflect.EnumNumber(vd.GetNumber())\n\t}\n\treturn vs, nil\n}\n\nfunc (r descsByName) initMessagesDeclarations(mds []*descriptorpb.DescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (ms []filedesc.Message, err error) {\n\tms = make([]filedesc.Message, len(mds)) // allocate up-front to ensure stable pointers\n\tfor i, md := range mds {\n\t\tm := &ms[i]\n\t\tm.L2 = new(filedesc.MessageL2)\n\t\tif m.L0, err = r.makeBase(m, parent, md.GetName(), i, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif opts := md.GetOptions(); opts != nil {\n\t\t\topts = proto.Clone(opts).(*descriptorpb.MessageOptions)\n\t\t\tm.L2.Options = func() protoreflect.ProtoMessage { return opts }\n\t\t\tm.L1.IsMapEntry = opts.GetMapEntry()\n\t\t\tm.L1.IsMessageSet = opts.GetMessageSetWireFormat()\n\t\t}\n\t\tfor _, s := range md.GetReservedName() {\n\t\t\tm.L2.ReservedNames.List = append(m.L2.ReservedNames.List, protoreflect.Name(s))\n\t\t}\n\t\tfor _, rr := range md.GetReservedRange() {\n\t\t\tm.L2.ReservedRanges.List = append(m.L2.ReservedRanges.List, [2]protoreflect.FieldNumber{\n\t\t\t\tprotoreflect.FieldNumber(rr.GetStart()),\n\t\t\t\tprotoreflect.FieldNumber(rr.GetEnd()),\n\t\t\t})\n\t\t}\n\t\tfor _, xr := range md.GetExtensionRange() {\n\t\t\tm.L2.ExtensionRanges.List = append(m.L2.ExtensionRanges.List, [2]protoreflect.FieldNumber{\n\t\t\t\tprotoreflect.FieldNumber(xr.GetStart()),\n\t\t\t\tprotoreflect.FieldNumber(xr.GetEnd()),\n\t\t\t})\n\t\t\tvar optsFunc func() protoreflect.ProtoMessage\n\t\t\tif opts := xr.GetOptions(); opts != nil {\n\t\t\t\topts = proto.Clone(opts).(*descriptorpb.ExtensionRangeOptions)\n\t\t\t\toptsFunc = func() protoreflect.ProtoMessage { return opts }\n\t\t\t}\n\t\t\tm.L2.ExtensionRangeOptions = append(m.L2.ExtensionRangeOptions, optsFunc)\n\t\t}\n\t\tif m.L2.Fields.List, err = r.initFieldsFromDescriptorProto(md.GetField(), m, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif m.L2.Oneofs.List, err = r.initOneofsFromDescriptorProto(md.GetOneofDecl(), m, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif m.L1.Enums.List, err = r.initEnumDeclarations(md.GetEnumType(), m, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif m.L1.Messages.List, err = r.initMessagesDeclarations(md.GetNestedType(), m, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif m.L1.Extensions.List, err = r.initExtensionDeclarations(md.GetExtension(), m, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn ms, nil\n}\n\nfunc (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (fs []filedesc.Field, err error) {\n\tfs = make([]filedesc.Field, len(fds)) // allocate up-front to ensure stable pointers\n\tfor i, fd := range fds {\n\t\tf := &fs[i]\n\t\tif f.L0, err = r.makeBase(f, parent, fd.GetName(), i, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tf.L1.IsProto3Optional = fd.GetProto3Optional()\n\t\tif opts := fd.GetOptions(); opts != nil {\n\t\t\topts = proto.Clone(opts).(*descriptorpb.FieldOptions)\n\t\t\tf.L1.Options = func() protoreflect.ProtoMessage { return opts }\n\t\t\tf.L1.IsWeak = opts.GetWeak()\n\t\t\tf.L1.HasPacked = opts.Packed != nil\n\t\t\tf.L1.IsPacked = opts.GetPacked()\n\t\t}\n\t\tf.L1.Number = protoreflect.FieldNumber(fd.GetNumber())\n\t\tf.L1.Cardinality = protoreflect.Cardinality(fd.GetLabel())\n\t\tif fd.Type != nil {\n\t\t\tf.L1.Kind = protoreflect.Kind(fd.GetType())\n\t\t}\n\t\tif fd.JsonName != nil {\n\t\t\tf.L1.StringName.InitJSON(fd.GetJsonName())\n\t\t}\n\t}\n\treturn fs, nil\n}\n\nfunc (r descsByName) initOneofsFromDescriptorProto(ods []*descriptorpb.OneofDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (os []filedesc.Oneof, err error) {\n\tos = make([]filedesc.Oneof, len(ods)) // allocate up-front to ensure stable pointers\n\tfor i, od := range ods {\n\t\to := &os[i]\n\t\tif o.L0, err = r.makeBase(o, parent, od.GetName(), i, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif opts := od.GetOptions(); opts != nil {\n\t\t\topts = proto.Clone(opts).(*descriptorpb.OneofOptions)\n\t\t\to.L1.Options = func() protoreflect.ProtoMessage { return opts }\n\t\t}\n\t}\n\treturn os, nil\n}\n\nfunc (r descsByName) initExtensionDeclarations(xds []*descriptorpb.FieldDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (xs []filedesc.Extension, err error) {\n\txs = make([]filedesc.Extension, len(xds)) // allocate up-front to ensure stable pointers\n\tfor i, xd := range xds {\n\t\tx := &xs[i]\n\t\tx.L2 = new(filedesc.ExtensionL2)\n\t\tif x.L0, err = r.makeBase(x, parent, xd.GetName(), i, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif opts := xd.GetOptions(); opts != nil {\n\t\t\topts = proto.Clone(opts).(*descriptorpb.FieldOptions)\n\t\t\tx.L2.Options = func() protoreflect.ProtoMessage { return opts }\n\t\t\tx.L2.IsPacked = opts.GetPacked()\n\t\t}\n\t\tx.L1.Number = protoreflect.FieldNumber(xd.GetNumber())\n\t\tx.L1.Cardinality = protoreflect.Cardinality(xd.GetLabel())\n\t\tif xd.Type != nil {\n\t\t\tx.L1.Kind = protoreflect.Kind(xd.GetType())\n\t\t}\n\t\tif xd.JsonName != nil {\n\t\t\tx.L2.StringName.InitJSON(xd.GetJsonName())\n\t\t}\n\t}\n\treturn xs, nil\n}\n\nfunc (r descsByName) initServiceDeclarations(sds []*descriptorpb.ServiceDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (ss []filedesc.Service, err error) {\n\tss = make([]filedesc.Service, len(sds)) // allocate up-front to ensure stable pointers\n\tfor i, sd := range sds {\n\t\ts := &ss[i]\n\t\ts.L2 = new(filedesc.ServiceL2)\n\t\tif s.L0, err = r.makeBase(s, parent, sd.GetName(), i, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif opts := sd.GetOptions(); opts != nil {\n\t\t\topts = proto.Clone(opts).(*descriptorpb.ServiceOptions)\n\t\t\ts.L2.Options = func() protoreflect.ProtoMessage { return opts }\n\t\t}\n\t\tif s.L2.Methods.List, err = r.initMethodsFromDescriptorProto(sd.GetMethod(), s, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn ss, nil\n}\n\nfunc (r descsByName) initMethodsFromDescriptorProto(mds []*descriptorpb.MethodDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (ms []filedesc.Method, err error) {\n\tms = make([]filedesc.Method, len(mds)) // allocate up-front to ensure stable pointers\n\tfor i, md := range mds {\n\t\tm := &ms[i]\n\t\tif m.L0, err = r.makeBase(m, parent, md.GetName(), i, sb); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif opts := md.GetOptions(); opts != nil {\n\t\t\topts = proto.Clone(opts).(*descriptorpb.MethodOptions)\n\t\t\tm.L1.Options = func() protoreflect.ProtoMessage { return opts }\n\t\t}\n\t\tm.L1.IsStreamingClient = md.GetClientStreaming()\n\t\tm.L1.IsStreamingServer = md.GetServerStreaming()\n\t}\n\treturn ms, nil\n}\n\nfunc (r descsByName) makeBase(child, parent protoreflect.Descriptor, name string, idx int, sb *strs.Builder) (filedesc.BaseL0, error) {\n\tif !protoreflect.Name(name).IsValid() {\n\t\treturn filedesc.BaseL0{}, errors.New(\"descriptor %q has an invalid nested name: %q\", parent.FullName(), name)\n\t}\n\n\t// Derive the full name of the child.\n\t// Note that enum values are a sibling to the enum parent in the namespace.\n\tvar fullName protoreflect.FullName\n\tif _, ok := parent.(protoreflect.EnumDescriptor); ok {\n\t\tfullName = sb.AppendFullName(parent.FullName().Parent(), protoreflect.Name(name))\n\t} else {\n\t\tfullName = sb.AppendFullName(parent.FullName(), protoreflect.Name(name))\n\t}\n\tif _, ok := r[fullName]; ok {\n\t\treturn filedesc.BaseL0{}, errors.New(\"descriptor %q already declared\", fullName)\n\t}\n\tr[fullName] = child\n\n\t// TODO: Verify that the full name does not already exist in the resolver?\n\t// This is not as critical since most usages of NewFile will register\n\t// the created file back into the registry, which will perform this check.\n\n\treturn filedesc.BaseL0{\n\t\tFullName:   fullName,\n\t\tParentFile: parent.ParentFile().(*filedesc.File),\n\t\tParent:     parent,\n\t\tIndex:      idx,\n\t}, nil\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protodesc/desc_resolve.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 protodesc\n\nimport (\n\t\"google.golang.org/protobuf/internal/encoding/defval\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n\n\t\"google.golang.org/protobuf/types/descriptorpb\"\n)\n\n// resolver is a wrapper around a local registry of declarations within the file\n// and the remote resolver. The remote resolver is restricted to only return\n// descriptors that have been imported.\ntype resolver struct {\n\tlocal   descsByName\n\tremote  Resolver\n\timports importSet\n\n\tallowUnresolvable bool\n}\n\nfunc (r *resolver) resolveMessageDependencies(ms []filedesc.Message, mds []*descriptorpb.DescriptorProto) (err error) {\n\tfor i, md := range mds {\n\t\tm := &ms[i]\n\t\tfor j, fd := range md.GetField() {\n\t\t\tf := &m.L2.Fields.List[j]\n\t\t\tif f.L1.Cardinality == protoreflect.Required {\n\t\t\t\tm.L2.RequiredNumbers.List = append(m.L2.RequiredNumbers.List, f.L1.Number)\n\t\t\t}\n\t\t\tif fd.OneofIndex != nil {\n\t\t\t\tk := int(fd.GetOneofIndex())\n\t\t\t\tif !(0 <= k && k < len(md.GetOneofDecl())) {\n\t\t\t\t\treturn errors.New(\"message field %q has an invalid oneof index: %d\", f.FullName(), k)\n\t\t\t\t}\n\t\t\t\to := &m.L2.Oneofs.List[k]\n\t\t\t\tf.L1.ContainingOneof = o\n\t\t\t\to.L1.Fields.List = append(o.L1.Fields.List, f)\n\t\t\t}\n\n\t\t\tif f.L1.Kind, f.L1.Enum, f.L1.Message, err = r.findTarget(f.Kind(), f.Parent().FullName(), partialName(fd.GetTypeName()), f.IsWeak()); err != nil {\n\t\t\t\treturn errors.New(\"message field %q cannot resolve type: %v\", f.FullName(), err)\n\t\t\t}\n\t\t\tif fd.DefaultValue != nil {\n\t\t\t\tv, ev, err := unmarshalDefault(fd.GetDefaultValue(), f, r.allowUnresolvable)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.New(\"message field %q has invalid default: %v\", f.FullName(), err)\n\t\t\t\t}\n\t\t\t\tf.L1.Default = filedesc.DefaultValue(v, ev)\n\t\t\t}\n\t\t}\n\n\t\tif err := r.resolveMessageDependencies(m.L1.Messages.List, md.GetNestedType()); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := r.resolveExtensionDependencies(m.L1.Extensions.List, md.GetExtension()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (r *resolver) resolveExtensionDependencies(xs []filedesc.Extension, xds []*descriptorpb.FieldDescriptorProto) (err error) {\n\tfor i, xd := range xds {\n\t\tx := &xs[i]\n\t\tif x.L1.Extendee, err = r.findMessageDescriptor(x.Parent().FullName(), partialName(xd.GetExtendee()), false); err != nil {\n\t\t\treturn errors.New(\"extension field %q cannot resolve extendee: %v\", x.FullName(), err)\n\t\t}\n\t\tif x.L1.Kind, x.L2.Enum, x.L2.Message, err = r.findTarget(x.Kind(), x.Parent().FullName(), partialName(xd.GetTypeName()), false); err != nil {\n\t\t\treturn errors.New(\"extension field %q cannot resolve type: %v\", x.FullName(), err)\n\t\t}\n\t\tif xd.DefaultValue != nil {\n\t\t\tv, ev, err := unmarshalDefault(xd.GetDefaultValue(), x, r.allowUnresolvable)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.New(\"extension field %q has invalid default: %v\", x.FullName(), err)\n\t\t\t}\n\t\t\tx.L2.Default = filedesc.DefaultValue(v, ev)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (r *resolver) resolveServiceDependencies(ss []filedesc.Service, sds []*descriptorpb.ServiceDescriptorProto) (err error) {\n\tfor i, sd := range sds {\n\t\ts := &ss[i]\n\t\tfor j, md := range sd.GetMethod() {\n\t\t\tm := &s.L2.Methods.List[j]\n\t\t\tm.L1.Input, err = r.findMessageDescriptor(m.Parent().FullName(), partialName(md.GetInputType()), false)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.New(\"service method %q cannot resolve input: %v\", m.FullName(), err)\n\t\t\t}\n\t\t\tm.L1.Output, err = r.findMessageDescriptor(s.FullName(), partialName(md.GetOutputType()), false)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.New(\"service method %q cannot resolve output: %v\", m.FullName(), err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\n// findTarget finds an enum or message descriptor if k is an enum, message,\n// group, or unknown. If unknown, and the name could be resolved, the kind\n// returned kind is set based on the type of the resolved descriptor.\nfunc (r *resolver) findTarget(k protoreflect.Kind, scope protoreflect.FullName, ref partialName, isWeak bool) (protoreflect.Kind, protoreflect.EnumDescriptor, protoreflect.MessageDescriptor, error) {\n\tswitch k {\n\tcase protoreflect.EnumKind:\n\t\ted, err := r.findEnumDescriptor(scope, ref, isWeak)\n\t\tif err != nil {\n\t\t\treturn 0, nil, nil, err\n\t\t}\n\t\treturn k, ed, nil, nil\n\tcase protoreflect.MessageKind, protoreflect.GroupKind:\n\t\tmd, err := r.findMessageDescriptor(scope, ref, isWeak)\n\t\tif err != nil {\n\t\t\treturn 0, nil, nil, err\n\t\t}\n\t\treturn k, nil, md, nil\n\tcase 0:\n\t\t// Handle unspecified kinds (possible with parsers that operate\n\t\t// on a per-file basis without knowledge of dependencies).\n\t\td, err := r.findDescriptor(scope, ref)\n\t\tif err == protoregistry.NotFound && (r.allowUnresolvable || isWeak) {\n\t\t\treturn k, filedesc.PlaceholderEnum(ref.FullName()), filedesc.PlaceholderMessage(ref.FullName()), nil\n\t\t} else if err == protoregistry.NotFound {\n\t\t\treturn 0, nil, nil, errors.New(\"%q not found\", ref.FullName())\n\t\t} else if err != nil {\n\t\t\treturn 0, nil, nil, err\n\t\t}\n\t\tswitch d := d.(type) {\n\t\tcase protoreflect.EnumDescriptor:\n\t\t\treturn protoreflect.EnumKind, d, nil, nil\n\t\tcase protoreflect.MessageDescriptor:\n\t\t\treturn protoreflect.MessageKind, nil, d, nil\n\t\tdefault:\n\t\t\treturn 0, nil, nil, errors.New(\"unknown kind\")\n\t\t}\n\tdefault:\n\t\tif ref != \"\" {\n\t\t\treturn 0, nil, nil, errors.New(\"target name cannot be specified for %v\", k)\n\t\t}\n\t\tif !k.IsValid() {\n\t\t\treturn 0, nil, nil, errors.New(\"invalid kind: %d\", k)\n\t\t}\n\t\treturn k, nil, nil, nil\n\t}\n}\n\n// findDescriptor finds the descriptor by name,\n// which may be a relative name within some scope.\n//\n// Suppose the scope was \"fizz.buzz\" and the reference was \"Foo.Bar\",\n// then the following full names are searched:\n//\t* fizz.buzz.Foo.Bar\n//\t* fizz.Foo.Bar\n//\t* Foo.Bar\nfunc (r *resolver) findDescriptor(scope protoreflect.FullName, ref partialName) (protoreflect.Descriptor, error) {\n\tif !ref.IsValid() {\n\t\treturn nil, errors.New(\"invalid name reference: %q\", ref)\n\t}\n\tif ref.IsFull() {\n\t\tscope, ref = \"\", ref[1:]\n\t}\n\tvar foundButNotImported protoreflect.Descriptor\n\tfor {\n\t\t// Derive the full name to search.\n\t\ts := protoreflect.FullName(ref)\n\t\tif scope != \"\" {\n\t\t\ts = scope + \".\" + s\n\t\t}\n\n\t\t// Check the current file for the descriptor.\n\t\tif d, ok := r.local[s]; ok {\n\t\t\treturn d, nil\n\t\t}\n\n\t\t// Check the remote registry for the descriptor.\n\t\td, err := r.remote.FindDescriptorByName(s)\n\t\tif err == nil {\n\t\t\t// Only allow descriptors covered by one of the imports.\n\t\t\tif r.imports[d.ParentFile().Path()] {\n\t\t\t\treturn d, nil\n\t\t\t}\n\t\t\tfoundButNotImported = d\n\t\t} else if err != protoregistry.NotFound {\n\t\t\treturn nil, errors.Wrap(err, \"%q\", s)\n\t\t}\n\n\t\t// Continue on at a higher level of scoping.\n\t\tif scope == \"\" {\n\t\t\tif d := foundButNotImported; d != nil {\n\t\t\t\treturn nil, errors.New(\"resolved %q, but %q is not imported\", d.FullName(), d.ParentFile().Path())\n\t\t\t}\n\t\t\treturn nil, protoregistry.NotFound\n\t\t}\n\t\tscope = scope.Parent()\n\t}\n}\n\nfunc (r *resolver) findEnumDescriptor(scope protoreflect.FullName, ref partialName, isWeak bool) (protoreflect.EnumDescriptor, error) {\n\td, err := r.findDescriptor(scope, ref)\n\tif err == protoregistry.NotFound && (r.allowUnresolvable || isWeak) {\n\t\treturn filedesc.PlaceholderEnum(ref.FullName()), nil\n\t} else if err == protoregistry.NotFound {\n\t\treturn nil, errors.New(\"%q not found\", ref.FullName())\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\ted, ok := d.(protoreflect.EnumDescriptor)\n\tif !ok {\n\t\treturn nil, errors.New(\"resolved %q, but it is not an enum\", d.FullName())\n\t}\n\treturn ed, nil\n}\n\nfunc (r *resolver) findMessageDescriptor(scope protoreflect.FullName, ref partialName, isWeak bool) (protoreflect.MessageDescriptor, error) {\n\td, err := r.findDescriptor(scope, ref)\n\tif err == protoregistry.NotFound && (r.allowUnresolvable || isWeak) {\n\t\treturn filedesc.PlaceholderMessage(ref.FullName()), nil\n\t} else if err == protoregistry.NotFound {\n\t\treturn nil, errors.New(\"%q not found\", ref.FullName())\n\t} else if err != nil {\n\t\treturn nil, err\n\t}\n\tmd, ok := d.(protoreflect.MessageDescriptor)\n\tif !ok {\n\t\treturn nil, errors.New(\"resolved %q, but it is not an message\", d.FullName())\n\t}\n\treturn md, nil\n}\n\n// partialName is the partial name. A leading dot means that the name is full,\n// otherwise the name is relative to some current scope.\n// See google.protobuf.FieldDescriptorProto.type_name.\ntype partialName string\n\nfunc (s partialName) IsFull() bool {\n\treturn len(s) > 0 && s[0] == '.'\n}\n\nfunc (s partialName) IsValid() bool {\n\tif s.IsFull() {\n\t\treturn protoreflect.FullName(s[1:]).IsValid()\n\t}\n\treturn protoreflect.FullName(s).IsValid()\n}\n\nconst unknownPrefix = \"*.\"\n\n// FullName converts the partial name to a full name on a best-effort basis.\n// If relative, it creates an invalid full name, using a \"*.\" prefix\n// to indicate that the start of the full name is unknown.\nfunc (s partialName) FullName() protoreflect.FullName {\n\tif s.IsFull() {\n\t\treturn protoreflect.FullName(s[1:])\n\t}\n\treturn protoreflect.FullName(unknownPrefix + s)\n}\n\nfunc unmarshalDefault(s string, fd protoreflect.FieldDescriptor, allowUnresolvable bool) (protoreflect.Value, protoreflect.EnumValueDescriptor, error) {\n\tvar evs protoreflect.EnumValueDescriptors\n\tif fd.Enum() != nil {\n\t\tevs = fd.Enum().Values()\n\t}\n\tv, ev, err := defval.Unmarshal(s, fd.Kind(), evs, defval.Descriptor)\n\tif err != nil && allowUnresolvable && evs != nil && protoreflect.Name(s).IsValid() {\n\t\tv = protoreflect.ValueOfEnum(0)\n\t\tif evs.Len() > 0 {\n\t\t\tv = protoreflect.ValueOfEnum(evs.Get(0).Number())\n\t\t}\n\t\tev = filedesc.PlaceholderEnumValue(fd.Enum().FullName().Parent().Append(protoreflect.Name(s)))\n\t} else if err != nil {\n\t\treturn v, ev, err\n\t}\n\tif fd.Syntax() == protoreflect.Proto3 {\n\t\treturn v, ev, errors.New(\"cannot be specified under proto3 semantics\")\n\t}\n\tif fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind || fd.Cardinality() == protoreflect.Repeated {\n\t\treturn v, ev, errors.New(\"cannot be specified on composite types\")\n\t}\n\treturn v, ev, nil\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protodesc/desc_validate.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 protodesc\n\nimport (\n\t\"strings\"\n\t\"unicode\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\n\t\"google.golang.org/protobuf/types/descriptorpb\"\n)\n\nfunc validateEnumDeclarations(es []filedesc.Enum, eds []*descriptorpb.EnumDescriptorProto) error {\n\tfor i, ed := range eds {\n\t\te := &es[i]\n\t\tif err := e.L2.ReservedNames.CheckValid(); err != nil {\n\t\t\treturn errors.New(\"enum %q reserved names has %v\", e.FullName(), err)\n\t\t}\n\t\tif err := e.L2.ReservedRanges.CheckValid(); err != nil {\n\t\t\treturn errors.New(\"enum %q reserved ranges has %v\", e.FullName(), err)\n\t\t}\n\t\tif len(ed.GetValue()) == 0 {\n\t\t\treturn errors.New(\"enum %q must contain at least one value declaration\", e.FullName())\n\t\t}\n\t\tallowAlias := ed.GetOptions().GetAllowAlias()\n\t\tfoundAlias := false\n\t\tfor i := 0; i < e.Values().Len(); i++ {\n\t\t\tv1 := e.Values().Get(i)\n\t\t\tif v2 := e.Values().ByNumber(v1.Number()); v1 != v2 {\n\t\t\t\tfoundAlias = true\n\t\t\t\tif !allowAlias {\n\t\t\t\t\treturn errors.New(\"enum %q has conflicting non-aliased values on number %d: %q with %q\", e.FullName(), v1.Number(), v1.Name(), v2.Name())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif allowAlias && !foundAlias {\n\t\t\treturn errors.New(\"enum %q allows aliases, but none were found\", e.FullName())\n\t\t}\n\t\tif e.Syntax() == protoreflect.Proto3 {\n\t\t\tif v := e.Values().Get(0); v.Number() != 0 {\n\t\t\t\treturn errors.New(\"enum %q using proto3 semantics must have zero number for the first value\", v.FullName())\n\t\t\t}\n\t\t\t// Verify that value names in proto3 do not conflict if the\n\t\t\t// case-insensitive prefix is removed.\n\t\t\t// See protoc v3.8.0: src/google/protobuf/descriptor.cc:4991-5055\n\t\t\tnames := map[string]protoreflect.EnumValueDescriptor{}\n\t\t\tprefix := strings.Replace(strings.ToLower(string(e.Name())), \"_\", \"\", -1)\n\t\t\tfor i := 0; i < e.Values().Len(); i++ {\n\t\t\t\tv1 := e.Values().Get(i)\n\t\t\t\ts := strs.EnumValueName(strs.TrimEnumPrefix(string(v1.Name()), prefix))\n\t\t\t\tif v2, ok := names[s]; ok && v1.Number() != v2.Number() {\n\t\t\t\t\treturn errors.New(\"enum %q using proto3 semantics has conflict: %q with %q\", e.FullName(), v1.Name(), v2.Name())\n\t\t\t\t}\n\t\t\t\tnames[s] = v1\n\t\t\t}\n\t\t}\n\n\t\tfor j, vd := range ed.GetValue() {\n\t\t\tv := &e.L2.Values.List[j]\n\t\t\tif vd.Number == nil {\n\t\t\t\treturn errors.New(\"enum value %q must have a specified number\", v.FullName())\n\t\t\t}\n\t\t\tif e.L2.ReservedNames.Has(v.Name()) {\n\t\t\t\treturn errors.New(\"enum value %q must not use reserved name\", v.FullName())\n\t\t\t}\n\t\t\tif e.L2.ReservedRanges.Has(v.Number()) {\n\t\t\t\treturn errors.New(\"enum value %q must not use reserved number %d\", v.FullName(), v.Number())\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.DescriptorProto) error {\n\tfor i, md := range mds {\n\t\tm := &ms[i]\n\n\t\t// Handle the message descriptor itself.\n\t\tisMessageSet := md.GetOptions().GetMessageSetWireFormat()\n\t\tif err := m.L2.ReservedNames.CheckValid(); err != nil {\n\t\t\treturn errors.New(\"message %q reserved names has %v\", m.FullName(), err)\n\t\t}\n\t\tif err := m.L2.ReservedRanges.CheckValid(isMessageSet); err != nil {\n\t\t\treturn errors.New(\"message %q reserved ranges has %v\", m.FullName(), err)\n\t\t}\n\t\tif err := m.L2.ExtensionRanges.CheckValid(isMessageSet); err != nil {\n\t\t\treturn errors.New(\"message %q extension ranges has %v\", m.FullName(), err)\n\t\t}\n\t\tif err := (*filedesc.FieldRanges).CheckOverlap(&m.L2.ReservedRanges, &m.L2.ExtensionRanges); err != nil {\n\t\t\treturn errors.New(\"message %q reserved and extension ranges has %v\", m.FullName(), err)\n\t\t}\n\t\tfor i := 0; i < m.Fields().Len(); i++ {\n\t\t\tf1 := m.Fields().Get(i)\n\t\t\tif f2 := m.Fields().ByNumber(f1.Number()); f1 != f2 {\n\t\t\t\treturn errors.New(\"message %q has conflicting fields: %q with %q\", m.FullName(), f1.Name(), f2.Name())\n\t\t\t}\n\t\t}\n\t\tif isMessageSet && !flags.ProtoLegacy {\n\t\t\treturn errors.New(\"message %q is a MessageSet, which is a legacy proto1 feature that is no longer supported\", m.FullName())\n\t\t}\n\t\tif isMessageSet && (m.Syntax() != protoreflect.Proto2 || m.Fields().Len() > 0 || m.ExtensionRanges().Len() == 0) {\n\t\t\treturn errors.New(\"message %q is an invalid proto1 MessageSet\", m.FullName())\n\t\t}\n\t\tif m.Syntax() == protoreflect.Proto3 {\n\t\t\tif m.ExtensionRanges().Len() > 0 {\n\t\t\t\treturn errors.New(\"message %q using proto3 semantics cannot have extension ranges\", m.FullName())\n\t\t\t}\n\t\t\t// Verify that field names in proto3 do not conflict if lowercased\n\t\t\t// with all underscores removed.\n\t\t\t// See protoc v3.8.0: src/google/protobuf/descriptor.cc:5830-5847\n\t\t\tnames := map[string]protoreflect.FieldDescriptor{}\n\t\t\tfor i := 0; i < m.Fields().Len(); i++ {\n\t\t\t\tf1 := m.Fields().Get(i)\n\t\t\t\ts := strings.Replace(strings.ToLower(string(f1.Name())), \"_\", \"\", -1)\n\t\t\t\tif f2, ok := names[s]; ok {\n\t\t\t\t\treturn errors.New(\"message %q using proto3 semantics has conflict: %q with %q\", m.FullName(), f1.Name(), f2.Name())\n\t\t\t\t}\n\t\t\t\tnames[s] = f1\n\t\t\t}\n\t\t}\n\n\t\tfor j, fd := range md.GetField() {\n\t\t\tf := &m.L2.Fields.List[j]\n\t\t\tif m.L2.ReservedNames.Has(f.Name()) {\n\t\t\t\treturn errors.New(\"message field %q must not use reserved name\", f.FullName())\n\t\t\t}\n\t\t\tif !f.Number().IsValid() {\n\t\t\t\treturn errors.New(\"message field %q has an invalid number: %d\", f.FullName(), f.Number())\n\t\t\t}\n\t\t\tif !f.Cardinality().IsValid() {\n\t\t\t\treturn errors.New(\"message field %q has an invalid cardinality: %d\", f.FullName(), f.Cardinality())\n\t\t\t}\n\t\t\tif m.L2.ReservedRanges.Has(f.Number()) {\n\t\t\t\treturn errors.New(\"message field %q must not use reserved number %d\", f.FullName(), f.Number())\n\t\t\t}\n\t\t\tif m.L2.ExtensionRanges.Has(f.Number()) {\n\t\t\t\treturn errors.New(\"message field %q with number %d in extension range\", f.FullName(), f.Number())\n\t\t\t}\n\t\t\tif fd.Extendee != nil {\n\t\t\t\treturn errors.New(\"message field %q may not have extendee: %q\", f.FullName(), fd.GetExtendee())\n\t\t\t}\n\t\t\tif f.L1.IsProto3Optional {\n\t\t\t\tif f.Syntax() != protoreflect.Proto3 {\n\t\t\t\t\treturn errors.New(\"message field %q under proto3 optional semantics must be specified in the proto3 syntax\", f.FullName())\n\t\t\t\t}\n\t\t\t\tif f.Cardinality() != protoreflect.Optional {\n\t\t\t\t\treturn errors.New(\"message field %q under proto3 optional semantics must have optional cardinality\", f.FullName())\n\t\t\t\t}\n\t\t\t\tif f.ContainingOneof() != nil && f.ContainingOneof().Fields().Len() != 1 {\n\t\t\t\t\treturn errors.New(\"message field %q under proto3 optional semantics must be within a single element oneof\", f.FullName())\n\t\t\t\t}\n\t\t\t}\n\t\t\tif f.IsWeak() && !flags.ProtoLegacy {\n\t\t\t\treturn errors.New(\"message field %q is a weak field, which is a legacy proto1 feature that is no longer supported\", f.FullName())\n\t\t\t}\n\t\t\tif f.IsWeak() && (f.Syntax() != protoreflect.Proto2 || !isOptionalMessage(f) || f.ContainingOneof() != nil) {\n\t\t\t\treturn errors.New(\"message field %q may only be weak for an optional message\", f.FullName())\n\t\t\t}\n\t\t\tif f.IsPacked() && !isPackable(f) {\n\t\t\t\treturn errors.New(\"message field %q is not packable\", f.FullName())\n\t\t\t}\n\t\t\tif err := checkValidGroup(f); err != nil {\n\t\t\t\treturn errors.New(\"message field %q is an invalid group: %v\", f.FullName(), err)\n\t\t\t}\n\t\t\tif err := checkValidMap(f); err != nil {\n\t\t\t\treturn errors.New(\"message field %q is an invalid map: %v\", f.FullName(), err)\n\t\t\t}\n\t\t\tif f.Syntax() == protoreflect.Proto3 {\n\t\t\t\tif f.Cardinality() == protoreflect.Required {\n\t\t\t\t\treturn errors.New(\"message field %q using proto3 semantics cannot be required\", f.FullName())\n\t\t\t\t}\n\t\t\t\tif f.Enum() != nil && !f.Enum().IsPlaceholder() && f.Enum().Syntax() != protoreflect.Proto3 {\n\t\t\t\t\treturn errors.New(\"message field %q using proto3 semantics may only depend on a proto3 enum\", f.FullName())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tseenSynthetic := false // synthetic oneofs for proto3 optional must come after real oneofs\n\t\tfor j := range md.GetOneofDecl() {\n\t\t\to := &m.L2.Oneofs.List[j]\n\t\t\tif o.Fields().Len() == 0 {\n\t\t\t\treturn errors.New(\"message oneof %q must contain at least one field declaration\", o.FullName())\n\t\t\t}\n\t\t\tif n := o.Fields().Len(); n-1 != (o.Fields().Get(n-1).Index() - o.Fields().Get(0).Index()) {\n\t\t\t\treturn errors.New(\"message oneof %q must have consecutively declared fields\", o.FullName())\n\t\t\t}\n\n\t\t\tif o.IsSynthetic() {\n\t\t\t\tseenSynthetic = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !o.IsSynthetic() && seenSynthetic {\n\t\t\t\treturn errors.New(\"message oneof %q must be declared before synthetic oneofs\", o.FullName())\n\t\t\t}\n\n\t\t\tfor i := 0; i < o.Fields().Len(); i++ {\n\t\t\t\tf := o.Fields().Get(i)\n\t\t\t\tif f.Cardinality() != protoreflect.Optional {\n\t\t\t\t\treturn errors.New(\"message field %q belongs in a oneof and must be optional\", f.FullName())\n\t\t\t\t}\n\t\t\t\tif f.IsWeak() {\n\t\t\t\t\treturn errors.New(\"message field %q belongs in a oneof and must not be a weak reference\", f.FullName())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif err := validateEnumDeclarations(m.L1.Enums.List, md.GetEnumType()); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := validateMessageDeclarations(m.L1.Messages.List, md.GetNestedType()); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := validateExtensionDeclarations(m.L1.Extensions.List, md.GetExtension()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc validateExtensionDeclarations(xs []filedesc.Extension, xds []*descriptorpb.FieldDescriptorProto) error {\n\tfor i, xd := range xds {\n\t\tx := &xs[i]\n\t\t// NOTE: Avoid using the IsValid method since extensions to MessageSet\n\t\t// may have a field number higher than normal. This check only verifies\n\t\t// that the number is not negative or reserved. We check again later\n\t\t// if we know that the extendee is definitely not a MessageSet.\n\t\tif n := x.Number(); n < 0 || (protowire.FirstReservedNumber <= n && n <= protowire.LastReservedNumber) {\n\t\t\treturn errors.New(\"extension field %q has an invalid number: %d\", x.FullName(), x.Number())\n\t\t}\n\t\tif !x.Cardinality().IsValid() || x.Cardinality() == protoreflect.Required {\n\t\t\treturn errors.New(\"extension field %q has an invalid cardinality: %d\", x.FullName(), x.Cardinality())\n\t\t}\n\t\tif xd.JsonName != nil {\n\t\t\t// A bug in older versions of protoc would always populate the\n\t\t\t// \"json_name\" option for extensions when it is meaningless.\n\t\t\t// When it did so, it would always use the camel-cased field name.\n\t\t\tif xd.GetJsonName() != strs.JSONCamelCase(string(x.Name())) {\n\t\t\t\treturn errors.New(\"extension field %q may not have an explicitly set JSON name: %q\", x.FullName(), xd.GetJsonName())\n\t\t\t}\n\t\t}\n\t\tif xd.OneofIndex != nil {\n\t\t\treturn errors.New(\"extension field %q may not be part of a oneof\", x.FullName())\n\t\t}\n\t\tif md := x.ContainingMessage(); !md.IsPlaceholder() {\n\t\t\tif !md.ExtensionRanges().Has(x.Number()) {\n\t\t\t\treturn errors.New(\"extension field %q extends %q with non-extension field number: %d\", x.FullName(), md.FullName(), x.Number())\n\t\t\t}\n\t\t\tisMessageSet := md.Options().(*descriptorpb.MessageOptions).GetMessageSetWireFormat()\n\t\t\tif isMessageSet && !isOptionalMessage(x) {\n\t\t\t\treturn errors.New(\"extension field %q extends MessageSet and must be an optional message\", x.FullName())\n\t\t\t}\n\t\t\tif !isMessageSet && !x.Number().IsValid() {\n\t\t\t\treturn errors.New(\"extension field %q has an invalid number: %d\", x.FullName(), x.Number())\n\t\t\t}\n\t\t}\n\t\tif xd.GetOptions().GetWeak() {\n\t\t\treturn errors.New(\"extension field %q cannot be a weak reference\", x.FullName())\n\t\t}\n\t\tif x.IsPacked() && !isPackable(x) {\n\t\t\treturn errors.New(\"extension field %q is not packable\", x.FullName())\n\t\t}\n\t\tif err := checkValidGroup(x); err != nil {\n\t\t\treturn errors.New(\"extension field %q is an invalid group: %v\", x.FullName(), err)\n\t\t}\n\t\tif md := x.Message(); md != nil && md.IsMapEntry() {\n\t\t\treturn errors.New(\"extension field %q cannot be a map entry\", x.FullName())\n\t\t}\n\t\tif x.Syntax() == protoreflect.Proto3 {\n\t\t\tswitch x.ContainingMessage().FullName() {\n\t\t\tcase (*descriptorpb.FileOptions)(nil).ProtoReflect().Descriptor().FullName():\n\t\t\tcase (*descriptorpb.EnumOptions)(nil).ProtoReflect().Descriptor().FullName():\n\t\t\tcase (*descriptorpb.EnumValueOptions)(nil).ProtoReflect().Descriptor().FullName():\n\t\t\tcase (*descriptorpb.MessageOptions)(nil).ProtoReflect().Descriptor().FullName():\n\t\t\tcase (*descriptorpb.FieldOptions)(nil).ProtoReflect().Descriptor().FullName():\n\t\t\tcase (*descriptorpb.OneofOptions)(nil).ProtoReflect().Descriptor().FullName():\n\t\t\tcase (*descriptorpb.ExtensionRangeOptions)(nil).ProtoReflect().Descriptor().FullName():\n\t\t\tcase (*descriptorpb.ServiceOptions)(nil).ProtoReflect().Descriptor().FullName():\n\t\t\tcase (*descriptorpb.MethodOptions)(nil).ProtoReflect().Descriptor().FullName():\n\t\t\tdefault:\n\t\t\t\treturn errors.New(\"extension field %q cannot be declared in proto3 unless extended descriptor options\", x.FullName())\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\n// isOptionalMessage reports whether this is an optional message.\n// If the kind is unknown, it is assumed to be a message.\nfunc isOptionalMessage(fd protoreflect.FieldDescriptor) bool {\n\treturn (fd.Kind() == 0 || fd.Kind() == protoreflect.MessageKind) && fd.Cardinality() == protoreflect.Optional\n}\n\n// isPackable checks whether the pack option can be specified.\nfunc isPackable(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.Kind() {\n\tcase protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind:\n\t\treturn false\n\t}\n\treturn fd.IsList()\n}\n\n// checkValidGroup reports whether fd is a valid group according to the same\n// rules that protoc imposes.\nfunc checkValidGroup(fd protoreflect.FieldDescriptor) error {\n\tmd := fd.Message()\n\tswitch {\n\tcase fd.Kind() != protoreflect.GroupKind:\n\t\treturn nil\n\tcase fd.Syntax() != protoreflect.Proto2:\n\t\treturn errors.New(\"invalid under proto2 semantics\")\n\tcase md == nil || md.IsPlaceholder():\n\t\treturn errors.New(\"message must be resolvable\")\n\tcase fd.FullName().Parent() != md.FullName().Parent():\n\t\treturn errors.New(\"message and field must be declared in the same scope\")\n\tcase !unicode.IsUpper(rune(md.Name()[0])):\n\t\treturn errors.New(\"message name must start with an uppercase\")\n\tcase fd.Name() != protoreflect.Name(strings.ToLower(string(md.Name()))):\n\t\treturn errors.New(\"field name must be lowercased form of the message name\")\n\t}\n\treturn nil\n}\n\n// checkValidMap checks whether the field is a valid map according to the same\n// rules that protoc imposes.\n// See protoc v3.8.0: src/google/protobuf/descriptor.cc:6045-6115\nfunc checkValidMap(fd protoreflect.FieldDescriptor) error {\n\tmd := fd.Message()\n\tswitch {\n\tcase md == nil || !md.IsMapEntry():\n\t\treturn nil\n\tcase fd.FullName().Parent() != md.FullName().Parent():\n\t\treturn errors.New(\"message and field must be declared in the same scope\")\n\tcase md.Name() != protoreflect.Name(strs.MapEntryName(string(fd.Name()))):\n\t\treturn errors.New(\"incorrect implicit map entry name\")\n\tcase fd.Cardinality() != protoreflect.Repeated:\n\t\treturn errors.New(\"field must be repeated\")\n\tcase md.Fields().Len() != 2:\n\t\treturn errors.New(\"message must have exactly two fields\")\n\tcase md.ExtensionRanges().Len() > 0:\n\t\treturn errors.New(\"message must not have any extension ranges\")\n\tcase md.Enums().Len()+md.Messages().Len()+md.Extensions().Len() > 0:\n\t\treturn errors.New(\"message must not have any nested declarations\")\n\t}\n\tkf := md.Fields().Get(0)\n\tvf := md.Fields().Get(1)\n\tswitch {\n\tcase kf.Name() != genid.MapEntry_Key_field_name || kf.Number() != genid.MapEntry_Key_field_number || kf.Cardinality() != protoreflect.Optional || kf.ContainingOneof() != nil || kf.HasDefault():\n\t\treturn errors.New(\"invalid key field\")\n\tcase vf.Name() != genid.MapEntry_Value_field_name || vf.Number() != genid.MapEntry_Value_field_number || vf.Cardinality() != protoreflect.Optional || vf.ContainingOneof() != nil || vf.HasDefault():\n\t\treturn errors.New(\"invalid value field\")\n\t}\n\tswitch kf.Kind() {\n\tcase protoreflect.BoolKind: // bool\n\tcase protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: // int32\n\tcase protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: // int64\n\tcase protoreflect.Uint32Kind, protoreflect.Fixed32Kind: // uint32\n\tcase protoreflect.Uint64Kind, protoreflect.Fixed64Kind: // uint64\n\tcase protoreflect.StringKind: // string\n\tdefault:\n\t\treturn errors.New(\"invalid key kind: %v\", kf.Kind())\n\t}\n\tif e := vf.Enum(); e != nil && e.Values().Len() > 0 && e.Values().Get(0).Number() != 0 {\n\t\treturn errors.New(\"map enum value must have zero number for the first value\")\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protodesc/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\npackage protodesc\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"google.golang.org/protobuf/internal/encoding/defval\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\n\t\"google.golang.org/protobuf/types/descriptorpb\"\n)\n\n// ToFileDescriptorProto copies a protoreflect.FileDescriptor into a\n// google.protobuf.FileDescriptorProto message.\nfunc ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tp := &descriptorpb.FileDescriptorProto{\n\t\tName:    proto.String(file.Path()),\n\t\tOptions: proto.Clone(file.Options()).(*descriptorpb.FileOptions),\n\t}\n\tif file.Package() != \"\" {\n\t\tp.Package = proto.String(string(file.Package()))\n\t}\n\tfor i, imports := 0, file.Imports(); i < imports.Len(); i++ {\n\t\timp := imports.Get(i)\n\t\tp.Dependency = append(p.Dependency, imp.Path())\n\t\tif imp.IsPublic {\n\t\t\tp.PublicDependency = append(p.PublicDependency, int32(i))\n\t\t}\n\t\tif imp.IsWeak {\n\t\t\tp.WeakDependency = append(p.WeakDependency, int32(i))\n\t\t}\n\t}\n\tfor i, locs := 0, file.SourceLocations(); i < locs.Len(); i++ {\n\t\tloc := locs.Get(i)\n\t\tl := &descriptorpb.SourceCodeInfo_Location{}\n\t\tl.Path = append(l.Path, loc.Path...)\n\t\tif loc.StartLine == loc.EndLine {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndColumn)}\n\t\t} else {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndLine), int32(loc.EndColumn)}\n\t\t}\n\t\tl.LeadingDetachedComments = append([]string(nil), loc.LeadingDetachedComments...)\n\t\tif loc.LeadingComments != \"\" {\n\t\t\tl.LeadingComments = proto.String(loc.LeadingComments)\n\t\t}\n\t\tif loc.TrailingComments != \"\" {\n\t\t\tl.TrailingComments = proto.String(loc.TrailingComments)\n\t\t}\n\t\tif p.SourceCodeInfo == nil {\n\t\t\tp.SourceCodeInfo = &descriptorpb.SourceCodeInfo{}\n\t\t}\n\t\tp.SourceCodeInfo.Location = append(p.SourceCodeInfo.Location, l)\n\n\t}\n\tfor i, messages := 0, file.Messages(); i < messages.Len(); i++ {\n\t\tp.MessageType = append(p.MessageType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, file.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, services := 0, file.Services(); i < services.Len(); i++ {\n\t\tp.Service = append(p.Service, ToServiceDescriptorProto(services.Get(i)))\n\t}\n\tfor i, exts := 0, file.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tif syntax := file.Syntax(); syntax != protoreflect.Proto2 {\n\t\tp.Syntax = proto.String(file.Syntax().String())\n\t}\n\treturn p\n}\n\n// ToDescriptorProto copies a protoreflect.MessageDescriptor into a\n// google.protobuf.DescriptorProto message.\nfunc ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\tp := &descriptorpb.DescriptorProto{\n\t\tName:    proto.String(string(message.Name())),\n\t\tOptions: proto.Clone(message.Options()).(*descriptorpb.MessageOptions),\n\t}\n\tfor i, fields := 0, message.Fields(); i < fields.Len(); i++ {\n\t\tp.Field = append(p.Field, ToFieldDescriptorProto(fields.Get(i)))\n\t}\n\tfor i, exts := 0, message.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tfor i, messages := 0, message.Messages(); i < messages.Len(); i++ {\n\t\tp.NestedType = append(p.NestedType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, message.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, xranges := 0, message.ExtensionRanges(); i < xranges.Len(); i++ {\n\t\txrange := xranges.Get(i)\n\t\tp.ExtensionRange = append(p.ExtensionRange, &descriptorpb.DescriptorProto_ExtensionRange{\n\t\t\tStart:   proto.Int32(int32(xrange[0])),\n\t\t\tEnd:     proto.Int32(int32(xrange[1])),\n\t\t\tOptions: proto.Clone(message.ExtensionRangeOptions(i)).(*descriptorpb.ExtensionRangeOptions),\n\t\t})\n\t}\n\tfor i, oneofs := 0, message.Oneofs(); i < oneofs.Len(); i++ {\n\t\tp.OneofDecl = append(p.OneofDecl, ToOneofDescriptorProto(oneofs.Get(i)))\n\t}\n\tfor i, ranges := 0, message.ReservedRanges(); i < ranges.Len(); i++ {\n\t\trrange := ranges.Get(i)\n\t\tp.ReservedRange = append(p.ReservedRange, &descriptorpb.DescriptorProto_ReservedRange{\n\t\t\tStart: proto.Int32(int32(rrange[0])),\n\t\t\tEnd:   proto.Int32(int32(rrange[1])),\n\t\t})\n\t}\n\tfor i, names := 0, message.ReservedNames(); i < names.Len(); i++ {\n\t\tp.ReservedName = append(p.ReservedName, string(names.Get(i)))\n\t}\n\treturn p\n}\n\n// ToFieldDescriptorProto copies a protoreflect.FieldDescriptor into a\n// google.protobuf.FieldDescriptorProto message.\nfunc ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\tp := &descriptorpb.FieldDescriptorProto{\n\t\tName:    proto.String(string(field.Name())),\n\t\tNumber:  proto.Int32(int32(field.Number())),\n\t\tLabel:   descriptorpb.FieldDescriptorProto_Label(field.Cardinality()).Enum(),\n\t\tOptions: proto.Clone(field.Options()).(*descriptorpb.FieldOptions),\n\t}\n\tif field.IsExtension() {\n\t\tp.Extendee = fullNameOf(field.ContainingMessage())\n\t}\n\tif field.Kind().IsValid() {\n\t\tp.Type = descriptorpb.FieldDescriptorProto_Type(field.Kind()).Enum()\n\t}\n\tif field.Enum() != nil {\n\t\tp.TypeName = fullNameOf(field.Enum())\n\t}\n\tif field.Message() != nil {\n\t\tp.TypeName = fullNameOf(field.Message())\n\t}\n\tif field.HasJSONName() {\n\t\t// A bug in older versions of protoc would always populate the\n\t\t// \"json_name\" option for extensions when it is meaningless.\n\t\t// When it did so, it would always use the camel-cased field name.\n\t\tif field.IsExtension() {\n\t\t\tp.JsonName = proto.String(strs.JSONCamelCase(string(field.Name())))\n\t\t} else {\n\t\t\tp.JsonName = proto.String(field.JSONName())\n\t\t}\n\t}\n\tif field.Syntax() == protoreflect.Proto3 && field.HasOptionalKeyword() {\n\t\tp.Proto3Optional = proto.Bool(true)\n\t}\n\tif field.HasDefault() {\n\t\tdef, err := defval.Marshal(field.Default(), field.DefaultEnumValue(), field.Kind(), defval.Descriptor)\n\t\tif err != nil && field.DefaultEnumValue() != nil {\n\t\t\tdef = string(field.DefaultEnumValue().Name()) // occurs for unresolved enum values\n\t\t} else if err != nil {\n\t\t\tpanic(fmt.Sprintf(\"%v: %v\", field.FullName(), err))\n\t\t}\n\t\tp.DefaultValue = proto.String(def)\n\t}\n\tif oneof := field.ContainingOneof(); oneof != nil {\n\t\tp.OneofIndex = proto.Int32(int32(oneof.Index()))\n\t}\n\treturn p\n}\n\n// ToOneofDescriptorProto copies a protoreflect.OneofDescriptor into a\n// google.protobuf.OneofDescriptorProto message.\nfunc ToOneofDescriptorProto(oneof protoreflect.OneofDescriptor) *descriptorpb.OneofDescriptorProto {\n\treturn &descriptorpb.OneofDescriptorProto{\n\t\tName:    proto.String(string(oneof.Name())),\n\t\tOptions: proto.Clone(oneof.Options()).(*descriptorpb.OneofOptions),\n\t}\n}\n\n// ToEnumDescriptorProto copies a protoreflect.EnumDescriptor into a\n// google.protobuf.EnumDescriptorProto message.\nfunc ToEnumDescriptorProto(enum protoreflect.EnumDescriptor) *descriptorpb.EnumDescriptorProto {\n\tp := &descriptorpb.EnumDescriptorProto{\n\t\tName:    proto.String(string(enum.Name())),\n\t\tOptions: proto.Clone(enum.Options()).(*descriptorpb.EnumOptions),\n\t}\n\tfor i, values := 0, enum.Values(); i < values.Len(); i++ {\n\t\tp.Value = append(p.Value, ToEnumValueDescriptorProto(values.Get(i)))\n\t}\n\tfor i, ranges := 0, enum.ReservedRanges(); i < ranges.Len(); i++ {\n\t\trrange := ranges.Get(i)\n\t\tp.ReservedRange = append(p.ReservedRange, &descriptorpb.EnumDescriptorProto_EnumReservedRange{\n\t\t\tStart: proto.Int32(int32(rrange[0])),\n\t\t\tEnd:   proto.Int32(int32(rrange[1])),\n\t\t})\n\t}\n\tfor i, names := 0, enum.ReservedNames(); i < names.Len(); i++ {\n\t\tp.ReservedName = append(p.ReservedName, string(names.Get(i)))\n\t}\n\treturn p\n}\n\n// ToEnumValueDescriptorProto copies a protoreflect.EnumValueDescriptor into a\n// google.protobuf.EnumValueDescriptorProto message.\nfunc ToEnumValueDescriptorProto(value protoreflect.EnumValueDescriptor) *descriptorpb.EnumValueDescriptorProto {\n\treturn &descriptorpb.EnumValueDescriptorProto{\n\t\tName:    proto.String(string(value.Name())),\n\t\tNumber:  proto.Int32(int32(value.Number())),\n\t\tOptions: proto.Clone(value.Options()).(*descriptorpb.EnumValueOptions),\n\t}\n}\n\n// ToServiceDescriptorProto copies a protoreflect.ServiceDescriptor into a\n// google.protobuf.ServiceDescriptorProto message.\nfunc ToServiceDescriptorProto(service protoreflect.ServiceDescriptor) *descriptorpb.ServiceDescriptorProto {\n\tp := &descriptorpb.ServiceDescriptorProto{\n\t\tName:    proto.String(string(service.Name())),\n\t\tOptions: proto.Clone(service.Options()).(*descriptorpb.ServiceOptions),\n\t}\n\tfor i, methods := 0, service.Methods(); i < methods.Len(); i++ {\n\t\tp.Method = append(p.Method, ToMethodDescriptorProto(methods.Get(i)))\n\t}\n\treturn p\n}\n\n// ToMethodDescriptorProto copies a protoreflect.MethodDescriptor into a\n// google.protobuf.MethodDescriptorProto message.\nfunc ToMethodDescriptorProto(method protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {\n\tp := &descriptorpb.MethodDescriptorProto{\n\t\tName:       proto.String(string(method.Name())),\n\t\tInputType:  fullNameOf(method.Input()),\n\t\tOutputType: fullNameOf(method.Output()),\n\t\tOptions:    proto.Clone(method.Options()).(*descriptorpb.MethodOptions),\n\t}\n\tif method.IsStreamingClient() {\n\t\tp.ClientStreaming = proto.Bool(true)\n\t}\n\tif method.IsStreamingServer() {\n\t\tp.ServerStreaming = proto.Bool(true)\n\t}\n\treturn p\n}\n\nfunc fullNameOf(d protoreflect.Descriptor) *string {\n\tif d == nil {\n\t\treturn nil\n\t}\n\tif strings.HasPrefix(string(d.FullName()), unknownPrefix) {\n\t\treturn proto.String(string(d.FullName()[len(unknownPrefix):]))\n\t}\n\treturn proto.String(\".\" + string(d.FullName()))\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protoreflect/methods.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 protoreflect\n\nimport (\n\t\"google.golang.org/protobuf/internal/pragma\"\n)\n\n// The following types are used by the fast-path Message.ProtoMethods method.\n//\n// To avoid polluting the public protoreflect API with types used only by\n// low-level implementations, the canonical definitions of these types are\n// in the runtime/protoiface package. The definitions here and in protoiface\n// must be kept in sync.\ntype (\n\tmethods = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tFlags            supportFlags\n\t\tSize             func(sizeInput) sizeOutput\n\t\tMarshal          func(marshalInput) (marshalOutput, error)\n\t\tUnmarshal        func(unmarshalInput) (unmarshalOutput, error)\n\t\tMerge            func(mergeInput) mergeOutput\n\t\tCheckInitialized func(checkInitializedInput) (checkInitializedOutput, error)\n\t}\n\tsupportFlags = uint64\n\tsizeInput    = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tMessage Message\n\t\tFlags   uint8\n\t}\n\tsizeOutput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tSize int\n\t}\n\tmarshalInput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tMessage Message\n\t\tBuf     []byte\n\t\tFlags   uint8\n\t}\n\tmarshalOutput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tBuf []byte\n\t}\n\tunmarshalInput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tMessage  Message\n\t\tBuf      []byte\n\t\tFlags    uint8\n\t\tResolver interface {\n\t\t\tFindExtensionByName(field FullName) (ExtensionType, error)\n\t\t\tFindExtensionByNumber(message FullName, field FieldNumber) (ExtensionType, error)\n\t\t}\n\t}\n\tunmarshalOutput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tFlags uint8\n\t}\n\tmergeInput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tSource      Message\n\t\tDestination Message\n\t}\n\tmergeOutput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tFlags uint8\n\t}\n\tcheckInitializedInput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tMessage Message\n\t}\n\tcheckInitializedOutput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t}\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protoreflect/proto.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 protoreflect provides interfaces to dynamically manipulate messages.\n//\n// This package includes type descriptors which describe the structure of types\n// defined in proto source files and value interfaces which provide the\n// ability to examine and manipulate the contents of messages.\n//\n//\n// Protocol Buffer Descriptors\n//\n// Protobuf descriptors (e.g., EnumDescriptor or MessageDescriptor)\n// are immutable objects that represent protobuf type information.\n// They are wrappers around the messages declared in descriptor.proto.\n// Protobuf descriptors alone lack any information regarding Go types.\n//\n// Enums and messages generated by this module implement Enum and ProtoMessage,\n// where the Descriptor and ProtoReflect.Descriptor accessors respectively\n// return the protobuf descriptor for the values.\n//\n// The protobuf descriptor interfaces are not meant to be implemented by\n// user code since they might need to be extended in the future to support\n// additions to the protobuf language.\n// The \"google.golang.org/protobuf/reflect/protodesc\" package converts between\n// google.protobuf.DescriptorProto messages and protobuf descriptors.\n//\n//\n// Go Type Descriptors\n//\n// A type descriptor (e.g., EnumType or MessageType) is a constructor for\n// a concrete Go type that represents the associated protobuf descriptor.\n// There is commonly a one-to-one relationship between protobuf descriptors and\n// Go type descriptors, but it can potentially be a one-to-many relationship.\n//\n// Enums and messages generated by this module implement Enum and ProtoMessage,\n// where the Type and ProtoReflect.Type accessors respectively\n// return the protobuf descriptor for the values.\n//\n// The \"google.golang.org/protobuf/types/dynamicpb\" package can be used to\n// create Go type descriptors from protobuf descriptors.\n//\n//\n// Value Interfaces\n//\n// The Enum and Message interfaces provide a reflective view over an\n// enum or message instance. For enums, it provides the ability to retrieve\n// the enum value number for any concrete enum type. For messages, it provides\n// the ability to access or manipulate fields of the message.\n//\n// To convert a proto.Message to a protoreflect.Message, use the\n// former's ProtoReflect method. Since the ProtoReflect method is new to the\n// v2 message interface, it may not be present on older message implementations.\n// The \"github.com/golang/protobuf/proto\".MessageReflect function can be used\n// to obtain a reflective view on older messages.\n//\n//\n// Relationships\n//\n// The following diagrams demonstrate the relationships between\n// various types declared in this package.\n//\n//\n//\t                       ┌───────────────────────────────────┐\n//\t                       V                                   │\n//\t   ┌────────────── New(n) ─────────────┐                   │\n//\t   │                                   │                   │\n//\t   │      ┌──── Descriptor() ──┐       │  ┌── Number() ──┐ │\n//\t   │      │                    V       V  │              V │\n//\t╔════════════╗  ╔════════════════╗  ╔════════╗  ╔════════════╗\n//\t║  EnumType  ║  ║ EnumDescriptor ║  ║  Enum  ║  ║ EnumNumber ║\n//\t╚════════════╝  ╚════════════════╝  ╚════════╝  ╚════════════╝\n//\t      Λ           Λ                   │ │\n//\t      │           └─── Descriptor() ──┘ │\n//\t      │                                 │\n//\t      └────────────────── Type() ───────┘\n//\n// • An EnumType describes a concrete Go enum type.\n// It has an EnumDescriptor and can construct an Enum instance.\n//\n// • An EnumDescriptor describes an abstract protobuf enum type.\n//\n// • An Enum is a concrete enum instance. Generated enums implement Enum.\n//\n//\n//\t  ┌──────────────── New() ─────────────────┐\n//\t  │                                        │\n//\t  │         ┌─── Descriptor() ─────┐       │   ┌── Interface() ───┐\n//\t  │         │                      V       V   │                  V\n//\t╔═════════════╗  ╔═══════════════════╗  ╔═════════╗  ╔══════════════╗\n//\t║ MessageType ║  ║ MessageDescriptor ║  ║ Message ║  ║ ProtoMessage ║\n//\t╚═════════════╝  ╚═══════════════════╝  ╚═════════╝  ╚══════════════╝\n//\t       Λ           Λ                      │ │  Λ                  │\n//\t       │           └──── Descriptor() ────┘ │  └─ ProtoReflect() ─┘\n//\t       │                                    │\n//\t       └─────────────────── Type() ─────────┘\n//\n// • A MessageType describes a concrete Go message type.\n// It has a MessageDescriptor and can construct a Message instance.\n//\n// • A MessageDescriptor describes an abstract protobuf message type.\n//\n// • A Message is a concrete message instance. Generated messages implement\n// ProtoMessage, which can convert to/from a Message.\n//\n//\n//\t      ┌── TypeDescriptor() ──┐    ┌───── Descriptor() ─────┐\n//\t      │                      V    │                        V\n//\t╔═══════════════╗  ╔═════════════════════════╗  ╔═════════════════════╗\n//\t║ ExtensionType ║  ║ ExtensionTypeDescriptor ║  ║ ExtensionDescriptor ║\n//\t╚═══════════════╝  ╚═════════════════════════╝  ╚═════════════════════╝\n//\t      Λ                      │   │ Λ                      │ Λ\n//\t      └─────── Type() ───────┘   │ └─── may implement ────┘ │\n//\t                                 │                          │\n//\t                                 └────── implements ────────┘\n//\n// • An ExtensionType describes a concrete Go implementation of an extension.\n// It has an ExtensionTypeDescriptor and can convert to/from\n// abstract Values and Go values.\n//\n// • An ExtensionTypeDescriptor is an ExtensionDescriptor\n// which also has an ExtensionType.\n//\n// • An ExtensionDescriptor describes an abstract protobuf extension field and\n// may not always be an ExtensionTypeDescriptor.\npackage protoreflect\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n)\n\ntype doNotImplement pragma.DoNotImplement\n\n// ProtoMessage is the top-level interface that all proto messages implement.\n// This is declared in the protoreflect package to avoid a cyclic dependency;\n// use the proto.Message type instead, which aliases this type.\ntype ProtoMessage interface{ ProtoReflect() Message }\n\n// Syntax is the language version of the proto file.\ntype Syntax syntax\n\ntype syntax int8 // keep exact type opaque as the int type may change\n\nconst (\n\tProto2 Syntax = 2\n\tProto3 Syntax = 3\n)\n\n// IsValid reports whether the syntax is valid.\nfunc (s Syntax) IsValid() bool {\n\tswitch s {\n\tcase Proto2, Proto3:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\n// String returns s as a proto source identifier (e.g., \"proto2\").\nfunc (s Syntax) String() string {\n\tswitch s {\n\tcase Proto2:\n\t\treturn \"proto2\"\n\tcase Proto3:\n\t\treturn \"proto3\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"<unknown:%d>\", s)\n\t}\n}\n\n// GoString returns s as a Go source identifier (e.g., \"Proto2\").\nfunc (s Syntax) GoString() string {\n\tswitch s {\n\tcase Proto2:\n\t\treturn \"Proto2\"\n\tcase Proto3:\n\t\treturn \"Proto3\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"Syntax(%d)\", s)\n\t}\n}\n\n// Cardinality determines whether a field is optional, required, or repeated.\ntype Cardinality cardinality\n\ntype cardinality int8 // keep exact type opaque as the int type may change\n\n// Constants as defined by the google.protobuf.Cardinality enumeration.\nconst (\n\tOptional Cardinality = 1 // appears zero or one times\n\tRequired Cardinality = 2 // appears exactly one time; invalid with Proto3\n\tRepeated Cardinality = 3 // appears zero or more times\n)\n\n// IsValid reports whether the cardinality is valid.\nfunc (c Cardinality) IsValid() bool {\n\tswitch c {\n\tcase Optional, Required, Repeated:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\n// String returns c as a proto source identifier (e.g., \"optional\").\nfunc (c Cardinality) String() string {\n\tswitch c {\n\tcase Optional:\n\t\treturn \"optional\"\n\tcase Required:\n\t\treturn \"required\"\n\tcase Repeated:\n\t\treturn \"repeated\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"<unknown:%d>\", c)\n\t}\n}\n\n// GoString returns c as a Go source identifier (e.g., \"Optional\").\nfunc (c Cardinality) GoString() string {\n\tswitch c {\n\tcase Optional:\n\t\treturn \"Optional\"\n\tcase Required:\n\t\treturn \"Required\"\n\tcase Repeated:\n\t\treturn \"Repeated\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"Cardinality(%d)\", c)\n\t}\n}\n\n// Kind indicates the basic proto kind of a field.\ntype Kind kind\n\ntype kind int8 // keep exact type opaque as the int type may change\n\n// Constants as defined by the google.protobuf.Field.Kind enumeration.\nconst (\n\tBoolKind     Kind = 8\n\tEnumKind     Kind = 14\n\tInt32Kind    Kind = 5\n\tSint32Kind   Kind = 17\n\tUint32Kind   Kind = 13\n\tInt64Kind    Kind = 3\n\tSint64Kind   Kind = 18\n\tUint64Kind   Kind = 4\n\tSfixed32Kind Kind = 15\n\tFixed32Kind  Kind = 7\n\tFloatKind    Kind = 2\n\tSfixed64Kind Kind = 16\n\tFixed64Kind  Kind = 6\n\tDoubleKind   Kind = 1\n\tStringKind   Kind = 9\n\tBytesKind    Kind = 12\n\tMessageKind  Kind = 11\n\tGroupKind    Kind = 10\n)\n\n// IsValid reports whether the kind is valid.\nfunc (k Kind) IsValid() bool {\n\tswitch k {\n\tcase BoolKind, EnumKind,\n\t\tInt32Kind, Sint32Kind, Uint32Kind,\n\t\tInt64Kind, Sint64Kind, Uint64Kind,\n\t\tSfixed32Kind, Fixed32Kind, FloatKind,\n\t\tSfixed64Kind, Fixed64Kind, DoubleKind,\n\t\tStringKind, BytesKind, MessageKind, GroupKind:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\n// String returns k as a proto source identifier (e.g., \"bool\").\nfunc (k Kind) String() string {\n\tswitch k {\n\tcase BoolKind:\n\t\treturn \"bool\"\n\tcase EnumKind:\n\t\treturn \"enum\"\n\tcase Int32Kind:\n\t\treturn \"int32\"\n\tcase Sint32Kind:\n\t\treturn \"sint32\"\n\tcase Uint32Kind:\n\t\treturn \"uint32\"\n\tcase Int64Kind:\n\t\treturn \"int64\"\n\tcase Sint64Kind:\n\t\treturn \"sint64\"\n\tcase Uint64Kind:\n\t\treturn \"uint64\"\n\tcase Sfixed32Kind:\n\t\treturn \"sfixed32\"\n\tcase Fixed32Kind:\n\t\treturn \"fixed32\"\n\tcase FloatKind:\n\t\treturn \"float\"\n\tcase Sfixed64Kind:\n\t\treturn \"sfixed64\"\n\tcase Fixed64Kind:\n\t\treturn \"fixed64\"\n\tcase DoubleKind:\n\t\treturn \"double\"\n\tcase StringKind:\n\t\treturn \"string\"\n\tcase BytesKind:\n\t\treturn \"bytes\"\n\tcase MessageKind:\n\t\treturn \"message\"\n\tcase GroupKind:\n\t\treturn \"group\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"<unknown:%d>\", k)\n\t}\n}\n\n// GoString returns k as a Go source identifier (e.g., \"BoolKind\").\nfunc (k Kind) GoString() string {\n\tswitch k {\n\tcase BoolKind:\n\t\treturn \"BoolKind\"\n\tcase EnumKind:\n\t\treturn \"EnumKind\"\n\tcase Int32Kind:\n\t\treturn \"Int32Kind\"\n\tcase Sint32Kind:\n\t\treturn \"Sint32Kind\"\n\tcase Uint32Kind:\n\t\treturn \"Uint32Kind\"\n\tcase Int64Kind:\n\t\treturn \"Int64Kind\"\n\tcase Sint64Kind:\n\t\treturn \"Sint64Kind\"\n\tcase Uint64Kind:\n\t\treturn \"Uint64Kind\"\n\tcase Sfixed32Kind:\n\t\treturn \"Sfixed32Kind\"\n\tcase Fixed32Kind:\n\t\treturn \"Fixed32Kind\"\n\tcase FloatKind:\n\t\treturn \"FloatKind\"\n\tcase Sfixed64Kind:\n\t\treturn \"Sfixed64Kind\"\n\tcase Fixed64Kind:\n\t\treturn \"Fixed64Kind\"\n\tcase DoubleKind:\n\t\treturn \"DoubleKind\"\n\tcase StringKind:\n\t\treturn \"StringKind\"\n\tcase BytesKind:\n\t\treturn \"BytesKind\"\n\tcase MessageKind:\n\t\treturn \"MessageKind\"\n\tcase GroupKind:\n\t\treturn \"GroupKind\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"Kind(%d)\", k)\n\t}\n}\n\n// FieldNumber is the field number in a message.\ntype FieldNumber = protowire.Number\n\n// FieldNumbers represent a list of field numbers.\ntype FieldNumbers interface {\n\t// Len reports the number of fields in the list.\n\tLen() int\n\t// Get returns the ith field number. It panics if out of bounds.\n\tGet(i int) FieldNumber\n\t// Has reports whether n is within the list of fields.\n\tHas(n FieldNumber) bool\n\n\tdoNotImplement\n}\n\n// FieldRanges represent a list of field number ranges.\ntype FieldRanges interface {\n\t// Len reports the number of ranges in the list.\n\tLen() int\n\t// Get returns the ith range. It panics if out of bounds.\n\tGet(i int) [2]FieldNumber // start inclusive; end exclusive\n\t// Has reports whether n is within any of the ranges.\n\tHas(n FieldNumber) bool\n\n\tdoNotImplement\n}\n\n// EnumNumber is the numeric value for an enum.\ntype EnumNumber int32\n\n// EnumRanges represent a list of enum number ranges.\ntype EnumRanges interface {\n\t// Len reports the number of ranges in the list.\n\tLen() int\n\t// Get returns the ith range. It panics if out of bounds.\n\tGet(i int) [2]EnumNumber // start inclusive; end inclusive\n\t// Has reports whether n is within any of the ranges.\n\tHas(n EnumNumber) bool\n\n\tdoNotImplement\n}\n\n// Name is the short name for a proto declaration. This is not the name\n// as used in Go source code, which might not be identical to the proto name.\ntype Name string // e.g., \"Kind\"\n\n// IsValid reports whether s is a syntactically valid name.\n// An empty name is invalid.\nfunc (s Name) IsValid() bool {\n\treturn consumeIdent(string(s)) == len(s)\n}\n\n// Names represent a list of names.\ntype Names interface {\n\t// Len reports the number of names in the list.\n\tLen() int\n\t// Get returns the ith name. It panics if out of bounds.\n\tGet(i int) Name\n\t// Has reports whether s matches any names in the list.\n\tHas(s Name) bool\n\n\tdoNotImplement\n}\n\n// FullName is a qualified name that uniquely identifies a proto declaration.\n// A qualified name is the concatenation of the proto package along with the\n// fully-declared name (i.e., name of parent preceding the name of the child),\n// with a '.' delimiter placed between each Name.\n//\n// This should not have any leading or trailing dots.\ntype FullName string // e.g., \"google.protobuf.Field.Kind\"\n\n// IsValid reports whether s is a syntactically valid full name.\n// An empty full name is invalid.\nfunc (s FullName) IsValid() bool {\n\ti := consumeIdent(string(s))\n\tif i < 0 {\n\t\treturn false\n\t}\n\tfor len(s) > i {\n\t\tif s[i] != '.' {\n\t\t\treturn false\n\t\t}\n\t\ti++\n\t\tn := consumeIdent(string(s[i:]))\n\t\tif n < 0 {\n\t\t\treturn false\n\t\t}\n\t\ti += n\n\t}\n\treturn true\n}\n\nfunc consumeIdent(s string) (i int) {\n\tif len(s) == 0 || !isLetter(s[i]) {\n\t\treturn -1\n\t}\n\ti++\n\tfor len(s) > i && isLetterDigit(s[i]) {\n\t\ti++\n\t}\n\treturn i\n}\nfunc isLetter(c byte) bool {\n\treturn c == '_' || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')\n}\nfunc isLetterDigit(c byte) bool {\n\treturn isLetter(c) || ('0' <= c && c <= '9')\n}\n\n// Name returns the short name, which is the last identifier segment.\n// A single segment FullName is the Name itself.\nfunc (n FullName) Name() Name {\n\tif i := strings.LastIndexByte(string(n), '.'); i >= 0 {\n\t\treturn Name(n[i+1:])\n\t}\n\treturn Name(n)\n}\n\n// Parent returns the full name with the trailing identifier removed.\n// A single segment FullName has no parent.\nfunc (n FullName) Parent() FullName {\n\tif i := strings.LastIndexByte(string(n), '.'); i >= 0 {\n\t\treturn n[:i]\n\t}\n\treturn \"\"\n}\n\n// Append returns the qualified name appended with the provided short name.\n//\n// Invariant: n == n.Parent().Append(n.Name()) // assuming n is valid\nfunc (n FullName) Append(s Name) FullName {\n\tif n == \"\" {\n\t\treturn FullName(s)\n\t}\n\treturn n + \".\" + FullName(s)\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protoreflect/source.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 protoreflect\n\nimport (\n\t\"strconv\"\n)\n\n// SourceLocations is a list of source locations.\ntype SourceLocations interface {\n\t// Len reports the number of source locations in the proto file.\n\tLen() int\n\t// Get returns the ith SourceLocation. It panics if out of bounds.\n\tGet(int) SourceLocation\n\n\t// ByPath returns the SourceLocation for the given path,\n\t// returning the first location if multiple exist for the same path.\n\t// If multiple locations exist for the same path,\n\t// then SourceLocation.Next index can be used to identify the\n\t// index of the next SourceLocation.\n\t// If no location exists for this path, it returns the zero value.\n\tByPath(path SourcePath) SourceLocation\n\n\t// ByDescriptor returns the SourceLocation for the given descriptor,\n\t// returning the first location if multiple exist for the same path.\n\t// If no location exists for this descriptor, it returns the zero value.\n\tByDescriptor(desc Descriptor) SourceLocation\n\n\tdoNotImplement\n}\n\n// SourceLocation describes a source location and\n// corresponds with the google.protobuf.SourceCodeInfo.Location message.\ntype SourceLocation struct {\n\t// Path is the path to the declaration from the root file descriptor.\n\t// The contents of this slice must not be mutated.\n\tPath SourcePath\n\n\t// StartLine and StartColumn are the zero-indexed starting location\n\t// in the source file for the declaration.\n\tStartLine, StartColumn int\n\t// EndLine and EndColumn are the zero-indexed ending location\n\t// in the source file for the declaration.\n\t// In the descriptor.proto, the end line may be omitted if it is identical\n\t// to the start line. Here, it is always populated.\n\tEndLine, EndColumn int\n\n\t// LeadingDetachedComments are the leading detached comments\n\t// for the declaration. The contents of this slice must not be mutated.\n\tLeadingDetachedComments []string\n\t// LeadingComments is the leading attached comment for the declaration.\n\tLeadingComments string\n\t// TrailingComments is the trailing attached comment for the declaration.\n\tTrailingComments string\n\n\t// Next is an index into SourceLocations for the next source location that\n\t// has the same Path. It is zero if there is no next location.\n\tNext int\n}\n\n// SourcePath identifies part of a file descriptor for a source location.\n// The SourcePath is a sequence of either field numbers or indexes into\n// a repeated field that form a path starting from the root file descriptor.\n//\n// See google.protobuf.SourceCodeInfo.Location.path.\ntype SourcePath []int32\n\n// Equal reports whether p1 equals p2.\nfunc (p1 SourcePath) Equal(p2 SourcePath) bool {\n\tif len(p1) != len(p2) {\n\t\treturn false\n\t}\n\tfor i := range p1 {\n\t\tif p1[i] != p2[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\n// String formats the path in a humanly readable manner.\n// The output is guaranteed to be deterministic,\n// making it suitable for use as a key into a Go map.\n// It is not guaranteed to be stable as the exact output could change\n// in a future version of this module.\n//\n// Example output:\n//\t.message_type[6].nested_type[15].field[3]\nfunc (p SourcePath) String() string {\n\tb := p.appendFileDescriptorProto(nil)\n\tfor _, i := range p {\n\t\tb = append(b, '.')\n\t\tb = strconv.AppendInt(b, int64(i), 10)\n\t}\n\treturn string(b)\n}\n\ntype appendFunc func(*SourcePath, []byte) []byte\n\nfunc (p *SourcePath) appendSingularField(b []byte, name string, f appendFunc) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tb = append(b, '.')\n\tb = append(b, name...)\n\t*p = (*p)[1:]\n\tif f != nil {\n\t\tb = f(p, b)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendRepeatedField(b []byte, name string, f appendFunc) []byte {\n\tb = p.appendSingularField(b, name, nil)\n\tif len(*p) == 0 || (*p)[0] < 0 {\n\t\treturn b\n\t}\n\tb = append(b, '[')\n\tb = strconv.AppendUint(b, uint64((*p)[0]), 10)\n\tb = append(b, ']')\n\t*p = (*p)[1:]\n\tif f != nil {\n\t\tb = f(p, b)\n\t}\n\treturn b\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protoreflect/source_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage protoreflect\n\nfunc (p *SourcePath) appendFileDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"package\", nil)\n\tcase 3:\n\t\tb = p.appendRepeatedField(b, \"dependency\", nil)\n\tcase 10:\n\t\tb = p.appendRepeatedField(b, \"public_dependency\", nil)\n\tcase 11:\n\t\tb = p.appendRepeatedField(b, \"weak_dependency\", nil)\n\tcase 4:\n\t\tb = p.appendRepeatedField(b, \"message_type\", (*SourcePath).appendDescriptorProto)\n\tcase 5:\n\t\tb = p.appendRepeatedField(b, \"enum_type\", (*SourcePath).appendEnumDescriptorProto)\n\tcase 6:\n\t\tb = p.appendRepeatedField(b, \"service\", (*SourcePath).appendServiceDescriptorProto)\n\tcase 7:\n\t\tb = p.appendRepeatedField(b, \"extension\", (*SourcePath).appendFieldDescriptorProto)\n\tcase 8:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendFileOptions)\n\tcase 9:\n\t\tb = p.appendSingularField(b, \"source_code_info\", (*SourcePath).appendSourceCodeInfo)\n\tcase 12:\n\t\tb = p.appendSingularField(b, \"syntax\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 2:\n\t\tb = p.appendRepeatedField(b, \"field\", (*SourcePath).appendFieldDescriptorProto)\n\tcase 6:\n\t\tb = p.appendRepeatedField(b, \"extension\", (*SourcePath).appendFieldDescriptorProto)\n\tcase 3:\n\t\tb = p.appendRepeatedField(b, \"nested_type\", (*SourcePath).appendDescriptorProto)\n\tcase 4:\n\t\tb = p.appendRepeatedField(b, \"enum_type\", (*SourcePath).appendEnumDescriptorProto)\n\tcase 5:\n\t\tb = p.appendRepeatedField(b, \"extension_range\", (*SourcePath).appendDescriptorProto_ExtensionRange)\n\tcase 8:\n\t\tb = p.appendRepeatedField(b, \"oneof_decl\", (*SourcePath).appendOneofDescriptorProto)\n\tcase 7:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendMessageOptions)\n\tcase 9:\n\t\tb = p.appendRepeatedField(b, \"reserved_range\", (*SourcePath).appendDescriptorProto_ReservedRange)\n\tcase 10:\n\t\tb = p.appendRepeatedField(b, \"reserved_name\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendEnumDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 2:\n\t\tb = p.appendRepeatedField(b, \"value\", (*SourcePath).appendEnumValueDescriptorProto)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendEnumOptions)\n\tcase 4:\n\t\tb = p.appendRepeatedField(b, \"reserved_range\", (*SourcePath).appendEnumDescriptorProto_EnumReservedRange)\n\tcase 5:\n\t\tb = p.appendRepeatedField(b, \"reserved_name\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendServiceDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 2:\n\t\tb = p.appendRepeatedField(b, \"method\", (*SourcePath).appendMethodDescriptorProto)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendServiceOptions)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendFieldDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"number\", nil)\n\tcase 4:\n\t\tb = p.appendSingularField(b, \"label\", nil)\n\tcase 5:\n\t\tb = p.appendSingularField(b, \"type\", nil)\n\tcase 6:\n\t\tb = p.appendSingularField(b, \"type_name\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"extendee\", nil)\n\tcase 7:\n\t\tb = p.appendSingularField(b, \"default_value\", nil)\n\tcase 9:\n\t\tb = p.appendSingularField(b, \"oneof_index\", nil)\n\tcase 10:\n\t\tb = p.appendSingularField(b, \"json_name\", nil)\n\tcase 8:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendFieldOptions)\n\tcase 17:\n\t\tb = p.appendSingularField(b, \"proto3_optional\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendFileOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"java_package\", nil)\n\tcase 8:\n\t\tb = p.appendSingularField(b, \"java_outer_classname\", nil)\n\tcase 10:\n\t\tb = p.appendSingularField(b, \"java_multiple_files\", nil)\n\tcase 20:\n\t\tb = p.appendSingularField(b, \"java_generate_equals_and_hash\", nil)\n\tcase 27:\n\t\tb = p.appendSingularField(b, \"java_string_check_utf8\", nil)\n\tcase 9:\n\t\tb = p.appendSingularField(b, \"optimize_for\", nil)\n\tcase 11:\n\t\tb = p.appendSingularField(b, \"go_package\", nil)\n\tcase 16:\n\t\tb = p.appendSingularField(b, \"cc_generic_services\", nil)\n\tcase 17:\n\t\tb = p.appendSingularField(b, \"java_generic_services\", nil)\n\tcase 18:\n\t\tb = p.appendSingularField(b, \"py_generic_services\", nil)\n\tcase 42:\n\t\tb = p.appendSingularField(b, \"php_generic_services\", nil)\n\tcase 23:\n\t\tb = p.appendSingularField(b, \"deprecated\", nil)\n\tcase 31:\n\t\tb = p.appendSingularField(b, \"cc_enable_arenas\", nil)\n\tcase 36:\n\t\tb = p.appendSingularField(b, \"objc_class_prefix\", nil)\n\tcase 37:\n\t\tb = p.appendSingularField(b, \"csharp_namespace\", nil)\n\tcase 39:\n\t\tb = p.appendSingularField(b, \"swift_prefix\", nil)\n\tcase 40:\n\t\tb = p.appendSingularField(b, \"php_class_prefix\", nil)\n\tcase 41:\n\t\tb = p.appendSingularField(b, \"php_namespace\", nil)\n\tcase 44:\n\t\tb = p.appendSingularField(b, \"php_metadata_namespace\", nil)\n\tcase 45:\n\t\tb = p.appendSingularField(b, \"ruby_package\", nil)\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendSourceCodeInfo(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendRepeatedField(b, \"location\", (*SourcePath).appendSourceCodeInfo_Location)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendDescriptorProto_ExtensionRange(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"start\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"end\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendExtensionRangeOptions)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendOneofDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendOneofOptions)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendMessageOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"message_set_wire_format\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"no_standard_descriptor_accessor\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"deprecated\", nil)\n\tcase 7:\n\t\tb = p.appendSingularField(b, \"map_entry\", nil)\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendDescriptorProto_ReservedRange(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"start\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"end\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendEnumValueDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"number\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendEnumValueOptions)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendEnumOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"allow_alias\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"deprecated\", nil)\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendEnumDescriptorProto_EnumReservedRange(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"start\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"end\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendMethodDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"input_type\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"output_type\", nil)\n\tcase 4:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendMethodOptions)\n\tcase 5:\n\t\tb = p.appendSingularField(b, \"client_streaming\", nil)\n\tcase 6:\n\t\tb = p.appendSingularField(b, \"server_streaming\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendServiceOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 33:\n\t\tb = p.appendSingularField(b, \"deprecated\", nil)\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendFieldOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"ctype\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"packed\", nil)\n\tcase 6:\n\t\tb = p.appendSingularField(b, \"jstype\", nil)\n\tcase 5:\n\t\tb = p.appendSingularField(b, \"lazy\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"deprecated\", nil)\n\tcase 10:\n\t\tb = p.appendSingularField(b, \"weak\", nil)\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendUninterpretedOption(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 2:\n\t\tb = p.appendRepeatedField(b, \"name\", (*SourcePath).appendUninterpretedOption_NamePart)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"identifier_value\", nil)\n\tcase 4:\n\t\tb = p.appendSingularField(b, \"positive_int_value\", nil)\n\tcase 5:\n\t\tb = p.appendSingularField(b, \"negative_int_value\", nil)\n\tcase 6:\n\t\tb = p.appendSingularField(b, \"double_value\", nil)\n\tcase 7:\n\t\tb = p.appendSingularField(b, \"string_value\", nil)\n\tcase 8:\n\t\tb = p.appendSingularField(b, \"aggregate_value\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendSourceCodeInfo_Location(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendRepeatedField(b, \"path\", nil)\n\tcase 2:\n\t\tb = p.appendRepeatedField(b, \"span\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"leading_comments\", nil)\n\tcase 4:\n\t\tb = p.appendSingularField(b, \"trailing_comments\", nil)\n\tcase 6:\n\t\tb = p.appendRepeatedField(b, \"leading_detached_comments\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendExtensionRangeOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendOneofOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendEnumValueOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"deprecated\", nil)\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendMethodOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 33:\n\t\tb = p.appendSingularField(b, \"deprecated\", nil)\n\tcase 34:\n\t\tb = p.appendSingularField(b, \"idempotency_level\", nil)\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendUninterpretedOption_NamePart(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name_part\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"is_extension\", nil)\n\t}\n\treturn b\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protoreflect/type.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 protoreflect\n\n// Descriptor provides a set of accessors that are common to every descriptor.\n// Each descriptor type wraps the equivalent google.protobuf.XXXDescriptorProto,\n// but provides efficient lookup and immutability.\n//\n// Each descriptor is comparable. Equality implies that the two types are\n// exactly identical. However, it is possible for the same semantically\n// identical proto type to be represented by multiple type descriptors.\n//\n// For example, suppose we have t1 and t2 which are both MessageDescriptors.\n// If t1 == t2, then the types are definitely equal and all accessors return\n// the same information. However, if t1 != t2, then it is still possible that\n// they still represent the same proto type (e.g., t1.FullName == t2.FullName).\n// This can occur if a descriptor type is created dynamically, or multiple\n// versions of the same proto type are accidentally linked into the Go binary.\ntype Descriptor interface {\n\t// ParentFile returns the parent file descriptor that this descriptor\n\t// is declared within. The parent file for the file descriptor is itself.\n\t//\n\t// Support for this functionality is optional and may return nil.\n\tParentFile() FileDescriptor\n\n\t// Parent returns the parent containing this descriptor declaration.\n\t// The following shows the mapping from child type to possible parent types:\n\t//\n\t//\t╔═════════════════════╤═══════════════════════════════════╗\n\t//\t║ Child type          │ Possible parent types             ║\n\t//\t╠═════════════════════╪═══════════════════════════════════╣\n\t//\t║ FileDescriptor      │ nil                               ║\n\t//\t║ MessageDescriptor   │ FileDescriptor, MessageDescriptor ║\n\t//\t║ FieldDescriptor     │ FileDescriptor, MessageDescriptor ║\n\t//\t║ OneofDescriptor     │ MessageDescriptor                 ║\n\t//\t║ EnumDescriptor      │ FileDescriptor, MessageDescriptor ║\n\t//\t║ EnumValueDescriptor │ EnumDescriptor                    ║\n\t//\t║ ServiceDescriptor   │ FileDescriptor                    ║\n\t//\t║ MethodDescriptor    │ ServiceDescriptor                 ║\n\t//\t╚═════════════════════╧═══════════════════════════════════╝\n\t//\n\t// Support for this functionality is optional and may return nil.\n\tParent() Descriptor\n\n\t// Index returns the index of this descriptor within its parent.\n\t// It returns 0 if the descriptor does not have a parent or if the parent\n\t// is unknown.\n\tIndex() int\n\n\t// Syntax is the protobuf syntax.\n\tSyntax() Syntax // e.g., Proto2 or Proto3\n\n\t// Name is the short name of the declaration (i.e., FullName.Name).\n\tName() Name // e.g., \"Any\"\n\n\t// FullName is the fully-qualified name of the declaration.\n\t//\n\t// The FullName is a concatenation of the full name of the type that this\n\t// type is declared within and the declaration name. For example,\n\t// field \"foo_field\" in message \"proto.package.MyMessage\" is\n\t// uniquely identified as \"proto.package.MyMessage.foo_field\".\n\t// Enum values are an exception to the rule (see EnumValueDescriptor).\n\tFullName() FullName // e.g., \"google.protobuf.Any\"\n\n\t// IsPlaceholder reports whether type information is missing since a\n\t// dependency is not resolved, in which case only name information is known.\n\t//\n\t// Placeholder types may only be returned by the following accessors\n\t// as a result of unresolved dependencies or weak imports:\n\t//\n\t//\t╔═══════════════════════════════════╤═════════════════════╗\n\t//\t║ Accessor                          │ Descriptor          ║\n\t//\t╠═══════════════════════════════════╪═════════════════════╣\n\t//\t║ FileImports.FileDescriptor        │ FileDescriptor      ║\n\t//\t║ FieldDescriptor.Enum              │ EnumDescriptor      ║\n\t//\t║ FieldDescriptor.Message           │ MessageDescriptor   ║\n\t//\t║ FieldDescriptor.DefaultEnumValue  │ EnumValueDescriptor ║\n\t//\t║ FieldDescriptor.ContainingMessage │ MessageDescriptor   ║\n\t//\t║ MethodDescriptor.Input            │ MessageDescriptor   ║\n\t//\t║ MethodDescriptor.Output           │ MessageDescriptor   ║\n\t//\t╚═══════════════════════════════════╧═════════════════════╝\n\t//\n\t// If true, only Name and FullName are valid.\n\t// For FileDescriptor, the Path is also valid.\n\tIsPlaceholder() bool\n\n\t// Options returns the descriptor options. The caller must not modify\n\t// the returned value.\n\t//\n\t// To avoid a dependency cycle, this function returns a proto.Message value.\n\t// The proto message type returned for each descriptor type is as follows:\n\t//\t╔═════════════════════╤══════════════════════════════════════════╗\n\t//\t║ Go type             │ Protobuf message type                    ║\n\t//\t╠═════════════════════╪══════════════════════════════════════════╣\n\t//\t║ FileDescriptor      │ google.protobuf.FileOptions              ║\n\t//\t║ EnumDescriptor      │ google.protobuf.EnumOptions              ║\n\t//\t║ EnumValueDescriptor │ google.protobuf.EnumValueOptions         ║\n\t//\t║ MessageDescriptor   │ google.protobuf.MessageOptions           ║\n\t//\t║ FieldDescriptor     │ google.protobuf.FieldOptions             ║\n\t//\t║ OneofDescriptor     │ google.protobuf.OneofOptions             ║\n\t//\t║ ServiceDescriptor   │ google.protobuf.ServiceOptions           ║\n\t//\t║ MethodDescriptor    │ google.protobuf.MethodOptions            ║\n\t//\t╚═════════════════════╧══════════════════════════════════════════╝\n\t//\n\t// This method returns a typed nil-pointer if no options are present.\n\t// The caller must import the descriptorpb package to use this.\n\tOptions() ProtoMessage\n\n\tdoNotImplement\n}\n\n// FileDescriptor describes the types in a complete proto file and\n// corresponds with the google.protobuf.FileDescriptorProto message.\n//\n// Top-level declarations:\n// EnumDescriptor, MessageDescriptor, FieldDescriptor, and/or ServiceDescriptor.\ntype FileDescriptor interface {\n\tDescriptor // Descriptor.FullName is identical to Package\n\n\t// Path returns the file name, relative to the source tree root.\n\tPath() string // e.g., \"path/to/file.proto\"\n\t// Package returns the protobuf package namespace.\n\tPackage() FullName // e.g., \"google.protobuf\"\n\n\t// Imports is a list of imported proto files.\n\tImports() FileImports\n\n\t// Enums is a list of the top-level enum declarations.\n\tEnums() EnumDescriptors\n\t// Messages is a list of the top-level message declarations.\n\tMessages() MessageDescriptors\n\t// Extensions is a list of the top-level extension declarations.\n\tExtensions() ExtensionDescriptors\n\t// Services is a list of the top-level service declarations.\n\tServices() ServiceDescriptors\n\n\t// SourceLocations is a list of source locations.\n\tSourceLocations() SourceLocations\n\n\tisFileDescriptor\n}\ntype isFileDescriptor interface{ ProtoType(FileDescriptor) }\n\n// FileImports is a list of file imports.\ntype FileImports interface {\n\t// Len reports the number of files imported by this proto file.\n\tLen() int\n\t// Get returns the ith FileImport. It panics if out of bounds.\n\tGet(i int) FileImport\n\n\tdoNotImplement\n}\n\n// FileImport is the declaration for a proto file import.\ntype FileImport struct {\n\t// FileDescriptor is the file type for the given import.\n\t// It is a placeholder descriptor if IsWeak is set or if a dependency has\n\t// not been regenerated to implement the new reflection APIs.\n\tFileDescriptor\n\n\t// IsPublic reports whether this is a public import, which causes this file\n\t// to alias declarations within the imported file. The intended use cases\n\t// for this feature is the ability to move proto files without breaking\n\t// existing dependencies.\n\t//\n\t// The current file and the imported file must be within proto package.\n\tIsPublic bool\n\n\t// IsWeak reports whether this is a weak import, which does not impose\n\t// a direct dependency on the target file.\n\t//\n\t// Weak imports are a legacy proto1 feature. Equivalent behavior is\n\t// achieved using proto2 extension fields or proto3 Any messages.\n\tIsWeak bool\n}\n\n// MessageDescriptor describes a message and\n// corresponds with the google.protobuf.DescriptorProto message.\n//\n// Nested declarations:\n// FieldDescriptor, OneofDescriptor, FieldDescriptor, EnumDescriptor,\n// and/or MessageDescriptor.\ntype MessageDescriptor interface {\n\tDescriptor\n\n\t// IsMapEntry indicates that this is an auto-generated message type to\n\t// represent the entry type for a map field.\n\t//\n\t// Map entry messages have only two fields:\n\t//\t• a \"key\" field with a field number of 1\n\t//\t• a \"value\" field with a field number of 2\n\t// The key and value types are determined by these two fields.\n\t//\n\t// If IsMapEntry is true, it implies that FieldDescriptor.IsMap is true\n\t// for some field with this message type.\n\tIsMapEntry() bool\n\n\t// Fields is a list of nested field declarations.\n\tFields() FieldDescriptors\n\t// Oneofs is a list of nested oneof declarations.\n\tOneofs() OneofDescriptors\n\n\t// ReservedNames is a list of reserved field names.\n\tReservedNames() Names\n\t// ReservedRanges is a list of reserved ranges of field numbers.\n\tReservedRanges() FieldRanges\n\t// RequiredNumbers is a list of required field numbers.\n\t// In Proto3, it is always an empty list.\n\tRequiredNumbers() FieldNumbers\n\t// ExtensionRanges is the field ranges used for extension fields.\n\t// In Proto3, it is always an empty ranges.\n\tExtensionRanges() FieldRanges\n\t// ExtensionRangeOptions returns the ith extension range options.\n\t//\n\t// To avoid a dependency cycle, this method returns a proto.Message value,\n\t// which always contains a google.protobuf.ExtensionRangeOptions message.\n\t// This method returns a typed nil-pointer if no options are present.\n\t// The caller must import the descriptorpb package to use this.\n\tExtensionRangeOptions(i int) ProtoMessage\n\n\t// Enums is a list of nested enum declarations.\n\tEnums() EnumDescriptors\n\t// Messages is a list of nested message declarations.\n\tMessages() MessageDescriptors\n\t// Extensions is a list of nested extension declarations.\n\tExtensions() ExtensionDescriptors\n\n\tisMessageDescriptor\n}\ntype isMessageDescriptor interface{ ProtoType(MessageDescriptor) }\n\n// MessageType encapsulates a MessageDescriptor with a concrete Go implementation.\n// It is recommended that implementations of this interface also implement the\n// MessageFieldTypes interface.\ntype MessageType interface {\n\t// New returns a newly allocated empty message.\n\t// It may return nil for synthetic messages representing a map entry.\n\tNew() Message\n\n\t// Zero returns an empty, read-only message.\n\t// It may return nil for synthetic messages representing a map entry.\n\tZero() Message\n\n\t// Descriptor returns the message descriptor.\n\t//\n\t// Invariant: t.Descriptor() == t.New().Descriptor()\n\tDescriptor() MessageDescriptor\n}\n\n// MessageFieldTypes extends a MessageType by providing type information\n// regarding enums and messages referenced by the message fields.\ntype MessageFieldTypes interface {\n\tMessageType\n\n\t// Enum returns the EnumType for the ith field in Descriptor.Fields.\n\t// It returns nil if the ith field is not an enum kind.\n\t// It panics if out of bounds.\n\t//\n\t// Invariant: mt.Enum(i).Descriptor() == mt.Descriptor().Fields(i).Enum()\n\tEnum(i int) EnumType\n\n\t// Message returns the MessageType for the ith field in Descriptor.Fields.\n\t// It returns nil if the ith field is not a message or group kind.\n\t// It panics if out of bounds.\n\t//\n\t// Invariant: mt.Message(i).Descriptor() == mt.Descriptor().Fields(i).Message()\n\tMessage(i int) MessageType\n}\n\n// MessageDescriptors is a list of message declarations.\ntype MessageDescriptors interface {\n\t// Len reports the number of messages.\n\tLen() int\n\t// Get returns the ith MessageDescriptor. It panics if out of bounds.\n\tGet(i int) MessageDescriptor\n\t// ByName returns the MessageDescriptor for a message named s.\n\t// It returns nil if not found.\n\tByName(s Name) MessageDescriptor\n\n\tdoNotImplement\n}\n\n// FieldDescriptor describes a field within a message and\n// corresponds with the google.protobuf.FieldDescriptorProto message.\n//\n// It is used for both normal fields defined within the parent message\n// (e.g., MessageDescriptor.Fields) and fields that extend some remote message\n// (e.g., FileDescriptor.Extensions or MessageDescriptor.Extensions).\ntype FieldDescriptor interface {\n\tDescriptor\n\n\t// Number reports the unique number for this field.\n\tNumber() FieldNumber\n\t// Cardinality reports the cardinality for this field.\n\tCardinality() Cardinality\n\t// Kind reports the basic kind for this field.\n\tKind() Kind\n\n\t// HasJSONName reports whether this field has an explicitly set JSON name.\n\tHasJSONName() bool\n\n\t// JSONName reports the name used for JSON serialization.\n\t// It is usually the camel-cased form of the field name.\n\t// Extension fields are represented by the full name surrounded by brackets.\n\tJSONName() string\n\n\t// TextName reports the name used for text serialization.\n\t// It is usually the name of the field, except that groups use the name\n\t// of the inlined message, and extension fields are represented by the\n\t// full name surrounded by brackets.\n\tTextName() string\n\n\t// HasPresence reports whether the field distinguishes between unpopulated\n\t// and default values.\n\tHasPresence() bool\n\n\t// IsExtension reports whether this is an extension field. If false,\n\t// then Parent and ContainingMessage refer to the same message.\n\t// Otherwise, ContainingMessage and Parent likely differ.\n\tIsExtension() bool\n\n\t// HasOptionalKeyword reports whether the \"optional\" keyword was explicitly\n\t// specified in the source .proto file.\n\tHasOptionalKeyword() bool\n\n\t// IsWeak reports whether this is a weak field, which does not impose a\n\t// direct dependency on the target type.\n\t// If true, then Message returns a placeholder type.\n\tIsWeak() bool\n\n\t// IsPacked reports whether repeated primitive numeric kinds should be\n\t// serialized using a packed encoding.\n\t// If true, then it implies Cardinality is Repeated.\n\tIsPacked() bool\n\n\t// IsList reports whether this field represents a list,\n\t// where the value type for the associated field is a List.\n\t// It is equivalent to checking whether Cardinality is Repeated and\n\t// that IsMap reports false.\n\tIsList() bool\n\n\t// IsMap reports whether this field represents a map,\n\t// where the value type for the associated field is a Map.\n\t// It is equivalent to checking whether Cardinality is Repeated,\n\t// that the Kind is MessageKind, and that Message.IsMapEntry reports true.\n\tIsMap() bool\n\n\t// MapKey returns the field descriptor for the key in the map entry.\n\t// It returns nil if IsMap reports false.\n\tMapKey() FieldDescriptor\n\n\t// MapValue returns the field descriptor for the value in the map entry.\n\t// It returns nil if IsMap reports false.\n\tMapValue() FieldDescriptor\n\n\t// HasDefault reports whether this field has a default value.\n\tHasDefault() bool\n\n\t// Default returns the default value for scalar fields.\n\t// For proto2, it is the default value as specified in the proto file,\n\t// or the zero value if unspecified.\n\t// For proto3, it is always the zero value of the scalar.\n\t// The Value type is determined by the Kind.\n\tDefault() Value\n\n\t// DefaultEnumValue returns the enum value descriptor for the default value\n\t// of an enum field, and is nil for any other kind of field.\n\tDefaultEnumValue() EnumValueDescriptor\n\n\t// ContainingOneof is the containing oneof that this field belongs to,\n\t// and is nil if this field is not part of a oneof.\n\tContainingOneof() OneofDescriptor\n\n\t// ContainingMessage is the containing message that this field belongs to.\n\t// For extension fields, this may not necessarily be the parent message\n\t// that the field is declared within.\n\tContainingMessage() MessageDescriptor\n\n\t// Enum is the enum descriptor if Kind is EnumKind.\n\t// It returns nil for any other Kind.\n\tEnum() EnumDescriptor\n\n\t// Message is the message descriptor if Kind is\n\t// MessageKind or GroupKind. It returns nil for any other Kind.\n\tMessage() MessageDescriptor\n\n\tisFieldDescriptor\n}\ntype isFieldDescriptor interface{ ProtoType(FieldDescriptor) }\n\n// FieldDescriptors is a list of field declarations.\ntype FieldDescriptors interface {\n\t// Len reports the number of fields.\n\tLen() int\n\t// Get returns the ith FieldDescriptor. It panics if out of bounds.\n\tGet(i int) FieldDescriptor\n\t// ByName returns the FieldDescriptor for a field named s.\n\t// It returns nil if not found.\n\tByName(s Name) FieldDescriptor\n\t// ByJSONName returns the FieldDescriptor for a field with s as the JSON name.\n\t// It returns nil if not found.\n\tByJSONName(s string) FieldDescriptor\n\t// ByTextName returns the FieldDescriptor for a field with s as the text name.\n\t// It returns nil if not found.\n\tByTextName(s string) FieldDescriptor\n\t// ByNumber returns the FieldDescriptor for a field numbered n.\n\t// It returns nil if not found.\n\tByNumber(n FieldNumber) FieldDescriptor\n\n\tdoNotImplement\n}\n\n// OneofDescriptor describes a oneof field set within a given message and\n// corresponds with the google.protobuf.OneofDescriptorProto message.\ntype OneofDescriptor interface {\n\tDescriptor\n\n\t// IsSynthetic reports whether this is a synthetic oneof created to support\n\t// proto3 optional semantics. If true, Fields contains exactly one field\n\t// with HasOptionalKeyword specified.\n\tIsSynthetic() bool\n\n\t// Fields is a list of fields belonging to this oneof.\n\tFields() FieldDescriptors\n\n\tisOneofDescriptor\n}\ntype isOneofDescriptor interface{ ProtoType(OneofDescriptor) }\n\n// OneofDescriptors is a list of oneof declarations.\ntype OneofDescriptors interface {\n\t// Len reports the number of oneof fields.\n\tLen() int\n\t// Get returns the ith OneofDescriptor. It panics if out of bounds.\n\tGet(i int) OneofDescriptor\n\t// ByName returns the OneofDescriptor for a oneof named s.\n\t// It returns nil if not found.\n\tByName(s Name) OneofDescriptor\n\n\tdoNotImplement\n}\n\n// ExtensionDescriptor is an alias of FieldDescriptor for documentation.\ntype ExtensionDescriptor = FieldDescriptor\n\n// ExtensionTypeDescriptor is an ExtensionDescriptor with an associated ExtensionType.\ntype ExtensionTypeDescriptor interface {\n\tExtensionDescriptor\n\n\t// Type returns the associated ExtensionType.\n\tType() ExtensionType\n\n\t// Descriptor returns the plain ExtensionDescriptor without the\n\t// associated ExtensionType.\n\tDescriptor() ExtensionDescriptor\n}\n\n// ExtensionDescriptors is a list of field declarations.\ntype ExtensionDescriptors interface {\n\t// Len reports the number of fields.\n\tLen() int\n\t// Get returns the ith ExtensionDescriptor. It panics if out of bounds.\n\tGet(i int) ExtensionDescriptor\n\t// ByName returns the ExtensionDescriptor for a field named s.\n\t// It returns nil if not found.\n\tByName(s Name) ExtensionDescriptor\n\n\tdoNotImplement\n}\n\n// ExtensionType encapsulates an ExtensionDescriptor with a concrete\n// Go implementation. The nested field descriptor must be for a extension field.\n//\n// While a normal field is a member of the parent message that it is declared\n// within (see Descriptor.Parent), an extension field is a member of some other\n// target message (see ExtensionDescriptor.Extendee) and may have no\n// relationship with the parent. However, the full name of an extension field is\n// relative to the parent that it is declared within.\n//\n// For example:\n//\tsyntax = \"proto2\";\n//\tpackage example;\n//\tmessage FooMessage {\n//\t\textensions 100 to max;\n//\t}\n//\tmessage BarMessage {\n//\t\textends FooMessage { optional BarMessage bar_field = 100; }\n//\t}\n//\n// Field \"bar_field\" is an extension of FooMessage, but its full name is\n// \"example.BarMessage.bar_field\" instead of \"example.FooMessage.bar_field\".\ntype ExtensionType interface {\n\t// New returns a new value for the field.\n\t// For scalars, this returns the default value in native Go form.\n\tNew() Value\n\n\t// Zero returns a new value for the field.\n\t// For scalars, this returns the default value in native Go form.\n\t// For composite types, this returns an empty, read-only message, list, or map.\n\tZero() Value\n\n\t// TypeDescriptor returns the extension type descriptor.\n\tTypeDescriptor() ExtensionTypeDescriptor\n\n\t// ValueOf wraps the input and returns it as a Value.\n\t// ValueOf panics if the input value is invalid or not the appropriate type.\n\t//\n\t// ValueOf is more extensive than protoreflect.ValueOf for a given field's\n\t// value as it has more type information available.\n\tValueOf(interface{}) Value\n\n\t// InterfaceOf completely unwraps the Value to the underlying Go type.\n\t// InterfaceOf panics if the input is nil or does not represent the\n\t// appropriate underlying Go type. For composite types, it panics if the\n\t// value is not mutable.\n\t//\n\t// InterfaceOf is able to unwrap the Value further than Value.Interface\n\t// as it has more type information available.\n\tInterfaceOf(Value) interface{}\n\n\t// IsValidValue reports whether the Value is valid to assign to the field.\n\tIsValidValue(Value) bool\n\n\t// IsValidInterface reports whether the input is valid to assign to the field.\n\tIsValidInterface(interface{}) bool\n}\n\n// EnumDescriptor describes an enum and\n// corresponds with the google.protobuf.EnumDescriptorProto message.\n//\n// Nested declarations:\n// EnumValueDescriptor.\ntype EnumDescriptor interface {\n\tDescriptor\n\n\t// Values is a list of nested enum value declarations.\n\tValues() EnumValueDescriptors\n\n\t// ReservedNames is a list of reserved enum names.\n\tReservedNames() Names\n\t// ReservedRanges is a list of reserved ranges of enum numbers.\n\tReservedRanges() EnumRanges\n\n\tisEnumDescriptor\n}\ntype isEnumDescriptor interface{ ProtoType(EnumDescriptor) }\n\n// EnumType encapsulates an EnumDescriptor with a concrete Go implementation.\ntype EnumType interface {\n\t// New returns an instance of this enum type with its value set to n.\n\tNew(n EnumNumber) Enum\n\n\t// Descriptor returns the enum descriptor.\n\t//\n\t// Invariant: t.Descriptor() == t.New(0).Descriptor()\n\tDescriptor() EnumDescriptor\n}\n\n// EnumDescriptors is a list of enum declarations.\ntype EnumDescriptors interface {\n\t// Len reports the number of enum types.\n\tLen() int\n\t// Get returns the ith EnumDescriptor. It panics if out of bounds.\n\tGet(i int) EnumDescriptor\n\t// ByName returns the EnumDescriptor for an enum named s.\n\t// It returns nil if not found.\n\tByName(s Name) EnumDescriptor\n\n\tdoNotImplement\n}\n\n// EnumValueDescriptor describes an enum value and\n// corresponds with the google.protobuf.EnumValueDescriptorProto message.\n//\n// All other proto declarations are in the namespace of the parent.\n// However, enum values do not follow this rule and are within the namespace\n// of the parent's parent (i.e., they are a sibling of the containing enum).\n// Thus, a value named \"FOO_VALUE\" declared within an enum uniquely identified\n// as \"proto.package.MyEnum\" has a full name of \"proto.package.FOO_VALUE\".\ntype EnumValueDescriptor interface {\n\tDescriptor\n\n\t// Number returns the enum value as an integer.\n\tNumber() EnumNumber\n\n\tisEnumValueDescriptor\n}\ntype isEnumValueDescriptor interface{ ProtoType(EnumValueDescriptor) }\n\n// EnumValueDescriptors is a list of enum value declarations.\ntype EnumValueDescriptors interface {\n\t// Len reports the number of enum values.\n\tLen() int\n\t// Get returns the ith EnumValueDescriptor. It panics if out of bounds.\n\tGet(i int) EnumValueDescriptor\n\t// ByName returns the EnumValueDescriptor for the enum value named s.\n\t// It returns nil if not found.\n\tByName(s Name) EnumValueDescriptor\n\t// ByNumber returns the EnumValueDescriptor for the enum value numbered n.\n\t// If multiple have the same number, the first one defined is returned\n\t// It returns nil if not found.\n\tByNumber(n EnumNumber) EnumValueDescriptor\n\n\tdoNotImplement\n}\n\n// ServiceDescriptor describes a service and\n// corresponds with the google.protobuf.ServiceDescriptorProto message.\n//\n// Nested declarations: MethodDescriptor.\ntype ServiceDescriptor interface {\n\tDescriptor\n\n\t// Methods is a list of nested message declarations.\n\tMethods() MethodDescriptors\n\n\tisServiceDescriptor\n}\ntype isServiceDescriptor interface{ ProtoType(ServiceDescriptor) }\n\n// ServiceDescriptors is a list of service declarations.\ntype ServiceDescriptors interface {\n\t// Len reports the number of services.\n\tLen() int\n\t// Get returns the ith ServiceDescriptor. It panics if out of bounds.\n\tGet(i int) ServiceDescriptor\n\t// ByName returns the ServiceDescriptor for a service named s.\n\t// It returns nil if not found.\n\tByName(s Name) ServiceDescriptor\n\n\tdoNotImplement\n}\n\n// MethodDescriptor describes a method and\n// corresponds with the google.protobuf.MethodDescriptorProto message.\ntype MethodDescriptor interface {\n\tDescriptor\n\n\t// Input is the input message descriptor.\n\tInput() MessageDescriptor\n\t// Output is the output message descriptor.\n\tOutput() MessageDescriptor\n\t// IsStreamingClient reports whether the client streams multiple messages.\n\tIsStreamingClient() bool\n\t// IsStreamingServer reports whether the server streams multiple messages.\n\tIsStreamingServer() bool\n\n\tisMethodDescriptor\n}\ntype isMethodDescriptor interface{ ProtoType(MethodDescriptor) }\n\n// MethodDescriptors is a list of method declarations.\ntype MethodDescriptors interface {\n\t// Len reports the number of methods.\n\tLen() int\n\t// Get returns the ith MethodDescriptor. It panics if out of bounds.\n\tGet(i int) MethodDescriptor\n\t// ByName returns the MethodDescriptor for a service method named s.\n\t// It returns nil if not found.\n\tByName(s Name) MethodDescriptor\n\n\tdoNotImplement\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protoreflect/value.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 protoreflect\n\nimport \"google.golang.org/protobuf/encoding/protowire\"\n\n// Enum is a reflection interface for a concrete enum value,\n// which provides type information and a getter for the enum number.\n// Enum does not provide a mutable API since enums are commonly backed by\n// Go constants, which are not addressable.\ntype Enum interface {\n\t// Descriptor returns enum descriptor, which contains only the protobuf\n\t// type information for the enum.\n\tDescriptor() EnumDescriptor\n\n\t// Type returns the enum type, which encapsulates both Go and protobuf\n\t// type information. If the Go type information is not needed,\n\t// it is recommended that the enum descriptor be used instead.\n\tType() EnumType\n\n\t// Number returns the enum value as an integer.\n\tNumber() EnumNumber\n}\n\n// Message is a reflective interface for a concrete message value,\n// encapsulating both type and value information for the message.\n//\n// Accessor/mutators for individual fields are keyed by FieldDescriptor.\n// For non-extension fields, the descriptor must exactly match the\n// field known by the parent message.\n// For extension fields, the descriptor must implement ExtensionTypeDescriptor,\n// extend the parent message (i.e., have the same message FullName), and\n// be within the parent's extension range.\n//\n// Each field Value can be a scalar or a composite type (Message, List, or Map).\n// See Value for the Go types associated with a FieldDescriptor.\n// Providing a Value that is invalid or of an incorrect type panics.\ntype Message interface {\n\t// Descriptor returns message descriptor, which contains only the protobuf\n\t// type information for the message.\n\tDescriptor() MessageDescriptor\n\n\t// Type returns the message type, which encapsulates both Go and protobuf\n\t// type information. If the Go type information is not needed,\n\t// it is recommended that the message descriptor be used instead.\n\tType() MessageType\n\n\t// New returns a newly allocated and mutable empty message.\n\tNew() Message\n\n\t// Interface unwraps the message reflection interface and\n\t// returns the underlying ProtoMessage interface.\n\tInterface() ProtoMessage\n\n\t// Range iterates over every populated field in an undefined order,\n\t// calling f for each field descriptor and value encountered.\n\t// Range returns immediately if f returns false.\n\t// While iterating, mutating operations may only be performed\n\t// on the current field descriptor.\n\tRange(f func(FieldDescriptor, Value) bool)\n\n\t// Has reports whether a field is populated.\n\t//\n\t// Some fields have the property of nullability where it is possible to\n\t// distinguish between the default value of a field and whether the field\n\t// was explicitly populated with the default value. Singular message fields,\n\t// member fields of a oneof, and proto2 scalar fields are nullable. Such\n\t// fields are populated only if explicitly set.\n\t//\n\t// In other cases (aside from the nullable cases above),\n\t// a proto3 scalar field is populated if it contains a non-zero value, and\n\t// a repeated field is populated if it is non-empty.\n\tHas(FieldDescriptor) bool\n\n\t// Clear clears the field such that a subsequent Has call reports false.\n\t//\n\t// Clearing an extension field clears both the extension type and value\n\t// associated with the given field number.\n\t//\n\t// Clear is a mutating operation and unsafe for concurrent use.\n\tClear(FieldDescriptor)\n\n\t// Get retrieves the value for a field.\n\t//\n\t// For unpopulated scalars, it returns the default value, where\n\t// the default value of a bytes scalar is guaranteed to be a copy.\n\t// For unpopulated composite types, it returns an empty, read-only view\n\t// of the value; to obtain a mutable reference, use Mutable.\n\tGet(FieldDescriptor) Value\n\n\t// Set stores the value for a field.\n\t//\n\t// For a field belonging to a oneof, it implicitly clears any other field\n\t// that may be currently set within the same oneof.\n\t// For extension fields, it implicitly stores the provided ExtensionType.\n\t// When setting a composite type, it is unspecified whether the stored value\n\t// aliases the source's memory in any way. If the composite value is an\n\t// empty, read-only value, then it panics.\n\t//\n\t// Set is a mutating operation and unsafe for concurrent use.\n\tSet(FieldDescriptor, Value)\n\n\t// Mutable returns a mutable reference to a composite type.\n\t//\n\t// If the field is unpopulated, it may allocate a composite value.\n\t// For a field belonging to a oneof, it implicitly clears any other field\n\t// that may be currently set within the same oneof.\n\t// For extension fields, it implicitly stores the provided ExtensionType\n\t// if not already stored.\n\t// It panics if the field does not contain a composite type.\n\t//\n\t// Mutable is a mutating operation and unsafe for concurrent use.\n\tMutable(FieldDescriptor) Value\n\n\t// NewField returns a new value that is assignable to the field\n\t// for the given descriptor. For scalars, this returns the default value.\n\t// For lists, maps, and messages, this returns a new, empty, mutable value.\n\tNewField(FieldDescriptor) Value\n\n\t// WhichOneof reports which field within the oneof is populated,\n\t// returning nil if none are populated.\n\t// It panics if the oneof descriptor does not belong to this message.\n\tWhichOneof(OneofDescriptor) FieldDescriptor\n\n\t// GetUnknown retrieves the entire list of unknown fields.\n\t// The caller may only mutate the contents of the RawFields\n\t// if the mutated bytes are stored back into the message with SetUnknown.\n\tGetUnknown() RawFields\n\n\t// SetUnknown stores an entire list of unknown fields.\n\t// The raw fields must be syntactically valid according to the wire format.\n\t// An implementation may panic if this is not the case.\n\t// Once stored, the caller must not mutate the content of the RawFields.\n\t// An empty RawFields may be passed to clear the fields.\n\t//\n\t// SetUnknown is a mutating operation and unsafe for concurrent use.\n\tSetUnknown(RawFields)\n\n\t// IsValid reports whether the message is valid.\n\t//\n\t// An invalid message is an empty, read-only value.\n\t//\n\t// An invalid message often corresponds to a nil pointer of the concrete\n\t// message type, but the details are implementation dependent.\n\t// Validity is not part of the protobuf data model, and may not\n\t// be preserved in marshaling or other operations.\n\tIsValid() bool\n\n\t// ProtoMethods returns optional fast-path implementions of various operations.\n\t// This method may return nil.\n\t//\n\t// The returned methods type is identical to\n\t// \"google.golang.org/protobuf/runtime/protoiface\".Methods.\n\t// Consult the protoiface package documentation for details.\n\tProtoMethods() *methods\n}\n\n// RawFields is the raw bytes for an ordered sequence of fields.\n// Each field contains both the tag (representing field number and wire type),\n// and also the wire data itself.\ntype RawFields []byte\n\n// IsValid reports whether b is syntactically correct wire format.\nfunc (b RawFields) IsValid() bool {\n\tfor len(b) > 0 {\n\t\t_, _, n := protowire.ConsumeField(b)\n\t\tif n < 0 {\n\t\t\treturn false\n\t\t}\n\t\tb = b[n:]\n\t}\n\treturn true\n}\n\n// List is a zero-indexed, ordered list.\n// The element Value type is determined by FieldDescriptor.Kind.\n// Providing a Value that is invalid or of an incorrect type panics.\ntype List interface {\n\t// Len reports the number of entries in the List.\n\t// Get, Set, and Truncate panic with out of bound indexes.\n\tLen() int\n\n\t// Get retrieves the value at the given index.\n\t// It never returns an invalid value.\n\tGet(int) Value\n\n\t// Set stores a value for the given index.\n\t// When setting a composite type, it is unspecified whether the set\n\t// value aliases the source's memory in any way.\n\t//\n\t// Set is a mutating operation and unsafe for concurrent use.\n\tSet(int, Value)\n\n\t// Append appends the provided value to the end of the list.\n\t// When appending a composite type, it is unspecified whether the appended\n\t// value aliases the source's memory in any way.\n\t//\n\t// Append is a mutating operation and unsafe for concurrent use.\n\tAppend(Value)\n\n\t// AppendMutable appends a new, empty, mutable message value to the end\n\t// of the list and returns it.\n\t// It panics if the list does not contain a message type.\n\tAppendMutable() Value\n\n\t// Truncate truncates the list to a smaller length.\n\t//\n\t// Truncate is a mutating operation and unsafe for concurrent use.\n\tTruncate(int)\n\n\t// NewElement returns a new value for a list element.\n\t// For enums, this returns the first enum value.\n\t// For other scalars, this returns the zero value.\n\t// For messages, this returns a new, empty, mutable value.\n\tNewElement() Value\n\n\t// IsValid reports whether the list is valid.\n\t//\n\t// An invalid list is an empty, read-only value.\n\t//\n\t// Validity is not part of the protobuf data model, and may not\n\t// be preserved in marshaling or other operations.\n\tIsValid() bool\n}\n\n// Map is an unordered, associative map.\n// The entry MapKey type is determined by FieldDescriptor.MapKey.Kind.\n// The entry Value type is determined by FieldDescriptor.MapValue.Kind.\n// Providing a MapKey or Value that is invalid or of an incorrect type panics.\ntype Map interface {\n\t// Len reports the number of elements in the map.\n\tLen() int\n\n\t// Range iterates over every map entry in an undefined order,\n\t// calling f for each key and value encountered.\n\t// Range calls f Len times unless f returns false, which stops iteration.\n\t// While iterating, mutating operations may only be performed\n\t// on the current map key.\n\tRange(f func(MapKey, Value) bool)\n\n\t// Has reports whether an entry with the given key is in the map.\n\tHas(MapKey) bool\n\n\t// Clear clears the entry associated with they given key.\n\t// The operation does nothing if there is no entry associated with the key.\n\t//\n\t// Clear is a mutating operation and unsafe for concurrent use.\n\tClear(MapKey)\n\n\t// Get retrieves the value for an entry with the given key.\n\t// It returns an invalid value for non-existent entries.\n\tGet(MapKey) Value\n\n\t// Set stores the value for an entry with the given key.\n\t// It panics when given a key or value that is invalid or the wrong type.\n\t// When setting a composite type, it is unspecified whether the set\n\t// value aliases the source's memory in any way.\n\t//\n\t// Set is a mutating operation and unsafe for concurrent use.\n\tSet(MapKey, Value)\n\n\t// Mutable retrieves a mutable reference to the entry for the given key.\n\t// If no entry exists for the key, it creates a new, empty, mutable value\n\t// and stores it as the entry for the key.\n\t// It panics if the map value is not a message.\n\tMutable(MapKey) Value\n\n\t// NewValue returns a new value assignable as a map value.\n\t// For enums, this returns the first enum value.\n\t// For other scalars, this returns the zero value.\n\t// For messages, this returns a new, empty, mutable value.\n\tNewValue() Value\n\n\t// IsValid reports whether the map is valid.\n\t//\n\t// An invalid map is an empty, read-only value.\n\t//\n\t// An invalid message often corresponds to a nil Go map value,\n\t// but the details are implementation dependent.\n\t// Validity is not part of the protobuf data model, and may not\n\t// be preserved in marshaling or other operations.\n\tIsValid() bool\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protoreflect/value_pure.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// +build purego appengine\n\npackage protoreflect\n\nimport \"google.golang.org/protobuf/internal/pragma\"\n\ntype valueType int\n\nconst (\n\tnilType valueType = iota\n\tboolType\n\tint32Type\n\tint64Type\n\tuint32Type\n\tuint64Type\n\tfloat32Type\n\tfloat64Type\n\tstringType\n\tbytesType\n\tenumType\n\tifaceType\n)\n\n// value is a union where only one type can be represented at a time.\n// This uses a distinct field for each type. This is type safe in Go, but\n// occupies more memory than necessary (72B).\ntype value struct {\n\tpragma.DoNotCompare // 0B\n\n\ttyp   valueType   // 8B\n\tnum   uint64      // 8B\n\tstr   string      // 16B\n\tbin   []byte      // 24B\n\tiface interface{} // 16B\n}\n\nfunc valueOfString(v string) Value {\n\treturn Value{typ: stringType, str: v}\n}\nfunc valueOfBytes(v []byte) Value {\n\treturn Value{typ: bytesType, bin: v}\n}\nfunc valueOfIface(v interface{}) Value {\n\treturn Value{typ: ifaceType, iface: v}\n}\n\nfunc (v Value) getString() string {\n\treturn v.str\n}\nfunc (v Value) getBytes() []byte {\n\treturn v.bin\n}\nfunc (v Value) getIface() interface{} {\n\treturn v.iface\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protoreflect/value_union.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 protoreflect\n\nimport (\n\t\"fmt\"\n\t\"math\"\n)\n\n// Value is a union where only one Go type may be set at a time.\n// The Value is used to represent all possible values a field may take.\n// The following shows which Go type is used to represent each proto Kind:\n//\n//\t╔════════════╤═════════════════════════════════════╗\n//\t║ Go type    │ Protobuf kind                       ║\n//\t╠════════════╪═════════════════════════════════════╣\n//\t║ bool       │ BoolKind                            ║\n//\t║ int32      │ Int32Kind, Sint32Kind, Sfixed32Kind ║\n//\t║ int64      │ Int64Kind, Sint64Kind, Sfixed64Kind ║\n//\t║ uint32     │ Uint32Kind, Fixed32Kind             ║\n//\t║ uint64     │ Uint64Kind, Fixed64Kind             ║\n//\t║ float32    │ FloatKind                           ║\n//\t║ float64    │ DoubleKind                          ║\n//\t║ string     │ StringKind                          ║\n//\t║ []byte     │ BytesKind                           ║\n//\t║ EnumNumber │ EnumKind                            ║\n//\t║ Message    │ MessageKind, GroupKind              ║\n//\t╚════════════╧═════════════════════════════════════╝\n//\n// Multiple protobuf Kinds may be represented by a single Go type if the type\n// can losslessly represent the information for the proto kind. For example,\n// Int64Kind, Sint64Kind, and Sfixed64Kind are all represented by int64,\n// but use different integer encoding methods.\n//\n// The List or Map types are used if the field cardinality is repeated.\n// A field is a List if FieldDescriptor.IsList reports true.\n// A field is a Map if FieldDescriptor.IsMap reports true.\n//\n// Converting to/from a Value and a concrete Go value panics on type mismatch.\n// For example, ValueOf(\"hello\").Int() panics because this attempts to\n// retrieve an int64 from a string.\ntype Value value\n\n// The protoreflect API uses a custom Value union type instead of interface{}\n// to keep the future open for performance optimizations. Using an interface{}\n// always incurs an allocation for primitives (e.g., int64) since it needs to\n// be boxed on the heap (as interfaces can only contain pointers natively).\n// Instead, we represent the Value union as a flat struct that internally keeps\n// track of which type is set. Using unsafe, the Value union can be reduced\n// down to 24B, which is identical in size to a slice.\n//\n// The latest compiler (Go1.11) currently suffers from some limitations:\n//\t• With inlining, the compiler should be able to statically prove that\n//\tonly one of these switch cases are taken and inline one specific case.\n//\tSee https://golang.org/issue/22310.\n\n// ValueOf returns a Value initialized with the concrete value stored in v.\n// This panics if the type does not match one of the allowed types in the\n// Value union.\nfunc ValueOf(v interface{}) Value {\n\tswitch v := v.(type) {\n\tcase nil:\n\t\treturn Value{}\n\tcase bool:\n\t\treturn ValueOfBool(v)\n\tcase int32:\n\t\treturn ValueOfInt32(v)\n\tcase int64:\n\t\treturn ValueOfInt64(v)\n\tcase uint32:\n\t\treturn ValueOfUint32(v)\n\tcase uint64:\n\t\treturn ValueOfUint64(v)\n\tcase float32:\n\t\treturn ValueOfFloat32(v)\n\tcase float64:\n\t\treturn ValueOfFloat64(v)\n\tcase string:\n\t\treturn ValueOfString(v)\n\tcase []byte:\n\t\treturn ValueOfBytes(v)\n\tcase EnumNumber:\n\t\treturn ValueOfEnum(v)\n\tcase Message, List, Map:\n\t\treturn valueOfIface(v)\n\tcase ProtoMessage:\n\t\tpanic(fmt.Sprintf(\"invalid proto.Message(%T) type, expected a protoreflect.Message type\", v))\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"invalid type: %T\", v))\n\t}\n}\n\n// ValueOfBool returns a new boolean value.\nfunc ValueOfBool(v bool) Value {\n\tif v {\n\t\treturn Value{typ: boolType, num: 1}\n\t} else {\n\t\treturn Value{typ: boolType, num: 0}\n\t}\n}\n\n// ValueOfInt32 returns a new int32 value.\nfunc ValueOfInt32(v int32) Value {\n\treturn Value{typ: int32Type, num: uint64(v)}\n}\n\n// ValueOfInt64 returns a new int64 value.\nfunc ValueOfInt64(v int64) Value {\n\treturn Value{typ: int64Type, num: uint64(v)}\n}\n\n// ValueOfUint32 returns a new uint32 value.\nfunc ValueOfUint32(v uint32) Value {\n\treturn Value{typ: uint32Type, num: uint64(v)}\n}\n\n// ValueOfUint64 returns a new uint64 value.\nfunc ValueOfUint64(v uint64) Value {\n\treturn Value{typ: uint64Type, num: v}\n}\n\n// ValueOfFloat32 returns a new float32 value.\nfunc ValueOfFloat32(v float32) Value {\n\treturn Value{typ: float32Type, num: uint64(math.Float64bits(float64(v)))}\n}\n\n// ValueOfFloat64 returns a new float64 value.\nfunc ValueOfFloat64(v float64) Value {\n\treturn Value{typ: float64Type, num: uint64(math.Float64bits(float64(v)))}\n}\n\n// ValueOfString returns a new string value.\nfunc ValueOfString(v string) Value {\n\treturn valueOfString(v)\n}\n\n// ValueOfBytes returns a new bytes value.\nfunc ValueOfBytes(v []byte) Value {\n\treturn valueOfBytes(v[:len(v):len(v)])\n}\n\n// ValueOfEnum returns a new enum value.\nfunc ValueOfEnum(v EnumNumber) Value {\n\treturn Value{typ: enumType, num: uint64(v)}\n}\n\n// ValueOfMessage returns a new Message value.\nfunc ValueOfMessage(v Message) Value {\n\treturn valueOfIface(v)\n}\n\n// ValueOfList returns a new List value.\nfunc ValueOfList(v List) Value {\n\treturn valueOfIface(v)\n}\n\n// ValueOfMap returns a new Map value.\nfunc ValueOfMap(v Map) Value {\n\treturn valueOfIface(v)\n}\n\n// IsValid reports whether v is populated with a value.\nfunc (v Value) IsValid() bool {\n\treturn v.typ != nilType\n}\n\n// Interface returns v as an interface{}.\n//\n// Invariant: v == ValueOf(v).Interface()\nfunc (v Value) Interface() interface{} {\n\tswitch v.typ {\n\tcase nilType:\n\t\treturn nil\n\tcase boolType:\n\t\treturn v.Bool()\n\tcase int32Type:\n\t\treturn int32(v.Int())\n\tcase int64Type:\n\t\treturn int64(v.Int())\n\tcase uint32Type:\n\t\treturn uint32(v.Uint())\n\tcase uint64Type:\n\t\treturn uint64(v.Uint())\n\tcase float32Type:\n\t\treturn float32(v.Float())\n\tcase float64Type:\n\t\treturn float64(v.Float())\n\tcase stringType:\n\t\treturn v.String()\n\tcase bytesType:\n\t\treturn v.Bytes()\n\tcase enumType:\n\t\treturn v.Enum()\n\tdefault:\n\t\treturn v.getIface()\n\t}\n}\n\nfunc (v Value) typeName() string {\n\tswitch v.typ {\n\tcase nilType:\n\t\treturn \"nil\"\n\tcase boolType:\n\t\treturn \"bool\"\n\tcase int32Type:\n\t\treturn \"int32\"\n\tcase int64Type:\n\t\treturn \"int64\"\n\tcase uint32Type:\n\t\treturn \"uint32\"\n\tcase uint64Type:\n\t\treturn \"uint64\"\n\tcase float32Type:\n\t\treturn \"float32\"\n\tcase float64Type:\n\t\treturn \"float64\"\n\tcase stringType:\n\t\treturn \"string\"\n\tcase bytesType:\n\t\treturn \"bytes\"\n\tcase enumType:\n\t\treturn \"enum\"\n\tdefault:\n\t\tswitch v := v.getIface().(type) {\n\t\tcase Message:\n\t\t\treturn \"message\"\n\t\tcase List:\n\t\t\treturn \"list\"\n\t\tcase Map:\n\t\t\treturn \"map\"\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"<unknown: %T>\", v)\n\t\t}\n\t}\n}\n\nfunc (v Value) panicMessage(what string) string {\n\treturn fmt.Sprintf(\"type mismatch: cannot convert %v to %s\", v.typeName(), what)\n}\n\n// Bool returns v as a bool and panics if the type is not a bool.\nfunc (v Value) Bool() bool {\n\tswitch v.typ {\n\tcase boolType:\n\t\treturn v.num > 0\n\tdefault:\n\t\tpanic(v.panicMessage(\"bool\"))\n\t}\n}\n\n// Int returns v as a int64 and panics if the type is not a int32 or int64.\nfunc (v Value) Int() int64 {\n\tswitch v.typ {\n\tcase int32Type, int64Type:\n\t\treturn int64(v.num)\n\tdefault:\n\t\tpanic(v.panicMessage(\"int\"))\n\t}\n}\n\n// Uint returns v as a uint64 and panics if the type is not a uint32 or uint64.\nfunc (v Value) Uint() uint64 {\n\tswitch v.typ {\n\tcase uint32Type, uint64Type:\n\t\treturn uint64(v.num)\n\tdefault:\n\t\tpanic(v.panicMessage(\"uint\"))\n\t}\n}\n\n// Float returns v as a float64 and panics if the type is not a float32 or float64.\nfunc (v Value) Float() float64 {\n\tswitch v.typ {\n\tcase float32Type, float64Type:\n\t\treturn math.Float64frombits(uint64(v.num))\n\tdefault:\n\t\tpanic(v.panicMessage(\"float\"))\n\t}\n}\n\n// String returns v as a string. Since this method implements fmt.Stringer,\n// this returns the formatted string value for any non-string type.\nfunc (v Value) String() string {\n\tswitch v.typ {\n\tcase stringType:\n\t\treturn v.getString()\n\tdefault:\n\t\treturn fmt.Sprint(v.Interface())\n\t}\n}\n\n// Bytes returns v as a []byte and panics if the type is not a []byte.\nfunc (v Value) Bytes() []byte {\n\tswitch v.typ {\n\tcase bytesType:\n\t\treturn v.getBytes()\n\tdefault:\n\t\tpanic(v.panicMessage(\"bytes\"))\n\t}\n}\n\n// Enum returns v as a EnumNumber and panics if the type is not a EnumNumber.\nfunc (v Value) Enum() EnumNumber {\n\tswitch v.typ {\n\tcase enumType:\n\t\treturn EnumNumber(v.num)\n\tdefault:\n\t\tpanic(v.panicMessage(\"enum\"))\n\t}\n}\n\n// Message returns v as a Message and panics if the type is not a Message.\nfunc (v Value) Message() Message {\n\tswitch vi := v.getIface().(type) {\n\tcase Message:\n\t\treturn vi\n\tdefault:\n\t\tpanic(v.panicMessage(\"message\"))\n\t}\n}\n\n// List returns v as a List and panics if the type is not a List.\nfunc (v Value) List() List {\n\tswitch vi := v.getIface().(type) {\n\tcase List:\n\t\treturn vi\n\tdefault:\n\t\tpanic(v.panicMessage(\"list\"))\n\t}\n}\n\n// Map returns v as a Map and panics if the type is not a Map.\nfunc (v Value) Map() Map {\n\tswitch vi := v.getIface().(type) {\n\tcase Map:\n\t\treturn vi\n\tdefault:\n\t\tpanic(v.panicMessage(\"map\"))\n\t}\n}\n\n// MapKey returns v as a MapKey and panics for invalid MapKey types.\nfunc (v Value) MapKey() MapKey {\n\tswitch v.typ {\n\tcase boolType, int32Type, int64Type, uint32Type, uint64Type, stringType:\n\t\treturn MapKey(v)\n\tdefault:\n\t\tpanic(v.panicMessage(\"map key\"))\n\t}\n}\n\n// MapKey is used to index maps, where the Go type of the MapKey must match\n// the specified key Kind (see MessageDescriptor.IsMapEntry).\n// The following shows what Go type is used to represent each proto Kind:\n//\n//\t╔═════════╤═════════════════════════════════════╗\n//\t║ Go type │ Protobuf kind                       ║\n//\t╠═════════╪═════════════════════════════════════╣\n//\t║ bool    │ BoolKind                            ║\n//\t║ int32   │ Int32Kind, Sint32Kind, Sfixed32Kind ║\n//\t║ int64   │ Int64Kind, Sint64Kind, Sfixed64Kind ║\n//\t║ uint32  │ Uint32Kind, Fixed32Kind             ║\n//\t║ uint64  │ Uint64Kind, Fixed64Kind             ║\n//\t║ string  │ StringKind                          ║\n//\t╚═════════╧═════════════════════════════════════╝\n//\n// A MapKey is constructed and accessed through a Value:\n//\tk := ValueOf(\"hash\").MapKey() // convert string to MapKey\n//\ts := k.String()               // convert MapKey to string\n//\n// The MapKey is a strict subset of valid types used in Value;\n// converting a Value to a MapKey with an invalid type panics.\ntype MapKey value\n\n// IsValid reports whether k is populated with a value.\nfunc (k MapKey) IsValid() bool {\n\treturn Value(k).IsValid()\n}\n\n// Interface returns k as an interface{}.\nfunc (k MapKey) Interface() interface{} {\n\treturn Value(k).Interface()\n}\n\n// Bool returns k as a bool and panics if the type is not a bool.\nfunc (k MapKey) Bool() bool {\n\treturn Value(k).Bool()\n}\n\n// Int returns k as a int64 and panics if the type is not a int32 or int64.\nfunc (k MapKey) Int() int64 {\n\treturn Value(k).Int()\n}\n\n// Uint returns k as a uint64 and panics if the type is not a uint32 or uint64.\nfunc (k MapKey) Uint() uint64 {\n\treturn Value(k).Uint()\n}\n\n// String returns k as a string. Since this method implements fmt.Stringer,\n// this returns the formatted string value for any non-string type.\nfunc (k MapKey) String() string {\n\treturn Value(k).String()\n}\n\n// Value returns k as a Value.\nfunc (k MapKey) Value() Value {\n\treturn Value(k)\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.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// +build !purego,!appengine\n\npackage protoreflect\n\nimport (\n\t\"unsafe\"\n\n\t\"google.golang.org/protobuf/internal/pragma\"\n)\n\ntype (\n\tstringHeader struct {\n\t\tData unsafe.Pointer\n\t\tLen  int\n\t}\n\tsliceHeader struct {\n\t\tData unsafe.Pointer\n\t\tLen  int\n\t\tCap  int\n\t}\n\tifaceHeader struct {\n\t\tType unsafe.Pointer\n\t\tData unsafe.Pointer\n\t}\n)\n\nvar (\n\tnilType     = typeOf(nil)\n\tboolType    = typeOf(*new(bool))\n\tint32Type   = typeOf(*new(int32))\n\tint64Type   = typeOf(*new(int64))\n\tuint32Type  = typeOf(*new(uint32))\n\tuint64Type  = typeOf(*new(uint64))\n\tfloat32Type = typeOf(*new(float32))\n\tfloat64Type = typeOf(*new(float64))\n\tstringType  = typeOf(*new(string))\n\tbytesType   = typeOf(*new([]byte))\n\tenumType    = typeOf(*new(EnumNumber))\n)\n\n// typeOf returns a pointer to the Go type information.\n// The pointer is comparable and equal if and only if the types are identical.\nfunc typeOf(t interface{}) unsafe.Pointer {\n\treturn (*ifaceHeader)(unsafe.Pointer(&t)).Type\n}\n\n// value is a union where only one type can be represented at a time.\n// The struct is 24B large on 64-bit systems and requires the minimum storage\n// necessary to represent each possible type.\n//\n// The Go GC needs to be able to scan variables containing pointers.\n// As such, pointers and non-pointers cannot be intermixed.\ntype value struct {\n\tpragma.DoNotCompare // 0B\n\n\t// typ stores the type of the value as a pointer to the Go type.\n\ttyp unsafe.Pointer // 8B\n\n\t// ptr stores the data pointer for a String, Bytes, or interface value.\n\tptr unsafe.Pointer // 8B\n\n\t// num stores a Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, or\n\t// Enum value as a raw uint64.\n\t//\n\t// It is also used to store the length of a String or Bytes value;\n\t// the capacity is ignored.\n\tnum uint64 // 8B\n}\n\nfunc valueOfString(v string) Value {\n\tp := (*stringHeader)(unsafe.Pointer(&v))\n\treturn Value{typ: stringType, ptr: p.Data, num: uint64(len(v))}\n}\nfunc valueOfBytes(v []byte) Value {\n\tp := (*sliceHeader)(unsafe.Pointer(&v))\n\treturn Value{typ: bytesType, ptr: p.Data, num: uint64(len(v))}\n}\nfunc valueOfIface(v interface{}) Value {\n\tp := (*ifaceHeader)(unsafe.Pointer(&v))\n\treturn Value{typ: p.Type, ptr: p.Data}\n}\n\nfunc (v Value) getString() (x string) {\n\t*(*stringHeader)(unsafe.Pointer(&x)) = stringHeader{Data: v.ptr, Len: int(v.num)}\n\treturn x\n}\nfunc (v Value) getBytes() (x []byte) {\n\t*(*sliceHeader)(unsafe.Pointer(&x)) = sliceHeader{Data: v.ptr, Len: int(v.num), Cap: int(v.num)}\n\treturn x\n}\nfunc (v Value) getIface() (x interface{}) {\n\t*(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr}\n\treturn x\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/reflect/protoregistry/registry.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 protoregistry provides data structures to register and lookup\n// protobuf descriptor types.\n//\n// The Files registry contains file descriptors and provides the ability\n// to iterate over the files or lookup a specific descriptor within the files.\n// Files only contains protobuf descriptors and has no understanding of Go\n// type information that may be associated with each descriptor.\n//\n// The Types registry contains descriptor types for which there is a known\n// Go type associated with that descriptor. It provides the ability to iterate\n// over the registered types or lookup a type by name.\npackage protoregistry\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// conflictPolicy configures the policy for handling registration conflicts.\n//\n// It can be over-written at compile time with a linker-initialized variable:\n//\tgo build -ldflags \"-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn\"\n//\n// It can be over-written at program execution with an environment variable:\n//\tGOLANG_PROTOBUF_REGISTRATION_CONFLICT=warn ./main\n//\n// Neither of the above are covered by the compatibility promise and\n// may be removed in a future release of this module.\nvar conflictPolicy = \"panic\" // \"panic\" | \"warn\" | \"ignore\"\n\n// ignoreConflict reports whether to ignore a registration conflict\n// given the descriptor being registered and the error.\n// It is a variable so that the behavior is easily overridden in another file.\nvar ignoreConflict = func(d protoreflect.Descriptor, err error) bool {\n\tconst env = \"GOLANG_PROTOBUF_REGISTRATION_CONFLICT\"\n\tconst faq = \"https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict\"\n\tpolicy := conflictPolicy\n\tif v := os.Getenv(env); v != \"\" {\n\t\tpolicy = v\n\t}\n\tswitch policy {\n\tcase \"panic\":\n\t\tpanic(fmt.Sprintf(\"%v\\nSee %v\\n\", err, faq))\n\tcase \"warn\":\n\t\tfmt.Fprintf(os.Stderr, \"WARNING: %v\\nSee %v\\n\\n\", err, faq)\n\t\treturn true\n\tcase \"ignore\":\n\t\treturn true\n\tdefault:\n\t\tpanic(\"invalid \" + env + \" value: \" + os.Getenv(env))\n\t}\n}\n\nvar globalMutex sync.RWMutex\n\n// GlobalFiles is a global registry of file descriptors.\nvar GlobalFiles *Files = new(Files)\n\n// GlobalTypes is the registry used by default for type lookups\n// unless a local registry is provided by the user.\nvar GlobalTypes *Types = new(Types)\n\n// NotFound is a sentinel error value to indicate that the type was not found.\n//\n// Since registry lookup can happen in the critical performance path, resolvers\n// must return this exact error value, not an error wrapping it.\nvar NotFound = errors.New(\"not found\")\n\n// Files is a registry for looking up or iterating over files and the\n// descriptors contained within them.\n// The Find and Range methods are safe for concurrent use.\ntype Files struct {\n\t// The map of descsByName contains:\n\t//\tEnumDescriptor\n\t//\tEnumValueDescriptor\n\t//\tMessageDescriptor\n\t//\tExtensionDescriptor\n\t//\tServiceDescriptor\n\t//\t*packageDescriptor\n\t//\n\t// Note that files are stored as a slice, since a package may contain\n\t// multiple files. Only top-level declarations are registered.\n\t// Note that enum values are in the top-level since that are in the same\n\t// scope as the parent enum.\n\tdescsByName map[protoreflect.FullName]interface{}\n\tfilesByPath map[string]protoreflect.FileDescriptor\n}\n\ntype packageDescriptor struct {\n\tfiles []protoreflect.FileDescriptor\n}\n\n// RegisterFile registers the provided file descriptor.\n//\n// If any descriptor within the file conflicts with the descriptor of any\n// previously registered file (e.g., two enums with the same full name),\n// then the file is not registered and an error is returned.\n//\n// It is permitted for multiple files to have the same file path.\nfunc (r *Files) RegisterFile(file protoreflect.FileDescriptor) error {\n\tif r == GlobalFiles {\n\t\tglobalMutex.Lock()\n\t\tdefer globalMutex.Unlock()\n\t}\n\tif r.descsByName == nil {\n\t\tr.descsByName = map[protoreflect.FullName]interface{}{\n\t\t\t\"\": &packageDescriptor{},\n\t\t}\n\t\tr.filesByPath = make(map[string]protoreflect.FileDescriptor)\n\t}\n\tpath := file.Path()\n\tif prev := r.filesByPath[path]; prev != nil {\n\t\tr.checkGenProtoConflict(path)\n\t\terr := errors.New(\"file %q is already registered\", file.Path())\n\t\terr = amendErrorWithCaller(err, prev, file)\n\t\tif r == GlobalFiles && ignoreConflict(file, err) {\n\t\t\terr = nil\n\t\t}\n\t\treturn err\n\t}\n\n\tfor name := file.Package(); name != \"\"; name = name.Parent() {\n\t\tswitch prev := r.descsByName[name]; prev.(type) {\n\t\tcase nil, *packageDescriptor:\n\t\tdefault:\n\t\t\terr := errors.New(\"file %q has a package name conflict over %v\", file.Path(), name)\n\t\t\terr = amendErrorWithCaller(err, prev, file)\n\t\t\tif r == GlobalFiles && ignoreConflict(file, err) {\n\t\t\t\terr = nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t}\n\tvar err error\n\tvar hasConflict bool\n\trangeTopLevelDescriptors(file, func(d protoreflect.Descriptor) {\n\t\tif prev := r.descsByName[d.FullName()]; prev != nil {\n\t\t\thasConflict = true\n\t\t\terr = errors.New(\"file %q has a name conflict over %v\", file.Path(), d.FullName())\n\t\t\terr = amendErrorWithCaller(err, prev, file)\n\t\t\tif r == GlobalFiles && ignoreConflict(d, err) {\n\t\t\t\terr = nil\n\t\t\t}\n\t\t}\n\t})\n\tif hasConflict {\n\t\treturn err\n\t}\n\n\tfor name := file.Package(); name != \"\"; name = name.Parent() {\n\t\tif r.descsByName[name] == nil {\n\t\t\tr.descsByName[name] = &packageDescriptor{}\n\t\t}\n\t}\n\tp := r.descsByName[file.Package()].(*packageDescriptor)\n\tp.files = append(p.files, file)\n\trangeTopLevelDescriptors(file, func(d protoreflect.Descriptor) {\n\t\tr.descsByName[d.FullName()] = d\n\t})\n\tr.filesByPath[path] = file\n\treturn nil\n}\n\n// Several well-known types were hosted in the google.golang.org/genproto module\n// but were later moved to this module. To avoid a weak dependency on the\n// genproto module (and its relatively large set of transitive dependencies),\n// we rely on a registration conflict to determine whether the genproto version\n// is too old (i.e., does not contain aliases to the new type declarations).\nfunc (r *Files) checkGenProtoConflict(path string) {\n\tif r != GlobalFiles {\n\t\treturn\n\t}\n\tvar prevPath string\n\tconst prevModule = \"google.golang.org/genproto\"\n\tconst prevVersion = \"cb27e3aa (May 26th, 2020)\"\n\tswitch path {\n\tcase \"google/protobuf/field_mask.proto\":\n\t\tprevPath = prevModule + \"/protobuf/field_mask\"\n\tcase \"google/protobuf/api.proto\":\n\t\tprevPath = prevModule + \"/protobuf/api\"\n\tcase \"google/protobuf/type.proto\":\n\t\tprevPath = prevModule + \"/protobuf/ptype\"\n\tcase \"google/protobuf/source_context.proto\":\n\t\tprevPath = prevModule + \"/protobuf/source_context\"\n\tdefault:\n\t\treturn\n\t}\n\tpkgName := strings.TrimSuffix(strings.TrimPrefix(path, \"google/protobuf/\"), \".proto\")\n\tpkgName = strings.Replace(pkgName, \"_\", \"\", -1) + \"pb\" // e.g., \"field_mask\" => \"fieldmaskpb\"\n\tcurrPath := \"google.golang.org/protobuf/types/known/\" + pkgName\n\tpanic(fmt.Sprintf(\"\"+\n\t\t\"duplicate registration of %q\\n\"+\n\t\t\"\\n\"+\n\t\t\"The generated definition for this file has moved:\\n\"+\n\t\t\"\\tfrom: %q\\n\"+\n\t\t\"\\tto:   %q\\n\"+\n\t\t\"A dependency on the %q module must\\n\"+\n\t\t\"be at version %v or higher.\\n\"+\n\t\t\"\\n\"+\n\t\t\"Upgrade the dependency by running:\\n\"+\n\t\t\"\\tgo get -u %v\\n\",\n\t\tpath, prevPath, currPath, prevModule, prevVersion, prevPath))\n}\n\n// FindDescriptorByName looks up a descriptor by the full name.\n//\n// This returns (nil, NotFound) if not found.\nfunc (r *Files) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) {\n\tif r == nil {\n\t\treturn nil, NotFound\n\t}\n\tif r == GlobalFiles {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tprefix := name\n\tsuffix := nameSuffix(\"\")\n\tfor prefix != \"\" {\n\t\tif d, ok := r.descsByName[prefix]; ok {\n\t\t\tswitch d := d.(type) {\n\t\t\tcase protoreflect.EnumDescriptor:\n\t\t\t\tif d.FullName() == name {\n\t\t\t\t\treturn d, nil\n\t\t\t\t}\n\t\t\tcase protoreflect.EnumValueDescriptor:\n\t\t\t\tif d.FullName() == name {\n\t\t\t\t\treturn d, nil\n\t\t\t\t}\n\t\t\tcase protoreflect.MessageDescriptor:\n\t\t\t\tif d.FullName() == name {\n\t\t\t\t\treturn d, nil\n\t\t\t\t}\n\t\t\t\tif d := findDescriptorInMessage(d, suffix); d != nil && d.FullName() == name {\n\t\t\t\t\treturn d, nil\n\t\t\t\t}\n\t\t\tcase protoreflect.ExtensionDescriptor:\n\t\t\t\tif d.FullName() == name {\n\t\t\t\t\treturn d, nil\n\t\t\t\t}\n\t\t\tcase protoreflect.ServiceDescriptor:\n\t\t\t\tif d.FullName() == name {\n\t\t\t\t\treturn d, nil\n\t\t\t\t}\n\t\t\t\tif d := d.Methods().ByName(suffix.Pop()); d != nil && d.FullName() == name {\n\t\t\t\t\treturn d, nil\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil, NotFound\n\t\t}\n\t\tprefix = prefix.Parent()\n\t\tsuffix = nameSuffix(name[len(prefix)+len(\".\"):])\n\t}\n\treturn nil, NotFound\n}\n\nfunc findDescriptorInMessage(md protoreflect.MessageDescriptor, suffix nameSuffix) protoreflect.Descriptor {\n\tname := suffix.Pop()\n\tif suffix == \"\" {\n\t\tif ed := md.Enums().ByName(name); ed != nil {\n\t\t\treturn ed\n\t\t}\n\t\tfor i := md.Enums().Len() - 1; i >= 0; i-- {\n\t\t\tif vd := md.Enums().Get(i).Values().ByName(name); vd != nil {\n\t\t\t\treturn vd\n\t\t\t}\n\t\t}\n\t\tif xd := md.Extensions().ByName(name); xd != nil {\n\t\t\treturn xd\n\t\t}\n\t\tif fd := md.Fields().ByName(name); fd != nil {\n\t\t\treturn fd\n\t\t}\n\t\tif od := md.Oneofs().ByName(name); od != nil {\n\t\t\treturn od\n\t\t}\n\t}\n\tif md := md.Messages().ByName(name); md != nil {\n\t\tif suffix == \"\" {\n\t\t\treturn md\n\t\t}\n\t\treturn findDescriptorInMessage(md, suffix)\n\t}\n\treturn nil\n}\n\ntype nameSuffix string\n\nfunc (s *nameSuffix) Pop() (name protoreflect.Name) {\n\tif i := strings.IndexByte(string(*s), '.'); i >= 0 {\n\t\tname, *s = protoreflect.Name((*s)[:i]), (*s)[i+1:]\n\t} else {\n\t\tname, *s = protoreflect.Name((*s)), \"\"\n\t}\n\treturn name\n}\n\n// FindFileByPath looks up a file by the path.\n//\n// This returns (nil, NotFound) if not found.\nfunc (r *Files) FindFileByPath(path string) (protoreflect.FileDescriptor, error) {\n\tif r == nil {\n\t\treturn nil, NotFound\n\t}\n\tif r == GlobalFiles {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tif fd, ok := r.filesByPath[path]; ok {\n\t\treturn fd, nil\n\t}\n\treturn nil, NotFound\n}\n\n// NumFiles reports the number of registered files.\nfunc (r *Files) NumFiles() int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\tif r == GlobalFiles {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\treturn len(r.filesByPath)\n}\n\n// RangeFiles iterates over all registered files while f returns true.\n// The iteration order is undefined.\nfunc (r *Files) RangeFiles(f func(protoreflect.FileDescriptor) bool) {\n\tif r == nil {\n\t\treturn\n\t}\n\tif r == GlobalFiles {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tfor _, file := range r.filesByPath {\n\t\tif !f(file) {\n\t\t\treturn\n\t\t}\n\t}\n}\n\n// NumFilesByPackage reports the number of registered files in a proto package.\nfunc (r *Files) NumFilesByPackage(name protoreflect.FullName) int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\tif r == GlobalFiles {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tp, ok := r.descsByName[name].(*packageDescriptor)\n\tif !ok {\n\t\treturn 0\n\t}\n\treturn len(p.files)\n}\n\n// RangeFilesByPackage iterates over all registered files in a given proto package\n// while f returns true. The iteration order is undefined.\nfunc (r *Files) RangeFilesByPackage(name protoreflect.FullName, f func(protoreflect.FileDescriptor) bool) {\n\tif r == nil {\n\t\treturn\n\t}\n\tif r == GlobalFiles {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tp, ok := r.descsByName[name].(*packageDescriptor)\n\tif !ok {\n\t\treturn\n\t}\n\tfor _, file := range p.files {\n\t\tif !f(file) {\n\t\t\treturn\n\t\t}\n\t}\n}\n\n// rangeTopLevelDescriptors iterates over all top-level descriptors in a file\n// which will be directly entered into the registry.\nfunc rangeTopLevelDescriptors(fd protoreflect.FileDescriptor, f func(protoreflect.Descriptor)) {\n\teds := fd.Enums()\n\tfor i := eds.Len() - 1; i >= 0; i-- {\n\t\tf(eds.Get(i))\n\t\tvds := eds.Get(i).Values()\n\t\tfor i := vds.Len() - 1; i >= 0; i-- {\n\t\t\tf(vds.Get(i))\n\t\t}\n\t}\n\tmds := fd.Messages()\n\tfor i := mds.Len() - 1; i >= 0; i-- {\n\t\tf(mds.Get(i))\n\t}\n\txds := fd.Extensions()\n\tfor i := xds.Len() - 1; i >= 0; i-- {\n\t\tf(xds.Get(i))\n\t}\n\tsds := fd.Services()\n\tfor i := sds.Len() - 1; i >= 0; i-- {\n\t\tf(sds.Get(i))\n\t}\n}\n\n// MessageTypeResolver is an interface for looking up messages.\n//\n// A compliant implementation must deterministically return the same type\n// if no error is encountered.\n//\n// The Types type implements this interface.\ntype MessageTypeResolver interface {\n\t// FindMessageByName looks up a message by its full name.\n\t// E.g., \"google.protobuf.Any\"\n\t//\n\t// This return (nil, NotFound) if not found.\n\tFindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error)\n\n\t// FindMessageByURL looks up a message by a URL identifier.\n\t// See documentation on google.protobuf.Any.type_url for the URL format.\n\t//\n\t// This returns (nil, NotFound) if not found.\n\tFindMessageByURL(url string) (protoreflect.MessageType, error)\n}\n\n// ExtensionTypeResolver is an interface for looking up extensions.\n//\n// A compliant implementation must deterministically return the same type\n// if no error is encountered.\n//\n// The Types type implements this interface.\ntype ExtensionTypeResolver interface {\n\t// FindExtensionByName looks up a extension field by the field's full name.\n\t// Note that this is the full name of the field as determined by\n\t// where the extension is declared and is unrelated to the full name of the\n\t// message being extended.\n\t//\n\t// This returns (nil, NotFound) if not found.\n\tFindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)\n\n\t// FindExtensionByNumber looks up a extension field by the field number\n\t// within some parent message, identified by full name.\n\t//\n\t// This returns (nil, NotFound) if not found.\n\tFindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)\n}\n\nvar (\n\t_ MessageTypeResolver   = (*Types)(nil)\n\t_ ExtensionTypeResolver = (*Types)(nil)\n)\n\n// Types is a registry for looking up or iterating over descriptor types.\n// The Find and Range methods are safe for concurrent use.\ntype Types struct {\n\ttypesByName         typesByName\n\textensionsByMessage extensionsByMessage\n\n\tnumEnums      int\n\tnumMessages   int\n\tnumExtensions int\n}\n\ntype (\n\ttypesByName         map[protoreflect.FullName]interface{}\n\textensionsByMessage map[protoreflect.FullName]extensionsByNumber\n\textensionsByNumber  map[protoreflect.FieldNumber]protoreflect.ExtensionType\n)\n\n// RegisterMessage registers the provided message type.\n//\n// If a naming conflict occurs, the type is not registered and an error is returned.\nfunc (r *Types) RegisterMessage(mt protoreflect.MessageType) error {\n\t// Under rare circumstances getting the descriptor might recursively\n\t// examine the registry, so fetch it before locking.\n\tmd := mt.Descriptor()\n\n\tif r == GlobalTypes {\n\t\tglobalMutex.Lock()\n\t\tdefer globalMutex.Unlock()\n\t}\n\n\tif err := r.register(\"message\", md, mt); err != nil {\n\t\treturn err\n\t}\n\tr.numMessages++\n\treturn nil\n}\n\n// RegisterEnum registers the provided enum type.\n//\n// If a naming conflict occurs, the type is not registered and an error is returned.\nfunc (r *Types) RegisterEnum(et protoreflect.EnumType) error {\n\t// Under rare circumstances getting the descriptor might recursively\n\t// examine the registry, so fetch it before locking.\n\ted := et.Descriptor()\n\n\tif r == GlobalTypes {\n\t\tglobalMutex.Lock()\n\t\tdefer globalMutex.Unlock()\n\t}\n\n\tif err := r.register(\"enum\", ed, et); err != nil {\n\t\treturn err\n\t}\n\tr.numEnums++\n\treturn nil\n}\n\n// RegisterExtension registers the provided extension type.\n//\n// If a naming conflict occurs, the type is not registered and an error is returned.\nfunc (r *Types) RegisterExtension(xt protoreflect.ExtensionType) error {\n\t// Under rare circumstances getting the descriptor might recursively\n\t// examine the registry, so fetch it before locking.\n\t//\n\t// A known case where this can happen: Fetching the TypeDescriptor for a\n\t// legacy ExtensionDesc can consult the global registry.\n\txd := xt.TypeDescriptor()\n\n\tif r == GlobalTypes {\n\t\tglobalMutex.Lock()\n\t\tdefer globalMutex.Unlock()\n\t}\n\n\tfield := xd.Number()\n\tmessage := xd.ContainingMessage().FullName()\n\tif prev := r.extensionsByMessage[message][field]; prev != nil {\n\t\terr := errors.New(\"extension number %d is already registered on message %v\", field, message)\n\t\terr = amendErrorWithCaller(err, prev, xt)\n\t\tif !(r == GlobalTypes && ignoreConflict(xd, err)) {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := r.register(\"extension\", xd, xt); err != nil {\n\t\treturn err\n\t}\n\tif r.extensionsByMessage == nil {\n\t\tr.extensionsByMessage = make(extensionsByMessage)\n\t}\n\tif r.extensionsByMessage[message] == nil {\n\t\tr.extensionsByMessage[message] = make(extensionsByNumber)\n\t}\n\tr.extensionsByMessage[message][field] = xt\n\tr.numExtensions++\n\treturn nil\n}\n\nfunc (r *Types) register(kind string, desc protoreflect.Descriptor, typ interface{}) error {\n\tname := desc.FullName()\n\tprev := r.typesByName[name]\n\tif prev != nil {\n\t\terr := errors.New(\"%v %v is already registered\", kind, name)\n\t\terr = amendErrorWithCaller(err, prev, typ)\n\t\tif !(r == GlobalTypes && ignoreConflict(desc, err)) {\n\t\t\treturn err\n\t\t}\n\t}\n\tif r.typesByName == nil {\n\t\tr.typesByName = make(typesByName)\n\t}\n\tr.typesByName[name] = typ\n\treturn nil\n}\n\n// FindEnumByName looks up an enum by its full name.\n// E.g., \"google.protobuf.Field.Kind\".\n//\n// This returns (nil, NotFound) if not found.\nfunc (r *Types) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumType, error) {\n\tif r == nil {\n\t\treturn nil, NotFound\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tif v := r.typesByName[enum]; v != nil {\n\t\tif et, _ := v.(protoreflect.EnumType); et != nil {\n\t\t\treturn et, nil\n\t\t}\n\t\treturn nil, errors.New(\"found wrong type: got %v, want enum\", typeName(v))\n\t}\n\treturn nil, NotFound\n}\n\n// FindMessageByName looks up a message by its full name,\n// e.g. \"google.protobuf.Any\".\n//\n// This returns (nil, NotFound) if not found.\nfunc (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) {\n\tif r == nil {\n\t\treturn nil, NotFound\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tif v := r.typesByName[message]; v != nil {\n\t\tif mt, _ := v.(protoreflect.MessageType); mt != nil {\n\t\t\treturn mt, nil\n\t\t}\n\t\treturn nil, errors.New(\"found wrong type: got %v, want message\", typeName(v))\n\t}\n\treturn nil, NotFound\n}\n\n// FindMessageByURL looks up a message by a URL identifier.\n// See documentation on google.protobuf.Any.type_url for the URL format.\n//\n// This returns (nil, NotFound) if not found.\nfunc (r *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) {\n\t// This function is similar to FindMessageByName but\n\t// truncates anything before and including '/' in the URL.\n\tif r == nil {\n\t\treturn nil, NotFound\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tmessage := protoreflect.FullName(url)\n\tif i := strings.LastIndexByte(url, '/'); i >= 0 {\n\t\tmessage = message[i+len(\"/\"):]\n\t}\n\n\tif v := r.typesByName[message]; v != nil {\n\t\tif mt, _ := v.(protoreflect.MessageType); mt != nil {\n\t\t\treturn mt, nil\n\t\t}\n\t\treturn nil, errors.New(\"found wrong type: got %v, want message\", typeName(v))\n\t}\n\treturn nil, NotFound\n}\n\n// FindExtensionByName looks up a extension field by the field's full name.\n// Note that this is the full name of the field as determined by\n// where the extension is declared and is unrelated to the full name of the\n// message being extended.\n//\n// This returns (nil, NotFound) if not found.\nfunc (r *Types) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) {\n\tif r == nil {\n\t\treturn nil, NotFound\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tif v := r.typesByName[field]; v != nil {\n\t\tif xt, _ := v.(protoreflect.ExtensionType); xt != nil {\n\t\t\treturn xt, nil\n\t\t}\n\n\t\t// MessageSet extensions are special in that the name of the extension\n\t\t// is the name of the message type used to extend the MessageSet.\n\t\t// This naming scheme is used by text and JSON serialization.\n\t\t//\n\t\t// This feature is protected by the ProtoLegacy flag since MessageSets\n\t\t// are a proto1 feature that is long deprecated.\n\t\tif flags.ProtoLegacy {\n\t\t\tif _, ok := v.(protoreflect.MessageType); ok {\n\t\t\t\tfield := field.Append(messageset.ExtensionName)\n\t\t\t\tif v := r.typesByName[field]; v != nil {\n\t\t\t\t\tif xt, _ := v.(protoreflect.ExtensionType); xt != nil {\n\t\t\t\t\t\tif messageset.IsMessageSetExtension(xt.TypeDescriptor()) {\n\t\t\t\t\t\t\treturn xt, nil\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn nil, errors.New(\"found wrong type: got %v, want extension\", typeName(v))\n\t}\n\treturn nil, NotFound\n}\n\n// FindExtensionByNumber looks up a extension field by the field number\n// within some parent message, identified by full name.\n//\n// This returns (nil, NotFound) if not found.\nfunc (r *Types) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) {\n\tif r == nil {\n\t\treturn nil, NotFound\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tif xt, ok := r.extensionsByMessage[message][field]; ok {\n\t\treturn xt, nil\n\t}\n\treturn nil, NotFound\n}\n\n// NumEnums reports the number of registered enums.\nfunc (r *Types) NumEnums() int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\treturn r.numEnums\n}\n\n// RangeEnums iterates over all registered enums while f returns true.\n// Iteration order is undefined.\nfunc (r *Types) RangeEnums(f func(protoreflect.EnumType) bool) {\n\tif r == nil {\n\t\treturn\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tfor _, typ := range r.typesByName {\n\t\tif et, ok := typ.(protoreflect.EnumType); ok {\n\t\t\tif !f(et) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}\n\n// NumMessages reports the number of registered messages.\nfunc (r *Types) NumMessages() int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\treturn r.numMessages\n}\n\n// RangeMessages iterates over all registered messages while f returns true.\n// Iteration order is undefined.\nfunc (r *Types) RangeMessages(f func(protoreflect.MessageType) bool) {\n\tif r == nil {\n\t\treturn\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tfor _, typ := range r.typesByName {\n\t\tif mt, ok := typ.(protoreflect.MessageType); ok {\n\t\t\tif !f(mt) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}\n\n// NumExtensions reports the number of registered extensions.\nfunc (r *Types) NumExtensions() int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\treturn r.numExtensions\n}\n\n// RangeExtensions iterates over all registered extensions while f returns true.\n// Iteration order is undefined.\nfunc (r *Types) RangeExtensions(f func(protoreflect.ExtensionType) bool) {\n\tif r == nil {\n\t\treturn\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tfor _, typ := range r.typesByName {\n\t\tif xt, ok := typ.(protoreflect.ExtensionType); ok {\n\t\t\tif !f(xt) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}\n\n// NumExtensionsByMessage reports the number of registered extensions for\n// a given message type.\nfunc (r *Types) NumExtensionsByMessage(message protoreflect.FullName) int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\treturn len(r.extensionsByMessage[message])\n}\n\n// RangeExtensionsByMessage iterates over all registered extensions filtered\n// by a given message type while f returns true. Iteration order is undefined.\nfunc (r *Types) RangeExtensionsByMessage(message protoreflect.FullName, f func(protoreflect.ExtensionType) bool) {\n\tif r == nil {\n\t\treturn\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tfor _, xt := range r.extensionsByMessage[message] {\n\t\tif !f(xt) {\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunc typeName(t interface{}) string {\n\tswitch t.(type) {\n\tcase protoreflect.EnumType:\n\t\treturn \"enum\"\n\tcase protoreflect.MessageType:\n\t\treturn \"message\"\n\tcase protoreflect.ExtensionType:\n\t\treturn \"extension\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"%T\", t)\n\t}\n}\n\nfunc amendErrorWithCaller(err error, prev, curr interface{}) error {\n\tprevPkg := goPackage(prev)\n\tcurrPkg := goPackage(curr)\n\tif prevPkg == \"\" || currPkg == \"\" || prevPkg == currPkg {\n\t\treturn err\n\t}\n\treturn errors.New(\"%s\\n\\tpreviously from: %q\\n\\tcurrently from:  %q\", err, prevPkg, currPkg)\n}\n\nfunc goPackage(v interface{}) string {\n\tswitch d := v.(type) {\n\tcase protoreflect.EnumType:\n\t\tv = d.Descriptor()\n\tcase protoreflect.MessageType:\n\t\tv = d.Descriptor()\n\tcase protoreflect.ExtensionType:\n\t\tv = d.TypeDescriptor()\n\t}\n\tif d, ok := v.(protoreflect.Descriptor); ok {\n\t\tv = d.ParentFile()\n\t}\n\tif d, ok := v.(interface{ GoPackagePath() string }); ok {\n\t\treturn d.GoPackagePath()\n\t}\n\treturn \"\"\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/runtime/protoiface/legacy.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 protoiface\n\ntype MessageV1 interface {\n\tReset()\n\tString() string\n\tProtoMessage()\n}\n\ntype ExtensionRangeV1 struct {\n\tStart, End int32 // both inclusive\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/runtime/protoiface/methods.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 protoiface contains types referenced or implemented by messages.\n//\n// WARNING: This package should only be imported by message implementations.\n// The functionality found in this package should be accessed through\n// higher-level abstractions provided by the proto package.\npackage protoiface\n\nimport (\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// Methods is a set of optional fast-path implementations of various operations.\ntype Methods = struct {\n\tpragma.NoUnkeyedLiterals\n\n\t// Flags indicate support for optional features.\n\tFlags SupportFlags\n\n\t// Size returns the size in bytes of the wire-format encoding of a message.\n\t// Marshal must be provided if a custom Size is provided.\n\tSize func(SizeInput) SizeOutput\n\n\t// Marshal formats a message in the wire-format encoding to the provided buffer.\n\t// Size should be provided if a custom Marshal is provided.\n\t// It must not return an error for a partial message.\n\tMarshal func(MarshalInput) (MarshalOutput, error)\n\n\t// Unmarshal parses the wire-format encoding and merges the result into a message.\n\t// It must not reset the target message or return an error for a partial message.\n\tUnmarshal func(UnmarshalInput) (UnmarshalOutput, error)\n\n\t// Merge merges the contents of a source message into a destination message.\n\tMerge func(MergeInput) MergeOutput\n\n\t// CheckInitialized returns an error if any required fields in the message are not set.\n\tCheckInitialized func(CheckInitializedInput) (CheckInitializedOutput, error)\n}\n\n// SupportFlags indicate support for optional features.\ntype SupportFlags = uint64\n\nconst (\n\t// SupportMarshalDeterministic reports whether MarshalOptions.Deterministic is supported.\n\tSupportMarshalDeterministic SupportFlags = 1 << iota\n\n\t// SupportUnmarshalDiscardUnknown reports whether UnmarshalOptions.DiscardUnknown is supported.\n\tSupportUnmarshalDiscardUnknown\n)\n\n// SizeInput is input to the Size method.\ntype SizeInput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tMessage protoreflect.Message\n\tFlags   MarshalInputFlags\n}\n\n// SizeOutput is output from the Size method.\ntype SizeOutput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tSize int\n}\n\n// MarshalInput is input to the Marshal method.\ntype MarshalInput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tMessage protoreflect.Message\n\tBuf     []byte // output is appended to this buffer\n\tFlags   MarshalInputFlags\n}\n\n// MarshalOutput is output from the Marshal method.\ntype MarshalOutput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tBuf []byte // contains marshaled message\n}\n\n// MarshalInputFlags configure the marshaler.\n// Most flags correspond to fields in proto.MarshalOptions.\ntype MarshalInputFlags = uint8\n\nconst (\n\tMarshalDeterministic MarshalInputFlags = 1 << iota\n\tMarshalUseCachedSize\n)\n\n// UnmarshalInput is input to the Unmarshal method.\ntype UnmarshalInput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tMessage  protoreflect.Message\n\tBuf      []byte // input buffer\n\tFlags    UnmarshalInputFlags\n\tResolver interface {\n\t\tFindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)\n\t\tFindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)\n\t}\n}\n\n// UnmarshalOutput is output from the Unmarshal method.\ntype UnmarshalOutput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tFlags UnmarshalOutputFlags\n}\n\n// UnmarshalInputFlags configure the unmarshaler.\n// Most flags correspond to fields in proto.UnmarshalOptions.\ntype UnmarshalInputFlags = uint8\n\nconst (\n\tUnmarshalDiscardUnknown UnmarshalInputFlags = 1 << iota\n)\n\n// UnmarshalOutputFlags are output from the Unmarshal method.\ntype UnmarshalOutputFlags = uint8\n\nconst (\n\t// UnmarshalInitialized may be set on return if all required fields are known to be set.\n\t// If unset, then it does not necessarily indicate that the message is uninitialized,\n\t// only that its status could not be confirmed.\n\tUnmarshalInitialized UnmarshalOutputFlags = 1 << iota\n)\n\n// MergeInput is input to the Merge method.\ntype MergeInput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tSource      protoreflect.Message\n\tDestination protoreflect.Message\n}\n\n// MergeOutput is output from the Merge method.\ntype MergeOutput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tFlags MergeOutputFlags\n}\n\n// MergeOutputFlags are output from the Merge method.\ntype MergeOutputFlags = uint8\n\nconst (\n\t// MergeComplete reports whether the merge was performed.\n\t// If unset, the merger must have made no changes to the destination.\n\tMergeComplete MergeOutputFlags = 1 << iota\n)\n\n// CheckInitializedInput is input to the CheckInitialized method.\ntype CheckInitializedInput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tMessage protoreflect.Message\n}\n\n// CheckInitializedOutput is output from the CheckInitialized method.\ntype CheckInitializedOutput = struct {\n\tpragma.NoUnkeyedLiterals\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/runtime/protoimpl/impl.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 protoimpl contains the default implementation for messages\n// generated by protoc-gen-go.\n//\n// WARNING: This package should only ever be imported by generated messages.\n// The compatibility agreement covers nothing except for functionality needed\n// to keep existing generated messages operational. Breakages that occur due\n// to unauthorized usages of this package are not the author's responsibility.\npackage protoimpl\n\nimport (\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/internal/filetype\"\n\t\"google.golang.org/protobuf/internal/impl\"\n)\n\n// UnsafeEnabled specifies whether package unsafe can be used.\nconst UnsafeEnabled = impl.UnsafeEnabled\n\ntype (\n\t// Types used by generated code in init functions.\n\tDescBuilder = filedesc.Builder\n\tTypeBuilder = filetype.Builder\n\n\t// Types used by generated code to implement EnumType, MessageType, and ExtensionType.\n\tEnumInfo      = impl.EnumInfo\n\tMessageInfo   = impl.MessageInfo\n\tExtensionInfo = impl.ExtensionInfo\n\n\t// Types embedded in generated messages.\n\tMessageState     = impl.MessageState\n\tSizeCache        = impl.SizeCache\n\tWeakFields       = impl.WeakFields\n\tUnknownFields    = impl.UnknownFields\n\tExtensionFields  = impl.ExtensionFields\n\tExtensionFieldV1 = impl.ExtensionField\n\n\tPointer = impl.Pointer\n)\n\nvar X impl.Export\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/runtime/protoimpl/version.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 protoimpl\n\nimport (\n\t\"google.golang.org/protobuf/internal/version\"\n)\n\nconst (\n\t// MaxVersion is the maximum supported version for generated .pb.go files.\n\t// It is always the current version of the module.\n\tMaxVersion = version.Minor\n\n\t// GenVersion is the runtime version required by generated .pb.go files.\n\t// This is incremented when generated code relies on new functionality\n\t// in the runtime.\n\tGenVersion = 20\n\n\t// MinVersion is the minimum supported version for generated .pb.go files.\n\t// This is incremented when the runtime drops support for old code.\n\tMinVersion = 0\n)\n\n// EnforceVersion is used by code generated by protoc-gen-go\n// to statically enforce minimum and maximum versions of this package.\n// A compilation failure implies either that:\n//\t* the runtime package is too old and needs to be updated OR\n//\t* the generated code is too old and needs to be regenerated.\n//\n// The runtime package can be upgraded by running:\n//\tgo get google.golang.org/protobuf\n//\n// The generated code can be regenerated by running:\n//\tprotoc --go_out=${PROTOC_GEN_GO_ARGS} ${PROTO_FILES}\n//\n// Example usage by generated code:\n//\tconst (\n//\t\t// Verify that this generated code is sufficiently up-to-date.\n//\t\t_ = protoimpl.EnforceVersion(genVersion - protoimpl.MinVersion)\n//\t\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n//\t\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - genVersion)\n//\t)\n//\n// The genVersion is the current minor version used to generated the code.\n// This compile-time check relies on negative integer overflow of a uint\n// being a compilation failure (guaranteed by the Go specification).\ntype EnforceVersion uint\n\n// This enforces the following invariant:\n//\tMinVersion ≤ GenVersion ≤ MaxVersion\nconst (\n\t_ = EnforceVersion(GenVersion - MinVersion)\n\t_ = EnforceVersion(MaxVersion - GenVersion)\n)\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Author: kenton@google.com (Kenton Varda)\n//  Based on original Protocol Buffers design by\n//  Sanjay Ghemawat, Jeff Dean, and others.\n//\n// The messages in this file describe the definitions found in .proto files.\n// A valid .proto file can be translated directly to a FileDescriptorProto\n// without any other information (e.g. without reading its imports).\n\n// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: google/protobuf/descriptor.proto\n\npackage descriptorpb\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\ntype FieldDescriptorProto_Type int32\n\nconst (\n\t// 0 is reserved for errors.\n\t// Order is weird for historical reasons.\n\tFieldDescriptorProto_TYPE_DOUBLE FieldDescriptorProto_Type = 1\n\tFieldDescriptorProto_TYPE_FLOAT  FieldDescriptorProto_Type = 2\n\t// Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if\n\t// negative values are likely.\n\tFieldDescriptorProto_TYPE_INT64  FieldDescriptorProto_Type = 3\n\tFieldDescriptorProto_TYPE_UINT64 FieldDescriptorProto_Type = 4\n\t// Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if\n\t// negative values are likely.\n\tFieldDescriptorProto_TYPE_INT32   FieldDescriptorProto_Type = 5\n\tFieldDescriptorProto_TYPE_FIXED64 FieldDescriptorProto_Type = 6\n\tFieldDescriptorProto_TYPE_FIXED32 FieldDescriptorProto_Type = 7\n\tFieldDescriptorProto_TYPE_BOOL    FieldDescriptorProto_Type = 8\n\tFieldDescriptorProto_TYPE_STRING  FieldDescriptorProto_Type = 9\n\t// Tag-delimited aggregate.\n\t// Group type is deprecated and not supported in proto3. However, Proto3\n\t// implementations should still be able to parse the group wire format and\n\t// treat group fields as unknown fields.\n\tFieldDescriptorProto_TYPE_GROUP   FieldDescriptorProto_Type = 10\n\tFieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11 // Length-delimited aggregate.\n\t// New in version 2.\n\tFieldDescriptorProto_TYPE_BYTES    FieldDescriptorProto_Type = 12\n\tFieldDescriptorProto_TYPE_UINT32   FieldDescriptorProto_Type = 13\n\tFieldDescriptorProto_TYPE_ENUM     FieldDescriptorProto_Type = 14\n\tFieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15\n\tFieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16\n\tFieldDescriptorProto_TYPE_SINT32   FieldDescriptorProto_Type = 17 // Uses ZigZag encoding.\n\tFieldDescriptorProto_TYPE_SINT64   FieldDescriptorProto_Type = 18 // Uses ZigZag encoding.\n)\n\n// Enum value maps for FieldDescriptorProto_Type.\nvar (\n\tFieldDescriptorProto_Type_name = map[int32]string{\n\t\t1:  \"TYPE_DOUBLE\",\n\t\t2:  \"TYPE_FLOAT\",\n\t\t3:  \"TYPE_INT64\",\n\t\t4:  \"TYPE_UINT64\",\n\t\t5:  \"TYPE_INT32\",\n\t\t6:  \"TYPE_FIXED64\",\n\t\t7:  \"TYPE_FIXED32\",\n\t\t8:  \"TYPE_BOOL\",\n\t\t9:  \"TYPE_STRING\",\n\t\t10: \"TYPE_GROUP\",\n\t\t11: \"TYPE_MESSAGE\",\n\t\t12: \"TYPE_BYTES\",\n\t\t13: \"TYPE_UINT32\",\n\t\t14: \"TYPE_ENUM\",\n\t\t15: \"TYPE_SFIXED32\",\n\t\t16: \"TYPE_SFIXED64\",\n\t\t17: \"TYPE_SINT32\",\n\t\t18: \"TYPE_SINT64\",\n\t}\n\tFieldDescriptorProto_Type_value = map[string]int32{\n\t\t\"TYPE_DOUBLE\":   1,\n\t\t\"TYPE_FLOAT\":    2,\n\t\t\"TYPE_INT64\":    3,\n\t\t\"TYPE_UINT64\":   4,\n\t\t\"TYPE_INT32\":    5,\n\t\t\"TYPE_FIXED64\":  6,\n\t\t\"TYPE_FIXED32\":  7,\n\t\t\"TYPE_BOOL\":     8,\n\t\t\"TYPE_STRING\":   9,\n\t\t\"TYPE_GROUP\":    10,\n\t\t\"TYPE_MESSAGE\":  11,\n\t\t\"TYPE_BYTES\":    12,\n\t\t\"TYPE_UINT32\":   13,\n\t\t\"TYPE_ENUM\":     14,\n\t\t\"TYPE_SFIXED32\": 15,\n\t\t\"TYPE_SFIXED64\": 16,\n\t\t\"TYPE_SINT32\":   17,\n\t\t\"TYPE_SINT64\":   18,\n\t}\n)\n\nfunc (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type {\n\tp := new(FieldDescriptorProto_Type)\n\t*p = x\n\treturn p\n}\n\nfunc (x FieldDescriptorProto_Type) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (FieldDescriptorProto_Type) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_google_protobuf_descriptor_proto_enumTypes[0].Descriptor()\n}\n\nfunc (FieldDescriptorProto_Type) Type() protoreflect.EnumType {\n\treturn &file_google_protobuf_descriptor_proto_enumTypes[0]\n}\n\nfunc (x FieldDescriptorProto_Type) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Do not use.\nfunc (x *FieldDescriptorProto_Type) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FieldDescriptorProto_Type(num)\n\treturn nil\n}\n\n// Deprecated: Use FieldDescriptorProto_Type.Descriptor instead.\nfunc (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{4, 0}\n}\n\ntype FieldDescriptorProto_Label int32\n\nconst (\n\t// 0 is reserved for errors\n\tFieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1\n\tFieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2\n\tFieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3\n)\n\n// Enum value maps for FieldDescriptorProto_Label.\nvar (\n\tFieldDescriptorProto_Label_name = map[int32]string{\n\t\t1: \"LABEL_OPTIONAL\",\n\t\t2: \"LABEL_REQUIRED\",\n\t\t3: \"LABEL_REPEATED\",\n\t}\n\tFieldDescriptorProto_Label_value = map[string]int32{\n\t\t\"LABEL_OPTIONAL\": 1,\n\t\t\"LABEL_REQUIRED\": 2,\n\t\t\"LABEL_REPEATED\": 3,\n\t}\n)\n\nfunc (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label {\n\tp := new(FieldDescriptorProto_Label)\n\t*p = x\n\treturn p\n}\n\nfunc (x FieldDescriptorProto_Label) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (FieldDescriptorProto_Label) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_google_protobuf_descriptor_proto_enumTypes[1].Descriptor()\n}\n\nfunc (FieldDescriptorProto_Label) Type() protoreflect.EnumType {\n\treturn &file_google_protobuf_descriptor_proto_enumTypes[1]\n}\n\nfunc (x FieldDescriptorProto_Label) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Do not use.\nfunc (x *FieldDescriptorProto_Label) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FieldDescriptorProto_Label(num)\n\treturn nil\n}\n\n// Deprecated: Use FieldDescriptorProto_Label.Descriptor instead.\nfunc (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{4, 1}\n}\n\n// Generated classes can be optimized for speed or code size.\ntype FileOptions_OptimizeMode int32\n\nconst (\n\tFileOptions_SPEED FileOptions_OptimizeMode = 1 // Generate complete code for parsing, serialization,\n\t// etc.\n\tFileOptions_CODE_SIZE    FileOptions_OptimizeMode = 2 // Use ReflectionOps to implement these methods.\n\tFileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3 // Generate code using MessageLite and the lite runtime.\n)\n\n// Enum value maps for FileOptions_OptimizeMode.\nvar (\n\tFileOptions_OptimizeMode_name = map[int32]string{\n\t\t1: \"SPEED\",\n\t\t2: \"CODE_SIZE\",\n\t\t3: \"LITE_RUNTIME\",\n\t}\n\tFileOptions_OptimizeMode_value = map[string]int32{\n\t\t\"SPEED\":        1,\n\t\t\"CODE_SIZE\":    2,\n\t\t\"LITE_RUNTIME\": 3,\n\t}\n)\n\nfunc (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode {\n\tp := new(FileOptions_OptimizeMode)\n\t*p = x\n\treturn p\n}\n\nfunc (x FileOptions_OptimizeMode) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (FileOptions_OptimizeMode) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_google_protobuf_descriptor_proto_enumTypes[2].Descriptor()\n}\n\nfunc (FileOptions_OptimizeMode) Type() protoreflect.EnumType {\n\treturn &file_google_protobuf_descriptor_proto_enumTypes[2]\n}\n\nfunc (x FileOptions_OptimizeMode) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Do not use.\nfunc (x *FileOptions_OptimizeMode) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FileOptions_OptimizeMode(num)\n\treturn nil\n}\n\n// Deprecated: Use FileOptions_OptimizeMode.Descriptor instead.\nfunc (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{10, 0}\n}\n\ntype FieldOptions_CType int32\n\nconst (\n\t// Default mode.\n\tFieldOptions_STRING       FieldOptions_CType = 0\n\tFieldOptions_CORD         FieldOptions_CType = 1\n\tFieldOptions_STRING_PIECE FieldOptions_CType = 2\n)\n\n// Enum value maps for FieldOptions_CType.\nvar (\n\tFieldOptions_CType_name = map[int32]string{\n\t\t0: \"STRING\",\n\t\t1: \"CORD\",\n\t\t2: \"STRING_PIECE\",\n\t}\n\tFieldOptions_CType_value = map[string]int32{\n\t\t\"STRING\":       0,\n\t\t\"CORD\":         1,\n\t\t\"STRING_PIECE\": 2,\n\t}\n)\n\nfunc (x FieldOptions_CType) Enum() *FieldOptions_CType {\n\tp := new(FieldOptions_CType)\n\t*p = x\n\treturn p\n}\n\nfunc (x FieldOptions_CType) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (FieldOptions_CType) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_google_protobuf_descriptor_proto_enumTypes[3].Descriptor()\n}\n\nfunc (FieldOptions_CType) Type() protoreflect.EnumType {\n\treturn &file_google_protobuf_descriptor_proto_enumTypes[3]\n}\n\nfunc (x FieldOptions_CType) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Do not use.\nfunc (x *FieldOptions_CType) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FieldOptions_CType(num)\n\treturn nil\n}\n\n// Deprecated: Use FieldOptions_CType.Descriptor instead.\nfunc (FieldOptions_CType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12, 0}\n}\n\ntype FieldOptions_JSType int32\n\nconst (\n\t// Use the default type.\n\tFieldOptions_JS_NORMAL FieldOptions_JSType = 0\n\t// Use JavaScript strings.\n\tFieldOptions_JS_STRING FieldOptions_JSType = 1\n\t// Use JavaScript numbers.\n\tFieldOptions_JS_NUMBER FieldOptions_JSType = 2\n)\n\n// Enum value maps for FieldOptions_JSType.\nvar (\n\tFieldOptions_JSType_name = map[int32]string{\n\t\t0: \"JS_NORMAL\",\n\t\t1: \"JS_STRING\",\n\t\t2: \"JS_NUMBER\",\n\t}\n\tFieldOptions_JSType_value = map[string]int32{\n\t\t\"JS_NORMAL\": 0,\n\t\t\"JS_STRING\": 1,\n\t\t\"JS_NUMBER\": 2,\n\t}\n)\n\nfunc (x FieldOptions_JSType) Enum() *FieldOptions_JSType {\n\tp := new(FieldOptions_JSType)\n\t*p = x\n\treturn p\n}\n\nfunc (x FieldOptions_JSType) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (FieldOptions_JSType) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_google_protobuf_descriptor_proto_enumTypes[4].Descriptor()\n}\n\nfunc (FieldOptions_JSType) Type() protoreflect.EnumType {\n\treturn &file_google_protobuf_descriptor_proto_enumTypes[4]\n}\n\nfunc (x FieldOptions_JSType) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Do not use.\nfunc (x *FieldOptions_JSType) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FieldOptions_JSType(num)\n\treturn nil\n}\n\n// Deprecated: Use FieldOptions_JSType.Descriptor instead.\nfunc (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12, 1}\n}\n\n// Is this method side-effect-free (or safe in HTTP parlance), or idempotent,\n// or neither? HTTP based RPC implementation may choose GET verb for safe\n// methods, and PUT verb for idempotent methods instead of the default POST.\ntype MethodOptions_IdempotencyLevel int32\n\nconst (\n\tMethodOptions_IDEMPOTENCY_UNKNOWN MethodOptions_IdempotencyLevel = 0\n\tMethodOptions_NO_SIDE_EFFECTS     MethodOptions_IdempotencyLevel = 1 // implies idempotent\n\tMethodOptions_IDEMPOTENT          MethodOptions_IdempotencyLevel = 2 // idempotent, but may have side effects\n)\n\n// Enum value maps for MethodOptions_IdempotencyLevel.\nvar (\n\tMethodOptions_IdempotencyLevel_name = map[int32]string{\n\t\t0: \"IDEMPOTENCY_UNKNOWN\",\n\t\t1: \"NO_SIDE_EFFECTS\",\n\t\t2: \"IDEMPOTENT\",\n\t}\n\tMethodOptions_IdempotencyLevel_value = map[string]int32{\n\t\t\"IDEMPOTENCY_UNKNOWN\": 0,\n\t\t\"NO_SIDE_EFFECTS\":     1,\n\t\t\"IDEMPOTENT\":          2,\n\t}\n)\n\nfunc (x MethodOptions_IdempotencyLevel) Enum() *MethodOptions_IdempotencyLevel {\n\tp := new(MethodOptions_IdempotencyLevel)\n\t*p = x\n\treturn p\n}\n\nfunc (x MethodOptions_IdempotencyLevel) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (MethodOptions_IdempotencyLevel) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_google_protobuf_descriptor_proto_enumTypes[5].Descriptor()\n}\n\nfunc (MethodOptions_IdempotencyLevel) Type() protoreflect.EnumType {\n\treturn &file_google_protobuf_descriptor_proto_enumTypes[5]\n}\n\nfunc (x MethodOptions_IdempotencyLevel) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Do not use.\nfunc (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = MethodOptions_IdempotencyLevel(num)\n\treturn nil\n}\n\n// Deprecated: Use MethodOptions_IdempotencyLevel.Descriptor instead.\nfunc (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{17, 0}\n}\n\n// The protocol compiler can output a FileDescriptorSet containing the .proto\n// files it parses.\ntype FileDescriptorSet struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tFile []*FileDescriptorProto `protobuf:\"bytes,1,rep,name=file\" json:\"file,omitempty\"`\n}\n\nfunc (x *FileDescriptorSet) Reset() {\n\t*x = FileDescriptorSet{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *FileDescriptorSet) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*FileDescriptorSet) ProtoMessage() {}\n\nfunc (x *FileDescriptorSet) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use FileDescriptorSet.ProtoReflect.Descriptor instead.\nfunc (*FileDescriptorSet) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{0}\n}\n\nfunc (x *FileDescriptorSet) GetFile() []*FileDescriptorProto {\n\tif x != nil {\n\t\treturn x.File\n\t}\n\treturn nil\n}\n\n// Describes a complete .proto file.\ntype FileDescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName    *string `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`       // file name, relative to root of source tree\n\tPackage *string `protobuf:\"bytes,2,opt,name=package\" json:\"package,omitempty\"` // e.g. \"foo\", \"foo.bar\", etc.\n\t// Names of files imported by this file.\n\tDependency []string `protobuf:\"bytes,3,rep,name=dependency\" json:\"dependency,omitempty\"`\n\t// Indexes of the public imported files in the dependency list above.\n\tPublicDependency []int32 `protobuf:\"varint,10,rep,name=public_dependency,json=publicDependency\" json:\"public_dependency,omitempty\"`\n\t// Indexes of the weak imported files in the dependency list.\n\t// For Google-internal migration only. Do not use.\n\tWeakDependency []int32 `protobuf:\"varint,11,rep,name=weak_dependency,json=weakDependency\" json:\"weak_dependency,omitempty\"`\n\t// All top-level definitions in this file.\n\tMessageType []*DescriptorProto        `protobuf:\"bytes,4,rep,name=message_type,json=messageType\" json:\"message_type,omitempty\"`\n\tEnumType    []*EnumDescriptorProto    `protobuf:\"bytes,5,rep,name=enum_type,json=enumType\" json:\"enum_type,omitempty\"`\n\tService     []*ServiceDescriptorProto `protobuf:\"bytes,6,rep,name=service\" json:\"service,omitempty\"`\n\tExtension   []*FieldDescriptorProto   `protobuf:\"bytes,7,rep,name=extension\" json:\"extension,omitempty\"`\n\tOptions     *FileOptions              `protobuf:\"bytes,8,opt,name=options\" json:\"options,omitempty\"`\n\t// This field contains optional information about the original source code.\n\t// You may safely remove this entire field without harming runtime\n\t// functionality of the descriptors -- the information is needed only by\n\t// development tools.\n\tSourceCodeInfo *SourceCodeInfo `protobuf:\"bytes,9,opt,name=source_code_info,json=sourceCodeInfo\" json:\"source_code_info,omitempty\"`\n\t// The syntax of the proto file.\n\t// The supported values are \"proto2\" and \"proto3\".\n\tSyntax *string `protobuf:\"bytes,12,opt,name=syntax\" json:\"syntax,omitempty\"`\n}\n\nfunc (x *FileDescriptorProto) Reset() {\n\t*x = FileDescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[1]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *FileDescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*FileDescriptorProto) ProtoMessage() {}\n\nfunc (x *FileDescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[1]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use FileDescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*FileDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{1}\n}\n\nfunc (x *FileDescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileDescriptorProto) GetPackage() string {\n\tif x != nil && x.Package != nil {\n\t\treturn *x.Package\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileDescriptorProto) GetDependency() []string {\n\tif x != nil {\n\t\treturn x.Dependency\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetPublicDependency() []int32 {\n\tif x != nil {\n\t\treturn x.PublicDependency\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetWeakDependency() []int32 {\n\tif x != nil {\n\t\treturn x.WeakDependency\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetMessageType() []*DescriptorProto {\n\tif x != nil {\n\t\treturn x.MessageType\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto {\n\tif x != nil {\n\t\treturn x.EnumType\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetService() []*ServiceDescriptorProto {\n\tif x != nil {\n\t\treturn x.Service\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetExtension() []*FieldDescriptorProto {\n\tif x != nil {\n\t\treturn x.Extension\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetOptions() *FileOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo {\n\tif x != nil {\n\t\treturn x.SourceCodeInfo\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetSyntax() string {\n\tif x != nil && x.Syntax != nil {\n\t\treturn *x.Syntax\n\t}\n\treturn \"\"\n}\n\n// Describes a message type.\ntype DescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName           *string                           `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tField          []*FieldDescriptorProto           `protobuf:\"bytes,2,rep,name=field\" json:\"field,omitempty\"`\n\tExtension      []*FieldDescriptorProto           `protobuf:\"bytes,6,rep,name=extension\" json:\"extension,omitempty\"`\n\tNestedType     []*DescriptorProto                `protobuf:\"bytes,3,rep,name=nested_type,json=nestedType\" json:\"nested_type,omitempty\"`\n\tEnumType       []*EnumDescriptorProto            `protobuf:\"bytes,4,rep,name=enum_type,json=enumType\" json:\"enum_type,omitempty\"`\n\tExtensionRange []*DescriptorProto_ExtensionRange `protobuf:\"bytes,5,rep,name=extension_range,json=extensionRange\" json:\"extension_range,omitempty\"`\n\tOneofDecl      []*OneofDescriptorProto           `protobuf:\"bytes,8,rep,name=oneof_decl,json=oneofDecl\" json:\"oneof_decl,omitempty\"`\n\tOptions        *MessageOptions                   `protobuf:\"bytes,7,opt,name=options\" json:\"options,omitempty\"`\n\tReservedRange  []*DescriptorProto_ReservedRange  `protobuf:\"bytes,9,rep,name=reserved_range,json=reservedRange\" json:\"reserved_range,omitempty\"`\n\t// Reserved field names, which may not be used by fields in the same message.\n\t// A given name may only be reserved once.\n\tReservedName []string `protobuf:\"bytes,10,rep,name=reserved_name,json=reservedName\" json:\"reserved_name,omitempty\"`\n}\n\nfunc (x *DescriptorProto) Reset() {\n\t*x = DescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[2]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *DescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*DescriptorProto) ProtoMessage() {}\n\nfunc (x *DescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[2]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use DescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*DescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{2}\n}\n\nfunc (x *DescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *DescriptorProto) GetField() []*FieldDescriptorProto {\n\tif x != nil {\n\t\treturn x.Field\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetExtension() []*FieldDescriptorProto {\n\tif x != nil {\n\t\treturn x.Extension\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetNestedType() []*DescriptorProto {\n\tif x != nil {\n\t\treturn x.NestedType\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetEnumType() []*EnumDescriptorProto {\n\tif x != nil {\n\t\treturn x.EnumType\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange {\n\tif x != nil {\n\t\treturn x.ExtensionRange\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetOneofDecl() []*OneofDescriptorProto {\n\tif x != nil {\n\t\treturn x.OneofDecl\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetOptions() *MessageOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetReservedRange() []*DescriptorProto_ReservedRange {\n\tif x != nil {\n\t\treturn x.ReservedRange\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetReservedName() []string {\n\tif x != nil {\n\t\treturn x.ReservedName\n\t}\n\treturn nil\n}\n\ntype ExtensionRangeOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\nfunc (x *ExtensionRangeOptions) Reset() {\n\t*x = ExtensionRangeOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[3]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *ExtensionRangeOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*ExtensionRangeOptions) ProtoMessage() {}\n\nfunc (x *ExtensionRangeOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[3]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use ExtensionRangeOptions.ProtoReflect.Descriptor instead.\nfunc (*ExtensionRangeOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{3}\n}\n\nfunc (x *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\n// Describes a field within a message.\ntype FieldDescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName   *string                     `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tNumber *int32                      `protobuf:\"varint,3,opt,name=number\" json:\"number,omitempty\"`\n\tLabel  *FieldDescriptorProto_Label `protobuf:\"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label\" json:\"label,omitempty\"`\n\t// If type_name is set, this need not be set.  If both this and type_name\n\t// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.\n\tType *FieldDescriptorProto_Type `protobuf:\"varint,5,opt,name=type,enum=google.protobuf.FieldDescriptorProto_Type\" json:\"type,omitempty\"`\n\t// For message and enum types, this is the name of the type.  If the name\n\t// starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping\n\t// rules are used to find the type (i.e. first the nested types within this\n\t// message are searched, then within the parent, on up to the root\n\t// namespace).\n\tTypeName *string `protobuf:\"bytes,6,opt,name=type_name,json=typeName\" json:\"type_name,omitempty\"`\n\t// For extensions, this is the name of the type being extended.  It is\n\t// resolved in the same manner as type_name.\n\tExtendee *string `protobuf:\"bytes,2,opt,name=extendee\" json:\"extendee,omitempty\"`\n\t// For numeric types, contains the original text representation of the value.\n\t// For booleans, \"true\" or \"false\".\n\t// For strings, contains the default text contents (not escaped in any way).\n\t// For bytes, contains the C escaped value.  All bytes >= 128 are escaped.\n\t// TODO(kenton):  Base-64 encode?\n\tDefaultValue *string `protobuf:\"bytes,7,opt,name=default_value,json=defaultValue\" json:\"default_value,omitempty\"`\n\t// If set, gives the index of a oneof in the containing type's oneof_decl\n\t// list.  This field is a member of that oneof.\n\tOneofIndex *int32 `protobuf:\"varint,9,opt,name=oneof_index,json=oneofIndex\" json:\"oneof_index,omitempty\"`\n\t// JSON name of this field. The value is set by protocol compiler. If the\n\t// user has set a \"json_name\" option on this field, that option's value\n\t// will be used. Otherwise, it's deduced from the field's name by converting\n\t// it to camelCase.\n\tJsonName *string       `protobuf:\"bytes,10,opt,name=json_name,json=jsonName\" json:\"json_name,omitempty\"`\n\tOptions  *FieldOptions `protobuf:\"bytes,8,opt,name=options\" json:\"options,omitempty\"`\n\t// If true, this is a proto3 \"optional\". When a proto3 field is optional, it\n\t// tracks presence regardless of field type.\n\t//\n\t// When proto3_optional is true, this field must be belong to a oneof to\n\t// signal to old proto3 clients that presence is tracked for this field. This\n\t// oneof is known as a \"synthetic\" oneof, and this field must be its sole\n\t// member (each proto3 optional field gets its own synthetic oneof). Synthetic\n\t// oneofs exist in the descriptor only, and do not generate any API. Synthetic\n\t// oneofs must be ordered after all \"real\" oneofs.\n\t//\n\t// For message fields, proto3_optional doesn't create any semantic change,\n\t// since non-repeated message fields always track presence. However it still\n\t// indicates the semantic detail of whether the user wrote \"optional\" or not.\n\t// This can be useful for round-tripping the .proto file. For consistency we\n\t// give message fields a synthetic oneof also, even though it is not required\n\t// to track presence. This is especially important because the parser can't\n\t// tell if a field is a message or an enum, so it must always create a\n\t// synthetic oneof.\n\t//\n\t// Proto2 optional fields do not set this flag, because they already indicate\n\t// optional with `LABEL_OPTIONAL`.\n\tProto3Optional *bool `protobuf:\"varint,17,opt,name=proto3_optional,json=proto3Optional\" json:\"proto3_optional,omitempty\"`\n}\n\nfunc (x *FieldDescriptorProto) Reset() {\n\t*x = FieldDescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[4]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *FieldDescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*FieldDescriptorProto) ProtoMessage() {}\n\nfunc (x *FieldDescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[4]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use FieldDescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*FieldDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{4}\n}\n\nfunc (x *FieldDescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *FieldDescriptorProto) GetNumber() int32 {\n\tif x != nil && x.Number != nil {\n\t\treturn *x.Number\n\t}\n\treturn 0\n}\n\nfunc (x *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label {\n\tif x != nil && x.Label != nil {\n\t\treturn *x.Label\n\t}\n\treturn FieldDescriptorProto_LABEL_OPTIONAL\n}\n\nfunc (x *FieldDescriptorProto) GetType() FieldDescriptorProto_Type {\n\tif x != nil && x.Type != nil {\n\t\treturn *x.Type\n\t}\n\treturn FieldDescriptorProto_TYPE_DOUBLE\n}\n\nfunc (x *FieldDescriptorProto) GetTypeName() string {\n\tif x != nil && x.TypeName != nil {\n\t\treturn *x.TypeName\n\t}\n\treturn \"\"\n}\n\nfunc (x *FieldDescriptorProto) GetExtendee() string {\n\tif x != nil && x.Extendee != nil {\n\t\treturn *x.Extendee\n\t}\n\treturn \"\"\n}\n\nfunc (x *FieldDescriptorProto) GetDefaultValue() string {\n\tif x != nil && x.DefaultValue != nil {\n\t\treturn *x.DefaultValue\n\t}\n\treturn \"\"\n}\n\nfunc (x *FieldDescriptorProto) GetOneofIndex() int32 {\n\tif x != nil && x.OneofIndex != nil {\n\t\treturn *x.OneofIndex\n\t}\n\treturn 0\n}\n\nfunc (x *FieldDescriptorProto) GetJsonName() string {\n\tif x != nil && x.JsonName != nil {\n\t\treturn *x.JsonName\n\t}\n\treturn \"\"\n}\n\nfunc (x *FieldDescriptorProto) GetOptions() *FieldOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\nfunc (x *FieldDescriptorProto) GetProto3Optional() bool {\n\tif x != nil && x.Proto3Optional != nil {\n\t\treturn *x.Proto3Optional\n\t}\n\treturn false\n}\n\n// Describes a oneof.\ntype OneofDescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName    *string       `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tOptions *OneofOptions `protobuf:\"bytes,2,opt,name=options\" json:\"options,omitempty\"`\n}\n\nfunc (x *OneofDescriptorProto) Reset() {\n\t*x = OneofDescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[5]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *OneofDescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*OneofDescriptorProto) ProtoMessage() {}\n\nfunc (x *OneofDescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[5]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use OneofDescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*OneofDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{5}\n}\n\nfunc (x *OneofDescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *OneofDescriptorProto) GetOptions() *OneofOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\n// Describes an enum type.\ntype EnumDescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName    *string                     `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tValue   []*EnumValueDescriptorProto `protobuf:\"bytes,2,rep,name=value\" json:\"value,omitempty\"`\n\tOptions *EnumOptions                `protobuf:\"bytes,3,opt,name=options\" json:\"options,omitempty\"`\n\t// Range of reserved numeric values. Reserved numeric values may not be used\n\t// by enum values in the same enum declaration. Reserved ranges may not\n\t// overlap.\n\tReservedRange []*EnumDescriptorProto_EnumReservedRange `protobuf:\"bytes,4,rep,name=reserved_range,json=reservedRange\" json:\"reserved_range,omitempty\"`\n\t// Reserved enum value names, which may not be reused. A given name may only\n\t// be reserved once.\n\tReservedName []string `protobuf:\"bytes,5,rep,name=reserved_name,json=reservedName\" json:\"reserved_name,omitempty\"`\n}\n\nfunc (x *EnumDescriptorProto) Reset() {\n\t*x = EnumDescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[6]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *EnumDescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*EnumDescriptorProto) ProtoMessage() {}\n\nfunc (x *EnumDescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[6]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use EnumDescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*EnumDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{6}\n}\n\nfunc (x *EnumDescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto {\n\tif x != nil {\n\t\treturn x.Value\n\t}\n\treturn nil\n}\n\nfunc (x *EnumDescriptorProto) GetOptions() *EnumOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\nfunc (x *EnumDescriptorProto) GetReservedRange() []*EnumDescriptorProto_EnumReservedRange {\n\tif x != nil {\n\t\treturn x.ReservedRange\n\t}\n\treturn nil\n}\n\nfunc (x *EnumDescriptorProto) GetReservedName() []string {\n\tif x != nil {\n\t\treturn x.ReservedName\n\t}\n\treturn nil\n}\n\n// Describes a value within an enum.\ntype EnumValueDescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName    *string           `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tNumber  *int32            `protobuf:\"varint,2,opt,name=number\" json:\"number,omitempty\"`\n\tOptions *EnumValueOptions `protobuf:\"bytes,3,opt,name=options\" json:\"options,omitempty\"`\n}\n\nfunc (x *EnumValueDescriptorProto) Reset() {\n\t*x = EnumValueDescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[7]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *EnumValueDescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*EnumValueDescriptorProto) ProtoMessage() {}\n\nfunc (x *EnumValueDescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[7]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use EnumValueDescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{7}\n}\n\nfunc (x *EnumValueDescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *EnumValueDescriptorProto) GetNumber() int32 {\n\tif x != nil && x.Number != nil {\n\t\treturn *x.Number\n\t}\n\treturn 0\n}\n\nfunc (x *EnumValueDescriptorProto) GetOptions() *EnumValueOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\n// Describes a service.\ntype ServiceDescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName    *string                  `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tMethod  []*MethodDescriptorProto `protobuf:\"bytes,2,rep,name=method\" json:\"method,omitempty\"`\n\tOptions *ServiceOptions          `protobuf:\"bytes,3,opt,name=options\" json:\"options,omitempty\"`\n}\n\nfunc (x *ServiceDescriptorProto) Reset() {\n\t*x = ServiceDescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[8]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *ServiceDescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*ServiceDescriptorProto) ProtoMessage() {}\n\nfunc (x *ServiceDescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[8]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use ServiceDescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*ServiceDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{8}\n}\n\nfunc (x *ServiceDescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto {\n\tif x != nil {\n\t\treturn x.Method\n\t}\n\treturn nil\n}\n\nfunc (x *ServiceDescriptorProto) GetOptions() *ServiceOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\n// Describes a method of a service.\ntype MethodDescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName *string `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\t// Input and output type names.  These are resolved in the same way as\n\t// FieldDescriptorProto.type_name, but must refer to a message type.\n\tInputType  *string        `protobuf:\"bytes,2,opt,name=input_type,json=inputType\" json:\"input_type,omitempty\"`\n\tOutputType *string        `protobuf:\"bytes,3,opt,name=output_type,json=outputType\" json:\"output_type,omitempty\"`\n\tOptions    *MethodOptions `protobuf:\"bytes,4,opt,name=options\" json:\"options,omitempty\"`\n\t// Identifies if client streams multiple client messages\n\tClientStreaming *bool `protobuf:\"varint,5,opt,name=client_streaming,json=clientStreaming,def=0\" json:\"client_streaming,omitempty\"`\n\t// Identifies if server streams multiple server messages\n\tServerStreaming *bool `protobuf:\"varint,6,opt,name=server_streaming,json=serverStreaming,def=0\" json:\"server_streaming,omitempty\"`\n}\n\n// Default values for MethodDescriptorProto fields.\nconst (\n\tDefault_MethodDescriptorProto_ClientStreaming = bool(false)\n\tDefault_MethodDescriptorProto_ServerStreaming = bool(false)\n)\n\nfunc (x *MethodDescriptorProto) Reset() {\n\t*x = MethodDescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[9]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *MethodDescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*MethodDescriptorProto) ProtoMessage() {}\n\nfunc (x *MethodDescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[9]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use MethodDescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*MethodDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{9}\n}\n\nfunc (x *MethodDescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *MethodDescriptorProto) GetInputType() string {\n\tif x != nil && x.InputType != nil {\n\t\treturn *x.InputType\n\t}\n\treturn \"\"\n}\n\nfunc (x *MethodDescriptorProto) GetOutputType() string {\n\tif x != nil && x.OutputType != nil {\n\t\treturn *x.OutputType\n\t}\n\treturn \"\"\n}\n\nfunc (x *MethodDescriptorProto) GetOptions() *MethodOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\nfunc (x *MethodDescriptorProto) GetClientStreaming() bool {\n\tif x != nil && x.ClientStreaming != nil {\n\t\treturn *x.ClientStreaming\n\t}\n\treturn Default_MethodDescriptorProto_ClientStreaming\n}\n\nfunc (x *MethodDescriptorProto) GetServerStreaming() bool {\n\tif x != nil && x.ServerStreaming != nil {\n\t\treturn *x.ServerStreaming\n\t}\n\treturn Default_MethodDescriptorProto_ServerStreaming\n}\n\ntype FileOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// Sets the Java package where classes generated from this .proto will be\n\t// placed.  By default, the proto package is used, but this is often\n\t// inappropriate because proto packages do not normally start with backwards\n\t// domain names.\n\tJavaPackage *string `protobuf:\"bytes,1,opt,name=java_package,json=javaPackage\" json:\"java_package,omitempty\"`\n\t// If set, all the classes from the .proto file are wrapped in a single\n\t// outer class with the given name.  This applies to both Proto1\n\t// (equivalent to the old \"--one_java_file\" option) and Proto2 (where\n\t// a .proto always translates to a single class, but you may want to\n\t// explicitly choose the class name).\n\tJavaOuterClassname *string `protobuf:\"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname\" json:\"java_outer_classname,omitempty\"`\n\t// If set true, then the Java code generator will generate a separate .java\n\t// file for each top-level message, enum, and service defined in the .proto\n\t// file.  Thus, these types will *not* be nested inside the outer class\n\t// named by java_outer_classname.  However, the outer class will still be\n\t// generated to contain the file's getDescriptor() method as well as any\n\t// top-level extensions defined in the file.\n\tJavaMultipleFiles *bool `protobuf:\"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0\" json:\"java_multiple_files,omitempty\"`\n\t// This option does nothing.\n\t//\n\t// Deprecated: Do not use.\n\tJavaGenerateEqualsAndHash *bool `protobuf:\"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash\" json:\"java_generate_equals_and_hash,omitempty\"`\n\t// If set true, then the Java2 code generator will generate code that\n\t// throws an exception whenever an attempt is made to assign a non-UTF-8\n\t// byte sequence to a string field.\n\t// Message reflection will do the same.\n\t// However, an extension field still accepts non-UTF-8 byte sequences.\n\t// This option has no effect on when used with the lite runtime.\n\tJavaStringCheckUtf8 *bool                     `protobuf:\"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0\" json:\"java_string_check_utf8,omitempty\"`\n\tOptimizeFor         *FileOptions_OptimizeMode `protobuf:\"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1\" json:\"optimize_for,omitempty\"`\n\t// Sets the Go package where structs generated from this .proto will be\n\t// placed. If omitted, the Go package will be derived from the following:\n\t//   - The basename of the package import path, if provided.\n\t//   - Otherwise, the package statement in the .proto file, if present.\n\t//   - Otherwise, the basename of the .proto file, without extension.\n\tGoPackage *string `protobuf:\"bytes,11,opt,name=go_package,json=goPackage\" json:\"go_package,omitempty\"`\n\t// Should generic services be generated in each language?  \"Generic\" services\n\t// are not specific to any particular RPC system.  They are generated by the\n\t// main code generators in each language (without additional plugins).\n\t// Generic services were the only kind of service generation supported by\n\t// early versions of google.protobuf.\n\t//\n\t// Generic services are now considered deprecated in favor of using plugins\n\t// that generate code specific to your particular RPC system.  Therefore,\n\t// these default to false.  Old code which depends on generic services should\n\t// explicitly set them to true.\n\tCcGenericServices   *bool `protobuf:\"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0\" json:\"cc_generic_services,omitempty\"`\n\tJavaGenericServices *bool `protobuf:\"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0\" json:\"java_generic_services,omitempty\"`\n\tPyGenericServices   *bool `protobuf:\"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0\" json:\"py_generic_services,omitempty\"`\n\tPhpGenericServices  *bool `protobuf:\"varint,42,opt,name=php_generic_services,json=phpGenericServices,def=0\" json:\"php_generic_services,omitempty\"`\n\t// Is this file deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for everything in the file, or it will be completely ignored; in the very\n\t// least, this is a formalization for deprecating files.\n\tDeprecated *bool `protobuf:\"varint,23,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// Enables the use of arenas for the proto messages in this file. This applies\n\t// only to generated classes for C++.\n\tCcEnableArenas *bool `protobuf:\"varint,31,opt,name=cc_enable_arenas,json=ccEnableArenas,def=1\" json:\"cc_enable_arenas,omitempty\"`\n\t// Sets the objective c class prefix which is prepended to all objective c\n\t// generated classes from this .proto. There is no default.\n\tObjcClassPrefix *string `protobuf:\"bytes,36,opt,name=objc_class_prefix,json=objcClassPrefix\" json:\"objc_class_prefix,omitempty\"`\n\t// Namespace for generated classes; defaults to the package.\n\tCsharpNamespace *string `protobuf:\"bytes,37,opt,name=csharp_namespace,json=csharpNamespace\" json:\"csharp_namespace,omitempty\"`\n\t// By default Swift generators will take the proto package and CamelCase it\n\t// replacing '.' with underscore and use that to prefix the types/symbols\n\t// defined. When this options is provided, they will use this value instead\n\t// to prefix the types/symbols defined.\n\tSwiftPrefix *string `protobuf:\"bytes,39,opt,name=swift_prefix,json=swiftPrefix\" json:\"swift_prefix,omitempty\"`\n\t// Sets the php class prefix which is prepended to all php generated classes\n\t// from this .proto. Default is empty.\n\tPhpClassPrefix *string `protobuf:\"bytes,40,opt,name=php_class_prefix,json=phpClassPrefix\" json:\"php_class_prefix,omitempty\"`\n\t// Use this option to change the namespace of php generated classes. Default\n\t// is empty. When this option is empty, the package name will be used for\n\t// determining the namespace.\n\tPhpNamespace *string `protobuf:\"bytes,41,opt,name=php_namespace,json=phpNamespace\" json:\"php_namespace,omitempty\"`\n\t// Use this option to change the namespace of php generated metadata classes.\n\t// Default is empty. When this option is empty, the proto file name will be\n\t// used for determining the namespace.\n\tPhpMetadataNamespace *string `protobuf:\"bytes,44,opt,name=php_metadata_namespace,json=phpMetadataNamespace\" json:\"php_metadata_namespace,omitempty\"`\n\t// Use this option to change the package of ruby generated classes. Default\n\t// is empty. When this option is not set, the package name will be used for\n\t// determining the ruby package.\n\tRubyPackage *string `protobuf:\"bytes,45,opt,name=ruby_package,json=rubyPackage\" json:\"ruby_package,omitempty\"`\n\t// The parser stores options it doesn't recognize here.\n\t// See the documentation for the \"Options\" section above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\n// Default values for FileOptions fields.\nconst (\n\tDefault_FileOptions_JavaMultipleFiles   = bool(false)\n\tDefault_FileOptions_JavaStringCheckUtf8 = bool(false)\n\tDefault_FileOptions_OptimizeFor         = FileOptions_SPEED\n\tDefault_FileOptions_CcGenericServices   = bool(false)\n\tDefault_FileOptions_JavaGenericServices = bool(false)\n\tDefault_FileOptions_PyGenericServices   = bool(false)\n\tDefault_FileOptions_PhpGenericServices  = bool(false)\n\tDefault_FileOptions_Deprecated          = bool(false)\n\tDefault_FileOptions_CcEnableArenas      = bool(true)\n)\n\nfunc (x *FileOptions) Reset() {\n\t*x = FileOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[10]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *FileOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*FileOptions) ProtoMessage() {}\n\nfunc (x *FileOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[10]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use FileOptions.ProtoReflect.Descriptor instead.\nfunc (*FileOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{10}\n}\n\nfunc (x *FileOptions) GetJavaPackage() string {\n\tif x != nil && x.JavaPackage != nil {\n\t\treturn *x.JavaPackage\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetJavaOuterClassname() string {\n\tif x != nil && x.JavaOuterClassname != nil {\n\t\treturn *x.JavaOuterClassname\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetJavaMultipleFiles() bool {\n\tif x != nil && x.JavaMultipleFiles != nil {\n\t\treturn *x.JavaMultipleFiles\n\t}\n\treturn Default_FileOptions_JavaMultipleFiles\n}\n\n// Deprecated: Do not use.\nfunc (x *FileOptions) GetJavaGenerateEqualsAndHash() bool {\n\tif x != nil && x.JavaGenerateEqualsAndHash != nil {\n\t\treturn *x.JavaGenerateEqualsAndHash\n\t}\n\treturn false\n}\n\nfunc (x *FileOptions) GetJavaStringCheckUtf8() bool {\n\tif x != nil && x.JavaStringCheckUtf8 != nil {\n\t\treturn *x.JavaStringCheckUtf8\n\t}\n\treturn Default_FileOptions_JavaStringCheckUtf8\n}\n\nfunc (x *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode {\n\tif x != nil && x.OptimizeFor != nil {\n\t\treturn *x.OptimizeFor\n\t}\n\treturn Default_FileOptions_OptimizeFor\n}\n\nfunc (x *FileOptions) GetGoPackage() string {\n\tif x != nil && x.GoPackage != nil {\n\t\treturn *x.GoPackage\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetCcGenericServices() bool {\n\tif x != nil && x.CcGenericServices != nil {\n\t\treturn *x.CcGenericServices\n\t}\n\treturn Default_FileOptions_CcGenericServices\n}\n\nfunc (x *FileOptions) GetJavaGenericServices() bool {\n\tif x != nil && x.JavaGenericServices != nil {\n\t\treturn *x.JavaGenericServices\n\t}\n\treturn Default_FileOptions_JavaGenericServices\n}\n\nfunc (x *FileOptions) GetPyGenericServices() bool {\n\tif x != nil && x.PyGenericServices != nil {\n\t\treturn *x.PyGenericServices\n\t}\n\treturn Default_FileOptions_PyGenericServices\n}\n\nfunc (x *FileOptions) GetPhpGenericServices() bool {\n\tif x != nil && x.PhpGenericServices != nil {\n\t\treturn *x.PhpGenericServices\n\t}\n\treturn Default_FileOptions_PhpGenericServices\n}\n\nfunc (x *FileOptions) GetDeprecated() bool {\n\tif x != nil && x.Deprecated != nil {\n\t\treturn *x.Deprecated\n\t}\n\treturn Default_FileOptions_Deprecated\n}\n\nfunc (x *FileOptions) GetCcEnableArenas() bool {\n\tif x != nil && x.CcEnableArenas != nil {\n\t\treturn *x.CcEnableArenas\n\t}\n\treturn Default_FileOptions_CcEnableArenas\n}\n\nfunc (x *FileOptions) GetObjcClassPrefix() string {\n\tif x != nil && x.ObjcClassPrefix != nil {\n\t\treturn *x.ObjcClassPrefix\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetCsharpNamespace() string {\n\tif x != nil && x.CsharpNamespace != nil {\n\t\treturn *x.CsharpNamespace\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetSwiftPrefix() string {\n\tif x != nil && x.SwiftPrefix != nil {\n\t\treturn *x.SwiftPrefix\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetPhpClassPrefix() string {\n\tif x != nil && x.PhpClassPrefix != nil {\n\t\treturn *x.PhpClassPrefix\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetPhpNamespace() string {\n\tif x != nil && x.PhpNamespace != nil {\n\t\treturn *x.PhpNamespace\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetPhpMetadataNamespace() string {\n\tif x != nil && x.PhpMetadataNamespace != nil {\n\t\treturn *x.PhpMetadataNamespace\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetRubyPackage() string {\n\tif x != nil && x.RubyPackage != nil {\n\t\treturn *x.RubyPackage\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype MessageOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// Set true to use the old proto1 MessageSet wire format for extensions.\n\t// This is provided for backwards-compatibility with the MessageSet wire\n\t// format.  You should not use this for any other reason:  It's less\n\t// efficient, has fewer features, and is more complicated.\n\t//\n\t// The message must be defined exactly as follows:\n\t//   message Foo {\n\t//     option message_set_wire_format = true;\n\t//     extensions 4 to max;\n\t//   }\n\t// Note that the message cannot have any defined fields; MessageSets only\n\t// have extensions.\n\t//\n\t// All extensions of your type must be singular messages; e.g. they cannot\n\t// be int32s, enums, or repeated messages.\n\t//\n\t// Because this is an option, the above two restrictions are not enforced by\n\t// the protocol compiler.\n\tMessageSetWireFormat *bool `protobuf:\"varint,1,opt,name=message_set_wire_format,json=messageSetWireFormat,def=0\" json:\"message_set_wire_format,omitempty\"`\n\t// Disables the generation of the standard \"descriptor()\" accessor, which can\n\t// conflict with a field of the same name.  This is meant to make migration\n\t// from proto1 easier; new code should avoid fields named \"descriptor\".\n\tNoStandardDescriptorAccessor *bool `protobuf:\"varint,2,opt,name=no_standard_descriptor_accessor,json=noStandardDescriptorAccessor,def=0\" json:\"no_standard_descriptor_accessor,omitempty\"`\n\t// Is this message deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the message, or it will be completely ignored; in the very least,\n\t// this is a formalization for deprecating messages.\n\tDeprecated *bool `protobuf:\"varint,3,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// Whether the message is an automatically generated map entry type for the\n\t// maps field.\n\t//\n\t// For maps fields:\n\t//     map<KeyType, ValueType> map_field = 1;\n\t// The parsed descriptor looks like:\n\t//     message MapFieldEntry {\n\t//         option map_entry = true;\n\t//         optional KeyType key = 1;\n\t//         optional ValueType value = 2;\n\t//     }\n\t//     repeated MapFieldEntry map_field = 1;\n\t//\n\t// Implementations may choose not to generate the map_entry=true message, but\n\t// use a native map in the target language to hold the keys and values.\n\t// The reflection APIs in such implementations still need to work as\n\t// if the field is a repeated message field.\n\t//\n\t// NOTE: Do not set the option in .proto files. Always use the maps syntax\n\t// instead. The option should only be implicitly set by the proto compiler\n\t// parser.\n\tMapEntry *bool `protobuf:\"varint,7,opt,name=map_entry,json=mapEntry\" json:\"map_entry,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\n// Default values for MessageOptions fields.\nconst (\n\tDefault_MessageOptions_MessageSetWireFormat         = bool(false)\n\tDefault_MessageOptions_NoStandardDescriptorAccessor = bool(false)\n\tDefault_MessageOptions_Deprecated                   = bool(false)\n)\n\nfunc (x *MessageOptions) Reset() {\n\t*x = MessageOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[11]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *MessageOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*MessageOptions) ProtoMessage() {}\n\nfunc (x *MessageOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[11]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use MessageOptions.ProtoReflect.Descriptor instead.\nfunc (*MessageOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{11}\n}\n\nfunc (x *MessageOptions) GetMessageSetWireFormat() bool {\n\tif x != nil && x.MessageSetWireFormat != nil {\n\t\treturn *x.MessageSetWireFormat\n\t}\n\treturn Default_MessageOptions_MessageSetWireFormat\n}\n\nfunc (x *MessageOptions) GetNoStandardDescriptorAccessor() bool {\n\tif x != nil && x.NoStandardDescriptorAccessor != nil {\n\t\treturn *x.NoStandardDescriptorAccessor\n\t}\n\treturn Default_MessageOptions_NoStandardDescriptorAccessor\n}\n\nfunc (x *MessageOptions) GetDeprecated() bool {\n\tif x != nil && x.Deprecated != nil {\n\t\treturn *x.Deprecated\n\t}\n\treturn Default_MessageOptions_Deprecated\n}\n\nfunc (x *MessageOptions) GetMapEntry() bool {\n\tif x != nil && x.MapEntry != nil {\n\t\treturn *x.MapEntry\n\t}\n\treturn false\n}\n\nfunc (x *MessageOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype FieldOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// The ctype option instructs the C++ code generator to use a different\n\t// representation of the field than it normally would.  See the specific\n\t// options below.  This option is not yet implemented in the open source\n\t// release -- sorry, we'll try to include it in a future version!\n\tCtype *FieldOptions_CType `protobuf:\"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0\" json:\"ctype,omitempty\"`\n\t// The packed option can be enabled for repeated primitive fields to enable\n\t// a more efficient representation on the wire. Rather than repeatedly\n\t// writing the tag and type for each element, the entire array is encoded as\n\t// a single length-delimited blob. In proto3, only explicit setting it to\n\t// false will avoid using packed encoding.\n\tPacked *bool `protobuf:\"varint,2,opt,name=packed\" json:\"packed,omitempty\"`\n\t// The jstype option determines the JavaScript type used for values of the\n\t// field.  The option is permitted only for 64 bit integral and fixed types\n\t// (int64, uint64, sint64, fixed64, sfixed64).  A field with jstype JS_STRING\n\t// is represented as JavaScript string, which avoids loss of precision that\n\t// can happen when a large value is converted to a floating point JavaScript.\n\t// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to\n\t// use the JavaScript \"number\" type.  The behavior of the default option\n\t// JS_NORMAL is implementation dependent.\n\t//\n\t// This option is an enum to permit additional types to be added, e.g.\n\t// goog.math.Integer.\n\tJstype *FieldOptions_JSType `protobuf:\"varint,6,opt,name=jstype,enum=google.protobuf.FieldOptions_JSType,def=0\" json:\"jstype,omitempty\"`\n\t// Should this field be parsed lazily?  Lazy applies only to message-type\n\t// fields.  It means that when the outer message is initially parsed, the\n\t// inner message's contents will not be parsed but instead stored in encoded\n\t// form.  The inner message will actually be parsed when it is first accessed.\n\t//\n\t// This is only a hint.  Implementations are free to choose whether to use\n\t// eager or lazy parsing regardless of the value of this option.  However,\n\t// setting this option true suggests that the protocol author believes that\n\t// using lazy parsing on this field is worth the additional bookkeeping\n\t// overhead typically needed to implement it.\n\t//\n\t// This option does not affect the public interface of any generated code;\n\t// all method signatures remain the same.  Furthermore, thread-safety of the\n\t// interface is not affected by this option; const methods remain safe to\n\t// call from multiple threads concurrently, while non-const methods continue\n\t// to require exclusive access.\n\t//\n\t//\n\t// Note that implementations may choose not to check required fields within\n\t// a lazy sub-message.  That is, calling IsInitialized() on the outer message\n\t// may return true even if the inner message has missing required fields.\n\t// This is necessary because otherwise the inner message would have to be\n\t// parsed in order to perform the check, defeating the purpose of lazy\n\t// parsing.  An implementation which chooses not to check required fields\n\t// must be consistent about it.  That is, for any particular sub-message, the\n\t// implementation must either *always* check its required fields, or *never*\n\t// check its required fields, regardless of whether or not the message has\n\t// been parsed.\n\tLazy *bool `protobuf:\"varint,5,opt,name=lazy,def=0\" json:\"lazy,omitempty\"`\n\t// Is this field deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for accessors, or it will be completely ignored; in the very least, this\n\t// is a formalization for deprecating fields.\n\tDeprecated *bool `protobuf:\"varint,3,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// For Google-internal migration only. Do not use.\n\tWeak *bool `protobuf:\"varint,10,opt,name=weak,def=0\" json:\"weak,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\n// Default values for FieldOptions fields.\nconst (\n\tDefault_FieldOptions_Ctype      = FieldOptions_STRING\n\tDefault_FieldOptions_Jstype     = FieldOptions_JS_NORMAL\n\tDefault_FieldOptions_Lazy       = bool(false)\n\tDefault_FieldOptions_Deprecated = bool(false)\n\tDefault_FieldOptions_Weak       = bool(false)\n)\n\nfunc (x *FieldOptions) Reset() {\n\t*x = FieldOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[12]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *FieldOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*FieldOptions) ProtoMessage() {}\n\nfunc (x *FieldOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[12]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use FieldOptions.ProtoReflect.Descriptor instead.\nfunc (*FieldOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12}\n}\n\nfunc (x *FieldOptions) GetCtype() FieldOptions_CType {\n\tif x != nil && x.Ctype != nil {\n\t\treturn *x.Ctype\n\t}\n\treturn Default_FieldOptions_Ctype\n}\n\nfunc (x *FieldOptions) GetPacked() bool {\n\tif x != nil && x.Packed != nil {\n\t\treturn *x.Packed\n\t}\n\treturn false\n}\n\nfunc (x *FieldOptions) GetJstype() FieldOptions_JSType {\n\tif x != nil && x.Jstype != nil {\n\t\treturn *x.Jstype\n\t}\n\treturn Default_FieldOptions_Jstype\n}\n\nfunc (x *FieldOptions) GetLazy() bool {\n\tif x != nil && x.Lazy != nil {\n\t\treturn *x.Lazy\n\t}\n\treturn Default_FieldOptions_Lazy\n}\n\nfunc (x *FieldOptions) GetDeprecated() bool {\n\tif x != nil && x.Deprecated != nil {\n\t\treturn *x.Deprecated\n\t}\n\treturn Default_FieldOptions_Deprecated\n}\n\nfunc (x *FieldOptions) GetWeak() bool {\n\tif x != nil && x.Weak != nil {\n\t\treturn *x.Weak\n\t}\n\treturn Default_FieldOptions_Weak\n}\n\nfunc (x *FieldOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype OneofOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\nfunc (x *OneofOptions) Reset() {\n\t*x = OneofOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[13]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *OneofOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*OneofOptions) ProtoMessage() {}\n\nfunc (x *OneofOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[13]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use OneofOptions.ProtoReflect.Descriptor instead.\nfunc (*OneofOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{13}\n}\n\nfunc (x *OneofOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype EnumOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// Set this option to true to allow mapping different tag names to the same\n\t// value.\n\tAllowAlias *bool `protobuf:\"varint,2,opt,name=allow_alias,json=allowAlias\" json:\"allow_alias,omitempty\"`\n\t// Is this enum deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the enum, or it will be completely ignored; in the very least, this\n\t// is a formalization for deprecating enums.\n\tDeprecated *bool `protobuf:\"varint,3,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\n// Default values for EnumOptions fields.\nconst (\n\tDefault_EnumOptions_Deprecated = bool(false)\n)\n\nfunc (x *EnumOptions) Reset() {\n\t*x = EnumOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[14]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *EnumOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*EnumOptions) ProtoMessage() {}\n\nfunc (x *EnumOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[14]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use EnumOptions.ProtoReflect.Descriptor instead.\nfunc (*EnumOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{14}\n}\n\nfunc (x *EnumOptions) GetAllowAlias() bool {\n\tif x != nil && x.AllowAlias != nil {\n\t\treturn *x.AllowAlias\n\t}\n\treturn false\n}\n\nfunc (x *EnumOptions) GetDeprecated() bool {\n\tif x != nil && x.Deprecated != nil {\n\t\treturn *x.Deprecated\n\t}\n\treturn Default_EnumOptions_Deprecated\n}\n\nfunc (x *EnumOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype EnumValueOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// Is this enum value deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the enum value, or it will be completely ignored; in the very least,\n\t// this is a formalization for deprecating enum values.\n\tDeprecated *bool `protobuf:\"varint,1,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\n// Default values for EnumValueOptions fields.\nconst (\n\tDefault_EnumValueOptions_Deprecated = bool(false)\n)\n\nfunc (x *EnumValueOptions) Reset() {\n\t*x = EnumValueOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[15]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *EnumValueOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*EnumValueOptions) ProtoMessage() {}\n\nfunc (x *EnumValueOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[15]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use EnumValueOptions.ProtoReflect.Descriptor instead.\nfunc (*EnumValueOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{15}\n}\n\nfunc (x *EnumValueOptions) GetDeprecated() bool {\n\tif x != nil && x.Deprecated != nil {\n\t\treturn *x.Deprecated\n\t}\n\treturn Default_EnumValueOptions_Deprecated\n}\n\nfunc (x *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype ServiceOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// Is this service deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the service, or it will be completely ignored; in the very least,\n\t// this is a formalization for deprecating services.\n\tDeprecated *bool `protobuf:\"varint,33,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\n// Default values for ServiceOptions fields.\nconst (\n\tDefault_ServiceOptions_Deprecated = bool(false)\n)\n\nfunc (x *ServiceOptions) Reset() {\n\t*x = ServiceOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[16]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *ServiceOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*ServiceOptions) ProtoMessage() {}\n\nfunc (x *ServiceOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[16]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use ServiceOptions.ProtoReflect.Descriptor instead.\nfunc (*ServiceOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{16}\n}\n\nfunc (x *ServiceOptions) GetDeprecated() bool {\n\tif x != nil && x.Deprecated != nil {\n\t\treturn *x.Deprecated\n\t}\n\treturn Default_ServiceOptions_Deprecated\n}\n\nfunc (x *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype MethodOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// Is this method deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the method, or it will be completely ignored; in the very least,\n\t// this is a formalization for deprecating methods.\n\tDeprecated       *bool                           `protobuf:\"varint,33,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\tIdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:\"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0\" json:\"idempotency_level,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\n// Default values for MethodOptions fields.\nconst (\n\tDefault_MethodOptions_Deprecated       = bool(false)\n\tDefault_MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN\n)\n\nfunc (x *MethodOptions) Reset() {\n\t*x = MethodOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[17]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *MethodOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*MethodOptions) ProtoMessage() {}\n\nfunc (x *MethodOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[17]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use MethodOptions.ProtoReflect.Descriptor instead.\nfunc (*MethodOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{17}\n}\n\nfunc (x *MethodOptions) GetDeprecated() bool {\n\tif x != nil && x.Deprecated != nil {\n\t\treturn *x.Deprecated\n\t}\n\treturn Default_MethodOptions_Deprecated\n}\n\nfunc (x *MethodOptions) GetIdempotencyLevel() MethodOptions_IdempotencyLevel {\n\tif x != nil && x.IdempotencyLevel != nil {\n\t\treturn *x.IdempotencyLevel\n\t}\n\treturn Default_MethodOptions_IdempotencyLevel\n}\n\nfunc (x *MethodOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\n// A message representing a option the parser does not recognize. This only\n// appears in options protos created by the compiler::Parser class.\n// DescriptorPool resolves these when building Descriptor objects. Therefore,\n// options protos in descriptor objects (e.g. returned by Descriptor::options(),\n// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions\n// in them.\ntype UninterpretedOption struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName []*UninterpretedOption_NamePart `protobuf:\"bytes,2,rep,name=name\" json:\"name,omitempty\"`\n\t// The value of the uninterpreted option, in whatever type the tokenizer\n\t// identified it as during parsing. Exactly one of these should be set.\n\tIdentifierValue  *string  `protobuf:\"bytes,3,opt,name=identifier_value,json=identifierValue\" json:\"identifier_value,omitempty\"`\n\tPositiveIntValue *uint64  `protobuf:\"varint,4,opt,name=positive_int_value,json=positiveIntValue\" json:\"positive_int_value,omitempty\"`\n\tNegativeIntValue *int64   `protobuf:\"varint,5,opt,name=negative_int_value,json=negativeIntValue\" json:\"negative_int_value,omitempty\"`\n\tDoubleValue      *float64 `protobuf:\"fixed64,6,opt,name=double_value,json=doubleValue\" json:\"double_value,omitempty\"`\n\tStringValue      []byte   `protobuf:\"bytes,7,opt,name=string_value,json=stringValue\" json:\"string_value,omitempty\"`\n\tAggregateValue   *string  `protobuf:\"bytes,8,opt,name=aggregate_value,json=aggregateValue\" json:\"aggregate_value,omitempty\"`\n}\n\nfunc (x *UninterpretedOption) Reset() {\n\t*x = UninterpretedOption{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[18]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *UninterpretedOption) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*UninterpretedOption) ProtoMessage() {}\n\nfunc (x *UninterpretedOption) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[18]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use UninterpretedOption.ProtoReflect.Descriptor instead.\nfunc (*UninterpretedOption) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{18}\n}\n\nfunc (x *UninterpretedOption) GetName() []*UninterpretedOption_NamePart {\n\tif x != nil {\n\t\treturn x.Name\n\t}\n\treturn nil\n}\n\nfunc (x *UninterpretedOption) GetIdentifierValue() string {\n\tif x != nil && x.IdentifierValue != nil {\n\t\treturn *x.IdentifierValue\n\t}\n\treturn \"\"\n}\n\nfunc (x *UninterpretedOption) GetPositiveIntValue() uint64 {\n\tif x != nil && x.PositiveIntValue != nil {\n\t\treturn *x.PositiveIntValue\n\t}\n\treturn 0\n}\n\nfunc (x *UninterpretedOption) GetNegativeIntValue() int64 {\n\tif x != nil && x.NegativeIntValue != nil {\n\t\treturn *x.NegativeIntValue\n\t}\n\treturn 0\n}\n\nfunc (x *UninterpretedOption) GetDoubleValue() float64 {\n\tif x != nil && x.DoubleValue != nil {\n\t\treturn *x.DoubleValue\n\t}\n\treturn 0\n}\n\nfunc (x *UninterpretedOption) GetStringValue() []byte {\n\tif x != nil {\n\t\treturn x.StringValue\n\t}\n\treturn nil\n}\n\nfunc (x *UninterpretedOption) GetAggregateValue() string {\n\tif x != nil && x.AggregateValue != nil {\n\t\treturn *x.AggregateValue\n\t}\n\treturn \"\"\n}\n\n// Encapsulates information about the original source file from which a\n// FileDescriptorProto was generated.\ntype SourceCodeInfo struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// A Location identifies a piece of source code in a .proto file which\n\t// corresponds to a particular definition.  This information is intended\n\t// to be useful to IDEs, code indexers, documentation generators, and similar\n\t// tools.\n\t//\n\t// For example, say we have a file like:\n\t//   message Foo {\n\t//     optional string foo = 1;\n\t//   }\n\t// Let's look at just the field definition:\n\t//   optional string foo = 1;\n\t//   ^       ^^     ^^  ^  ^^^\n\t//   a       bc     de  f  ghi\n\t// We have the following locations:\n\t//   span   path               represents\n\t//   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.\n\t//   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).\n\t//   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).\n\t//   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).\n\t//   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).\n\t//\n\t// Notes:\n\t// - A location may refer to a repeated field itself (i.e. not to any\n\t//   particular index within it).  This is used whenever a set of elements are\n\t//   logically enclosed in a single code segment.  For example, an entire\n\t//   extend block (possibly containing multiple extension definitions) will\n\t//   have an outer location whose path refers to the \"extensions\" repeated\n\t//   field without an index.\n\t// - Multiple locations may have the same path.  This happens when a single\n\t//   logical declaration is spread out across multiple places.  The most\n\t//   obvious example is the \"extend\" block again -- there may be multiple\n\t//   extend blocks in the same scope, each of which will have the same path.\n\t// - A location's span is not always a subset of its parent's span.  For\n\t//   example, the \"extendee\" of an extension declaration appears at the\n\t//   beginning of the \"extend\" block and is shared by all extensions within\n\t//   the block.\n\t// - Just because a location's span is a subset of some other location's span\n\t//   does not mean that it is a descendant.  For example, a \"group\" defines\n\t//   both a type and a field in a single declaration.  Thus, the locations\n\t//   corresponding to the type and field and their components will overlap.\n\t// - Code which tries to interpret locations should probably be designed to\n\t//   ignore those that it doesn't understand, as more types of locations could\n\t//   be recorded in the future.\n\tLocation []*SourceCodeInfo_Location `protobuf:\"bytes,1,rep,name=location\" json:\"location,omitempty\"`\n}\n\nfunc (x *SourceCodeInfo) Reset() {\n\t*x = SourceCodeInfo{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[19]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *SourceCodeInfo) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*SourceCodeInfo) ProtoMessage() {}\n\nfunc (x *SourceCodeInfo) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[19]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use SourceCodeInfo.ProtoReflect.Descriptor instead.\nfunc (*SourceCodeInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19}\n}\n\nfunc (x *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location {\n\tif x != nil {\n\t\treturn x.Location\n\t}\n\treturn nil\n}\n\n// Describes the relationship between generated code and its original source\n// file. A GeneratedCodeInfo message is associated with only one generated\n// source file, but may contain references to different source .proto files.\ntype GeneratedCodeInfo struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// An Annotation connects some span of text in generated code to an element\n\t// of its generating .proto file.\n\tAnnotation []*GeneratedCodeInfo_Annotation `protobuf:\"bytes,1,rep,name=annotation\" json:\"annotation,omitempty\"`\n}\n\nfunc (x *GeneratedCodeInfo) Reset() {\n\t*x = GeneratedCodeInfo{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[20]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *GeneratedCodeInfo) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*GeneratedCodeInfo) ProtoMessage() {}\n\nfunc (x *GeneratedCodeInfo) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[20]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use GeneratedCodeInfo.ProtoReflect.Descriptor instead.\nfunc (*GeneratedCodeInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{20}\n}\n\nfunc (x *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation {\n\tif x != nil {\n\t\treturn x.Annotation\n\t}\n\treturn nil\n}\n\ntype DescriptorProto_ExtensionRange struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tStart   *int32                 `protobuf:\"varint,1,opt,name=start\" json:\"start,omitempty\"` // Inclusive.\n\tEnd     *int32                 `protobuf:\"varint,2,opt,name=end\" json:\"end,omitempty\"`     // Exclusive.\n\tOptions *ExtensionRangeOptions `protobuf:\"bytes,3,opt,name=options\" json:\"options,omitempty\"`\n}\n\nfunc (x *DescriptorProto_ExtensionRange) Reset() {\n\t*x = DescriptorProto_ExtensionRange{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[21]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *DescriptorProto_ExtensionRange) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*DescriptorProto_ExtensionRange) ProtoMessage() {}\n\nfunc (x *DescriptorProto_ExtensionRange) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[21]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use DescriptorProto_ExtensionRange.ProtoReflect.Descriptor instead.\nfunc (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{2, 0}\n}\n\nfunc (x *DescriptorProto_ExtensionRange) GetStart() int32 {\n\tif x != nil && x.Start != nil {\n\t\treturn *x.Start\n\t}\n\treturn 0\n}\n\nfunc (x *DescriptorProto_ExtensionRange) GetEnd() int32 {\n\tif x != nil && x.End != nil {\n\t\treturn *x.End\n\t}\n\treturn 0\n}\n\nfunc (x *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\n// Range of reserved tag numbers. Reserved tag numbers may not be used by\n// fields or extension ranges in the same message. Reserved ranges may\n// not overlap.\ntype DescriptorProto_ReservedRange struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tStart *int32 `protobuf:\"varint,1,opt,name=start\" json:\"start,omitempty\"` // Inclusive.\n\tEnd   *int32 `protobuf:\"varint,2,opt,name=end\" json:\"end,omitempty\"`     // Exclusive.\n}\n\nfunc (x *DescriptorProto_ReservedRange) Reset() {\n\t*x = DescriptorProto_ReservedRange{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[22]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *DescriptorProto_ReservedRange) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*DescriptorProto_ReservedRange) ProtoMessage() {}\n\nfunc (x *DescriptorProto_ReservedRange) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[22]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use DescriptorProto_ReservedRange.ProtoReflect.Descriptor instead.\nfunc (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{2, 1}\n}\n\nfunc (x *DescriptorProto_ReservedRange) GetStart() int32 {\n\tif x != nil && x.Start != nil {\n\t\treturn *x.Start\n\t}\n\treturn 0\n}\n\nfunc (x *DescriptorProto_ReservedRange) GetEnd() int32 {\n\tif x != nil && x.End != nil {\n\t\treturn *x.End\n\t}\n\treturn 0\n}\n\n// Range of reserved numeric values. Reserved values may not be used by\n// entries in the same enum. Reserved ranges may not overlap.\n//\n// Note that this is distinct from DescriptorProto.ReservedRange in that it\n// is inclusive such that it can appropriately represent the entire int32\n// domain.\ntype EnumDescriptorProto_EnumReservedRange struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tStart *int32 `protobuf:\"varint,1,opt,name=start\" json:\"start,omitempty\"` // Inclusive.\n\tEnd   *int32 `protobuf:\"varint,2,opt,name=end\" json:\"end,omitempty\"`     // Inclusive.\n}\n\nfunc (x *EnumDescriptorProto_EnumReservedRange) Reset() {\n\t*x = EnumDescriptorProto_EnumReservedRange{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[23]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *EnumDescriptorProto_EnumReservedRange) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {}\n\nfunc (x *EnumDescriptorProto_EnumReservedRange) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[23]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use EnumDescriptorProto_EnumReservedRange.ProtoReflect.Descriptor instead.\nfunc (*EnumDescriptorProto_EnumReservedRange) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{6, 0}\n}\n\nfunc (x *EnumDescriptorProto_EnumReservedRange) GetStart() int32 {\n\tif x != nil && x.Start != nil {\n\t\treturn *x.Start\n\t}\n\treturn 0\n}\n\nfunc (x *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 {\n\tif x != nil && x.End != nil {\n\t\treturn *x.End\n\t}\n\treturn 0\n}\n\n// The name of the uninterpreted option.  Each string represents a segment in\n// a dot-separated name.  is_extension is true iff a segment represents an\n// extension (denoted with parentheses in options specs in .proto files).\n// E.g.,{ [\"foo\", false], [\"bar.baz\", true], [\"qux\", false] } represents\n// \"foo.(bar.baz).qux\".\ntype UninterpretedOption_NamePart struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tNamePart    *string `protobuf:\"bytes,1,req,name=name_part,json=namePart\" json:\"name_part,omitempty\"`\n\tIsExtension *bool   `protobuf:\"varint,2,req,name=is_extension,json=isExtension\" json:\"is_extension,omitempty\"`\n}\n\nfunc (x *UninterpretedOption_NamePart) Reset() {\n\t*x = UninterpretedOption_NamePart{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[24]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *UninterpretedOption_NamePart) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*UninterpretedOption_NamePart) ProtoMessage() {}\n\nfunc (x *UninterpretedOption_NamePart) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[24]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use UninterpretedOption_NamePart.ProtoReflect.Descriptor instead.\nfunc (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{18, 0}\n}\n\nfunc (x *UninterpretedOption_NamePart) GetNamePart() string {\n\tif x != nil && x.NamePart != nil {\n\t\treturn *x.NamePart\n\t}\n\treturn \"\"\n}\n\nfunc (x *UninterpretedOption_NamePart) GetIsExtension() bool {\n\tif x != nil && x.IsExtension != nil {\n\t\treturn *x.IsExtension\n\t}\n\treturn false\n}\n\ntype SourceCodeInfo_Location struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// Identifies which part of the FileDescriptorProto was defined at this\n\t// location.\n\t//\n\t// Each element is a field number or an index.  They form a path from\n\t// the root FileDescriptorProto to the place where the definition.  For\n\t// example, this path:\n\t//   [ 4, 3, 2, 7, 1 ]\n\t// refers to:\n\t//   file.message_type(3)  // 4, 3\n\t//       .field(7)         // 2, 7\n\t//       .name()           // 1\n\t// This is because FileDescriptorProto.message_type has field number 4:\n\t//   repeated DescriptorProto message_type = 4;\n\t// and DescriptorProto.field has field number 2:\n\t//   repeated FieldDescriptorProto field = 2;\n\t// and FieldDescriptorProto.name has field number 1:\n\t//   optional string name = 1;\n\t//\n\t// Thus, the above path gives the location of a field name.  If we removed\n\t// the last element:\n\t//   [ 4, 3, 2, 7 ]\n\t// this path refers to the whole field declaration (from the beginning\n\t// of the label to the terminating semicolon).\n\tPath []int32 `protobuf:\"varint,1,rep,packed,name=path\" json:\"path,omitempty\"`\n\t// Always has exactly three or four elements: start line, start column,\n\t// end line (optional, otherwise assumed same as start line), end column.\n\t// These are packed into a single field for efficiency.  Note that line\n\t// and column numbers are zero-based -- typically you will want to add\n\t// 1 to each before displaying to a user.\n\tSpan []int32 `protobuf:\"varint,2,rep,packed,name=span\" json:\"span,omitempty\"`\n\t// If this SourceCodeInfo represents a complete declaration, these are any\n\t// comments appearing before and after the declaration which appear to be\n\t// attached to the declaration.\n\t//\n\t// A series of line comments appearing on consecutive lines, with no other\n\t// tokens appearing on those lines, will be treated as a single comment.\n\t//\n\t// leading_detached_comments will keep paragraphs of comments that appear\n\t// before (but not connected to) the current element. Each paragraph,\n\t// separated by empty lines, will be one comment element in the repeated\n\t// field.\n\t//\n\t// Only the comment content is provided; comment markers (e.g. //) are\n\t// stripped out.  For block comments, leading whitespace and an asterisk\n\t// will be stripped from the beginning of each line other than the first.\n\t// Newlines are included in the output.\n\t//\n\t// Examples:\n\t//\n\t//   optional int32 foo = 1;  // Comment attached to foo.\n\t//   // Comment attached to bar.\n\t//   optional int32 bar = 2;\n\t//\n\t//   optional string baz = 3;\n\t//   // Comment attached to baz.\n\t//   // Another line attached to baz.\n\t//\n\t//   // Comment attached to qux.\n\t//   //\n\t//   // Another line attached to qux.\n\t//   optional double qux = 4;\n\t//\n\t//   // Detached comment for corge. This is not leading or trailing comments\n\t//   // to qux or corge because there are blank lines separating it from\n\t//   // both.\n\t//\n\t//   // Detached comment for corge paragraph 2.\n\t//\n\t//   optional string corge = 5;\n\t//   /* Block comment attached\n\t//    * to corge.  Leading asterisks\n\t//    * will be removed. */\n\t//   /* Block comment attached to\n\t//    * grault. */\n\t//   optional int32 grault = 6;\n\t//\n\t//   // ignored detached comments.\n\tLeadingComments         *string  `protobuf:\"bytes,3,opt,name=leading_comments,json=leadingComments\" json:\"leading_comments,omitempty\"`\n\tTrailingComments        *string  `protobuf:\"bytes,4,opt,name=trailing_comments,json=trailingComments\" json:\"trailing_comments,omitempty\"`\n\tLeadingDetachedComments []string `protobuf:\"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments\" json:\"leading_detached_comments,omitempty\"`\n}\n\nfunc (x *SourceCodeInfo_Location) Reset() {\n\t*x = SourceCodeInfo_Location{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[25]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *SourceCodeInfo_Location) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*SourceCodeInfo_Location) ProtoMessage() {}\n\nfunc (x *SourceCodeInfo_Location) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[25]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use SourceCodeInfo_Location.ProtoReflect.Descriptor instead.\nfunc (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19, 0}\n}\n\nfunc (x *SourceCodeInfo_Location) GetPath() []int32 {\n\tif x != nil {\n\t\treturn x.Path\n\t}\n\treturn nil\n}\n\nfunc (x *SourceCodeInfo_Location) GetSpan() []int32 {\n\tif x != nil {\n\t\treturn x.Span\n\t}\n\treturn nil\n}\n\nfunc (x *SourceCodeInfo_Location) GetLeadingComments() string {\n\tif x != nil && x.LeadingComments != nil {\n\t\treturn *x.LeadingComments\n\t}\n\treturn \"\"\n}\n\nfunc (x *SourceCodeInfo_Location) GetTrailingComments() string {\n\tif x != nil && x.TrailingComments != nil {\n\t\treturn *x.TrailingComments\n\t}\n\treturn \"\"\n}\n\nfunc (x *SourceCodeInfo_Location) GetLeadingDetachedComments() []string {\n\tif x != nil {\n\t\treturn x.LeadingDetachedComments\n\t}\n\treturn nil\n}\n\ntype GeneratedCodeInfo_Annotation struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// Identifies the element in the original source .proto file. This field\n\t// is formatted the same as SourceCodeInfo.Location.path.\n\tPath []int32 `protobuf:\"varint,1,rep,packed,name=path\" json:\"path,omitempty\"`\n\t// Identifies the filesystem path to the original source .proto.\n\tSourceFile *string `protobuf:\"bytes,2,opt,name=source_file,json=sourceFile\" json:\"source_file,omitempty\"`\n\t// Identifies the starting offset in bytes in the generated code\n\t// that relates to the identified object.\n\tBegin *int32 `protobuf:\"varint,3,opt,name=begin\" json:\"begin,omitempty\"`\n\t// Identifies the ending offset in bytes in the generated code that\n\t// relates to the identified offset. The end offset should be one past\n\t// the last relevant byte (so the length of the text = end - begin).\n\tEnd *int32 `protobuf:\"varint,4,opt,name=end\" json:\"end,omitempty\"`\n}\n\nfunc (x *GeneratedCodeInfo_Annotation) Reset() {\n\t*x = GeneratedCodeInfo_Annotation{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[26]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *GeneratedCodeInfo_Annotation) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*GeneratedCodeInfo_Annotation) ProtoMessage() {}\n\nfunc (x *GeneratedCodeInfo_Annotation) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[26]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use GeneratedCodeInfo_Annotation.ProtoReflect.Descriptor instead.\nfunc (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{20, 0}\n}\n\nfunc (x *GeneratedCodeInfo_Annotation) GetPath() []int32 {\n\tif x != nil {\n\t\treturn x.Path\n\t}\n\treturn nil\n}\n\nfunc (x *GeneratedCodeInfo_Annotation) GetSourceFile() string {\n\tif x != nil && x.SourceFile != nil {\n\t\treturn *x.SourceFile\n\t}\n\treturn \"\"\n}\n\nfunc (x *GeneratedCodeInfo_Annotation) GetBegin() int32 {\n\tif x != nil && x.Begin != nil {\n\t\treturn *x.Begin\n\t}\n\treturn 0\n}\n\nfunc (x *GeneratedCodeInfo_Annotation) GetEnd() int32 {\n\tif x != nil && x.End != nil {\n\t\treturn *x.End\n\t}\n\treturn 0\n}\n\nvar File_google_protobuf_descriptor_proto protoreflect.FileDescriptor\n\nvar file_google_protobuf_descriptor_proto_rawDesc = []byte{\n\t0x0a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,\n\t0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f,\n\t0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x62, 0x75, 0x66, 0x22, 0x4d, 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72,\n\t0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65,\n\t0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73,\n\t0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x04, 0x66, 0x69,\n\t0x6c, 0x65, 0x22, 0xe4, 0x04, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72,\n\t0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,\n\t0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18,\n\t0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,\n\t0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x65,\n\t0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65,\n\t0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x70, 0x75, 0x62, 0x6c,\n\t0x69, 0x63, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0a, 0x20,\n\t0x03, 0x28, 0x05, 0x52, 0x10, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x44, 0x65, 0x70, 0x65, 0x6e,\n\t0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x65, 0x61, 0x6b, 0x5f, 0x64, 0x65,\n\t0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0e,\n\t0x77, 0x65, 0x61, 0x6b, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x43,\n\t0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04,\n\t0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,\n\t0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f,\n\t0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54,\n\t0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65,\n\t0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73,\n\t0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x08, 0x65, 0x6e,\n\t0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,\n\t0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,\n\t0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f,\n\t0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74,\n\t0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67,\n\t0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46,\n\t0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72,\n\t0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x36,\n\t0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32,\n\t0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,\n\t0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f,\n\t0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x49, 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,\n\t0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b,\n\t0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,\n\t0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66,\n\t0x6f, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66,\n\t0x6f, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28,\n\t0x09, 0x52, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x22, 0xb9, 0x06, 0x0a, 0x0f, 0x44, 0x65,\n\t0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a,\n\t0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,\n\t0x65, 0x12, 0x3b, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,\n\t0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,\n\t0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,\n\t0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x43,\n\t0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28,\n\t0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,\n\t0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73,\n\t0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x79,\n\t0x70, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,\n\t0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72,\n\t0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74,\n\t0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74,\n\t0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67,\n\t0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d,\n\t0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52,\n\t0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x65, 0x78, 0x74,\n\t0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x05, 0x20, 0x03,\n\t0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,\n\t0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50,\n\t0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61,\n\t0x6e, 0x67, 0x65, 0x52, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61,\n\t0x6e, 0x67, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x64, 0x65, 0x63,\n\t0x6c, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44,\n\t0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09,\n\t0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x63, 0x6c, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74,\n\t0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f,\n\t0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73,\n\t0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74,\n\t0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64,\n\t0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x67,\n\t0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44,\n\t0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52,\n\t0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65,\n\t0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72,\n\t0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x03,\n\t0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65,\n\t0x1a, 0x7a, 0x0a, 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e,\n\t0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,\n\t0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18,\n\t0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x40, 0x0a, 0x07, 0x6f, 0x70,\n\t0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f,\n\t0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78,\n\t0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69,\n\t0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x37, 0x0a, 0x0d,\n\t0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a,\n\t0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74,\n\t0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,\n\t0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x7c, 0x0a, 0x15, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,\n\t0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58,\n\t0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f,\n\t0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e,\n\t0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,\n\t0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74,\n\t0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74,\n\t0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80,\n\t0x80, 0x80, 0x02, 0x22, 0xc1, 0x06, 0x0a, 0x14, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73,\n\t0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04,\n\t0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,\n\t0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05,\n\t0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65,\n\t0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44,\n\t0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c,\n\t0x61, 0x62, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x3e, 0x0a, 0x04, 0x74,\n\t0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67,\n\t0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c,\n\t0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f,\n\t0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74,\n\t0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,\n\t0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65,\n\t0x6e, 0x64, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x78, 0x74, 0x65,\n\t0x6e, 0x64, 0x65, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f,\n\t0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66,\n\t0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x6e, 0x65,\n\t0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a,\n\t0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x6a, 0x73,\n\t0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6a,\n\t0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f,\n\t0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,\n\t0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64,\n\t0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,\n\t0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f,\n\t0x6e, 0x61, 0x6c, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x33, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0xb6, 0x02, 0x0a, 0x04, 0x54, 0x79,\n\t0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c,\n\t0x45, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x4f, 0x41,\n\t0x54, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x36,\n\t0x34, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54,\n\t0x36, 0x34, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54,\n\t0x33, 0x32, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58,\n\t0x45, 0x44, 0x36, 0x34, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46,\n\t0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45,\n\t0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x08, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f,\n\t0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x09, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45,\n\t0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x0a, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45,\n\t0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59,\n\t0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x53, 0x10, 0x0c, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59,\n\t0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x0d, 0x12, 0x0d, 0x0a, 0x09, 0x54,\n\t0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x0e, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59,\n\t0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x0f, 0x12, 0x11, 0x0a,\n\t0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x10,\n\t0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10,\n\t0x11, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34,\n\t0x10, 0x12, 0x22, 0x43, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x0e, 0x4c,\n\t0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12,\n\t0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45,\n\t0x44, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x50,\n\t0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x22, 0x63, 0x0a, 0x14, 0x4f, 0x6e, 0x65, 0x6f, 0x66,\n\t0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12,\n\t0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,\n\t0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02,\n\t0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,\n\t0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69,\n\t0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xe3, 0x02, 0x0a,\n\t0x13, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50,\n\t0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,\n\t0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,\n\t0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61,\n\t0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f,\n\t0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x6f, 0x70, 0x74,\n\t0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f,\n\t0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75,\n\t0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,\n\t0x73, 0x12, 0x5d, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61,\n\t0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67,\n\t0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d,\n\t0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e,\n\t0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67,\n\t0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65,\n\t0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d,\n\t0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65,\n\t0x64, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x3b, 0x0a, 0x11, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73,\n\t0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74,\n\t0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74,\n\t0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65,\n\t0x6e, 0x64, 0x22, 0x83, 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65,\n\t0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12,\n\t0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,\n\t0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20,\n\t0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f,\n\t0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67,\n\t0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45,\n\t0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52,\n\t0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x72,\n\t0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72,\n\t0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,\n\t0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f,\n\t0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64,\n\t0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52,\n\t0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f,\n\t0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,\n\t0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69,\n\t0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f,\n\t0x6e, 0x73, 0x22, 0x89, 0x02, 0x0a, 0x15, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73,\n\t0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04,\n\t0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,\n\t0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02,\n\t0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12,\n\t0x1f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03,\n\t0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65,\n\t0x12, 0x38, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28,\n\t0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,\n\t0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x30, 0x0a, 0x10, 0x63, 0x6c,\n\t0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x05,\n\t0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x63, 0x6c, 0x69,\n\t0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x30, 0x0a, 0x10,\n\t0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67,\n\t0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x73,\n\t0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x22, 0x91,\n\t0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21,\n\t0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01,\n\t0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6a, 0x61, 0x76, 0x61, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67,\n\t0x65, 0x12, 0x30, 0x0a, 0x14, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f,\n\t0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52,\n\t0x12, 0x6a, 0x61, 0x76, 0x61, 0x4f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x6e,\n\t0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74,\n\t0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08,\n\t0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x6a, 0x61, 0x76, 0x61, 0x4d, 0x75, 0x6c,\n\t0x74, 0x69, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x1d, 0x6a, 0x61,\n\t0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x65, 0x71, 0x75, 0x61,\n\t0x6c, 0x73, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x14, 0x20, 0x01, 0x28,\n\t0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x19, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72,\n\t0x61, 0x74, 0x65, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x41, 0x6e, 0x64, 0x48, 0x61, 0x73, 0x68,\n\t0x12, 0x3a, 0x0a, 0x16, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f,\n\t0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x75, 0x74, 0x66, 0x38, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x08,\n\t0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x53, 0x74, 0x72,\n\t0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x74, 0x66, 0x38, 0x12, 0x53, 0x0a, 0x0c,\n\t0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01,\n\t0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,\n\t0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,\n\t0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x3a, 0x05, 0x53,\n\t0x50, 0x45, 0x45, 0x44, 0x52, 0x0b, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x46, 0x6f,\n\t0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18,\n\t0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65,\n\t0x12, 0x35, 0x0a, 0x13, 0x63, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73,\n\t0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66,\n\t0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x63, 0x63, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53,\n\t0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x15, 0x6a, 0x61, 0x76, 0x61, 0x5f,\n\t0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73,\n\t0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a,\n\t0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,\n\t0x65, 0x73, 0x12, 0x35, 0x0a, 0x13, 0x70, 0x79, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63,\n\t0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x08, 0x3a,\n\t0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x70, 0x79, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69,\n\t0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x14, 0x70, 0x68, 0x70,\n\t0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,\n\t0x73, 0x18, 0x2a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x12,\n\t0x70, 0x68, 0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,\n\t0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64,\n\t0x18, 0x17, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64,\n\t0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x10, 0x63, 0x63, 0x5f,\n\t0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x18, 0x1f, 0x20,\n\t0x01, 0x28, 0x08, 0x3a, 0x04, 0x74, 0x72, 0x75, 0x65, 0x52, 0x0e, 0x63, 0x63, 0x45, 0x6e, 0x61,\n\t0x62, 0x6c, 0x65, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x6f, 0x62, 0x6a,\n\t0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x24,\n\t0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6f, 0x62, 0x6a, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50,\n\t0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f,\n\t0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x25, 0x20, 0x01, 0x28, 0x09, 0x52,\n\t0x0f, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65,\n\t0x12, 0x21, 0x0a, 0x0c, 0x73, 0x77, 0x69, 0x66, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78,\n\t0x18, 0x27, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x77, 0x69, 0x66, 0x74, 0x50, 0x72, 0x65,\n\t0x66, 0x69, 0x78, 0x12, 0x28, 0x0a, 0x10, 0x70, 0x68, 0x70, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73,\n\t0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70,\n\t0x68, 0x70, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x23, 0x0a,\n\t0x0d, 0x70, 0x68, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x29,\n\t0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x68, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61,\n\t0x63, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x70, 0x68, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61,\n\t0x74, 0x61, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x2c, 0x20, 0x01,\n\t0x28, 0x09, 0x52, 0x14, 0x70, 0x68, 0x70, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4e,\n\t0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x75, 0x62, 0x79,\n\t0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x2d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,\n\t0x72, 0x75, 0x62, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x58, 0x0a, 0x14, 0x75,\n\t0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74,\n\t0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f,\n\t0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69,\n\t0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,\n\t0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f,\n\t0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x0a, 0x0c, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a,\n\t0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x10, 0x01,\n\t0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x10, 0x02, 0x12,\n\t0x10, 0x0a, 0x0c, 0x4c, 0x49, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10,\n\t0x03, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x26,\n\t0x10, 0x27, 0x22, 0xd1, 0x02, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70,\n\t0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,\n\t0x5f, 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74,\n\t0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14, 0x6d,\n\t0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f, 0x72,\n\t0x6d, 0x61, 0x74, 0x12, 0x4c, 0x0a, 0x1f, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61,\n\t0x72, 0x64, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x63,\n\t0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61,\n\t0x6c, 0x73, 0x65, 0x52, 0x1c, 0x6e, 0x6f, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x44,\n\t0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f,\n\t0x72, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18,\n\t0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65,\n\t0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f,\n\t0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x70,\n\t0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72,\n\t0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07,\n\t0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,\n\t0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72,\n\t0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e,\n\t0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a,\n\t0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09,\n\t0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0xe2, 0x03, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64,\n\t0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65,\n\t0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70,\n\t0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x06, 0x53, 0x54, 0x52,\n\t0x49, 0x4e, 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61,\n\t0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, 0x63, 0x6b,\n\t0x65, 0x64, 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01,\n\t0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,\n\t0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,\n\t0x73, 0x2e, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52,\n\t0x4d, 0x41, 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x04, 0x6c,\n\t0x61, 0x7a, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65,\n\t0x52, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63,\n\t0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73,\n\t0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a,\n\t0x04, 0x77, 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c,\n\t0x73, 0x65, 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e,\n\t0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,\n\t0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65,\n\t0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75,\n\t0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69,\n\t0x6f, 0x6e, 0x22, 0x2f, 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x53,\n\t0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x52, 0x44, 0x10,\n\t0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x49, 0x45, 0x43,\n\t0x45, 0x10, 0x02, 0x22, 0x35, 0x0a, 0x06, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a,\n\t0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09,\n\t0x4a, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4a,\n\t0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10,\n\t0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x73, 0x0a, 0x0c, 0x4f,\n\t0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75,\n\t0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74,\n\t0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f,\n\t0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69,\n\t0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,\n\t0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f,\n\t0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02,\n\t0x22, 0xc0, 0x01, 0x0a, 0x0b, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,\n\t0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18,\n\t0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x69, 0x61,\n\t0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18,\n\t0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65,\n\t0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e,\n\t0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,\n\t0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65,\n\t0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75,\n\t0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69,\n\t0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08,\n\t0x05, 0x10, 0x06, 0x22, 0x9e, 0x01, 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75,\n\t0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72,\n\t0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61,\n\t0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12,\n\t0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64,\n\t0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24,\n\t0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,\n\t0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70,\n\t0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65,\n\t0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80,\n\t0x80, 0x80, 0x80, 0x02, 0x22, 0x9c, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,\n\t0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65,\n\t0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c,\n\t0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58,\n\t0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f,\n\t0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e,\n\t0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,\n\t0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74,\n\t0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74,\n\t0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80,\n\t0x80, 0x80, 0x02, 0x22, 0xe0, 0x02, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70,\n\t0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61,\n\t0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65,\n\t0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x11,\n\t0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65,\n\t0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64,\n\t0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65,\n\t0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f,\n\t0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, 0x69,\n\t0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12,\n\t0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64,\n\t0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24,\n\t0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,\n\t0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70,\n\t0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65,\n\t0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x50, 0x0a, 0x10, 0x49, 0x64, 0x65,\n\t0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x17, 0x0a,\n\t0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b,\n\t0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44,\n\t0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, 0x54, 0x53, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x49,\n\t0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x54, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07,\n\t0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9a, 0x03, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x6e, 0x74,\n\t0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41,\n\t0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67,\n\t0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55,\n\t0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69,\n\t0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d,\n\t0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f,\n\t0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x64, 0x65,\n\t0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12,\n\t0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c,\n\t0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69,\n\t0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x65,\n\t0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65,\n\t0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65,\n\t0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62,\n\t0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b,\n\t0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73,\n\t0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28,\n\t0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27,\n\t0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75,\n\t0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61,\n\t0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x4a, 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x50,\n\t0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74,\n\t0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74,\n\t0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,\n\t0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73,\n\t0x69, 0x6f, 0x6e, 0x22, 0xa7, 0x02, 0x0a, 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f,\n\t0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69,\n\t0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,\n\t0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63,\n\t0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69,\n\t0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, 0x01, 0x0a,\n\t0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74,\n\t0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74,\n\t0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x42,\n\t0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c, 0x65, 0x61,\n\t0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20,\n\t0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d,\n\t0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67,\n\t0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,\n\t0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74,\n\t0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74,\n\t0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06,\n\t0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74,\n\t0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd1, 0x01,\n\t0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49,\n\t0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f,\n\t0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61,\n\t0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f,\n\t0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69,\n\t0x6f, 0x6e, 0x1a, 0x6d, 0x0a, 0x0a, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,\n\t0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02,\n\t0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72,\n\t0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73,\n\t0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x65, 0x67,\n\t0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x12,\n\t0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e,\n\t0x64, 0x42, 0x7e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69,\n\t0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x2d, 0x67, 0x6f,\n\t0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64,\n\t0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02,\n\t0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72,\n\t0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f,\n\t0x6e,\n}\n\nvar (\n\tfile_google_protobuf_descriptor_proto_rawDescOnce sync.Once\n\tfile_google_protobuf_descriptor_proto_rawDescData = file_google_protobuf_descriptor_proto_rawDesc\n)\n\nfunc file_google_protobuf_descriptor_proto_rawDescGZIP() []byte {\n\tfile_google_protobuf_descriptor_proto_rawDescOnce.Do(func() {\n\t\tfile_google_protobuf_descriptor_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_descriptor_proto_rawDescData)\n\t})\n\treturn file_google_protobuf_descriptor_proto_rawDescData\n}\n\nvar file_google_protobuf_descriptor_proto_enumTypes = make([]protoimpl.EnumInfo, 6)\nvar file_google_protobuf_descriptor_proto_msgTypes = make([]protoimpl.MessageInfo, 27)\nvar file_google_protobuf_descriptor_proto_goTypes = []interface{}{\n\t(FieldDescriptorProto_Type)(0),                // 0: google.protobuf.FieldDescriptorProto.Type\n\t(FieldDescriptorProto_Label)(0),               // 1: google.protobuf.FieldDescriptorProto.Label\n\t(FileOptions_OptimizeMode)(0),                 // 2: google.protobuf.FileOptions.OptimizeMode\n\t(FieldOptions_CType)(0),                       // 3: google.protobuf.FieldOptions.CType\n\t(FieldOptions_JSType)(0),                      // 4: google.protobuf.FieldOptions.JSType\n\t(MethodOptions_IdempotencyLevel)(0),           // 5: google.protobuf.MethodOptions.IdempotencyLevel\n\t(*FileDescriptorSet)(nil),                     // 6: google.protobuf.FileDescriptorSet\n\t(*FileDescriptorProto)(nil),                   // 7: google.protobuf.FileDescriptorProto\n\t(*DescriptorProto)(nil),                       // 8: google.protobuf.DescriptorProto\n\t(*ExtensionRangeOptions)(nil),                 // 9: google.protobuf.ExtensionRangeOptions\n\t(*FieldDescriptorProto)(nil),                  // 10: google.protobuf.FieldDescriptorProto\n\t(*OneofDescriptorProto)(nil),                  // 11: google.protobuf.OneofDescriptorProto\n\t(*EnumDescriptorProto)(nil),                   // 12: google.protobuf.EnumDescriptorProto\n\t(*EnumValueDescriptorProto)(nil),              // 13: google.protobuf.EnumValueDescriptorProto\n\t(*ServiceDescriptorProto)(nil),                // 14: google.protobuf.ServiceDescriptorProto\n\t(*MethodDescriptorProto)(nil),                 // 15: google.protobuf.MethodDescriptorProto\n\t(*FileOptions)(nil),                           // 16: google.protobuf.FileOptions\n\t(*MessageOptions)(nil),                        // 17: google.protobuf.MessageOptions\n\t(*FieldOptions)(nil),                          // 18: google.protobuf.FieldOptions\n\t(*OneofOptions)(nil),                          // 19: google.protobuf.OneofOptions\n\t(*EnumOptions)(nil),                           // 20: google.protobuf.EnumOptions\n\t(*EnumValueOptions)(nil),                      // 21: google.protobuf.EnumValueOptions\n\t(*ServiceOptions)(nil),                        // 22: google.protobuf.ServiceOptions\n\t(*MethodOptions)(nil),                         // 23: google.protobuf.MethodOptions\n\t(*UninterpretedOption)(nil),                   // 24: google.protobuf.UninterpretedOption\n\t(*SourceCodeInfo)(nil),                        // 25: google.protobuf.SourceCodeInfo\n\t(*GeneratedCodeInfo)(nil),                     // 26: google.protobuf.GeneratedCodeInfo\n\t(*DescriptorProto_ExtensionRange)(nil),        // 27: google.protobuf.DescriptorProto.ExtensionRange\n\t(*DescriptorProto_ReservedRange)(nil),         // 28: google.protobuf.DescriptorProto.ReservedRange\n\t(*EnumDescriptorProto_EnumReservedRange)(nil), // 29: google.protobuf.EnumDescriptorProto.EnumReservedRange\n\t(*UninterpretedOption_NamePart)(nil),          // 30: google.protobuf.UninterpretedOption.NamePart\n\t(*SourceCodeInfo_Location)(nil),               // 31: google.protobuf.SourceCodeInfo.Location\n\t(*GeneratedCodeInfo_Annotation)(nil),          // 32: google.protobuf.GeneratedCodeInfo.Annotation\n}\nvar file_google_protobuf_descriptor_proto_depIdxs = []int32{\n\t7,  // 0: google.protobuf.FileDescriptorSet.file:type_name -> google.protobuf.FileDescriptorProto\n\t8,  // 1: google.protobuf.FileDescriptorProto.message_type:type_name -> google.protobuf.DescriptorProto\n\t12, // 2: google.protobuf.FileDescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto\n\t14, // 3: google.protobuf.FileDescriptorProto.service:type_name -> google.protobuf.ServiceDescriptorProto\n\t10, // 4: google.protobuf.FileDescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto\n\t16, // 5: google.protobuf.FileDescriptorProto.options:type_name -> google.protobuf.FileOptions\n\t25, // 6: google.protobuf.FileDescriptorProto.source_code_info:type_name -> google.protobuf.SourceCodeInfo\n\t10, // 7: google.protobuf.DescriptorProto.field:type_name -> google.protobuf.FieldDescriptorProto\n\t10, // 8: google.protobuf.DescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto\n\t8,  // 9: google.protobuf.DescriptorProto.nested_type:type_name -> google.protobuf.DescriptorProto\n\t12, // 10: google.protobuf.DescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto\n\t27, // 11: google.protobuf.DescriptorProto.extension_range:type_name -> google.protobuf.DescriptorProto.ExtensionRange\n\t11, // 12: google.protobuf.DescriptorProto.oneof_decl:type_name -> google.protobuf.OneofDescriptorProto\n\t17, // 13: google.protobuf.DescriptorProto.options:type_name -> google.protobuf.MessageOptions\n\t28, // 14: google.protobuf.DescriptorProto.reserved_range:type_name -> google.protobuf.DescriptorProto.ReservedRange\n\t24, // 15: google.protobuf.ExtensionRangeOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t1,  // 16: google.protobuf.FieldDescriptorProto.label:type_name -> google.protobuf.FieldDescriptorProto.Label\n\t0,  // 17: google.protobuf.FieldDescriptorProto.type:type_name -> google.protobuf.FieldDescriptorProto.Type\n\t18, // 18: google.protobuf.FieldDescriptorProto.options:type_name -> google.protobuf.FieldOptions\n\t19, // 19: google.protobuf.OneofDescriptorProto.options:type_name -> google.protobuf.OneofOptions\n\t13, // 20: google.protobuf.EnumDescriptorProto.value:type_name -> google.protobuf.EnumValueDescriptorProto\n\t20, // 21: google.protobuf.EnumDescriptorProto.options:type_name -> google.protobuf.EnumOptions\n\t29, // 22: google.protobuf.EnumDescriptorProto.reserved_range:type_name -> google.protobuf.EnumDescriptorProto.EnumReservedRange\n\t21, // 23: google.protobuf.EnumValueDescriptorProto.options:type_name -> google.protobuf.EnumValueOptions\n\t15, // 24: google.protobuf.ServiceDescriptorProto.method:type_name -> google.protobuf.MethodDescriptorProto\n\t22, // 25: google.protobuf.ServiceDescriptorProto.options:type_name -> google.protobuf.ServiceOptions\n\t23, // 26: google.protobuf.MethodDescriptorProto.options:type_name -> google.protobuf.MethodOptions\n\t2,  // 27: google.protobuf.FileOptions.optimize_for:type_name -> google.protobuf.FileOptions.OptimizeMode\n\t24, // 28: google.protobuf.FileOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t24, // 29: google.protobuf.MessageOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t3,  // 30: google.protobuf.FieldOptions.ctype:type_name -> google.protobuf.FieldOptions.CType\n\t4,  // 31: google.protobuf.FieldOptions.jstype:type_name -> google.protobuf.FieldOptions.JSType\n\t24, // 32: google.protobuf.FieldOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t24, // 33: google.protobuf.OneofOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t24, // 34: google.protobuf.EnumOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t24, // 35: google.protobuf.EnumValueOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t24, // 36: google.protobuf.ServiceOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t5,  // 37: google.protobuf.MethodOptions.idempotency_level:type_name -> google.protobuf.MethodOptions.IdempotencyLevel\n\t24, // 38: google.protobuf.MethodOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t30, // 39: google.protobuf.UninterpretedOption.name:type_name -> google.protobuf.UninterpretedOption.NamePart\n\t31, // 40: google.protobuf.SourceCodeInfo.location:type_name -> google.protobuf.SourceCodeInfo.Location\n\t32, // 41: google.protobuf.GeneratedCodeInfo.annotation:type_name -> google.protobuf.GeneratedCodeInfo.Annotation\n\t9,  // 42: google.protobuf.DescriptorProto.ExtensionRange.options:type_name -> google.protobuf.ExtensionRangeOptions\n\t43, // [43:43] is the sub-list for method output_type\n\t43, // [43:43] is the sub-list for method input_type\n\t43, // [43:43] is the sub-list for extension type_name\n\t43, // [43:43] is the sub-list for extension extendee\n\t0,  // [0:43] is the sub-list for field type_name\n}\n\nfunc init() { file_google_protobuf_descriptor_proto_init() }\nfunc file_google_protobuf_descriptor_proto_init() {\n\tif File_google_protobuf_descriptor_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*FileDescriptorSet); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*FileDescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*DescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*ExtensionRangeOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*FieldDescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*OneofDescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*EnumDescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*EnumValueDescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*ServiceDescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*MethodDescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*FileOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*MessageOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*FieldOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*OneofOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*EnumOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*EnumValueOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*ServiceOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*MethodOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*UninterpretedOption); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*SourceCodeInfo); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*GeneratedCodeInfo); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*DescriptorProto_ExtensionRange); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*DescriptorProto_ReservedRange); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*EnumDescriptorProto_EnumReservedRange); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*UninterpretedOption_NamePart); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*SourceCodeInfo_Location); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*GeneratedCodeInfo_Annotation); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_google_protobuf_descriptor_proto_rawDesc,\n\t\t\tNumEnums:      6,\n\t\t\tNumMessages:   27,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_google_protobuf_descriptor_proto_goTypes,\n\t\tDependencyIndexes: file_google_protobuf_descriptor_proto_depIdxs,\n\t\tEnumInfos:         file_google_protobuf_descriptor_proto_enumTypes,\n\t\tMessageInfos:      file_google_protobuf_descriptor_proto_msgTypes,\n\t}.Build()\n\tFile_google_protobuf_descriptor_proto = out.File\n\tfile_google_protobuf_descriptor_proto_rawDesc = nil\n\tfile_google_protobuf_descriptor_proto_goTypes = nil\n\tfile_google_protobuf_descriptor_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "_tools/src/google.golang.org/protobuf/types/pluginpb/plugin.pb.go",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Author: kenton@google.com (Kenton Varda)\n//\n// WARNING:  The plugin interface is currently EXPERIMENTAL and is subject to\n//   change.\n//\n// protoc (aka the Protocol Compiler) can be extended via plugins.  A plugin is\n// just a program that reads a CodeGeneratorRequest from stdin and writes a\n// CodeGeneratorResponse to stdout.\n//\n// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead\n// of dealing with the raw protocol defined here.\n//\n// A plugin executable needs only to be placed somewhere in the path.  The\n// plugin should be named \"protoc-gen-$NAME\", and will then be used when the\n// flag \"--${NAME}_out\" is passed to protoc.\n\n// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: google/protobuf/compiler/plugin.proto\n\npackage pluginpb\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\tsync \"sync\"\n)\n\n// Sync with code_generator.h.\ntype CodeGeneratorResponse_Feature int32\n\nconst (\n\tCodeGeneratorResponse_FEATURE_NONE            CodeGeneratorResponse_Feature = 0\n\tCodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL CodeGeneratorResponse_Feature = 1\n)\n\n// Enum value maps for CodeGeneratorResponse_Feature.\nvar (\n\tCodeGeneratorResponse_Feature_name = map[int32]string{\n\t\t0: \"FEATURE_NONE\",\n\t\t1: \"FEATURE_PROTO3_OPTIONAL\",\n\t}\n\tCodeGeneratorResponse_Feature_value = map[string]int32{\n\t\t\"FEATURE_NONE\":            0,\n\t\t\"FEATURE_PROTO3_OPTIONAL\": 1,\n\t}\n)\n\nfunc (x CodeGeneratorResponse_Feature) Enum() *CodeGeneratorResponse_Feature {\n\tp := new(CodeGeneratorResponse_Feature)\n\t*p = x\n\treturn p\n}\n\nfunc (x CodeGeneratorResponse_Feature) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (CodeGeneratorResponse_Feature) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_google_protobuf_compiler_plugin_proto_enumTypes[0].Descriptor()\n}\n\nfunc (CodeGeneratorResponse_Feature) Type() protoreflect.EnumType {\n\treturn &file_google_protobuf_compiler_plugin_proto_enumTypes[0]\n}\n\nfunc (x CodeGeneratorResponse_Feature) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Do not use.\nfunc (x *CodeGeneratorResponse_Feature) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = CodeGeneratorResponse_Feature(num)\n\treturn nil\n}\n\n// Deprecated: Use CodeGeneratorResponse_Feature.Descriptor instead.\nfunc (CodeGeneratorResponse_Feature) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{2, 0}\n}\n\n// The version number of protocol compiler.\ntype Version struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tMajor *int32 `protobuf:\"varint,1,opt,name=major\" json:\"major,omitempty\"`\n\tMinor *int32 `protobuf:\"varint,2,opt,name=minor\" json:\"minor,omitempty\"`\n\tPatch *int32 `protobuf:\"varint,3,opt,name=patch\" json:\"patch,omitempty\"`\n\t// A suffix for alpha, beta or rc release, e.g., \"alpha-1\", \"rc2\". It should\n\t// be empty for mainline stable releases.\n\tSuffix *string `protobuf:\"bytes,4,opt,name=suffix\" json:\"suffix,omitempty\"`\n}\n\nfunc (x *Version) Reset() {\n\t*x = Version{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Version) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Version) ProtoMessage() {}\n\nfunc (x *Version) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Version.ProtoReflect.Descriptor instead.\nfunc (*Version) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{0}\n}\n\nfunc (x *Version) GetMajor() int32 {\n\tif x != nil && x.Major != nil {\n\t\treturn *x.Major\n\t}\n\treturn 0\n}\n\nfunc (x *Version) GetMinor() int32 {\n\tif x != nil && x.Minor != nil {\n\t\treturn *x.Minor\n\t}\n\treturn 0\n}\n\nfunc (x *Version) GetPatch() int32 {\n\tif x != nil && x.Patch != nil {\n\t\treturn *x.Patch\n\t}\n\treturn 0\n}\n\nfunc (x *Version) GetSuffix() string {\n\tif x != nil && x.Suffix != nil {\n\t\treturn *x.Suffix\n\t}\n\treturn \"\"\n}\n\n// An encoded CodeGeneratorRequest is written to the plugin's stdin.\ntype CodeGeneratorRequest struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// The .proto files that were explicitly listed on the command-line.  The\n\t// code generator should generate code only for these files.  Each file's\n\t// descriptor will be included in proto_file, below.\n\tFileToGenerate []string `protobuf:\"bytes,1,rep,name=file_to_generate,json=fileToGenerate\" json:\"file_to_generate,omitempty\"`\n\t// The generator parameter passed on the command-line.\n\tParameter *string `protobuf:\"bytes,2,opt,name=parameter\" json:\"parameter,omitempty\"`\n\t// FileDescriptorProtos for all files in files_to_generate and everything\n\t// they import.  The files will appear in topological order, so each file\n\t// appears before any file that imports it.\n\t//\n\t// protoc guarantees that all proto_files will be written after\n\t// the fields above, even though this is not technically guaranteed by the\n\t// protobuf wire format.  This theoretically could allow a plugin to stream\n\t// in the FileDescriptorProtos and handle them one by one rather than read\n\t// the entire set into memory at once.  However, as of this writing, this\n\t// is not similarly optimized on protoc's end -- it will store all fields in\n\t// memory at once before sending them to the plugin.\n\t//\n\t// Type names of fields and extensions in the FileDescriptorProto are always\n\t// fully qualified.\n\tProtoFile []*descriptorpb.FileDescriptorProto `protobuf:\"bytes,15,rep,name=proto_file,json=protoFile\" json:\"proto_file,omitempty\"`\n\t// The version number of protocol compiler.\n\tCompilerVersion *Version `protobuf:\"bytes,3,opt,name=compiler_version,json=compilerVersion\" json:\"compiler_version,omitempty\"`\n}\n\nfunc (x *CodeGeneratorRequest) Reset() {\n\t*x = CodeGeneratorRequest{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[1]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *CodeGeneratorRequest) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*CodeGeneratorRequest) ProtoMessage() {}\n\nfunc (x *CodeGeneratorRequest) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[1]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use CodeGeneratorRequest.ProtoReflect.Descriptor instead.\nfunc (*CodeGeneratorRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{1}\n}\n\nfunc (x *CodeGeneratorRequest) GetFileToGenerate() []string {\n\tif x != nil {\n\t\treturn x.FileToGenerate\n\t}\n\treturn nil\n}\n\nfunc (x *CodeGeneratorRequest) GetParameter() string {\n\tif x != nil && x.Parameter != nil {\n\t\treturn *x.Parameter\n\t}\n\treturn \"\"\n}\n\nfunc (x *CodeGeneratorRequest) GetProtoFile() []*descriptorpb.FileDescriptorProto {\n\tif x != nil {\n\t\treturn x.ProtoFile\n\t}\n\treturn nil\n}\n\nfunc (x *CodeGeneratorRequest) GetCompilerVersion() *Version {\n\tif x != nil {\n\t\treturn x.CompilerVersion\n\t}\n\treturn nil\n}\n\n// The plugin writes an encoded CodeGeneratorResponse to stdout.\ntype CodeGeneratorResponse struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// Error message.  If non-empty, code generation failed.  The plugin process\n\t// should exit with status code zero even if it reports an error in this way.\n\t//\n\t// This should be used to indicate errors in .proto files which prevent the\n\t// code generator from generating correct code.  Errors which indicate a\n\t// problem in protoc itself -- such as the input CodeGeneratorRequest being\n\t// unparseable -- should be reported by writing a message to stderr and\n\t// exiting with a non-zero status code.\n\tError *string `protobuf:\"bytes,1,opt,name=error\" json:\"error,omitempty\"`\n\t// A bitmask of supported features that the code generator supports.\n\t// This is a bitwise \"or\" of values from the Feature enum.\n\tSupportedFeatures *uint64                       `protobuf:\"varint,2,opt,name=supported_features,json=supportedFeatures\" json:\"supported_features,omitempty\"`\n\tFile              []*CodeGeneratorResponse_File `protobuf:\"bytes,15,rep,name=file\" json:\"file,omitempty\"`\n}\n\nfunc (x *CodeGeneratorResponse) Reset() {\n\t*x = CodeGeneratorResponse{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[2]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *CodeGeneratorResponse) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*CodeGeneratorResponse) ProtoMessage() {}\n\nfunc (x *CodeGeneratorResponse) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[2]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use CodeGeneratorResponse.ProtoReflect.Descriptor instead.\nfunc (*CodeGeneratorResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{2}\n}\n\nfunc (x *CodeGeneratorResponse) GetError() string {\n\tif x != nil && x.Error != nil {\n\t\treturn *x.Error\n\t}\n\treturn \"\"\n}\n\nfunc (x *CodeGeneratorResponse) GetSupportedFeatures() uint64 {\n\tif x != nil && x.SupportedFeatures != nil {\n\t\treturn *x.SupportedFeatures\n\t}\n\treturn 0\n}\n\nfunc (x *CodeGeneratorResponse) GetFile() []*CodeGeneratorResponse_File {\n\tif x != nil {\n\t\treturn x.File\n\t}\n\treturn nil\n}\n\n// Represents a single generated file.\ntype CodeGeneratorResponse_File struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// The file name, relative to the output directory.  The name must not\n\t// contain \".\" or \"..\" components and must be relative, not be absolute (so,\n\t// the file cannot lie outside the output directory).  \"/\" must be used as\n\t// the path separator, not \"\\\".\n\t//\n\t// If the name is omitted, the content will be appended to the previous\n\t// file.  This allows the generator to break large files into small chunks,\n\t// and allows the generated text to be streamed back to protoc so that large\n\t// files need not reside completely in memory at one time.  Note that as of\n\t// this writing protoc does not optimize for this -- it will read the entire\n\t// CodeGeneratorResponse before writing files to disk.\n\tName *string `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\t// If non-empty, indicates that the named file should already exist, and the\n\t// content here is to be inserted into that file at a defined insertion\n\t// point.  This feature allows a code generator to extend the output\n\t// produced by another code generator.  The original generator may provide\n\t// insertion points by placing special annotations in the file that look\n\t// like:\n\t//   @@protoc_insertion_point(NAME)\n\t// The annotation can have arbitrary text before and after it on the line,\n\t// which allows it to be placed in a comment.  NAME should be replaced with\n\t// an identifier naming the point -- this is what other generators will use\n\t// as the insertion_point.  Code inserted at this point will be placed\n\t// immediately above the line containing the insertion point (thus multiple\n\t// insertions to the same point will come out in the order they were added).\n\t// The double-@ is intended to make it unlikely that the generated code\n\t// could contain things that look like insertion points by accident.\n\t//\n\t// For example, the C++ code generator places the following line in the\n\t// .pb.h files that it generates:\n\t//   // @@protoc_insertion_point(namespace_scope)\n\t// This line appears within the scope of the file's package namespace, but\n\t// outside of any particular class.  Another plugin can then specify the\n\t// insertion_point \"namespace_scope\" to generate additional classes or\n\t// other declarations that should be placed in this scope.\n\t//\n\t// Note that if the line containing the insertion point begins with\n\t// whitespace, the same whitespace will be added to every line of the\n\t// inserted text.  This is useful for languages like Python, where\n\t// indentation matters.  In these languages, the insertion point comment\n\t// should be indented the same amount as any inserted code will need to be\n\t// in order to work correctly in that context.\n\t//\n\t// The code generator that generates the initial file and the one which\n\t// inserts into it must both run as part of a single invocation of protoc.\n\t// Code generators are executed in the order in which they appear on the\n\t// command line.\n\t//\n\t// If |insertion_point| is present, |name| must also be present.\n\tInsertionPoint *string `protobuf:\"bytes,2,opt,name=insertion_point,json=insertionPoint\" json:\"insertion_point,omitempty\"`\n\t// The file contents.\n\tContent *string `protobuf:\"bytes,15,opt,name=content\" json:\"content,omitempty\"`\n\t// Information describing the file content being inserted. If an insertion\n\t// point is used, this information will be appropriately offset and inserted\n\t// into the code generation metadata for the generated files.\n\tGeneratedCodeInfo *descriptorpb.GeneratedCodeInfo `protobuf:\"bytes,16,opt,name=generated_code_info,json=generatedCodeInfo\" json:\"generated_code_info,omitempty\"`\n}\n\nfunc (x *CodeGeneratorResponse_File) Reset() {\n\t*x = CodeGeneratorResponse_File{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[3]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *CodeGeneratorResponse_File) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*CodeGeneratorResponse_File) ProtoMessage() {}\n\nfunc (x *CodeGeneratorResponse_File) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[3]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use CodeGeneratorResponse_File.ProtoReflect.Descriptor instead.\nfunc (*CodeGeneratorResponse_File) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{2, 0}\n}\n\nfunc (x *CodeGeneratorResponse_File) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *CodeGeneratorResponse_File) GetInsertionPoint() string {\n\tif x != nil && x.InsertionPoint != nil {\n\t\treturn *x.InsertionPoint\n\t}\n\treturn \"\"\n}\n\nfunc (x *CodeGeneratorResponse_File) GetContent() string {\n\tif x != nil && x.Content != nil {\n\t\treturn *x.Content\n\t}\n\treturn \"\"\n}\n\nfunc (x *CodeGeneratorResponse_File) GetGeneratedCodeInfo() *descriptorpb.GeneratedCodeInfo {\n\tif x != nil {\n\t\treturn x.GeneratedCodeInfo\n\t}\n\treturn nil\n}\n\nvar File_google_protobuf_compiler_plugin_proto protoreflect.FileDescriptor\n\nvar file_google_protobuf_compiler_plugin_proto_rawDesc = []byte{\n\t0x0a, 0x25, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,\n\t0x66, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69,\n\t0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x18, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65,\n\t0x72, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,\n\t0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72,\n\t0x6f, 0x74, 0x6f, 0x22, 0x63, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14,\n\t0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d,\n\t0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, 0x20,\n\t0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61,\n\t0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68,\n\t0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,\n\t0x52, 0x06, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x22, 0xf1, 0x01, 0x0a, 0x14, 0x43, 0x6f, 0x64,\n\t0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,\n\t0x74, 0x12, 0x28, 0x0a, 0x10, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x74, 0x6f, 0x5f, 0x67, 0x65, 0x6e,\n\t0x65, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x66, 0x69, 0x6c,\n\t0x65, 0x54, 0x6f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70,\n\t0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,\n\t0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x43, 0x0a, 0x0a, 0x70, 0x72, 0x6f,\n\t0x74, 0x6f, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e,\n\t0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,\n\t0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72,\n\t0x6f, 0x74, 0x6f, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x4c,\n\t0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69,\n\t0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,\n\t0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69,\n\t0x6c, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x63, 0x6f, 0x6d,\n\t0x70, 0x69, 0x6c, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x94, 0x03, 0x0a,\n\t0x15, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65,\n\t0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18,\n\t0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x2d, 0x0a, 0x12,\n\t0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72,\n\t0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72,\n\t0x74, 0x65, 0x64, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x04, 0x66,\n\t0x69, 0x6c, 0x65, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x67, 0x6f, 0x6f, 0x67,\n\t0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70,\n\t0x69, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,\n\t0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52,\n\t0x04, 0x66, 0x69, 0x6c, 0x65, 0x1a, 0xb1, 0x01, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12,\n\t0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,\n\t0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x5f,\n\t0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x69, 0x6e, 0x73,\n\t0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63,\n\t0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f,\n\t0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x52, 0x0a, 0x13, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,\n\t0x65, 0x64, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x10, 0x20, 0x01,\n\t0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,\n\t0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f,\n\t0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x11, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,\n\t0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x38, 0x0a, 0x07, 0x46, 0x65, 0x61,\n\t0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x46, 0x45, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f,\n\t0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x46, 0x45, 0x41, 0x54, 0x55, 0x52,\n\t0x45, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x33, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41,\n\t0x4c, 0x10, 0x01, 0x42, 0x57, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,\n\t0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69,\n\t0x6c, 0x65, 0x72, 0x42, 0x0c, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f,\n\t0x73, 0x5a, 0x29, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67,\n\t0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79,\n\t0x70, 0x65, 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x70, 0x62,\n}\n\nvar (\n\tfile_google_protobuf_compiler_plugin_proto_rawDescOnce sync.Once\n\tfile_google_protobuf_compiler_plugin_proto_rawDescData = file_google_protobuf_compiler_plugin_proto_rawDesc\n)\n\nfunc file_google_protobuf_compiler_plugin_proto_rawDescGZIP() []byte {\n\tfile_google_protobuf_compiler_plugin_proto_rawDescOnce.Do(func() {\n\t\tfile_google_protobuf_compiler_plugin_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_compiler_plugin_proto_rawDescData)\n\t})\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescData\n}\n\nvar file_google_protobuf_compiler_plugin_proto_enumTypes = make([]protoimpl.EnumInfo, 1)\nvar file_google_protobuf_compiler_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 4)\nvar file_google_protobuf_compiler_plugin_proto_goTypes = []interface{}{\n\t(CodeGeneratorResponse_Feature)(0),       // 0: google.protobuf.compiler.CodeGeneratorResponse.Feature\n\t(*Version)(nil),                          // 1: google.protobuf.compiler.Version\n\t(*CodeGeneratorRequest)(nil),             // 2: google.protobuf.compiler.CodeGeneratorRequest\n\t(*CodeGeneratorResponse)(nil),            // 3: google.protobuf.compiler.CodeGeneratorResponse\n\t(*CodeGeneratorResponse_File)(nil),       // 4: google.protobuf.compiler.CodeGeneratorResponse.File\n\t(*descriptorpb.FileDescriptorProto)(nil), // 5: google.protobuf.FileDescriptorProto\n\t(*descriptorpb.GeneratedCodeInfo)(nil),   // 6: google.protobuf.GeneratedCodeInfo\n}\nvar file_google_protobuf_compiler_plugin_proto_depIdxs = []int32{\n\t5, // 0: google.protobuf.compiler.CodeGeneratorRequest.proto_file:type_name -> google.protobuf.FileDescriptorProto\n\t1, // 1: google.protobuf.compiler.CodeGeneratorRequest.compiler_version:type_name -> google.protobuf.compiler.Version\n\t4, // 2: google.protobuf.compiler.CodeGeneratorResponse.file:type_name -> google.protobuf.compiler.CodeGeneratorResponse.File\n\t6, // 3: google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info:type_name -> google.protobuf.GeneratedCodeInfo\n\t4, // [4:4] is the sub-list for method output_type\n\t4, // [4:4] is the sub-list for method input_type\n\t4, // [4:4] is the sub-list for extension type_name\n\t4, // [4:4] is the sub-list for extension extendee\n\t0, // [0:4] is the sub-list for field type_name\n}\n\nfunc init() { file_google_protobuf_compiler_plugin_proto_init() }\nfunc file_google_protobuf_compiler_plugin_proto_init() {\n\tif File_google_protobuf_compiler_plugin_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_google_protobuf_compiler_plugin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Version); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_compiler_plugin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*CodeGeneratorRequest); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_compiler_plugin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*CodeGeneratorResponse); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_compiler_plugin_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*CodeGeneratorResponse_File); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_google_protobuf_compiler_plugin_proto_rawDesc,\n\t\t\tNumEnums:      1,\n\t\t\tNumMessages:   4,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_google_protobuf_compiler_plugin_proto_goTypes,\n\t\tDependencyIndexes: file_google_protobuf_compiler_plugin_proto_depIdxs,\n\t\tEnumInfos:         file_google_protobuf_compiler_plugin_proto_enumTypes,\n\t\tMessageInfos:      file_google_protobuf_compiler_plugin_proto_msgTypes,\n\t}.Build()\n\tFile_google_protobuf_compiler_plugin_proto = out.File\n\tfile_google_protobuf_compiler_plugin_proto_rawDesc = nil\n\tfile_google_protobuf_compiler_plugin_proto_goTypes = nil\n\tfile_google_protobuf_compiler_plugin_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "check_protoc_version.sh",
    "content": "#!/usr/bin/env bash\n\n# Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n# use this file except in compliance with the License. A copy of the License is\n# located at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# or in the \"license\" file accompanying this file. This file is distributed on\n# an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n# express or implied. See the License for the specific language governing\n# permissions and limitations under the License.\n\nwhich protoc\nPROTOC_EXISTS=$?\nif [ $PROTOC_EXISTS -eq 0 ]; then\n\tPROTOC_VERSION=`protoc --version`\n    if [[ $PROTOC_VERSION == \"libprotoc 3.\"* ]]; then\n        echo \"protoc version: $PROTOC_VERSION\"\n\t\texit 0\n\tfi\n\techo \"required protoc v3, but found: $PROTOC_VERSION\"\n\texit 1\nfi\necho \"Please install protoc v3. See https://grpc.io/docs/protoc-installation/, for example in MacOS: brew install protobuf\"\nexit 1\n"
  },
  {
    "path": "client_options.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\npackage twirp\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"reflect\"\n)\n\n// ClientOption is a functional option for extending a Twirp client.\ntype ClientOption func(*ClientOptions)\n\n// WithClientHooks defines the hooks for a Twirp client.\nfunc WithClientHooks(hooks *ClientHooks) ClientOption {\n\treturn func(opts *ClientOptions) {\n\t\topts.Hooks = hooks\n\t}\n}\n\n// WithClientInterceptors defines the interceptors for a Twirp client.\nfunc WithClientInterceptors(interceptors ...Interceptor) ClientOption {\n\treturn func(opts *ClientOptions) {\n\t\topts.Interceptors = append(opts.Interceptors, interceptors...)\n\t}\n}\n\n// WithClientPathPrefix specifies a different prefix to use for routing.\n// If not specified, the \"/twirp\" prefix is used by default.\n// The service must be configured to serve on the same prefix.\n// An empty value \"\" can be specified to use no prefix.\n// URL format: \"<baseURL>[<prefix>]/<package>.<Service>/<Method>\"\n// More info on Twirp docs: https://twitchtv.github.io/twirp/docs/routing.html\nfunc WithClientPathPrefix(prefix string) ClientOption {\n\treturn func(opts *ClientOptions) {\n\t\topts.setOpt(\"pathPrefix\", prefix)\n\t\topts.pathPrefix = &prefix // for code generated before v8.1.0\n\t}\n}\n\n// WithClientLiteralURLs configures the Twirp client to use the exact values\n// as defined in the proto file for Service and Method names,\n// fixing the issue https://github.com/twitchtv/twirp/issues/244, which is manifested\n// when working with Twirp services implemented other languages (e.g. Python) and the proto file definitions\n// are not properly following the [Protobuf Style Guide](https://developers.google.com/protocol-buffers/docs/style#services).\n// By default (false), Go clients modify the routes by CamelCasing the values. For example,\n// with Service: `haberdasher`, Method: `make_hat`, the URLs generated by Go clients are `Haberdasher/MakeHat`,\n// but with this option enabled (true) the client will properly use `haberdasher/make_hat` instead.\nfunc WithClientLiteralURLs(b bool) ClientOption {\n\treturn func(opts *ClientOptions) {\n\t\topts.setOpt(\"literalURLs\", b)\n\t\topts.LiteralURLs = b // for code generated before v8.1.0\n\t}\n}\n\n// ClientHooks is a container for callbacks that can instrument a\n// Twirp-generated client. These callbacks all accept a context and some return\n// a context. They can use this to add to the context, appending values or\n// deadlines to it.\n//\n// The RequestPrepared hook is special because it can return errors. If it\n// returns non-nil error, handling for that request will be stopped at that\n// point. The Error hook will then be triggered.\n//\n// The RequestPrepared hook will always be called first and will be called for\n// each outgoing request from the Twirp client. The last hook to be called\n// will either be Error or ResponseReceived, so be sure to handle both cases in\n// your hooks.\ntype ClientHooks struct {\n\t// RequestPrepared is called as soon as a request has been created and before\n\t// it has been sent to the Twirp server.\n\tRequestPrepared func(context.Context, *http.Request) (context.Context, error)\n\n\t// ResponseReceived is called after a request has finished sending. Since this\n\t// is terminal, the context is not returned. ResponseReceived will not be\n\t// called in the case of an error being returned from the request.\n\tResponseReceived func(context.Context)\n\n\t// Error hook is called whenever an error occurs during the sending of a\n\t// request. The Error is passed as an argument to the hook.\n\tError func(context.Context, Error)\n}\n\n// ChainClientHooks creates a new *ClientHooks which chains the callbacks in\n// each of the constituent hooks passed in. Each hook function will be\n// called in the order of the ClientHooks values passed in.\n//\n// For the erroring hook, RequestPrepared, any returned\n// errors prevent processing by later hooks.\nfunc ChainClientHooks(hooks ...*ClientHooks) *ClientHooks {\n\tif len(hooks) == 0 {\n\t\treturn nil\n\t}\n\tif len(hooks) == 1 {\n\t\treturn hooks[0]\n\t}\n\treturn &ClientHooks{\n\t\tRequestPrepared: func(ctx context.Context, req *http.Request) (context.Context, error) {\n\t\t\tfor _, h := range hooks {\n\t\t\t\tif h != nil && h.RequestPrepared != nil {\n\t\t\t\t\tvar err error\n\t\t\t\t\tctx, err = h.RequestPrepared(ctx, req)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn ctx, err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ctx, nil\n\t\t},\n\t\tResponseReceived: func(ctx context.Context) {\n\t\t\tfor _, h := range hooks {\n\t\t\t\tif h != nil && h.ResponseReceived != nil {\n\t\t\t\t\th.ResponseReceived(ctx)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tError: func(ctx context.Context, twerr Error) {\n\t\t\tfor _, h := range hooks {\n\t\t\t\tif h != nil && h.Error != nil {\n\t\t\t\t\th.Error(ctx, twerr)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}\n}\n\n// ClientOptions encapsulate the configurable parameters on a Twirp client.\n// This type is meant to be used only by generated code.\ntype ClientOptions struct {\n\t// Untyped options map. The methods setOpt and ReadOpt are used to set\n\t// and read options. The options are untyped so when a new option is added,\n\t// newly generated code can still work with older versions of the runtime.\n\tm map[string]interface{}\n\n\tHooks        *ClientHooks\n\tInterceptors []Interceptor\n\n\t// Properties below are only used by code that was\n\t// generated by older versions of Twirp (before v8.1.0).\n\t// New options with standard types added in the future\n\t// don't need new properties, they should use ReadOpt.\n\tLiteralURLs bool\n\tpathPrefix  *string\n}\n\n// ReadOpt extracts an option to a pointer value,\n// returns true if the option exists and was extracted.\n// This method is meant to be used by generated code,\n// keeping the type dependency outside of the runtime.\n//\n// Usage example:\n//\n//     opts.setOpt(\"fooOpt\", 123)\n//     var foo int\n//     ok := opts.ReadOpt(\"fooOpt\", &int)\n//\nfunc (opts *ClientOptions) ReadOpt(key string, out interface{}) bool {\n\tval, ok := opts.m[key]\n\tif !ok {\n\t\treturn false\n\t}\n\n\trout := reflect.ValueOf(out)\n\tif rout.Kind() != reflect.Ptr {\n\t\tpanic(\"ReadOpt(key, out); out must be a pointer but it was not\")\n\t}\n\trout.Elem().Set(reflect.ValueOf(val))\n\treturn true\n}\n\n// setOpt adds an option key/value. It is used by ServerOption helpers.\n// The value can be extracted with ReadOpt by passing a pointer to the same type.\nfunc (opts *ClientOptions) setOpt(key string, val interface{}) {\n\tif opts.m == nil {\n\t\topts.m = make(map[string]interface{})\n\t}\n\topts.m[key] = val\n}\n\n// PathPrefix() is used only by clients generated before v8.1.0\nfunc (opts *ClientOptions) PathPrefix() string {\n\tif opts.pathPrefix == nil {\n\t\treturn \"/twirp\" // default prefix\n\t}\n\treturn *opts.pathPrefix\n}\n"
  },
  {
    "path": "client_options_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage twirp\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"reflect\"\n\t\"testing\"\n)\n\nfunc TestClientOptionsReadOpt(t *testing.T) {\n\topts := &ClientOptions{}\n\tok := false\n\n\tvar fooNum int\n\tok = opts.ReadOpt(\"fooNum\", &fooNum)\n\tif ok {\n\t\tt.Errorf(\"option 'fooNum' does not exist, opts.ReadOpt should have returned false\")\n\t}\n\n\topts.setOpt(\"fooNum\", 455)\n\tok = opts.ReadOpt(\"fooNum\", &fooNum)\n\tif !ok || fooNum != 455 {\n\t\tt.Errorf(\"option 'fooNum' expected to be 455\")\n\t}\n\n\tvar literalURLs bool\n\tok = opts.ReadOpt(\"literalURLs\", &literalURLs)\n\tif ok {\n\t\tt.Errorf(\"option 'literalURLs' does not exist, opts.ReadOpt should have returned false\")\n\t}\n\n\tWithClientLiteralURLs(true)(opts)\n\tok = opts.ReadOpt(\"literalURLs\", &literalURLs)\n\tif !ok || !literalURLs {\n\t\tt.Errorf(\"option 'literalURLs' expected to be true, ok: %v, val: %v\", ok, literalURLs)\n\t}\n\n\tWithClientLiteralURLs(false)(opts)\n\tok = opts.ReadOpt(\"literalURLs\", &literalURLs)\n\tif !ok || literalURLs {\n\t\tt.Errorf(\"option 'literalURLs' expected to be false, ok: %v, val: %v\", ok, literalURLs)\n\t}\n}\n\nfunc TestChainClientHooks(t *testing.T) {\n\tvar (\n\t\thook1 = new(ClientHooks)\n\t\thook2 = new(ClientHooks)\n\t\thook3 = new(ClientHooks)\n\n\t\tresponseReceivedCalled []string\n\t\terrorCalled            []string\n\t)\n\n\tconst key = \"key\"\n\n\thook1.RequestPrepared = func(ctx context.Context, req *http.Request) (context.Context, error) {\n\t\treturn context.WithValue(ctx, key, []string{\"hook1\"}), nil\n\t}\n\thook2.RequestPrepared = func(ctx context.Context, req *http.Request) (context.Context, error) {\n\t\tv := ctx.Value(key).([]string)\n\t\treturn context.WithValue(ctx, key, append(v, \"hook2\")), nil\n\t}\n\thook3.RequestPrepared = func(ctx context.Context, req *http.Request) (context.Context, error) {\n\t\tv := ctx.Value(key).([]string)\n\t\treturn context.WithValue(ctx, key, append(v, \"hook3\")), nil\n\t}\n\n\thook1.ResponseReceived = func(ctx context.Context) {\n\t\tresponseReceivedCalled = append(responseReceivedCalled, \"hook1\")\n\t}\n\n\thook2.Error = func(ctx context.Context, twerr Error) {\n\t\terrorCalled = append(errorCalled, \"hook2\")\n\t}\n\n\tchain := ChainClientHooks(hook1, hook2, hook3)\n\n\tctx := context.Background()\n\n\t// When all three chained hooks have a handler, all should be called in order.\n\twant := []string{\"hook1\", \"hook2\", \"hook3\"}\n\thaveCtx, err := chain.RequestPrepared(ctx, new(http.Request))\n\tif err != nil {\n\t\tt.Fatalf(\"RequestPrepared chain has unexpected err %v\", err)\n\t}\n\thave := haveCtx.Value(key)\n\tif !reflect.DeepEqual(have, want) {\n\t\tt.Errorf(\"RequestPrepared chain has unexpected ctx, have=%v, want=%v\", have, want)\n\t}\n\n\t// When only the first chained hook has a handler, it should be called, and\n\t// there should be no panic.\n\twant = []string{\"hook1\"}\n\tchain.ResponseReceived(ctx)\n\tif have := responseReceivedCalled; !reflect.DeepEqual(have, want) {\n\t\tt.Errorf(\"unexpected hooks called, have: %v, want: %v\", have, want)\n\t}\n\n\t// When only the second chained hook has a handler, it should be called, and\n\t// there should be no panic.\n\twant = []string{\"hook2\"}\n\tchain.Error(ctx, InternalError(\"whoops\"))\n\tif have := errorCalled; !reflect.DeepEqual(have, want) {\n\t\tt.Errorf(\"unexpected hooks called, have: %v, want: %v\", have, want)\n\t}\n\n\t// When none of the chained hooks has a handler there should be no panic.\n\terrorCalled = nil\n\thook2.Error = nil\n\tchain.Error(ctx, InternalError(\"whoops\"))\n\tif have, want := len(errorCalled), 0; have != want {\n\t\tt.Errorf(\"unexpected number of calls, have: %d, want: %d\", have, want)\n\t}\n}\n\nfunc TestWithClientPathPrefix(t *testing.T) {\n\topts := &ClientOptions{}\n\n\t// Default value\n\tif have, want := opts.PathPrefix(), \"/twirp\"; have != want {\n\t\tt.Errorf(\"unexpected default PathPrefix() on ClientOptions, have: %q, want: %q\", have, want)\n\t}\n\n\t// Set a different prefix\n\tWithClientPathPrefix(\"/newprfx/foobar\")(opts)\n\tif have, want := opts.PathPrefix(), \"/newprfx/foobar\"; have != want {\n\t\tt.Errorf(\"unexpected value after WithClientPathPrefix, have: %q, want: %q\", have, want)\n\t}\n\n\t// Use empty value for no-prefix\n\tWithClientPathPrefix(\"\")(opts)\n\tif have, want := opts.PathPrefix(), \"\"; have != want {\n\t\tt.Errorf(\"unexpected value after WithClientPathPrefix, have: %q, want: %q\", have, want)\n\t}\n}\n\nfunc TestWithClientLiteralURLs(t *testing.T) {\n\topts := &ClientOptions{}\n\n\tWithClientLiteralURLs(true)(opts)\n\tif have, want := opts.LiteralURLs, true; have != want {\n\t\tt.Errorf(\"unexpected value after WithClientLiteralURLs, have: %t, want: %t\", have, want)\n\t\treturn\n\t}\n\n\tWithClientLiteralURLs(false)(opts)\n\tif have, want := opts.LiteralURLs, false; have != want {\n\t\tt.Errorf(\"unexpected value after WithClientLiteralURLs, have: %t, want: %t\", have, want)\n\t\treturn\n\t}\n}\n"
  },
  {
    "path": "clientcompat/README.md",
    "content": "# clientcompat #\n\nclientcompat is a tool to test the compatibility of Twirp client\nimplementations.\n\n## Usage ##\n`clientcompat -client=<binary>`\n\nThe client should be generated for the compattest.proto file found in this\ndirectory.\n\nThe client binary must accept, over stdin, a protobuf-encoded\nClientCompatMessage (defined in clientcompat.proto). This message contains a\n`service_address`, which is the address of a reference-implementation\nCompatService to talk to, a `method`, which specifies which RPC of the\nCompatService should be called, and an embedded, proto-encoded `request` which\nthe client should send.\n\nIf the server sends an error, then the client should parse the error and write\nthe error code string (\"internal\", \"unauthenticated\", etc) to stderr. If the\nserver doesn't send an error, the client should encode the response message it\nreceived as protobuf and write it to stdout.\n\n## Example ##\n\nThe [gocompat](./gocompat) subdirectory contains an example implementation which\ncan be run with clientcompat to prove that the Go client implementation works.\n"
  },
  {
    "path": "clientcompat/clientcompat.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\nimport (\n\t\"context\"\n\n\t\"github.com/twitchtv/twirp/clientcompat/internal/clientcompat\"\n)\n\ntype clientCompat struct {\n\tmethod func(context.Context, *clientcompat.Req) (*clientcompat.Resp, error)\n\tnoop   func(context.Context, *clientcompat.Empty) (*clientcompat.Empty, error)\n}\n\nfunc (c *clientCompat) Method(ctx context.Context, req *clientcompat.Req) (*clientcompat.Resp, error) {\n\treturn c.method(ctx, req)\n}\n\nfunc (c *clientCompat) NoopMethod(ctx context.Context, e *clientcompat.Empty) (*clientcompat.Empty, error) {\n\treturn c.noop(ctx, e)\n}\n"
  },
  {
    "path": "clientcompat/clientcompat.proto",
    "content": "syntax = \"proto3\";\n\npackage twirp.clientcompat;\noption go_package = \"/internal/clientcompat\";\n\nservice CompatService {\n  rpc Method(Req) returns (Resp);\n  rpc NoopMethod(Empty) returns (Empty);\n}\n\nmessage Empty {}\n\nmessage Req {\n  string v = 1;\n}\n\nmessage Resp {\n  int32 v = 1;\n}\n\nmessage ClientCompatMessage {\n  string service_address = 1;\n  enum CompatServiceMethod {\n    NOOP = 0;\n    METHOD = 1;\n  }\n  CompatServiceMethod method = 2;\n  bytes request = 3;\n}\n"
  },
  {
    "path": "clientcompat/gen.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\n//go:generate protoc --twirp_out=. --go_out=. clientcompat.proto\n"
  },
  {
    "path": "clientcompat/gocompat/gocompat.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\nimport (\n\t\"context\"\n\t\"io\"\n\t\"log\"\n\t\"net/http\"\n\t\"os\"\n\n\t\"google.golang.org/protobuf/proto\"\n\n\t\"github.com/twitchtv/twirp\"\n\t\"github.com/twitchtv/twirp/clientcompat/internal/clientcompat\"\n)\n\nfunc main() {\n\tvar in clientcompat.ClientCompatMessage\n\tinBytes, err := io.ReadAll(os.Stdin)\n\tif err != nil {\n\t\tlog.Fatalf(\"read stdin err: %v\", err)\n\t}\n\terr = proto.Unmarshal(inBytes, &in)\n\tif err != nil {\n\t\tlog.Fatalf(\"unmarshal err: %v\", err)\n\t}\n\n\tclient := clientcompat.NewCompatServiceProtobufClient(in.ServiceAddress, http.DefaultClient)\n\n\tswitch in.Method {\n\tcase clientcompat.ClientCompatMessage_NOOP:\n\t\tif err := doNoop(client, in.Request); err != nil {\n\t\t\tlog.Fatalf(\"doNoop err: %v\", err)\n\t\t}\n\tcase clientcompat.ClientCompatMessage_METHOD:\n\t\tif err := doMethod(client, in.Request); err != nil {\n\t\t\tlog.Fatalf(\"doMethod err: %v\", err)\n\t\t}\n\tdefault:\n\t\tlog.Fatalf(\"unexpected method: %v\", in.Method)\n\t}\n}\n\nfunc doNoop(client clientcompat.CompatService, req []byte) error {\n\tvar e clientcompat.Empty\n\terr := proto.Unmarshal(req, &e)\n\tif err != nil {\n\t\treturn err\n\t}\n\tresp, err := client.NoopMethod(context.Background(), &e)\n\tif err != nil {\n\t\terrCode := err.(twirp.Error).Code()\n\t\tos.Stderr.Write([]byte(errCode))\n\t} else {\n\t\trespBytes, err := proto.Marshal(resp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tos.Stdout.Write(respBytes)\n\t}\n\treturn nil\n}\n\nfunc doMethod(client clientcompat.CompatService, req []byte) error {\n\tvar r clientcompat.Req\n\terr := proto.Unmarshal(req, &r)\n\tif err != nil {\n\t\treturn err\n\t}\n\tresp, err := client.Method(context.Background(), &r)\n\tif err != nil {\n\t\terrCode := err.(twirp.Error).Code()\n\t\tos.Stderr.Write([]byte(errCode))\n\t} else {\n\t\trespBytes, err := proto.Marshal(resp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tos.Stdout.Write(respBytes)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "clientcompat/internal/clientcompat/clientcompat.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: clientcompat.proto\n\npackage clientcompat\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\ntype ClientCompatMessage_CompatServiceMethod int32\n\nconst (\n\tClientCompatMessage_NOOP   ClientCompatMessage_CompatServiceMethod = 0\n\tClientCompatMessage_METHOD ClientCompatMessage_CompatServiceMethod = 1\n)\n\n// Enum value maps for ClientCompatMessage_CompatServiceMethod.\nvar (\n\tClientCompatMessage_CompatServiceMethod_name = map[int32]string{\n\t\t0: \"NOOP\",\n\t\t1: \"METHOD\",\n\t}\n\tClientCompatMessage_CompatServiceMethod_value = map[string]int32{\n\t\t\"NOOP\":   0,\n\t\t\"METHOD\": 1,\n\t}\n)\n\nfunc (x ClientCompatMessage_CompatServiceMethod) Enum() *ClientCompatMessage_CompatServiceMethod {\n\tp := new(ClientCompatMessage_CompatServiceMethod)\n\t*p = x\n\treturn p\n}\n\nfunc (x ClientCompatMessage_CompatServiceMethod) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (ClientCompatMessage_CompatServiceMethod) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_clientcompat_proto_enumTypes[0].Descriptor()\n}\n\nfunc (ClientCompatMessage_CompatServiceMethod) Type() protoreflect.EnumType {\n\treturn &file_clientcompat_proto_enumTypes[0]\n}\n\nfunc (x ClientCompatMessage_CompatServiceMethod) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Use ClientCompatMessage_CompatServiceMethod.Descriptor instead.\nfunc (ClientCompatMessage_CompatServiceMethod) EnumDescriptor() ([]byte, []int) {\n\treturn file_clientcompat_proto_rawDescGZIP(), []int{3, 0}\n}\n\ntype Empty struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n}\n\nfunc (x *Empty) Reset() {\n\t*x = Empty{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_clientcompat_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Empty) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Empty) ProtoMessage() {}\n\nfunc (x *Empty) ProtoReflect() protoreflect.Message {\n\tmi := &file_clientcompat_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Empty.ProtoReflect.Descriptor instead.\nfunc (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_clientcompat_proto_rawDescGZIP(), []int{0}\n}\n\ntype Req struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tV string `protobuf:\"bytes,1,opt,name=v,proto3\" json:\"v,omitempty\"`\n}\n\nfunc (x *Req) Reset() {\n\t*x = Req{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_clientcompat_proto_msgTypes[1]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Req) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Req) ProtoMessage() {}\n\nfunc (x *Req) ProtoReflect() protoreflect.Message {\n\tmi := &file_clientcompat_proto_msgTypes[1]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Req.ProtoReflect.Descriptor instead.\nfunc (*Req) Descriptor() ([]byte, []int) {\n\treturn file_clientcompat_proto_rawDescGZIP(), []int{1}\n}\n\nfunc (x *Req) GetV() string {\n\tif x != nil {\n\t\treturn x.V\n\t}\n\treturn \"\"\n}\n\ntype Resp struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tV int32 `protobuf:\"varint,1,opt,name=v,proto3\" json:\"v,omitempty\"`\n}\n\nfunc (x *Resp) Reset() {\n\t*x = Resp{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_clientcompat_proto_msgTypes[2]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Resp) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Resp) ProtoMessage() {}\n\nfunc (x *Resp) ProtoReflect() protoreflect.Message {\n\tmi := &file_clientcompat_proto_msgTypes[2]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Resp.ProtoReflect.Descriptor instead.\nfunc (*Resp) Descriptor() ([]byte, []int) {\n\treturn file_clientcompat_proto_rawDescGZIP(), []int{2}\n}\n\nfunc (x *Resp) GetV() int32 {\n\tif x != nil {\n\t\treturn x.V\n\t}\n\treturn 0\n}\n\ntype ClientCompatMessage struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tServiceAddress string                                  `protobuf:\"bytes,1,opt,name=service_address,json=serviceAddress,proto3\" json:\"service_address,omitempty\"`\n\tMethod         ClientCompatMessage_CompatServiceMethod `protobuf:\"varint,2,opt,name=method,proto3,enum=twirp.clientcompat.ClientCompatMessage_CompatServiceMethod\" json:\"method,omitempty\"`\n\tRequest        []byte                                  `protobuf:\"bytes,3,opt,name=request,proto3\" json:\"request,omitempty\"`\n}\n\nfunc (x *ClientCompatMessage) Reset() {\n\t*x = ClientCompatMessage{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_clientcompat_proto_msgTypes[3]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *ClientCompatMessage) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*ClientCompatMessage) ProtoMessage() {}\n\nfunc (x *ClientCompatMessage) ProtoReflect() protoreflect.Message {\n\tmi := &file_clientcompat_proto_msgTypes[3]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use ClientCompatMessage.ProtoReflect.Descriptor instead.\nfunc (*ClientCompatMessage) Descriptor() ([]byte, []int) {\n\treturn file_clientcompat_proto_rawDescGZIP(), []int{3}\n}\n\nfunc (x *ClientCompatMessage) GetServiceAddress() string {\n\tif x != nil {\n\t\treturn x.ServiceAddress\n\t}\n\treturn \"\"\n}\n\nfunc (x *ClientCompatMessage) GetMethod() ClientCompatMessage_CompatServiceMethod {\n\tif x != nil {\n\t\treturn x.Method\n\t}\n\treturn ClientCompatMessage_NOOP\n}\n\nfunc (x *ClientCompatMessage) GetRequest() []byte {\n\tif x != nil {\n\t\treturn x.Request\n\t}\n\treturn nil\n}\n\nvar File_clientcompat_proto protoreflect.FileDescriptor\n\nvar file_clientcompat_proto_rawDesc = []byte{\n\t0x0a, 0x12, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x2e, 0x70,\n\t0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x63, 0x6c, 0x69, 0x65,\n\t0x6e, 0x74, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74,\n\t0x79, 0x22, 0x13, 0x0a, 0x03, 0x52, 0x65, 0x71, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20,\n\t0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x22, 0x14, 0x0a, 0x04, 0x52, 0x65, 0x73, 0x70, 0x12, 0x0c,\n\t0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x76, 0x22, 0xda, 0x01, 0x0a,\n\t0x13, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x4d, 0x65, 0x73,\n\t0x73, 0x61, 0x67, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f,\n\t0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73,\n\t0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x53, 0x0a,\n\t0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e,\n\t0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x63, 0x6f, 0x6d, 0x70,\n\t0x61, 0x74, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x4d,\n\t0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x53, 0x65, 0x72,\n\t0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68,\n\t0x6f, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20,\n\t0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x2b, 0x0a, 0x13,\n\t0x43, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74,\n\t0x68, 0x6f, 0x64, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4f, 0x50, 0x10, 0x00, 0x12, 0x0a, 0x0a,\n\t0x06, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x10, 0x01, 0x32, 0x90, 0x01, 0x0a, 0x0d, 0x43, 0x6f,\n\t0x6d, 0x70, 0x61, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x4d,\n\t0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x17, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x63, 0x6c,\n\t0x69, 0x65, 0x6e, 0x74, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x1a, 0x18,\n\t0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x63, 0x6f, 0x6d,\n\t0x70, 0x61, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x42, 0x0a, 0x0a, 0x4e, 0x6f, 0x6f, 0x70,\n\t0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x19, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x63,\n\t0x6c, 0x69, 0x65, 0x6e, 0x74, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x2e, 0x45, 0x6d, 0x70, 0x74,\n\t0x79, 0x1a, 0x19, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74,\n\t0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x18, 0x5a, 0x16,\n\t0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74,\n\t0x63, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar (\n\tfile_clientcompat_proto_rawDescOnce sync.Once\n\tfile_clientcompat_proto_rawDescData = file_clientcompat_proto_rawDesc\n)\n\nfunc file_clientcompat_proto_rawDescGZIP() []byte {\n\tfile_clientcompat_proto_rawDescOnce.Do(func() {\n\t\tfile_clientcompat_proto_rawDescData = protoimpl.X.CompressGZIP(file_clientcompat_proto_rawDescData)\n\t})\n\treturn file_clientcompat_proto_rawDescData\n}\n\nvar file_clientcompat_proto_enumTypes = make([]protoimpl.EnumInfo, 1)\nvar file_clientcompat_proto_msgTypes = make([]protoimpl.MessageInfo, 4)\nvar file_clientcompat_proto_goTypes = []interface{}{\n\t(ClientCompatMessage_CompatServiceMethod)(0), // 0: twirp.clientcompat.ClientCompatMessage.CompatServiceMethod\n\t(*Empty)(nil),               // 1: twirp.clientcompat.Empty\n\t(*Req)(nil),                 // 2: twirp.clientcompat.Req\n\t(*Resp)(nil),                // 3: twirp.clientcompat.Resp\n\t(*ClientCompatMessage)(nil), // 4: twirp.clientcompat.ClientCompatMessage\n}\nvar file_clientcompat_proto_depIdxs = []int32{\n\t0, // 0: twirp.clientcompat.ClientCompatMessage.method:type_name -> twirp.clientcompat.ClientCompatMessage.CompatServiceMethod\n\t2, // 1: twirp.clientcompat.CompatService.Method:input_type -> twirp.clientcompat.Req\n\t1, // 2: twirp.clientcompat.CompatService.NoopMethod:input_type -> twirp.clientcompat.Empty\n\t3, // 3: twirp.clientcompat.CompatService.Method:output_type -> twirp.clientcompat.Resp\n\t1, // 4: twirp.clientcompat.CompatService.NoopMethod:output_type -> twirp.clientcompat.Empty\n\t3, // [3:5] is the sub-list for method output_type\n\t1, // [1:3] is the sub-list for method input_type\n\t1, // [1:1] is the sub-list for extension type_name\n\t1, // [1:1] is the sub-list for extension extendee\n\t0, // [0:1] is the sub-list for field type_name\n}\n\nfunc init() { file_clientcompat_proto_init() }\nfunc file_clientcompat_proto_init() {\n\tif File_clientcompat_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_clientcompat_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Empty); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_clientcompat_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Req); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_clientcompat_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Resp); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_clientcompat_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*ClientCompatMessage); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_clientcompat_proto_rawDesc,\n\t\t\tNumEnums:      1,\n\t\t\tNumMessages:   4,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_clientcompat_proto_goTypes,\n\t\tDependencyIndexes: file_clientcompat_proto_depIdxs,\n\t\tEnumInfos:         file_clientcompat_proto_enumTypes,\n\t\tMessageInfos:      file_clientcompat_proto_msgTypes,\n\t}.Build()\n\tFile_clientcompat_proto = out.File\n\tfile_clientcompat_proto_rawDesc = nil\n\tfile_clientcompat_proto_goTypes = nil\n\tfile_clientcompat_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "clientcompat/internal/clientcompat/clientcompat.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: clientcompat.proto\n\npackage clientcompat\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// =======================\n// CompatService Interface\n// =======================\n\ntype CompatService interface {\n\tMethod(context.Context, *Req) (*Resp, error)\n\n\tNoopMethod(context.Context, *Empty) (*Empty, error)\n}\n\n// =============================\n// CompatService Protobuf Client\n// =============================\n\ntype compatServiceProtobufClient struct {\n\tclient      HTTPClient\n\turls        [2]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewCompatServiceProtobufClient creates a Protobuf client that implements the CompatService interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewCompatServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) CompatService {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.clientcompat\", \"CompatService\")\n\turls := [2]string{\n\t\tserviceURL + \"Method\",\n\t\tserviceURL + \"NoopMethod\",\n\t}\n\n\treturn &compatServiceProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *compatServiceProtobufClient) Method(ctx context.Context, in *Req) (*Resp, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.clientcompat\")\n\tctx = ctxsetters.WithServiceName(ctx, \"CompatService\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Method\")\n\tcaller := c.callMethod\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Req) (*Resp, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Req)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Req) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callMethod(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Resp)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Resp) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *compatServiceProtobufClient) callMethod(ctx context.Context, in *Req) (*Resp, error) {\n\tout := new(Resp)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\nfunc (c *compatServiceProtobufClient) NoopMethod(ctx context.Context, in *Empty) (*Empty, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.clientcompat\")\n\tctx = ctxsetters.WithServiceName(ctx, \"CompatService\")\n\tctx = ctxsetters.WithMethodName(ctx, \"NoopMethod\")\n\tcaller := c.callNoopMethod\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Empty) (*Empty, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Empty)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Empty) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callNoopMethod(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Empty)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Empty) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *compatServiceProtobufClient) callNoopMethod(ctx context.Context, in *Empty) (*Empty, error) {\n\tout := new(Empty)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// =========================\n// CompatService JSON Client\n// =========================\n\ntype compatServiceJSONClient struct {\n\tclient      HTTPClient\n\turls        [2]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewCompatServiceJSONClient creates a JSON client that implements the CompatService interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewCompatServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) CompatService {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.clientcompat\", \"CompatService\")\n\turls := [2]string{\n\t\tserviceURL + \"Method\",\n\t\tserviceURL + \"NoopMethod\",\n\t}\n\n\treturn &compatServiceJSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *compatServiceJSONClient) Method(ctx context.Context, in *Req) (*Resp, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.clientcompat\")\n\tctx = ctxsetters.WithServiceName(ctx, \"CompatService\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Method\")\n\tcaller := c.callMethod\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Req) (*Resp, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Req)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Req) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callMethod(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Resp)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Resp) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *compatServiceJSONClient) callMethod(ctx context.Context, in *Req) (*Resp, error) {\n\tout := new(Resp)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\nfunc (c *compatServiceJSONClient) NoopMethod(ctx context.Context, in *Empty) (*Empty, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.clientcompat\")\n\tctx = ctxsetters.WithServiceName(ctx, \"CompatService\")\n\tctx = ctxsetters.WithMethodName(ctx, \"NoopMethod\")\n\tcaller := c.callNoopMethod\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Empty) (*Empty, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Empty)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Empty) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callNoopMethod(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Empty)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Empty) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *compatServiceJSONClient) callNoopMethod(ctx context.Context, in *Empty) (*Empty, error) {\n\tout := new(Empty)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ============================\n// CompatService Server Handler\n// ============================\n\ntype compatServiceServer struct {\n\tCompatService\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewCompatServiceServer builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewCompatServiceServer(svc CompatService, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &compatServiceServer{\n\t\tCompatService:    svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *compatServiceServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *compatServiceServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// CompatServicePathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst CompatServicePathPrefix = \"/twirp/twirp.clientcompat.CompatService/\"\n\nfunc (s *compatServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.clientcompat\")\n\tctx = ctxsetters.WithServiceName(ctx, \"CompatService\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"twirp.clientcompat.CompatService\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"Method\":\n\t\ts.serveMethod(ctx, resp, req)\n\t\treturn\n\tcase \"NoopMethod\":\n\t\ts.serveNoopMethod(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *compatServiceServer) serveMethod(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveMethodJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveMethodProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *compatServiceServer) serveMethodJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Method\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(Req)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.CompatService.Method\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Req) (*Resp, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Req)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Req) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.CompatService.Method(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Resp)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Resp) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Resp\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Resp and nil error while calling Method. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *compatServiceServer) serveMethodProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Method\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(Req)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.CompatService.Method\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Req) (*Resp, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Req)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Req) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.CompatService.Method(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Resp)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Resp) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Resp\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Resp and nil error while calling Method. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *compatServiceServer) serveNoopMethod(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveNoopMethodJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveNoopMethodProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *compatServiceServer) serveNoopMethodJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"NoopMethod\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(Empty)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.CompatService.NoopMethod\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Empty) (*Empty, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Empty)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Empty) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.CompatService.NoopMethod(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Empty)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Empty) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Empty\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Empty and nil error while calling NoopMethod. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *compatServiceServer) serveNoopMethodProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"NoopMethod\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(Empty)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.CompatService.NoopMethod\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Empty) (*Empty, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Empty)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Empty) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.CompatService.NoopMethod(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Empty)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Empty) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Empty\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Empty and nil error while calling NoopMethod. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *compatServiceServer) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *compatServiceServer) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *compatServiceServer) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"twirp.clientcompat\", \"CompatService\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 285 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xc1, 0x4a, 0xc3, 0x40,\n\t0x10, 0x86, 0x5d, 0xdb, 0xa6, 0x3a, 0xd4, 0x5a, 0x36, 0xa2, 0x6b, 0x4f, 0x21, 0x17, 0x03, 0x42,\n\t0x0a, 0xf5, 0xd8, 0x93, 0xad, 0x05, 0x2f, 0x69, 0x64, 0xeb, 0xc9, 0x8b, 0xc4, 0x64, 0xd0, 0x40,\n\t0x93, 0xdd, 0xec, 0xae, 0x11, 0xdf, 0xc2, 0xe7, 0xf3, 0x69, 0xc4, 0x24, 0x62, 0xc5, 0xf4, 0x38,\n\t0xff, 0x37, 0xf3, 0xed, 0xb0, 0x03, 0x34, 0xde, 0xa4, 0x98, 0x9b, 0x58, 0x64, 0x32, 0x32, 0xbe,\n\t0x54, 0xc2, 0x08, 0x4a, 0xcd, 0x5b, 0xaa, 0xa4, 0xbf, 0x4d, 0xdc, 0x3e, 0xf4, 0x96, 0x99, 0x34,\n\t0xef, 0xae, 0x0d, 0x1d, 0x8e, 0x05, 0x1d, 0x00, 0x29, 0x19, 0x71, 0x88, 0x77, 0xc8, 0x49, 0xe9,\n\t0x9e, 0x40, 0x97, 0xa3, 0x96, 0xbf, 0x69, 0xef, 0x3b, 0xfd, 0x24, 0x60, 0x2f, 0x2a, 0xc9, 0xa2,\n\t0x92, 0x04, 0xa8, 0x75, 0xf4, 0x8c, 0xf4, 0x02, 0x8e, 0x35, 0xaa, 0x32, 0x8d, 0xf1, 0x31, 0x4a,\n\t0x12, 0x85, 0x5a, 0x37, 0xa6, 0x61, 0x13, 0x5f, 0xd7, 0x29, 0x5d, 0x83, 0x95, 0xa1, 0x79, 0x11,\n\t0x09, 0xdb, 0x77, 0x88, 0x37, 0x9c, 0xce, 0xfc, 0xff, 0x9b, 0xf9, 0x2d, 0x2f, 0xf8, 0x75, 0xb5,\n\t0xae, 0x6d, 0x41, 0xa5, 0xe0, 0x8d, 0x8a, 0x32, 0xe8, 0x2b, 0x2c, 0x5e, 0x51, 0x1b, 0xd6, 0x71,\n\t0x88, 0x37, 0xe0, 0x3f, 0xa5, 0x7b, 0x09, 0x76, 0xcb, 0x20, 0x3d, 0x80, 0xee, 0x2a, 0x0c, 0xef,\n\t0x46, 0x7b, 0x14, 0xc0, 0x0a, 0x96, 0xf7, 0xb7, 0xe1, 0xcd, 0x88, 0x4c, 0x3f, 0x08, 0x1c, 0xfd,\n\t0xe9, 0xa6, 0x33, 0xb0, 0x9a, 0x89, 0xb3, 0xb6, 0x3d, 0x39, 0x16, 0x63, 0xd6, 0x0e, 0xb4, 0xa4,\n\t0x73, 0x80, 0x95, 0x10, 0xb2, 0x11, 0x9c, 0xb7, 0xf5, 0x55, 0xff, 0x3f, 0xde, 0x8d, 0xe6, 0xec,\n\t0xe1, 0x74, 0x92, 0xe6, 0x06, 0x55, 0x1e, 0x6d, 0x26, 0xdb, 0xfc, 0xc9, 0xaa, 0x0e, 0x7b, 0xf5,\n\t0x15, 0x00, 0x00, 0xff, 0xff, 0x89, 0x54, 0x2a, 0x1e, 0xee, 0x01, 0x00, 0x00,\n}\n"
  },
  {
    "path": "clientcompat/main.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\nimport (\n\t\"context\"\n\t\"flag\"\n\t\"fmt\"\n\t\"google.golang.org/protobuf/proto\"\n\t\"log\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"os\"\n\n\t\"github.com/twitchtv/twirp\"\n\t\"github.com/twitchtv/twirp/clientcompat/internal/clientcompat\"\n)\n\nvar (\n\tfailures  = 0\n\tsuccesses = 0\n)\n\nfunc main() {\n\tclientBin := flag.String(\"client\", \"\", \"client binary\")\n\tflag.Parse()\n\n\tif *clientBin == \"\" {\n\t\tlog.Fatal(\"-client must be specified\")\n\t}\n\n\tcc, s := newServer()\n\tdefer s.Close()\n\n\ttestNoop(cc, s, *clientBin)\n\ttestMethod(cc, s, *clientBin)\n\ttestInvalidErrorHandling(*clientBin)\n\n\tif failures > 0 {\n\t\tfmt.Printf(\"FAILED with %d failures, %d successes\\n\", failures, successes)\n\t\tos.Exit(1)\n\t}\n\tfmt.Printf(\"PASSED with %d failures, %d successes\\n\", failures, successes)\n}\n\nfunc newServer() (*clientCompat, *httptest.Server) {\n\tcc := &clientCompat{}\n\ts := clientcompat.NewCompatServiceServer(cc, nil)\n\treturn cc, httptest.NewServer(s)\n}\n\nfunc startTest(name string) {\n\tfmt.Printf(\"Testing %v... \", name)\n}\n\nfunc fail(msg string, args ...interface{}) {\n\tfailures++\n\tfmt.Printf(\"FAIL: \"+msg+\"\\n\", args...)\n}\n\nfunc pass() {\n\tsuccesses++\n\tfmt.Printf(\"PASS\\n\")\n}\n\nfunc testNoop(cc *clientCompat, s *httptest.Server, clientBin string) {\n\n\ttype noop func(context.Context, *clientcompat.Empty) (*clientcompat.Empty, error)\n\n\ttestcase := func(name string, f noop, wantErrCode string) {\n\t\tstartTest(name)\n\t\tcc.noop = f\n\t\t_, haveErrCode, err := runClientNoop(s.URL, clientBin)\n\t\tif err != nil {\n\t\t\tfail(\"error: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tswitch {\n\t\tcase wantErrCode == \"\" && haveErrCode != \"\":\n\t\t\tfail(\"client reported twirp error %q when server did not error\", haveErrCode)\n\t\tcase wantErrCode != \"\" && haveErrCode == \"\":\n\t\t\tfail(\"client did not report err code when server errored, expected %q\", wantErrCode)\n\t\tcase wantErrCode != haveErrCode:\n\t\t\tfail(\"client reported wrong error code %q, want %q\", haveErrCode, wantErrCode)\n\t\tdefault:\n\t\t\tpass()\n\t\t}\n\t}\n\n\ttestcase(\n\t\t\"noop without error\",\n\t\tfunc(context.Context, *clientcompat.Empty) (*clientcompat.Empty, error) {\n\t\t\treturn &clientcompat.Empty{}, nil\n\t\t},\n\t\t\"\",\n\t)\n\n\tfor _, code := range []twirp.ErrorCode{\n\t\ttwirp.Canceled, twirp.Unknown, twirp.InvalidArgument, twirp.DeadlineExceeded,\n\t\ttwirp.NotFound, twirp.BadRoute, twirp.AlreadyExists, twirp.PermissionDenied,\n\t\ttwirp.Unauthenticated, twirp.ResourceExhausted, twirp.FailedPrecondition,\n\t\ttwirp.Aborted, twirp.OutOfRange, twirp.Unimplemented, twirp.Internal,\n\t\ttwirp.Unavailable, twirp.DataLoss,\n\t} {\n\t\ttestcase(\n\t\t\tfmt.Sprintf(\"%q error parsing\", code),\n\t\t\tfunc(context.Context, *clientcompat.Empty) (*clientcompat.Empty, error) {\n\t\t\t\treturn nil, twirp.NewError(code, \"failed\")\n\t\t\t},\n\t\t\tstring(code),\n\t\t)\n\t}\n}\n\nfunc testMethod(cc *clientCompat, s *httptest.Server, clientBin string) {\n\n\ttype method func(context.Context, *clientcompat.Req) (*clientcompat.Resp, error)\n\n\ttestcase := func(name string, req *clientcompat.Req, f method, wantResp *clientcompat.Resp, wantErrCode string) {\n\t\tstartTest(name)\n\n\t\tcalled := false\n\n\t\tcc.method = func(ctx context.Context, req *clientcompat.Req) (*clientcompat.Resp, error) {\n\t\t\tcalled = true\n\t\t\treturn f(ctx, req)\n\t\t}\n\n\t\tresp, haveErrCode, err := runClientMethod(s.URL, clientBin, req)\n\t\tif err != nil {\n\t\t\tfail(\"error: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tif !called {\n\t\t\tfail(\"RPC Method was not called on server\")\n\t\t\treturn\n\t\t}\n\n\t\tswitch {\n\t\tcase wantErrCode == \"\" && haveErrCode != \"\":\n\t\t\tfail(\"client reported twirp error %q when server did not error\", haveErrCode)\n\t\t\treturn\n\t\tcase wantErrCode != \"\" && haveErrCode == \"\":\n\t\t\tfail(\"client did not report err code when server errored, expected %q\", wantErrCode)\n\t\t\treturn\n\t\tcase wantErrCode != haveErrCode:\n\t\t\tfail(\"client reported wrong error code %q, want %q\", haveErrCode, wantErrCode)\n\t\t\treturn\n\t\t}\n\n\t\tif !proto.Equal(resp, wantResp) {\n\t\t\tfail(\"client has wrong response, have %+v want %+v\", resp, wantResp)\n\t\t\treturn\n\t\t}\n\n\t\tpass()\n\t}\n\n\ttestcase(\n\t\t\"empty value\",\n\t\t&clientcompat.Req{},\n\t\tfunc(context.Context, *clientcompat.Req) (*clientcompat.Resp, error) {\n\t\t\treturn &clientcompat.Resp{}, nil\n\t\t},\n\t\t&clientcompat.Resp{},\n\t\t\"\",\n\t)\n\n\ttestcase(\n\t\t\"request value formatting\",\n\t\t&clientcompat.Req{\n\t\t\tV: \"value\",\n\t\t},\n\t\tfunc(_ context.Context, req *clientcompat.Req) (*clientcompat.Resp, error) {\n\t\t\tif req.V != \"value\" {\n\t\t\t\treturn nil, twirp.InvalidArgumentError(\"V\", \"should be 'value'\")\n\t\t\t}\n\t\t\treturn &clientcompat.Resp{V: 1}, nil\n\t\t},\n\t\t&clientcompat.Resp{V: 1},\n\t\t\"\",\n\t)\n}\n\nfunc testInvalidErrorHandling(clientBin string) {\n\tstartTest(\"handling invalid error formatting from server\")\n\ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(400)\n\t\t_, err := w.Write([]byte(\"garbage\"))\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}))\n\tdefer s.Close()\n\t_, errCode, err := runClientNoop(s.URL, clientBin)\n\tif err != nil {\n\t\tfail(\"err: %v\", err)\n\t} else if errCode != \"internal\" {\n\t\tfail(\"wrong error code: %v\", errCode)\n\t}\n\tpass()\n}\n"
  },
  {
    "path": "clientcompat/run.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\nimport (\n\t\"bytes\"\n\t\"log\"\n\t\"os/exec\"\n\n\t\"github.com/pkg/errors\"\n\t\"github.com/twitchtv/twirp/clientcompat/internal/clientcompat\"\n\t\"google.golang.org/protobuf/proto\"\n)\n\nfunc runClient(clientBin string, msg *clientcompat.ClientCompatMessage) (resp []byte, errCode string, err error) {\n\tcmd := exec.Command(clientBin)\n\n\tmsgBytes, err := proto.Marshal(msg)\n\tif err != nil {\n\t\treturn nil, \"\", errors.Wrap(err, \"unable to marshal ClientCompatMessage message\")\n\t}\n\tcmd.Stdin = bytes.NewReader(msgBytes)\n\n\tstdout, stderr := bytes.NewBuffer(nil), bytes.NewBuffer(nil)\n\tcmd.Stdout = stdout\n\tcmd.Stderr = stderr\n\n\terr = cmd.Run()\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"error running client binary\")\n\t\tlog.Printf(\"client stdout: %s\", stdout.String())\n\t\tlog.Printf(\"client stderr: %s\", stderr.String())\n\t\treturn nil, \"\", err\n\t}\n\n\tif stdout.Len() > 0 && stderr.Len() > 0 {\n\t\treturn nil, \"\", errors.Errorf(\"client bin should write to either stdout or stderr, but never both in one invocation\")\n\t}\n\tif stderr.Len() > 0 {\n\t\treturn nil, stderr.String(), err\n\t}\n\n\treturn stdout.Bytes(), \"\", nil\n}\n\nfunc runClientNoop(serverURL string, clientBin string) (resp *clientcompat.Empty, twirpErrCode string, err error) {\n\treq := &clientcompat.Empty{}\n\treqBytes, err := proto.Marshal(req)\n\tif err != nil {\n\t\treturn nil, \"\", errors.Wrap(err, \"unable to marshal Empty message\")\n\t}\n\tmsg := &clientcompat.ClientCompatMessage{\n\t\tServiceAddress: serverURL,\n\t\tMethod:         clientcompat.ClientCompatMessage_NOOP,\n\t\tRequest:        reqBytes,\n\t}\n\n\trespBytes, code, err := runClient(clientBin, msg)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\tif respBytes != nil {\n\t\tresp = new(clientcompat.Empty)\n\t\terr = proto.Unmarshal(respBytes, resp)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", errors.Wrap(err, \"unable to unmarshal stdout from client bin as an Empty response\")\n\t\t}\n\t}\n\treturn resp, code, nil\n}\n\nfunc runClientMethod(serverURL string, clientBin string, req *clientcompat.Req) (resp *clientcompat.Resp, twirpErrCode string, err error) {\n\treqBytes, err := proto.Marshal(req)\n\tif err != nil {\n\t\treturn nil, \"\", errors.Wrap(err, \"unable to marshal Req\")\n\t}\n\tmsg := &clientcompat.ClientCompatMessage{\n\t\tServiceAddress: serverURL,\n\t\tMethod:         clientcompat.ClientCompatMessage_METHOD,\n\t\tRequest:        reqBytes,\n\t}\n\n\trespBytes, code, err := runClient(clientBin, msg)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\tif respBytes != nil {\n\t\tresp = new(clientcompat.Resp)\n\t\terr = proto.Unmarshal(respBytes, resp)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", errors.Wrap(err, \"unable to unmarshal stdout from client bin as a Resp\")\n\t\t}\n\t}\n\n\treturn resp, code, nil\n}\n"
  },
  {
    "path": "context.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage twirp\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/twitchtv/twirp/internal/contextkeys\"\n)\n\n// MethodName extracts the name of the method being handled in the given\n// context. If it is not known, it returns (\"\", false).\nfunc MethodName(ctx context.Context) (string, bool) {\n\tname, ok := ctx.Value(contextkeys.MethodNameKey).(string)\n\treturn name, ok\n}\n\n// ServiceName extracts the name of the service handling the given context. If\n// it is not known, it returns (\"\", false).\nfunc ServiceName(ctx context.Context) (string, bool) {\n\tname, ok := ctx.Value(contextkeys.ServiceNameKey).(string)\n\treturn name, ok\n}\n\n// PackageName extracts the fully-qualified protobuf package name of the service\n// handling the given context. If it is not known, it returns (\"\", false). If\n// the service comes from a proto file that does not declare a package name, it\n// returns (\"\", true).\n//\n// Note that the protobuf package name can be very different than the go package\n// name; the two are unrelated.\nfunc PackageName(ctx context.Context) (string, bool) {\n\tname, ok := ctx.Value(contextkeys.PackageNameKey).(string)\n\treturn name, ok\n}\n\n// StatusCode retrieves the status code of the response (as string like \"200\").\n// If it is known returns (status, true).\n// If it is not known, it returns (\"\", false).\nfunc StatusCode(ctx context.Context) (string, bool) {\n\tcode, ok := ctx.Value(contextkeys.StatusCodeKey).(string)\n\treturn code, ok\n}\n\n// WithHTTPRequestHeaders stores an http.Header in a context.Context. When\n// using a Twirp-generated client, you can pass the returned context\n// into any of the request methods, and the stored header will be\n// included in outbound HTTP requests.\n//\n// This can be used to set custom HTTP headers like authorization tokens or\n// client IDs. But note that HTTP headers are a Twirp implementation detail,\n// only visible by middleware, not by the server implementation.\n//\n// WithHTTPRequestHeaders returns an error if the provided http.Header\n// would overwrite a header that is needed by Twirp, like \"Content-Type\".\nfunc WithHTTPRequestHeaders(ctx context.Context, h http.Header) (context.Context, error) {\n\tif _, ok := h[\"Accept\"]; ok {\n\t\treturn nil, errors.New(\"provided header cannot set Accept\")\n\t}\n\tif _, ok := h[\"Content-Type\"]; ok {\n\t\treturn nil, errors.New(\"provided header cannot set Content-Type\")\n\t}\n\tif _, ok := h[\"Twirp-Version\"]; ok {\n\t\treturn nil, errors.New(\"provided header cannot set Twirp-Version\")\n\t}\n\n\tcopied := make(http.Header, len(h))\n\tfor k, vv := range h {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\n\treturn context.WithValue(ctx, contextkeys.RequestHeaderKey, copied), nil\n}\n\nfunc HTTPRequestHeaders(ctx context.Context) (http.Header, bool) {\n\th, ok := ctx.Value(contextkeys.RequestHeaderKey).(http.Header)\n\treturn h, ok\n}\n\n// SetHTTPResponseHeader sets an HTTP header key-value pair using a context\n// provided by a twirp-generated server, or a child of that context.\n// The server will include the header in its response for that request context.\n//\n// This can be used to respond with custom HTTP headers like \"Cache-Control\".\n// But note that HTTP headers are a Twirp implementation detail,\n// only visible by middleware, not by the clients or their responses.\n//\n// The header will be ignored (noop) if the context is invalid (i.e. using a new\n// context.Background() instead of passing the context from the handler).\n//\n// If called multiple times with the same key, it replaces any existing values\n// associated with that key.\n//\n// SetHTTPResponseHeader returns an error if the provided header key\n// would overwrite a header that is needed by Twirp, like \"Content-Type\".\nfunc SetHTTPResponseHeader(ctx context.Context, key, value string) error {\n\tif key == \"Content-Type\" {\n\t\treturn errors.New(\"header key can not be Content-Type\")\n\t}\n\n\tresponseWriter, ok := ctx.Value(contextkeys.ResponseWriterKey).(http.ResponseWriter)\n\tif ok {\n\t\tresponseWriter.Header().Set(key, value)\n\t} // invalid context is ignored, not an error, this is to allow easy unit testing with mock servers\n\n\treturn nil\n}\n\n// AddHTTPResponseHeader behaves like SetHTTPResponseHeader,\n// but it appends the key-value pair to the header (instead of replacing it).\n//\n// AddHTTPResponseHeader returns an error if the key is \"Content-Type\".\nfunc AddHTTPResponseHeader(ctx context.Context, key, value string) error {\n\tif key == \"Content-Type\" {\n\t\treturn errors.New(\"header key can not be Content-Type\")\n\t}\n\n\tresponseWriter, ok := ctx.Value(contextkeys.ResponseWriterKey).(http.ResponseWriter)\n\tif ok {\n\t\tresponseWriter.Header().Add(key, value)\n\t} // invalid context is ignored, not an error, this is to allow easy unit testing with mock servers\n\n\treturn nil\n}\n"
  },
  {
    "path": "ctxsetters/ctxsetters.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\n// Package ctxsetters is an implementation detail for twirp generated code, used\n// by the generated servers to set values in contexts for later access with the\n// twirp package's accessors.\n//\n// Do not use ctxsetters outside of twirp's generated code.\npackage ctxsetters\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"strconv\"\n\n\t\"github.com/twitchtv/twirp/internal/contextkeys\"\n)\n\nfunc WithMethodName(ctx context.Context, name string) context.Context {\n\treturn context.WithValue(ctx, contextkeys.MethodNameKey, name)\n}\n\nfunc WithServiceName(ctx context.Context, name string) context.Context {\n\treturn context.WithValue(ctx, contextkeys.ServiceNameKey, name)\n}\n\nfunc WithPackageName(ctx context.Context, name string) context.Context {\n\treturn context.WithValue(ctx, contextkeys.PackageNameKey, name)\n}\n\nfunc WithStatusCode(ctx context.Context, code int) context.Context {\n\treturn context.WithValue(ctx, contextkeys.StatusCodeKey, strconv.Itoa(code))\n}\n\nfunc WithResponseWriter(ctx context.Context, w http.ResponseWriter) context.Context {\n\treturn context.WithValue(ctx, contextkeys.ResponseWriterKey, w)\n}\n"
  },
  {
    "path": "docs/best_practices.md",
    "content": "---\nid: \"best_practices\"\ntitle: \"Best Practices\"\nsidebar_label: \"Best Practices\"\n---\n\nTwirp simplifies service design when compared with a REST endpoint: method\ndefinitions, message types and parsing is handled by the framework (i.e. you\ndon’t have to worry about JSON fields or types). However, there are still some\nthings to consider when making a new service in Twirp, mainly to keep\nconsistency.\n\n## Folder/Package Structure\n\nThe recommended folder/package structure for your twirp `<service>` is:\n\n```\n/cmd\n    /<service>\n        main.go\n/rpc\n    /<service>\n        service.proto\n        // and auto-generated files\n/internal\n    /<service>server\n        server.go\n        // and usually one other file per method\n```\n\nFor example, for the Haberdasher service it would be:\n\n```\n/cmd\n    /haberdasherserver\n        main.go\n/rpc\n    /haberdasher\n        service.proto\n        service.pb.go\n        service.twirp.go\n/internal\n    /haberdasherserver\n        server_test.go\n        server.go\n        make_hat_test.go\n        make_hat.go\n```\n\nNotes:\n\n * Keep the `.proto` and generated files in their own package.\n * Do not implement the server or other files in the same package. This allows\n   other services to do a \"clean import\" of the autogenerated client.\n * Do not name the package something generic like `api`, `client` or `service`;\n   name it after your service. Remember that the package is going to be imported\n   by other projects that will likely import other clients from other services\n   as well.\n\n## `.proto` File\n\nThe `.proto` file is the source of truth for your service design.\n\n * The first step to design your service is to write a `.proto` file. Use that\n   to discuss design with your coworkers before starting the implementation.\n * Use proto3 (first line should be `syntax=\"proto3\"`). Do not use proto2.\n * Use `option go_package = \"<service>\";` for the Go package name.\n * Add comments on message fields; they translate to the generated Go\n   interfaces.\n * Don’t worry about fields like `user_id` being auto-converted into `UserId` in\n   Go. I know, the right case should be `UserID`, but it's not your fault how\n   the protoc-gen-go compiler decides to translate it. Avoid doing hacks like\n   naming it `user_i_d` so it looks \"good\" in Go (`UserID`). In the future, we\n   may use a better Go code generator, or generate clients for other languages\n   like Python or JavaScript.\n * rpc methods should clearly be named with <action><resource> (i.e.: ListBooks,\n   GetBook, CreateBook, UpdateBook, RenameBook, DeleteBook). See more in \"Naming\n   Conventions\" below.\n\nThe header of the `.proto` file should look like this (change <repo> and\n<service> with your values):\n\n```go\nsyntax = \"proto3\"\n\npackage <organization>.<repo>.<service>;\n\noption go_package = \"<service>\";\n```\n\n## Specifying protoc version and using `Makefile` for code generation\n\nCode generation depends on `protoc` and its plugins `protoc-gen-go` and\n`protoc-gen-twirp`. Having different versions may cause problems.\n\nMake sure to specify the required `protoc` version in your README or\nCONTRIBUTING file.\n\nUsing a Makefile is a good way to simplify code generation:\n\n```Makefile\ngen:\n\t# Auto-generate code\n\tprotoc --proto_path=. --twirp_out=. --go_out=. rpc/<service>/service.proto\n\nupgrade:\n\t# Upgrade dependencies if using modules\n\tgo get -u\n```\n\n## Naming Conventions\n\nLike in any other API or interface, it is very important to have names that are\nsimple, intuitive and consistent.\n\nRespect the [Protocol Buffers Style Guide](https://developers.google.com/protocol-buffers/docs/style):\n\n * Use `CamelCase` for `Service`, `Message` and `Type` names.\n * Use `underscore_separated_names` for field names.\n * Use `CAPITALS_WITH_UNDERSCORES` for enum value names.\n\nFor naming conventions, the\n[Google Cloud Platform design guides](https://cloud.google.com/apis/design/naming_convention)\nare a good reference:\n\n * Use the same name for the same concept, even across APIs.\n * Avoid name overloading. Use different names for different concepts.\n * Include units on field names for durations and quantities (e.g.\n   `delay_seconds` is better than just `delay`).\n\nFor times, we have a few Twitch-specific conventions that have worked for us:\n\n * Timestamp names should end with `_at` whenever possible (i.e. `created_at`,\n   `updated_at`).\n * Timestamps should be [RFC3339](https://tools.ietf.org/html/rfc3339) strings\n   (in Go it's very easy to generate these with `t.Format(time.RFC3339)` and\n   parse them with `time.Parse(time.RFC3339Nano, t)`).\n * Timestamps can also be a `google.protobuf.Timestamp`, in which case their\n   names should end with `_time` for clarity.\n\n## Default Values and Required Fields\n\nIn proto3 all fields have zero-value defaults (string is `\"\"`, int32 is `0`), so\nall fields are optional.\n\nIf you want to make a required field (i.e. \"name is required\"), it needs to be\nhandled by the service implementation. But to make this clear in the `.proto`\nfile:\n\n * Add a \"required\" comment on the field. For example `string name = 1; // required` implies that the server implementation will return an\n  `twirp.RequiredArgumentError(\"name\")` if the name is empty.\n\nIf you need a different default (e.g. limit default 20 for paginated\ncollections), it needs to be handled by the service implementation. But to make\nthis clear in the `.proto` file:\n\n * Add a \"(default X)\" comment on the field. For example `int32 limit = 1; // (default 20)` implies that the server implementation will convert the\n  zero-value 0 to 20 (0 == 20).\n * For enums, the first item is the default.\n\nYour service implementation cannot tell the difference between empty and missing\nfields (this is by design). If you really need to tell them apart, you need to\nuse an extra bool field, or use `google/protobuf.wrappers.proto` messages (which\ncan be nil in go).\n\n## Twirp Errors\n\nProtocol Buffers do not specify errors. You can always add an extra field on the\nreturned message for the error, but Twirp has an excellent system that you\nshould use instead:\n\n * Familiarize yourself with the possible [Twirp error codes](errors.md) and use\n   the ones that make sense for each situation (i.e. `InvalidArgument`,\n   `NotFound`, `Internal`). The codes are very straightforward and are almost\n   the same as in gRPC.\n * Always return a `twirp.Error`. Twirp allows you to return a regular `error`,\n   that will get wrapped with `twirp.InternalErrorWith(err)`, but it is better\n   if you explicitly wrap it yourself. Being explicit makes the server and the\n   client to always return the same twirp errors, which is more predictable and\n   easier for unit tests.\n * Include possible errors on the `.proto` file (add comments to RPC methods).\n * But there's no need to document all the obvious `Internal` errors, which can\n   always happen for diverse reasons (e.g. backend service is down, or there was\n   a problem on the client).\n * Make sure to document (with comments) possible validation errors on the\n   specific message fields. For example `int32 amount = 1; // must be positive`\n   implies that the server implementation will return a\n   `twirp.InvalidArgumentError(\"amount\", \"must be positive\")` error if the condition\n   is not met.\n * Required fields are also validation errors. For example, if a given string\n   field cannot be empty, you should add a \"required\" comment in the proto file,\n   which implies that a `twirp.RequiredArgumentError(field)` will be returned if\n   the field is empty (or missing, which is the same thing in proto3). If you\n   are using proto2 (I hope not), the \"required\" comment is still preferred over\n   the required field type.\n"
  },
  {
    "path": "docs/command_line.md",
    "content": "---\nid: \"command_line\"\ntitle: \"Generator Flags for the Protoc Compiler\"\nsidebar_label: \"Generator Flags\"\n---\n\n\n### Protoc Compiler Invocation\n\nMake sure to [Install Twirp and Protobuf](install.md) generators first.\n\nThe `protoc` compiler uses the flag  `--twirp_out` to generate `twirp.go` files, and `--go_out` to generate `.pb.go` files. See [Protobuf Docs](https://developers.google.com/protocol-buffers/docs/reference/go-generated) for details on how to use the protoc compiler with `--go-out`, the Twirp flag `--twirp_out` supports the same parameters.\n\nFor example, invoke the protoc compiler with default parameters to generate code for `rpc/haberdasher/service.proto`:\n\n```sh\nprotoc --go_out=. --twirp_out=. rpc/haberdasher/service.proto\n```\n\n\n### Modifying imports\n\nThe protoc compiler invocation can include optional flags to set the import path to be used in generated code: `--go_opt` and `--twirp_opt`.\n\nWhen working with multiple proto files that use import statements, `protoc-gen-twirp` uses the `option go_package` field in the `.proto` files to determine the import paths for imported message types. For example:\n\n```protobuf\noption go_package = \"github.com/twitchtv/thisisanexample\";\n```\n\nThe `import_prefix` parameter can be passed to `--twirp_out` in order to prefix the generated import path with something.\n\n```sh\n$ PROTO_SRC_PATH=./\n$ IMPORT_PREFIX=\"github.com/example/rpc/haberdasher\"\n$ protoc \\\n  --proto_path=$PROTO_SRC_PATH \\\n  --twirp_out=import_prefix=$IMPORT_PREFIX:$PROTO_SRC_PATH \\\n  --go_out=import_prefix=$IMPORT_PREFIX:$PROTO_SRC_PATH \\\n  $PROTO_SRC_PATH/rpc/haberdasher/service.proto\n```\n\nAlternatively, an import mapping parameter can be passed multiple times to `--twirp_out` in\norder to substitute the import path for a given proto file with something else.\nBy passing the parameter multiple times you can build up a map of proto file to\nimport path inside the generator.\n\nThis parameter should be used when one of your proto files imports a proto\nfile from another package and you're not generating your code at the\n`$GOPATH/src` root.\n\nFor example, you could tell `protoc-gen-twirp` that\n`rpcutil/empty.proto` can be found at `github.com/example/rpcutil` by using\n`Mrpcutil/empty.proto=github.com/example/rpcutil`:\n\n```sh\n$ PROTO_SRC_PATH=./\n$ IMPORT_MAPPING=\"rpcutil/empty.proto=github.com/example/rpcutil\"\n$ protoc \\\n  --proto_path=$PROTO_SRC_PATH \\\n  --twirp_out=M$IMPORT_MAPPING:$PROTO_SRC_PATH \\\n  --go_out=M$IMPORT_MAPPING:$PROTO_SRC_PATH \\\n  $PROTO_SRC_PATH/rpc/haberdasher/service.proto\n```\n"
  },
  {
    "path": "docs/curl.md",
    "content": "---\nid: \"curl\"\ntitle: \"cURL\"\nsidebar_label: \"cURL\"\n---\n\nYou can access a Twirp service with cURL, using either JSON or Protobuf.\n\n## Example\n\nWith the following HelloWorld service defined in this proto file:\n\n```proto\nsyntax = \"proto3\";\npackage example.helloworld;\n\nservice HelloWorld {\n  rpc Hello(HelloReq) returns (HelloResp);\n}\n\nmessage HelloReq {\n   string subject = 1;\n}\n\nmessage HelloResp {\n  string text = 1;\n}\n```\n\nAssuming a service generated from this definition is running in `http://localhost:8080` with the default\n\"/twirp\" prefix, you can call it with cURL by following the routing rules (see\n[Routing](routing.md))\n\n### JSON\n\nUse the header `Content-Type: application/json` to signal that the request and response are JSON:\n\n```sh\ncurl --request \"POST\" \\\n    --header \"Content-Type: application/json\" \\\n    --data '{\"subject\": \"World\"}' \\\n    http://localhost:8080/twirp/example.helloworld.HelloWorld/Hello\n```\n\nThe service should respond with something like this:\n\n```json\n{\"text\": \"Hello World\"}\n```\n\nNOTE: Twirp uses [proto3-json mapping](https://developers.google.com/protocol-buffers/docs/proto3#json),\nwhich means that empty fields are excluded. If you specify an empty request `--data '{}'` it will be\ninterpreted as zero-values. Zero-values are also excluded on responses. In this example,\nif the service responded with an empty \"text\" field, the response you will see is empty `{}`.\n\n### Protobuf\n\nUse the header `Content-Type: application/protobuf` to signal that the request and response are Protobuf.\nUse the `protoc` tool to encode and decode the Protobuf messages into readable key-values:\n\n```sh\necho 'subject:\"World\"' \\\n\t| protoc --encode example.helloworld.HelloReq ./rpc/helloworld/service.proto \\\n\t| curl -s --request POST \\\n      --header \"Content-Type: application/protobuf\" \\\n      --data-binary @- \\\n      http://localhost:8080/twirp/example.helloworld.HelloWorld/Hello \\\n\t| protoc --decode example.helloworld.HelloResp ./rpc/haberdasher/service.proto\n```\n\nThe service should respond with something like this:\n\n```\ntext:\"Hello World\"\n```\n\n### Errors\n\nTwirp error responses are always JSON, even if the request is done in Protobuf. A Twirp error response looks like this:\n\n```json\n{\"code\": \"internal\", \"msg\": \"Something went wrong\"}\n```\n"
  },
  {
    "path": "docs/errors.md",
    "content": "---\nid: \"errors\"\ntitle: \"Errors\"\nsidebar_label: \"Errors\"\n---\n\nA Twirp error has the following properties:\n\n * **code**: Identifies the type of error.\n * **msg**: Free-form message with detailed information about the error. This is for humans, to help with debugging. Programs should not try to parse the error message.\n * **meta**: (optional) key-value pairs with arbitrary string metadata. Useful to define subtypes under the same code, or add extra fields for the callers.\n\nOn the network, an error is represented as a JSON response with those properties. In Go, any value that implements the [twirp.Error](https://pkg.go.dev/github.com/twitchtv/twirp#Error) interface is considered a Twirp error. Other languages have different ways to represent the errors, but they always have the same properties and valid set of codes.\n\n## Error Codes\n\nTwirp error codes with equivalent [HTTP status](https://pkg.go.dev/github.com/twitchtv/twirp#ServerHTTPStatusFromErrorCode):\n\n * `internal` (500)\n * `not_found` (404)\n * `invalid_argument` (400)\n * `unauthenticated` (401)\n * `permission_denied` (403)\n * `already_exists` (409)\n * ... more on the [Errors Spec](spec_v7.md#error-codes)\n\n## Overview\n\nA Twirp service may implement an endpoint that returns an error. For example:\n\n```go\nfunc (s *Server) OpenDoor(ctx context.Context, req *pb.OpenDoorRequest) (*pb.OpenDoorResp, error) {\n    return nil, twirp.PermissionDenied.Error(\"this door is closed\")\n}\n```\n\nThe service HTTP response becomes be the error serialized as JSON:\n\n```json\n// HTTP status: 403\n{\n  \"code\": \"permission_denied\",\n  \"msg\": \"this door is closed\"\n}\n```\n\nCalling the endpoint from an auto-generated client will result on the same error, that can be inspected through the properties on the [twirp.Error](https://pkg.go.dev/github.com/twitchtv/twirp#Error) interface:\n\n```go\nresp, err := client.OpenDoor(ctx, req)\nif twerr, ok := err.(twirp.Error); ok {\n    twerr.Code() // => twirp.PermissionDenied\n    twerr.Msg()  //=> \"this door is closed\"\n}\n```\n\n## Server Side: Returning Error Responses\n\nThe `twirp` package provides a variety of error constructors. Check the [errors.go file for details](https://github.com/twitchtv/twirp/blob/main/errors.go). Some examples:\n\n```go\n// (twirp.Code).Error(msg) to build a new error from the code\ntwirp.Internal.Error(\"oops\")\ntwirp.NotFound.Error(\"user not found\")\ntwirp.InvalidArgument.Error(\"user_id must be alphanumeric\")\n\n// (twirp.Code).Errorf(msg, ...args) to wrap other errors\ntwirp.Internal.Errorf(\"Failed to perform operation: w%\", err)\n\n// Generic constructor\ntwirp.NewError(twirp.InvalidArgument, \"user_id must be alphanumeric\")\n\n// Any value that implements the twirp.Error interface\nmyOwnTwirpErrImpl{code: twirp.NotFound}\n```\n\nExample of a Twirp endpoint that returns errors:\n\n```go\nfunc (s *Server) FindUser(ctx context.Context, req *pb.FindUserRequest) (*pb.FindUserResp, error) {\n    // Validation errors\n    if req.UserId == \"\" {\n        return nil, twirp.InvalidArgument.Error(\"user_id is required\")\n    }\n    if !isAlphanumeric(req.UserId) {\n        return nil, twirp.InvalidArgument.Error(\"user_id must be alphanumeric\")\n    }\n    if !isAuthorized(ctx, req.UserId) {\n        return nil, twirp.PermissionDenied.Error(\"not allowed to access user profiles\")\n    }\n\n    // Perform some operation\n    user, err := s.DB.FindByID(ctx, req.UserID)\n    if errors.Is(err, DB_NOT_FOUND) {\n        return nil, twirp.NotFound.Error(\"user not found\")\n    }\n    if err != nil {\n        return nil, twirp.Internal.Errorf(\"DB error: %w\", err)\n    }\n\n    // Success\n    return &pb.FindUserResp{\n        Login: user.Login,\n    }, nil\n}\n```\n\nIf the endpoint returns a vanilla (non-twirp) error, it will be automatically wrapped using [twirp.InternalErrorWith(err)](https://pkg.go.dev/github.com/twitchtv/twirp#InternalErrorWith).\n\nThe following examples are equivalent (the client receives the same internal error).\n\n```go\nfunc (s *Server) FindUser(ctx context.Context, req *pb.FindUserRequest) (*pb.FindUserResp, error) {\n    return nil, errors.New(\"vanilla\")\n}\n```\n\nIs equivalent to wrap the error with the helper:\n\n```go\nfunc (s *Server) FindUser(ctx context.Context, req *pb.FindUserRequest) (*pb.FindUserResp, error) {\n    return nil, twirp.InternalErrorWith(errors.New(\"vanilla\"))\n}\n```\n\nWhich is also equivalent to building the error from scratch this way:\n\n```go\nfunc (s *Server) FindUser(ctx context.Context, req *pb.FindUserRequest) (*pb.FindUserResp, error) {\n    err := errors.New(\"vanilla\")\n\treturn twirp.Internal.Errorf(\"%w\", err).\n        WithMeta(\"cause\", fmt.Sprintf(\"%T\", err))\n}\n```\n\n#### Middleware, outside Twirp endpoints\n\nTwirp services can be [muxed with other HTTP services](mux.md). For consistent responses and error codes _outside_ Twirp servers, such as HTTP middleware, you can call [twirp.WriteError](https://pkg.go.dev/github.com/twitchtv/twirp#WriteError).\n\n```go\ntwirp.WriteError(responseWriter, twirp.Unauthenticated.Error(\"invalid token\"))\n```\n\n## Client Side: Handling Error Responses\n\nTwirp clients return errors that can always be cast to the `twirp.Error` interface. Unpack the error type to access the `Code()`, `Msg()` and `Meta(key)` properties. For example:\n\n```go\nresp, err := client.FindUser(ctx, req)\nif err != nil {\n    if twerr, ok := err.(twirp.Error); ok {\n        if twerr.Code() == twirp.NotFound {\n            fmt.Println(\"not found\")\n        }\n    }\n    fmt.Printf(\"internal: %s\", err)\n}\n```\n\nYou can also use [errors.Is](https://pkg.go.dev/errors#Is) and [errors.As](https://pkg.go.dev/errors#As) to check and unwrap Twirp errors:\n\n```go\nresp, err := client.MakeHat(ctx, req)\nvar twerr twirp.Error\nif errors.As(err, &twerr) {\n    if twerr.Code() == twirp.NotFound {\n        fmt.Println(\"not found\")\n    }\n} else if err != nil {\n    fmt.Printf(\"internal: %s\", err)\n}\n```\n\nTransport-level errors (e.g. connection issues) are returned as internal errors. If desired, the original client-side network error can be unwrapped:\n\n```go\nresp, err := client.MakeHat(ctx, req)\nvar twerr twirp.Error\nif errors.As(err, &twerr) {\n    if twerr.Code() == twirp.Internal {\n        if transportErr := errors.Unwrap(twerr); transportErr != nil {\n            // transportErr could be something like an HTTP connection error\n        }\n    }\n}\n```\n\n### HTTP Errors from Intermediary Proxies\n\nTwirp Clients may receive HTTP responses with non-200 status\nfrom different sources like proxies or load balancers. For example,\na \"503 Service Temporarily Unavailable\" body, which cannot be\ndeserialized into a Twirp error.\n\nIn those cases, generated Go clients will try to best-guess the equivalent Twirp error depending on the HTTP status of the invalid response:\n\n| HTTP status code         |  Twirp Error Code\n| ------------------------ | ------------------\n| 3xx (redirects)          | Internal\n| 400 Bad Request          | Internal\n| 401 Unauthorized         | Unauthenticated\n| 403 Forbidden            | PermissionDenied\n| 404 Not Found            | BadRoute\n| 429 Too Many Requests    | ResourceExhausted\n| 502 Bad Gateway          | Unavailable\n| 503 Service Unavailable  | Unavailable\n| 504 Gateway Timeout      | Unavailable\n| ... other                | Unknown\n\nAdditional metadata is added to make it easy to identify intermediary errors:\n\n* `\"http_error_from_intermediary\": \"true\"`\n* `\"status_code\": string` (original status code on the HTTP response, e.g. `\"500\"`).\n* `\"body\": string` (original non-Twirp error response as string).\n* `\"location\": url-string` (only on 3xx responses, matching the `Location` header).\n\n\n## Metadata\n\nIn addition to `code` and `msg`, Twirp errors can optionally include arbitrary string metadata in the `meta` field.\n\nUse the chainable method [WithMeta(key, val)](https://pkg.go.dev/github.com/twitchtv/twirp#Error.WithMeta) to add extra metadata to a Twirp error. For example:\n\n```go\nif unavailable {\n    return nil, twirp.Unavailable.Error(\"taking a nap ...\").\n        WithMeta(\"retryable\", \"true\").\n        WithMeta(\"retry_after\", \"15s\")\n}\n```\n\nTwirp serializes the response as JSON with the additional `meta` field:\n\n```json\n// HTTP status: 503\n{\n  \"code\": \"unavailable\",\n  \"msg\": \"taking a nap ...\",\n  \"meta\": {\n    \"retryable\": \"true\",\n    \"retry_after\": \"15s\"\n  }\n}\n```\n\nMetadata is available on the client through the [Meta(key)](https://pkg.go.dev/github.com/twitchtv/twirp#Error.Meta) accessor:\n\n```go\nif twerr.Code() == twirp.Unavailable {\n    if twerr.Meta(\"retryable\") == \"true\" {\n        fmt.Printf(\"retry after %s\", twerr.Meta(\"retry_after\"))\n    }\n}\n```\n\nError metadata can only have string values. This is to simplify error parsing by client implementations in multiple platforms. If your service requires errors with complex shapes, consider adding client wrappers on top of the auto-generated clients, or include specific business-logic errors on the Protobuf messages (as part of success responses).\n"
  },
  {
    "path": "docs/example.md",
    "content": "---\nid: \"example\"\ntitle: \"Usage Example: Haberdasher\"\nsidebar_label: \"Usage Example\"\n---\n\nLet's make the canonical Twirp service: a `Haberdasher`.\n\nThe `Haberdasher` service makes hats. It has only one RPC method, `MakeHat`,\nwhich makes a new hat of a particular size.\n\nMake sure to [Install Protobuf and Twirp](install.md) before starting.\n\nBy the end of this, we'll run a Haberdasher service with a strongly typed client.\n\nThere are 5 steps here:\n\n 1. [Write a Protobuf service definition](#write-a-protobuf-service-definition)\n 2. [Generate code](#generate-code)\n 3. [Implement the server](#implement-the-server)\n 4. [Mount and run the server](#mount-and-run-the-server)\n 5. [Use the client](#use-the-client)\n\n## Write a Protobuf Service Definition\n\nStart with the proto definition file, placed in `rpc/haberdasher/service.proto`:\n\n```protobuf\nsyntax = \"proto3\";\n\npackage twirp.example.haberdasher;\noption go_package = \"github.com/example/rpc/haberdasher\";\n\n// Haberdasher service makes hats for clients.\nservice Haberdasher {\n  // MakeHat produces a hat of mysterious, randomly-selected color!\n  rpc MakeHat(Size) returns (Hat);\n}\n\n// Size of a Hat, in inches.\nmessage Size {\n  int32 inches = 1; // must be > 0\n}\n\n// A Hat is a piece of headwear made by a Haberdasher.\nmessage Hat {\n  int32 inches = 1;\n  string color = 2; // anything but \"invisible\"\n  string name = 3; // i.e. \"bowler\"\n}\n```\n\nIt's a good idea to add comments on your Protobuf file. These files can work as\nthe primary documentation of your API. The comments also show up in the generated\nGo types.\n\n## Generate code\n\nTo generate code run the `protoc` compiler pointed at your service's `.proto`\nfiles:\n\n```sh\n$ protoc --go_out=. --twirp_out=. \\\n   --go_opt=paths=source_relative \\\n   --twirp_opt=paths=source_relative \\\n   rpc/haberdasher/service.proto\n```\n\nSee [Generator Command Line Arguments](command_line.md) for details about running the generator.\n\nThe code should be generated in the same directory as the `.proto` files.\n\n```text\n/rpc\n  /haberdasher\n    service.proto\n    service.pb.go     # generated by protoc-gen-go\n    service.twirp.go  # generated by protoc-gen-twirp\n```\n\nIf you open the generated `.twirp.go` file, you should see a Go interface like this:\n\n```go\n// A Haberdasher makes hats for clients.\ntype Haberdasher interface {\n    // MakeHat produces a hat of mysterious, randomly-selected color!\n    MakeHat(context.Context, *Size) (*Hat, error)\n}\n```\n\nalong with code to instantiate clients and servers.\n\n\n## Implement the Server\n\nNow, our job is to write code that fulfills the `Haberdasher` interface. This\nwill be the \"backend\" logic to handle the requests.\n\nThe implementation could go in `internal/haberdasherserver/server.go`:\n\n```go\npackage haberdasherserver\n\nimport (\n    \"context\"\n    \"math/rand\"\n\n    \"github.com/twitchtv/twirp\"\n    pb \"github.com/example/rpc/haberdasher\"\n)\n\n// Server implements the Haberdasher service\ntype Server struct {}\n\nfunc (s *Server) MakeHat(ctx context.Context, size *pb.Size) (hat *pb.Hat, err error) {\n    if size.Inches <= 0 {\n        return nil, twirp.InvalidArgumentError(\"inches\", \"I can't make a hat that small!\")\n    }\n    return &pb.Hat{\n        Inches:  size.Inches,\n        Color: []string{\"white\", \"black\", \"brown\", \"red\", \"blue\"}[rand.Intn(5)],\n        Name:  []string{\"bowler\", \"baseball cap\", \"top hat\", \"derby\"}[rand.Intn(4)],\n    }, nil\n}\n```\n\n## Mount and run the server\n\nTo serve our Haberdasher over HTTP, use the generated server constructor\n`New{{Service}}Server`. For Haberdasher, it is:\n\n```go\nfunc NewHaberdasherServer(svc Haberdasher, opts ...interface{}) TwirpServer\n```\n\nThis constructor wraps your interface implementation as an `TwirpServer`, which\nis a `http.Handler` with a few extra bells and whistles.\n\nThe `http.Handler` can be mounted like any other HTTP handler. For example,\nusing the standard library `http.ListenAndServe` method.\n\nIn `cmd/server/main.go`:\n\n```go\npackage main\n\nimport (\n    \"net/http\"\n\n    \"github.com/example/internal/haberdasherserver\"\n    \"github.com/example/rpc/haberdasher\"\n)\n\nfunc main() {\n  server := &haberdasherserver.Server{} // implements Haberdasher interface\n  twirpHandler := haberdasher.NewHaberdasherServer(server)\n\n  http.ListenAndServe(\":8080\", twirpHandler)\n}\n```\n\nIf you `go run ./cmd/server/main.go`, you'll be running your server at\n`localhost:8080`. All that's left is to create a client!\n\n## Use the Client\n\nClient stubs are automatically generated, hooray!\n\nFor each service, there are 2 client constructors:\n\n * `New{{Service}}ProtobufClient` for Protobuf requests.\n * `New{{Service}}JSONClient` for JSON requests.\n\nYou should use the ProtobufClient. See\n[Protobuf vs JSON](protobuf_and_json.md) for comparison.\n\nClients in other languages can also be generated by using the respective\n`protoc` plugins defined by their languages, for example [--twirp_ruby_out](https://github.com/twitchtv/twirp-ruby/wiki/Code-Generation#code-generation).\n\nTo use the `Haberdasher` service from another Go project, import the\nauto-generated client.\n\nFor example, in `cmd/client/main.go`:\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"net/http\"\n    \"os\"\n    \"fmt\"\n    \"github.com/example/rpc/haberdasher\"\n)\n\nfunc main() {\n    client := haberdasher.NewHaberdasherProtobufClient(\"http://localhost:8080\", &http.Client{})\n\n    hat, err := client.MakeHat(context.Background(), &haberdasher.Size{Inches: 12})\n    if err != nil {\n        fmt.Printf(\"oh no: %v\", err)\n        os.Exit(1)\n    }\n    fmt.Printf(\"I have a nice new hat: %+v\", hat)\n}\n```\n\nIf you have the server running in another terminal, try running this client with\n`go run ./cmd/client/main.go`. Enjoy the new hat!\n"
  },
  {
    "path": "docs/headers.md",
    "content": "---\nid: \"headers\"\ntitle: \"Using custom HTTP Headers\"\nsidebar_label: \"Custom HTTP Headers\"\n---\nSometimes, you need to send custom HTTP headers.\n\nFor Twirp, HTTP headers are a transport implementation detail. You should not\nhave to worry about them, but maybe your HTTP middleware requires them.\n\nIf so, there's nothing the Twirp spec that _forbids_ extra headers, so go ahead.\nThe rest of this doc is a guide on how to do this.\n\n## Client side\n\n### Send HTTP Headers with client requests\n\nUse `twirp.WithHTTPRequestHeaders` to attach the `http.Header` to a particular\n`context.Context`, then use that context in the client request:\n\n```go\n// Given a client ...\nclient := haberdasher.NewHaberdasherProtobufClient(addr, &http.Client{})\n\n// Given some headers ...\nheader := make(http.Header)\nheader.Set(\"Twitch-Authorization\", \"uDRlDxQYbFVXarBvmTncBoWKcZKqrZTY\")\nheader.Set(\"Twitch-Client-ID\", \"FrankerZ\")\n\n// Attach the headers to a context\nctx := context.Background()\nctx, err := twirp.WithHTTPRequestHeaders(ctx, header)\nif err != nil {\n  log.Printf(\"twirp error setting headers: %s\", err)\n  return\n}\n\n// And use the context in the request. Headers will be included in the request!\nresp, err := client.MakeHat(ctx, &haberdasher.Size{Inches: 7})\n```\n\n### Read HTTP Headers from responses\n\nTwirp client responses are structs that depend only on the Protobuf response.\nHTTP headers can not be used by the Twirp client in any way.\n\nHowever, remember that the Twirp client is instantiated with an `http.Client`,\nwhich can be configured with any `http.RoundTripper` transport. You could make a\nRoundTripper that reads some response headers and does something with them.\n\n## Server side\n\n### Send HTTP Headers on server responses\n\nIn your server implementation code, set response headers one by one with the\nhelper `twirp.SetHTTPResponseHeader`, using the same context provided by the\nhandler. For example:\n\n```go\nfunc (h *myServer) MyRPC(ctx context.Context, req *pb.Req) (*pb.Resp, error) {\n\n  // Add Cache-Control custom header to HTTP response\n  err := twirp.SetHTTPResponseHeader(ctx, \"Cache-Control\", \"public, max-age=60\")\n  if err != nil {\n    return nil, twirp.InternalErrorWith(err)\n  }\n\n  return &pb.Resp{}, nil\n}\n```\n`twirp.AddHTTPResponseHeader` can be used to append values to a header.\n\n### Read HTTP Headers from requests\n\nTwirp server methods are abstracted away from HTTP, therefore they don't have\ndirect access to HTTP Headers.\n\nHowever, they receive the `http.Request`'s `context.Context` as parameter that\ncan be modified by HTTP middleware before being used by the Twirp method.\n\nIn more detail, you could do the following:\n\n * Write some middleware (a `func(http.Handler) http.Handler`) that reads the\n   header's value and stores it in the request context.\n * Wrap your Twirp server with the middleware you wrote.\n * Inside your service, pull the header value out through the context.\n\nFor example, lets say you want to read the 'User-Agent' HTTP header inside a\ntwirp server method. You might write this middleware:\n\n```go\nfunc WithUserAgent(base http.Handler) http.Handler {\n    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n        ctx := r.Context()\n        ua := r.Header.Get(\"User-Agent\")\n        ctx = context.WithValue(ctx, \"user-agent\", ua)\n        r = r.WithContext(ctx)\n\n        base.ServeHTTP(w, r)\n    })\n}\n```\n\nThen, you could wrap your generated Twirp server with this middleware:\n\n```go\nh := haberdasher.NewHaberdasherServer(...)\nwrapped := WithUserAgent(h)\nhttp.ListenAndServe(\":8080\", wrapped)\n```\n\nNow, in your application code, you would have access to the header through the\ncontext, so you can do whatever you like with it:\n\n```go\nfunc (h *haberdasherImpl) MakeHat(ctx context.Context, req *pb.MakeHatRequest) (*pb.Hat, error) {\n    ua := ctx.Value(\"user-agent\").(string)\n    log.Printf(\"user agent: %v\", ua)\n}\n```\n"
  },
  {
    "path": "docs/hooks.md",
    "content": "---\nid: \"hooks\"\ntitle: \"Hooks and Interceptors\"\nsidebar_label: \"Hooks and Interceptors\"\n---\n\nTwirp main responsibility is [routing and serialization](routing.md), but extra functionality can be plugged in through Hooks and Interceptors. This is useful to do things like log requests, record response times, report metrics, authenticate requests, and so on.\n\nThere are multiple ways to inject functionality:\n\n * [Server Hooks](https://pkg.go.dev/github.com/twitchtv/twirp#ServerHooks): Can be used on the generated server constructor. They provide callbacks for before and after the request is handled. The Error hook is called only if an error was returned by the handler. Every hook receives the request `context.Context` and can return a modified `context.Context` if desired.\n * [Client Hooks](https://pkg.go.dev/github.com/twitchtv/twirp#ClientHooks): Can be used on the generated client constructor. They provide callbacks for before and after the request is sent over the network. The Error hook is called only if an error was returned through the network.\n * [Interceptors](https://pkg.go.dev/github.com/twitchtv/twirp#Interceptor): Can be used to wrap servers and clients. Interceptors are a form of middleware for Twirp requests. Interceptors can mutate the request and responses, which can enable some powerful integrations, but in most cases, it is better to use Hooks for observability at key points during a request. Mutating the request adds complexity to the request lifecycle.\n\n### Examples\n\n\nServer Hooks:\n\n```go\n// NewLoggingServerHooks logs request and errors to stdout in the service\nfunc NewLoggingServerHooks() *twirp.ServerHooks {\n    return &twirp.ServerHooks{\n        RequestRouted: func(ctx context.Context) (context.Context, error) {\n            method, _ := twirp.MethodName(ctx)\n            log.Println(\"Method: \" + method)\n            return ctx, nil\n        },\n        Error: func(ctx context.Context, twerr twirp.Error) context.Context {\n            log.Println(\"Error: \" + string(twerr.Code()))\n            return ctx\n        },\n        ResponseSent: func(ctx context.Context) {\n            log.Println(\"Response Sent (error or success)\")\n        },\n    }\n}\n```\n\nClient Hooks:\n\n```go\n// NewLoggingClientHooks logs request and errors to stdout in the client\nfunc NewLoggingClientHooks() *twirp.ClientHooks {\n    return &twirp.ClientHooks{\n        RequestPrepared: func(ctx context.Context, r *http.Request) (context.Context, error) {\n            fmt.Printf(\"Req: %s %s\\n\", r.Host, r.URL.Path)\n            return ctx, nil\n        },\n        Error: func(ctx context.Context, twerr twirp.Error) {\n            log.Println(\"Error: \" + string(twerr.Code()))\n            return ctx\n        },\n        ResponseReceived: func(ctx context.Context) {\n            log.Println(\"Success\")\n        },\n    }\n}\n```\n\nInterceptor:\n\n```go\n// NewInterceptorMakeSmallHats builds an interceptor that modifies\n// calls to MakeHat ignoring the request, and instead always making small hats.\nfunc NewInterceptorMakeSmallHats() twirp.Interceptor {\n    return func(next twirp.Method) twirp.Method {\n        return func(ctx context.Context, req interface{}) (interface{}, error) {\n            if twirp.MethodName(ctx) == \"MakeHat\" {\n              return next(ctx, &haberdasher.Size{Inches: 1})\n            }\n            return next(ctx, req)\n        }\n    }\n}\n```\n\nInstantiate an example [Haberdasher](example.md) server with hooks and interceptors:\n\n```go\nserver := NewHaberdasherServer(svcImpl,\n    twirp.WithServerInterceptors(NewInterceptorMakeSmallHats()),\n    twirp.WithServerHooks(NewLoggingServerHooks()))\n```\n\nInstantiate an example [Haberdasher](example.md) client with hooks and interceptors:\n\n```go\nclient := NewHaberdasherProtobufClient(url, &http.Client{},\n    twirp.WithClientInterceptors(NewInterceptorMakeSmallHats()),\n    twirp.WithClientHooks(NewLoggingClientHooks()))\n```\n"
  },
  {
    "path": "docs/install.md",
    "content": "---\nid: install\ntitle: Installing Twirp\nsidebar_label: Installation\n---\n\n## Runtime Library\n\nThe runtime library package `github.com/twitchtv/twirp` contains common types like `twirp.Error`. If you are only importing Twirp clients from other services, you only need to import the twirp package and the protobuf APIv2 dependency (`google.golang.org/protobuf`).\n\nIf the Twirp client was generated with older versions of Twirp (v5, v7), then you need to import the older protobuf APIv1 dependency (`github.com/golang/protobuf`).\n\n\n## Code Generator\n\nYou need to install `go` and the `protoc` compiler in your system. Then, install the protoc plugins `protoc-gen-twirp` and `protoc-gen-go` to generate Go code.\n\n\n### Prerequisites\n\n * [Go](https://golang.org/): Twirp works well with any one of the three latest major [releases of Go](https://golang.org/doc/devel/release.html). For installation instructions, see Go’s [Getting Started](https://golang.org/doc/install) guide.\n * [Protocol buffer](https://developers.google.com/protocol-buffers) compiler, `protoc` [version 3](https://developers.google.com/protocol-buffers/docs/proto3). For installation instructions, see [Protocol Buffer Compiler Installation](https://grpc.io/docs/protoc-installation/) (For example in MacOS: `brew install protobuf`).\n\n\n### Define tools.go for versioning in go.mod\n\nYou should track the Twirp and Protobuf versions like any other go-based tool (e.g. `stringer`). The currently recommended approach is to track the tool's version in your module's `go.mod` file (See [\"Go Modules by Example\" walkthrough](https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md)). For example, a `tools.go` file may look like this:\n\n```go\n// +build tools\n\npackage tools\n\nimport (\n        _ \"google.golang.org/protobuf/cmd/protoc-gen-go\"\n        _ \"github.com/twitchtv/twirp/protoc-gen-twirp\"\n)\n```\n\n### Install Twirp and Protobuf Generators\n\nSet `GOBIN` (see [go help environment](https://golang.org/cmd/go/#hdr-Environment_variables)) to define where the tool dependencies will be installed. For example, if you have a `/bin` folder in your project:\n\n```sh\nexport GOBIN=$PWD/bin\n```\n\nThe installed packages need to be accessible by the `protoc` compiler. You might need to add GOBIN to your PATH:\n\n```sh\nexport PATH=$GOBIN:$PATH\n```\n\nInstall generators:\n\n```sh\ngo install github.com/twitchtv/twirp/protoc-gen-twirp@latest\ngo install google.golang.org/protobuf/cmd/protoc-gen-go@latest\n```\n\n\n### Old Twirp versions (v5, v7) depend on Protobuf APIv1\n\n\nOlder versions of Twirp require Protobuf APIv1 instead of APIv2 (See [Version Compatibility](version_matrix.md)), that has a different module name:\n\n```sh\ngo get github.com/twitchtv/twirp/protoc-gen-twirp@v7.2.0\ngo get github.com/golang/protobuf/protoc-gen-go@1.5.2\n```\n\n### Generate code\n\nTry the `protoc` compiler with the flags  `--twirp_out` and `--go_out` to see if it is able to generate the `twirp.go` and `.pb.go` files. See [protobuf docs](https://developers.google.com/protocol-buffers/docs/reference/go-generated) for details on how to use the protoc compiler with `--go-out`, the Twirp flag `--twirp_out` supports the same parameters (see [Generator Flags](command_line.md) for more options).\n\nAn example call with default parameters to generate code for `rpc/haberdasher/service.proto`:\n\n```sh\nprotoc --go_out=. --twirp_out=. rpc/haberdasher/service.proto\n```\n\n"
  },
  {
    "path": "docs/intro.md",
    "content": "---\nid: intro\ntitle: Meet Twirp!\nsidebar_label: Overview\n---\n\nTwirp is a simple RPC framework built on\n[protobuf](https://developers.google.com/protocol-buffers/). You define a\nservice in a `.proto` specification file, then Twirp will _generate_ servers and\nclients for that service. It's your job to fill in the \"business logic\" that\npowers the server, and then generated clients can consume your service straight\naway.\n\nThis doc is an overview of how you use Twirp - how you interact with it, what\nyou write, and what it generates. Using the Go implementation as example: https://github.com/twitchtv/twirp\n\n## Making a Twirp Service in Go\n\nTo make a Twirp service:\n\n  1. Define your service in a **Proto** file.\n  2. Use the `protoc` command to generate go code from the **Proto** file, it\n     will generate an **interface**, a **client** and some **server utils** (to\n     easily start an http listener).\n  3. Implement the generated **interface** to implement the service.\n\nFor example, a HelloWorld **Proto** file:\n\n```protobuf\nsyntax = \"proto3\";\npackage example.com.my.package.helloworld;\noption go_package = \"example.com/my/package/helloworld\";\n\nservice HelloWorld {\n  rpc Hello(HelloReq) returns (HelloResp);\n}\n\nmessage HelloReq {\n  string subject = 1;\n}\n\nmessage HelloResp {\n  string text = 1;\n}\n```\n\nRunning the `protoc` compiler with the `--go_out` and `--twirp_out` options will generate `.pb.go` and `.twirp.go` files. The Twirp file contains this **interface**:\n\n```go\ntype HelloWorld interface {\n\tHello(context.Context, *HelloReq) (*HelloResp, error)\n}\n```\n\nYou provide the **implementation**:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\n\tpb \"github.com/twitchtv/twirp-example/rpc/helloworld\"\n)\n\ntype HelloWorldServer struct{}\n\nfunc (s *HelloWorldServer) Hello(ctx context.Context, req *pb.HelloReq) (*pb.HelloResp, error) {\n\treturn &pb.HelloResp{Text: \"Hello \" + req.Subject}, nil\n}\n\n// Run the implementation in a local server\nfunc main() {\n\ttwirpHandler := pb.NewHelloWorldServer(&HelloWorldServer{})\n\t// You can use any mux you like - NewHelloWorldServer gives you an http.Handler.\n\tmux := http.NewServeMux()\n\t// The generated code includes a method, PathPrefix(), which\n\t// can be used to mount your service on a mux.\n\tmux.Handle(twirpHandler.PathPrefix(), twirpHandler)\n\thttp.ListenAndServe(\":8080\", mux)\n}\n```\n\nAnd voila! Now you can use the auto-generated **Client** to make remote calls to your new service:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"net/http\"\n\n\tpb \"github.com/twitchtv/twirp-example/rpc/helloworld\"\n)\n\nfunc main() {\n\tclient := pb.NewHelloWorldProtobufClient(\"http://localhost:8080\", &http.Client{})\n\n\tresp, err := client.Hello(context.Background(), &pb.HelloReq{Subject: \"World\"})\n\tif err == nil {\n\t\tfmt.Println(resp.Text) // prints \"Hello World\"\n\t}\n}\n```\n\n## Why this is good\n\nTwirp [routing and serialization](routing.md) reduces the risk\nof introducing bugs. Both JSON and Protobuf are supported. The\n[Protobuf protocol](https://developers.google.com/protocol-buffers/docs/proto3)\nis designed to allow backwards compatible changes (unlike JSON, it is trivial to\nrename fields). Protobuf is super fast and the proto file definition\nalso works well as documentation for your service.\n\n## What's next?\n\n * [Install Twirp](install.md): instructions to install or upgrade Twirp tools\n   for code auto-generation (protoc, protoc-gen-go and protoc-gen-twirp).\n * [Usage Example](example.md): step by step guide to build an awesome\n   Haberdasher service.\n * [How Twirp routes requests](routing.md): learn more about how Twirp works\n   under the covers.\n"
  },
  {
    "path": "docs/migrate_to_twirp.md",
    "content": "---\nid: migrate_to_twirp\ntitle: Migrate APIs to Twirp\nsidebar_label: Migrate APIs to Twirp\n---\n\n## Migrate REST/JSON APIs to Twirp\n\nMigrating existing REST/JSON APIs to Twirp is a case-by-case scenario. Unfortunately, it involves creating a new service, generating a new client, and migrating callers to use the new endpoints in the new client.\n\nTwirp APIs are restricted to requests in the form `POST [<prefix>]/[<package>.]<Service>/<Method>` (see [Routing and Serialization](routing.md)). That limitation is what allows building simple and consistent API schemas. In the other hand, REST/JSON APIs usually don't have strongly defined schemas and tend to have edge cases that need special attention when being translated into Twirp endpoints.\n\nThe process is a case-by-case scenario, but we can highlight a few common steps:\n\n1.  Identify all the API endpoints in your old service, including request parameters, valid responses and possible errors. Also, identify all the API callers (upstream services) and let them know about the migration, they will soon need to update their client to use the new Twirp client when available.\n2.  Write a Protobuf schema. Respect [Protobuf naming and best practices](https://developers.google.com/protocol-buffers/docs/style) when possible, but don't try and significantly change the API design of your application during the migration; it will be a lot easier to migrate callers to the new API if the new endpoints are closely related to the old endpoints. Try to use parameter types that are similar to the old parameters. Use comments on the schema to clarify edge cases.\n3.  If the API is too big, it may be better to only migrate a few endpoints first. Protobuf schemas are good at evolving over time, you can always complete the migration for a few endpoints and add more endpoints later.\n4.  Generate code and implement your new API methods. You may be able to re-use some of the older code from the previous endpoints. One way to do this is to implement the new service in a subfolder inside the same project, and then mount the new Twirp handler in a sub-route (see [Muxing Twirp with other services](mux.md)).\n5.  Make sure to track stats about API endpoint usage, so you can see the traffic being migrated to the new endpoints. Use [hooks, interceptors](hooks.md) and/or HTTP [middleware](mux.md) as needed.\n6.  When the new Twirp service is ready, the API callers (upstream services) need to import the new Twirp client and update their calls to use the new Twirp API. This is why making the new API similar to the old one is useful. Some services may be able to just replace the old client with the new one and start sending traffic to the new endpoints, relying on their staging/canary environment for testing. Other services may want to implement a rollout slider to migrate traffic slowly (10%, 50%, etc.). The slider can be implemented in different ways. Here's a very naive implementation in Go to allow 10% traffic on the new client: `if r.Intn(100) < 10 { callNewClient() } else { callOldClient() }`. In more complex cases, it is also possible to make client that implements the same Twirp service interface, but with options to split the traffic between the new API and the old API.\n7.  When all traffic is migrated, don't forget to clean up the old code. If the old API is impossible to remove completely, it may be useful to re-implement old endpoints as shim calls to the new Twirp endpoints.\n"
  },
  {
    "path": "docs/mux.md",
    "content": "---\nid: \"mux\"\ntitle: \"Muxing Twirp with other HTTP services\"\nsidebar_label: \"Muxing Twirp services\"\n---\n\nIf you want run your server next to other `http.Handler`s, you'll need to use a\nmux. The generated code includes a path prefix that you can use for routing\nTwirp requests correctly. It's an exported string const, always as\n`<ServiceName>PathPrefix`, and it is the prefix for all Twirp requests.\n\nFor example, you could use it with [`http.ServeMux`](https://golang.org/pkg/net/http/#ServeMux) like this:\n\n```go\nserverImpl := &haberdasherserver.Server{}\ntwirpHandler := haberdasher.NewHaberdasherServer(serverImpl)\n\nmux := http.NewServeMux()\nmux.Handle(twirpHandler.PathPrefix(), twirpHandler)\nmux.Handle(\"/some/other/path\", someOtherHandler)\n\nhttp.ListenAndServe(\":8080\", mux)\n```\n\nYou can also serve your Handler on many third-party muxes which accept\n`http.Handler`s. For example, on a `goji.Mux`:\n\n```go\nserverImpl := &haberdasherserver.Server{} // implements Haberdasher interface\ntwirpHandler := haberdasher.NewHaberdasherServer(serverImpl)\n\nmux := goji.NewMux()\nmux.Handle(pat.Post(twirpHandler.PathPrefix()+\"*\"), twirpHandler)\n// mux.Handle other things like health checks ...\nhttp.ListenAndServe(\"localhost:8000\", mux)\n```\n\n### Using a different path prefix\n\nBy default, Twirp routes have a \"/twirp\" path prefix. See\n[Routing](routing.md) for more info.\n\nWhile the URL format can not be customized, the prefix can be changed to allow mounting the service\nin different routes. Use the option `twirp.WithServerPathPrefix`:\n\n```go\nserverImpl := &haberdasherserver.Server{}\ntwirpHandler := haberdasher.NewHaberdasherServer(serverImpl,\n    twirp.WithServerPathPrefix(\"/my/custom/prefix\"))\n\nmux := http.NewServeMux()\nmux.Handle(twirpHandler.PathPrefix(), twirpHandler)\nhttp.ListenAndServe(\":8080\", mux)\n```\n\nThe clients must be initialized with the same prefix to send requests to the right routes. Use the\noption `twirp.WithClientPathPrefix`:\n\n```go\nclient := haberdasher.NewHaberdasherProtoClient(s.URL, http.DefaultClient,\n    twirp.WithClientPathPrefix(\"/my/custom/prefix\"))\nresp, err := c.MakeHat(ctx, &Size{Inches: 1})\n```\n"
  },
  {
    "path": "docs/protobuf_and_json.md",
    "content": "---\nid: \"proto_and_json\"\ntitle: \"Twirp's Serialization Schemes\"\nsidebar_label: \"Protobuf and JSON\"\n---\n\nTwirp can handle both Protobuf and JSON encoding for requests and responses.\n\nThis is transparent to your service implementation. Twirp parses the HTTP\nrequest (returning an Internal error if the `Content-Type` or the body are\ninvalid) and converts it into the request struct defined in the interface. Your\nimplementation returns a response struct, which Twirp serializes back to a\nProtobuf or JSON response (depending on the request `Content-Type`).\n\nSee [the spec](spec_v7.md) for more details on routing and serialization.\n\nTwirp can generates two types of clients for your service:\n\n * `New{{Service}}ProtobufClient`: makes Protobuf requests to your service.\n * `New{{Service}}JSONClient`: makes JSON requests to your service.\n\n### Which one should I use, ProtobufClient or JSONClient?\n\nYou should use the **ProtobufClient**.\n\nProtobuf uses fewer bytes to encode than JSON (it is more compact), and it\nserializes faster.\n\nIn addition, Protobuf is designed to gracefully handle schema\nupdates. Did you notice the numbers added after each field? They allow you to\nchange a field and it still works if the client and the server have a different\nversions (that doesn't work with JSON clients).\n\n### If Protobuf is better, why does Twirp support JSON?\n\nYou will probably never need to use a Twirp **JSONClient** in Go, but having\nyour servers automatically handle JSON requests is still very convenient. It\nmakes it easier to debug (see [cURL requests](curl.md)), allows to easily write\nclients in other languages like Python, or make REST mappings to Twirp\nservices.\n\nThe JSON client is generated to provide a reference for implementations in other\nlanguages, and because in some rare circumstances, binary encoding of request\nbodies is unacceptable, and you just need to use JSON.\n"
  },
  {
    "path": "docs/routing.md",
    "content": "---\nid: \"routing\"\ntitle: \"Routing and Serialization\"\nsidebar_label: \"Routing and Serialization\"\n---\n\nRouting and Serialization is handled by Twirp. All you really need to know is\nthat \"it just works\". However you may find this interesting and useful for\ndebugging and advanced configuration.\n\n### HTTP Routes\n\nTwirp works over HTTP 1.1; all RPC methods map to routes that follow the format:\n\n```plaintext\nPOST [<prefix>]/[<package>.]<Service>/<Method>\n```\n\nWhere:\n\n- The `<prefix>` is \"/twirp\" by default, but it is optional and can be configured with other paths like \"/my/custom/prefix\" (see `twirp.WithServerPathPrefix`).\n- The `<package>`, `<Service>` and `<Method>` names are the same values used in the `.proto` file where the service was defined.\n\nFor example, to make a hat with the [Haberdasher service](example.md):\n\n```plaintext\nPOST /twirp/twirp.example.haberdasher.Haberdasher/MakeHat\n```\n\nMore details on the [protocol specification](spec_v7.md).\n\n#### Naming Style\n\nFor maximum compatibility, please follow the [Protocol Buffers Style Guide](https://developers.google.com/protocol-buffers/docs/style#services). In particular, the `<Service>` and `<Method>` names should be CamelCased (with an initial capital). This will ensure cross-language compatibility and prevent name collisions (e.g. `myMethod` and `my_method` would both map to `MyMethod`, causing a compile time error in some languages like Go).\n\n### Content-Type Header (json or protobuf)\n\nThe `Content-Type` header is required and must be either `application/json` or\n`application/protobuf`. JSON is easier for debugging (particularly when making\nrequests with cURL), but Protobuf is better in almost every other way. Please\nuse Protobuf in real code. See\n[Protobuf and JSON](protobuf_and_json.md)\nfor more details.\n\n### JSON serialization\n\nThe JSON format generally matches the\n[official spec](https://developers.google.com/protocol-buffers/docs/proto3#json)'s\nrules for JSON serialization. In a nutshell: _all_\nfields must be set, _no_ extra fields may be set, and `null` means \"I want to\nleave this field blank\".\nOne exception to this is that names match the proto names, this is considered more predictable to those writing custom JSON clients.\n\n### Error responses\n\nErrors returned by Twirp servers use non-200 HTTP status codes and always have\nJSON-encoded bodies (even if the request was Protobuf-encoded). The body JSON\nhas three fields `{code, msg, meta}`. For example:\n\n```\nPOST /twirp/twirp.example.haberdasher.Haberdasher/INVALIDROUTE\n\n404 Not Found\n{\n    \"code\": \"bad_route\",\n    \"msg\": \"no handler for path /twirp/twirp.example.haberdasher.Haberdasher/INVALIDROUTE\",\n    \"meta\": {\"twirp_invalid_route\": \"POST /twirp/twirp.example.haberdasher.Haberdasher/INVALIDROUTE\"}\n}\n```\n"
  },
  {
    "path": "docs/spec_v5.md",
    "content": "---\nid: \"spec_v5\"\ntitle: \"Twirp Wire Protocol (v5)\"\nsidebar_label: \"Version 5 (Previous)\"\n---\n\nThis document defines the initial Twirp wire protocol over HTTP.\nThe version 5 of the protocol was the initial version released to\nthe public. If you are working on a new implementation of Twirp,\nplease use the latest version of the spec.\n\n## Overview\n\nThe Twirp wire protocol is a simple RPC protocol based on HTTP and\nProtocol Buffers (proto). The protocol uses HTTP URLs to specify the\nRPC endpoints, and sends/receives proto messages as HTTP\nrequest/response bodies.\n\nTo use Twirp, developers first define their APIs using proto files,\nthen use Twirp tools to generate the client and the server libraries.\nThe generated libraries implement the Twirp wire protocol, using the\nstandard HTTP library provided by the programming language runtime or\nthe operating system. Once the client and the server are implemented,\nthe client can communicate with the server by making RPC calls.\n\nThe Twirp wire protocol supports both binary and JSON encodings of\nproto messages, and works with any HTTP client and any HTTP version.\n\n### URLs\n\nIn [ABNF syntax](https://tools.ietf.org/html/rfc5234), Twirp's URLs\nhave the following format:\n\n```abnf\nURL ::= Base-URL \"/twirp/\" [ Package \".\" ] Service \"/\" Method\n```\n\nThe Twirp wire protocol uses HTTP URLs to specify the RPC\nendpoints on the server for sending the requests. Such direct mapping\nmakes the request routing simple and efficient. The Twirp URLs have\nthe following components.\n\n* **Base-URL** is the virtual location of a Twirp API server, which is\n  typically published via API documentation or service discovery.\n  Currently, it should only contain URL `scheme` and `authority`. For\n  example, \"https://example.com\".\n* **Package** is the proto `package` name for an API, which is often\n  considered as an API version. For example,\n  `example.calendar.v1`. This component is omitted if the API\n  definition doesn't have a package name.\n* **Service** is the proto `service` name for an API. For example,\n  `CalendarService`.\n* **Method** is the proto `rpc` name for an API method. For example,\n  `CreateEvent`.\n\n### Requests\n\nTwirp always uses HTTP POST method to send requests, because it\nclosely matches the semantics of RPC methods.\n\nThe **Request-Headers** are normal HTTP headers. The Twirp wire\nprotocol uses the following headers.\n\n* **Content-Type** header indicates the proto message encoding, which\n  should be one of \"application/protobuf\", \"application/json\". The\n  server uses this value to decide how to parse the request body,\n  and encode the response body.\n\nThe **Request-Body** is the encoded request message, contained in the\nHTTP request body. The encoding is specified by the `Content-Type`\nheader.\n\n### Responses\n\nThe **Response-Headers** are just normal HTTP response headers. The\nTwirp wire protocol uses the following headers.\n\n* **Content-Type** The value should be either \"application/protobuf\"\n  or \"application/json\" to indicate the encoding of the response\n  message. It must match the \"Content-Type\" header in the request.\n\nThe **Request-Body** is the encoded response message contained in the\nHTTP response body. The encoding is specified by the `Content-Type`\nheader.\n\n### Example\n\nThe following example shows a simple Echo API definition and its\ncorresponding wire payloads.\n\nThe example assumes the server base URL is \"https://example.com\".\n\n```proto\nsyntax = \"proto3\";\n\npackage example.echoer;\n\nservice Echo {\n  rpc Hello(HelloRequest) returns (HelloResponse);\n}\n\nmessage HelloRequest {\n  string message;\n}\n\nmessage HelloResponse {\n  string message;\n}\n```\n\n**Proto Request**\n\n```\nPOST /twirp/example.echoer.Echo/Hello HTTP/1.1\nHost: example.com\nContent-Type: application/protobuf\nContent-Length: 15\n\n<encoded HelloRequest>\n```\n\n**JSON Request**\n\n```\nPOST /twirp/example.echoer.Echo/Hello HTTP/1.1\nHost: example.com\nContent-Type: application/json\nContent-Length: 27\n\n{\"message\":\"Hello, World!\"}\n```\n\n**Proto Response**\n\n```\nHTTP/1.1 200 OK\nContent-Type: application/protobuf\nContent-Length: 15\n\n<encoded HelloResponse>\n```\n\n**JSON Response**\n\n```\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 27\n\n{\"message\":\"Hello, World!\"}\n```\n\n\n## Errors\n\nTwirp error responses are always JSON-encoded, regardless of\nthe request's Content-Type, with a corresponding\n`Content-Type: application/json` header. This ensures that\nthe errors are human-readable in any setting.\n\nTwirp errors are a JSON object with the keys:\n\n* **code**: One of the Twirp error codes as a string.\n* **msg**: A human-readable message describing the error\n  as a string.\n* **meta**: (optional) An object with string values holding\n  arbitrary additional metadata describing the error.\n\nExample:\n\n```json\n{\n  \"code\": \"internal\",\n  \"msg\": \"Something went wrong\"\n}\n```\n\nExample with metadata:\n\n```json\n{\n  \"code\": \"permission_denied\",\n  \"msg\": \"Thou shall not pass\",\n  \"meta\": {\n    \"target\": \"Balrog\",\n    \"power\": \"999\"\n  }\n}\n```\n\n### Error Codes\n\nTwirp errors always include an error code. This code is represented\nas a string and must be one of a fixed set of codes, listed in the\ntable below. Each code has an associated HTTP Status Code. When a\nserver responds with the given error code, it must set the\ncorresponding HTTP Status Code for the response.\n\n| Twirp Error Code    | HTTP Status | Description\n| ------------------- | ----------- | -----------\n| canceled            | 408 | The operation was cancelled.\n| unknown             | 500 | An unknown error occurred. For example, this can be used when handling errors raised by APIs that do not return any error information.\n| invalid_argument    | 400 | The client specified an invalid argument. This indicates arguments that are invalid regardless of the state of the system (i.e. a malformed file name, required argument, number out of range, etc.).\n| malformed           | 400 | The client sent a message which could not be decoded. This may mean that the message was encoded improperly or that the client and server have incompatible message definitions.\n| deadline_exceeded   | 408 | Operation expired before completion. For operations that change the state of the system, this error may be returned even if the operation has completed successfully (timeout).\n| not_found           | 404 | Some requested entity was not found.\n| bad_route           | 404 | The requested URL path wasn't routable to a Twirp service and method. This is returned by generated server code and should not be returned by application code (use \"not_found\" or \"unimplemented\" instead).\n| already_exists      | 409 | An attempt to create an entity failed because one already exists.\n| permission_denied   | 403 | The caller does not have permission to execute the specified operation. It must not be used if the caller cannot be identified (use \"unauthenticated\" instead).\n| unauthenticated     | 401 | The request does not have valid authentication credentials for the operation.\n| resource_exhausted  | 403 | Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.\n| failed_precondition | 412 | The operation was rejected because the system is not in a state required for the operation's execution. For example, doing an rmdir operation on a directory that is non-empty, or on a non-directory object, or when having conflicting read-modify-write on the same resource.\n| aborted             | 409 | The operation was aborted, typically due to a concurrency issue like sequencer check failures, transaction aborts, etc.\n| out_of_range        | 400 | The operation was attempted past the valid range. For example, seeking or reading past end of a paginated collection. Unlike \"invalid_argument\", this error indicates a problem that may be fixed if the system state changes (i.e. adding more items to the collection). There is a fair bit of overlap between \"failed_precondition\" and \"out_of_range\". We recommend using \"out_of_range\" (the more specific error) when it applies so that callers who are iterating through a space can easily look for an \"out_of_range\" error to detect when they are done.\n| unimplemented       | 501 | The operation is not implemented or not supported/enabled in this service.\n| internal            | 500 | When some invariants expected by the underlying system have been broken. In other words, something bad happened in the library or backend service. Twirp specific issues like wire and serialization problems are also reported as \"internal\" errors.\n| unavailable         | 503 | The service is currently unavailable. This is most likely a transient condition and may be corrected by retrying with a backoff.\n| dataloss            | 500 | The operation resulted in unrecoverable data loss or corruption.\n\n\n"
  },
  {
    "path": "docs/spec_v6.md",
    "content": "---\nid: \"spec_v6\"\ntitle: \"Twirp Wire Protocol (v6)\"\nsidebar_label: \"Version 6 (Archived)\"\n---\n\nThis is a historical document for the Twirp wire protocol \"v6\", that was never released. At the time of writing, all existing production systems were using the \"v5\" protocol. New systems will implement \"v7\" and above.\n\n## Why was v6 never released?\n\nThe proposal for the v6 protocol has been standing without progress for too long. The streaming proposal was not simple enough to be officially released. The wire protocol is the glue connecting all the systems in production, once formalized it needs to be implemented by all different implementations across multiple languages. Because of this, it is very difficult to plan a path forward without having a negative impact on the Twirp ecosystem.\n\n### Feature: Streaming API\n\nIssue: https://github.com/twitchtv/twirp/issues/70\n\nHandling streams out of the box. Not implemented because streams require assumptions about how the connection state is managed, they are complex and not required by the majority of Twirp users. Websockets or gRPC may be good alternatives.\n\nThere may still be reasons to implement streams in the future. If that happens, it will be managed separately from this v6 protocol draft.\n\n\n### Feature: HTTP Routes update\n\nIssue: https://github.com/twitchtv/twirp/issues/55\n\nTwirp routes have a `/twirp` prefix that is inconvenient in some cases. The different proposals to allow different routes were not entirely backwards compatible, and they were waiting for the Streaming API branch to be finalized. Too much time has passed since those routing proposals, and the backwards compatibility requirements have become more important.\n\nThe \"v7\" protocol introduces an optional prefix for routing (where `/twirp` is the default prefix): https://github.com/twitchtv/twirp/pull/264\n\n"
  },
  {
    "path": "docs/spec_v7.md",
    "content": "---\nid: \"spec_v7\"\ntitle: \"Twirp Wire Protocol (v7)\"\nsidebar_label: \"Version 7 (Current)\"\n---\n\nThis document defines the Twirp wire protocol over HTTP. The\ncurrent protocol version is v7.\n\n## Overview\n\nThe Twirp wire protocol is a simple RPC protocol based on HTTP and\nProtocol Buffers (proto). The protocol uses HTTP URLs to specify the\nRPC endpoints, and sends/receives proto messages as HTTP\nrequest/response bodies.\n\nTo use Twirp, developers first define their APIs using proto files,\nthen use Twirp tools to generate the client and the server libraries.\nThe generated libraries implement the Twirp wire protocol, using the\nstandard HTTP library provided by the programming language runtime or\nthe operating system. Once the client and the server are implemented,\nthe client can communicate with the server by making RPC calls.\n\nThe Twirp wire protocol supports both binary and JSON encodings of\nproto messages, and works with any HTTP client and any HTTP version.\n\n### URLs\n\nIn [ABNF syntax](https://tools.ietf.org/html/rfc5234), Twirp's URLs\nhave the following format:\n\n```abnf\nURL ::= Base-URL [ Prefix ] \"/\" [ Package \".\" ] Service \"/\" Method\n```\n\nThe Twirp wire protocol uses HTTP URLs to specify the RPC\nendpoints on the server for sending the requests. Such direct mapping\nmakes the request routing simple and efficient. The Twirp URLs have\nthe following components.\n\n* **Base-URL** is the virtual location of a Twirp API server, which is\n  typically published via API documentation or service discovery.\n  Currently, it should only contain URL `scheme` and `authority`. For\n  example, \"https://example.com\".\n* **Prefix** is usually \"/twirp\", but it could be empty \"\", or an\n  arbitrary path like \"/my/custom/prefix\".\n* **Package** is the proto `package` name for an API, which is often\n  considered as an API version. For example,\n  `example.calendar.v1`. This component is omitted if the API\n  definition doesn't have a package name.\n* **Service** is the proto `service` name for an API. For example,\n  `CalendarService`.\n* **Method** is the proto `rpc` name for an API method. For example,\n  `CreateEvent`.\n\n### Requests\n\nTwirp always uses HTTP POST method to send requests, because it\nclosely matches the semantics of RPC methods.\n\nThe **Request-Headers** are normal HTTP headers. The Twirp wire\nprotocol uses the following headers.\n\n* **Content-Type** header indicates the proto message encoding, which\n  should be one of \"application/protobuf\", \"application/json\". The\n  server uses this value to decide how to parse the request body,\n  and encode the response body.\n\nThe **Request-Body** is the encoded request message, contained in the\nHTTP request body. The encoding is specified by the `Content-Type`\nheader.\n\n### Responses\n\nThe **Response-Headers** are just normal HTTP response headers. The\nTwirp wire protocol uses the following headers.\n\n* **Content-Type** The value should be either \"application/protobuf\"\n  or \"application/json\" to indicate the encoding of the response\n  message. It must match the \"Content-Type\" header in the request.\n\nThe **Request-Body** is the encoded response message contained in the\nHTTP response body. The encoding is specified by the `Content-Type`\nheader.\n\n### Example\n\nThe following example shows a simple Echo API definition and its\ncorresponding wire payloads.\n\nThe example assumes the server base URL is \"https://example.com\".\n\n```proto\nsyntax = \"proto3\";\n\npackage example.echoer;\n\nservice Echo {\n  rpc Hello(HelloRequest) returns (HelloResponse);\n}\n\nmessage HelloRequest {\n  string message;\n}\n\nmessage HelloResponse {\n  string message;\n}\n```\n\n**Proto Request**\n\n```\nPOST /twirp/example.echoer.Echo/Hello HTTP/1.1\nHost: example.com\nContent-Type: application/protobuf\nContent-Length: 15\n\n<encoded HelloRequest>\n```\n\n**JSON Request**\n\n```\nPOST /twirp/example.echoer.Echo/Hello HTTP/1.1\nHost: example.com\nContent-Type: application/json\nContent-Length: 27\n\n{\"message\":\"Hello, World!\"}\n```\n\n**Proto Response**\n\n```\nHTTP/1.1 200 OK\nContent-Type: application/protobuf\nContent-Length: 15\n\n<encoded HelloResponse>\n```\n\n**JSON Response**\n\n```\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 27\n\n{\"message\":\"Hello, World!\"}\n```\n\n\n## Errors\n\nTwirp error responses are always JSON-encoded, regardless of\nthe request's Content-Type, with a corresponding\n`Content-Type: application/json` header. This ensures that\nthe errors are human-readable in any setting.\n\nTwirp errors are a JSON object with the keys:\n\n* **code**: One of the Twirp error codes as a string.\n* **msg**: A human-readable message describing the error\n  as a string.\n* **meta**: (optional) An object with string values holding\n  arbitrary additional metadata describing the error.\n\nExample:\n\n```json\n{\n  \"code\": \"internal\",\n  \"msg\": \"Something went wrong\"\n}\n```\n\nExample with metadata:\n\n```json\n{\n  \"code\": \"permission_denied\",\n  \"msg\": \"Thou shall not pass\",\n  \"meta\": {\n    \"target\": \"Balrog\",\n    \"power\": \"999\"\n  }\n}\n```\n\n### Error Codes\n\nTwirp errors always include an error code. This code is represented\nas a string and must be one of a fixed set of codes, listed in the\ntable below. Each code has an associated HTTP Status Code. When a\nserver responds with the given error code, it must set the\ncorresponding HTTP Status Code for the response.\n\n| Twirp Error Code    | HTTP Status | Description\n| ------------------- | ----------- | -----------\n| canceled            | 408 | The operation was cancelled.\n| unknown             | 500 | An unknown error occurred. For example, this can be used when handling errors raised by APIs that do not return any error information.\n| invalid_argument    | 400 | The client specified an invalid argument. This indicates arguments that are invalid regardless of the state of the system (i.e. a malformed file name, required argument, number out of range, etc.).\n| malformed           | 400 | The client sent a message which could not be decoded. This may mean that the message was encoded improperly or that the client and server have incompatible message definitions.\n| deadline_exceeded   | 408 | Operation expired before completion. For operations that change the state of the system, this error may be returned even if the operation has completed successfully (timeout).\n| not_found           | 404 | Some requested entity was not found.\n| bad_route           | 404 | The requested URL path wasn't routable to a Twirp service and method. This is returned by generated server code and should not be returned by application code (use \"not_found\" or \"unimplemented\" instead).\n| already_exists      | 409 | An attempt to create an entity failed because one already exists.\n| permission_denied   | 403 | The caller does not have permission to execute the specified operation. It must not be used if the caller cannot be identified (use \"unauthenticated\" instead).\n| unauthenticated     | 401 | The request does not have valid authentication credentials for the operation.\n| resource_exhausted  | 429 | Some resource has been exhausted or rate-limited, perhaps a per-user quota, or perhaps the entire file system is out of space.\n| failed_precondition | 412 | The operation was rejected because the system is not in a state required for the operation's execution. For example, doing an rmdir operation on a directory that is non-empty, or on a non-directory object, or when having conflicting read-modify-write on the same resource.\n| aborted             | 409 | The operation was aborted, typically due to a concurrency issue like sequencer check failures, transaction aborts, etc.\n| out_of_range        | 400 | The operation was attempted past the valid range. For example, seeking or reading past end of a paginated collection. Unlike \"invalid_argument\", this error indicates a problem that may be fixed if the system state changes (i.e. adding more items to the collection). There is a fair bit of overlap between \"failed_precondition\" and \"out_of_range\". We recommend using \"out_of_range\" (the more specific error) when it applies so that callers who are iterating through a space can easily look for an \"out_of_range\" error to detect when they are done.\n| unimplemented       | 501 | The operation is not implemented or not supported/enabled in this service.\n| internal            | 500 | When some invariants expected by the underlying system have been broken. In other words, something bad happened in the library or backend service. Twirp specific issues like wire and serialization problems are also reported as \"internal\" errors.\n| unavailable         | 503 | The service is currently unavailable. This is most likely a transient condition and may be corrected by retrying with a backoff.\n| dataloss            | 500 | The operation resulted in unrecoverable data loss or corruption.\n\n\n## Differences with v5\n\nNote v6 was a draft and never released. Twirp implementations supporting the protocol spec v5 should update directly to support v7.\n\n * Twirp URLs in v5 could only have the \"/twirp\" prefix. In v7 they can have any arbitrary prefix or no prefix. See Go PR for reference: https://github.com/twitchtv/twirp/pull/264\n * Error responses with code `resource_exhausted` in v5 had the HTTP status `403`. In v7 they have status `429`. See Go PR for reference: https://github.com/twitchtv/twirp/pull/270\n\n"
  },
  {
    "path": "docs/version_matrix.md",
    "content": "---\nid: version_matrix\ntitle: Version Compatibility\nsidebar_label: Version Compatibility\n---\n\n## Compatibility Matrix\n\nGenerally speaking, code generated with newer versions of the generator require newer versions of the runtime, but runtime library is backwards compatible and works with older clients. This allows importing multiple clients generated at different versions into the same service, as long as the service is running the latest runtime.\n\nRead the matrix from left to right: Code generated with the Twirp Generator version on the left, is compatible with the runtime, protobuf runtime, protobuf generated code, and spec versions on the right.\n\n| Twirp Generator  | Twirp Runtime | Protobuf | Twirp Spec | Key feature |\n| ---------------- |---------------| ---------| ---------- | ------------|\n| **v8.1**         | v8.1+         | APIv2    | V7         | [Error matching with errors.As](https://github.com/twitchtv/twirp/releases/tag/v8.1.0)\n| **v8.0**         | v7.1+         | APIv2    | V7         | [Protobuf APIv2](https://github.com/twitchtv/twirp/releases/tag/v8.0.0)\n| **v7.1**         | v7.1+         | APIv1    | V7         | [Interceptors](https://github.com/twitchtv/twirp/releases/tag/v7.1.0)\n| **v7.0**         | v7.0+         | APIv1    | V7         | [V7 Spec and ServerOptions](https://github.com/twitchtv/twirp/releases/tag/v7.0.0)\n| **v5.11**        | v5.10+        | APIv1    | V7, V5     | [Unwrap errors](https://github.com/twitchtv/twirp/releases/tag/v5.11.0)\n| **v5.10**        | v5.10+        | APIv1    | V7, V5     | [ClientHooks](https://github.com/twitchtv/twirp/releases/tag/v5.10.0)\n| **v5.8**         | v5.8+         | APIv1    | V7, V5     | [Marlformed Error](https://github.com/twitchtv/twirp/releases/tag/v5.8.0)\n| **v5**           | v5+           | APIv1    | V7, V5     | [First Public Release](https://github.com/twitchtv/twirp/releases/tag/v5.0.0)\n\nThis table includes only versions that have potential breaking changes. Please read the [Release Notes](https://github.com/twitchtv/twirp/releases) to ensure upgrading without issues.\n\n\n### Go Twirp and Protobuf compatibility\n\nBoth Twirp and Protobuf contain a runtime library and a code generator plugin. The generated code can have incompatibility issues with different versions of the library.\n\nTwirp (https://github.com/twitchtv/twirp):\n\n * Twirp Generator: `github.com/twitchtv/twirp/protoc-gen-twirp`. Generates Go code with the `.twirp.go` file extension, with Twirp clients and servers.\n * Twirp Runtime: `github.com/twitchtv/twirp`. Is the Go library with shared types like `twirp.Error` and `twirp.ServerOptions`)\n\nProtobuf APIv2 (https://github.com/protocolbuffers/protobuf-go, https://blog.golang.org/protobuf-apiv2)\n\n * Proto Generator: `google.golang.org/protobuf/cmd/protoc-gen-go`. Generates Go code with the `.pb.go` file extension, with Protobuf message types.\n * Proto Runtime: `google.golang.org/protobuf/proto`. Is the Proto library used to serialize Protobuf and JSON messages over the network. The new version (APIv2) is used by new versions of Twirp (v8+). The older version (APIv1) has a different import path (`github.com/golang/protobuf/proto`) and is used by older versions of Twirp (v5 and v7).\n\nProtobuf APIv1 (DEPRECATED) (https://github.com/golang/protobuf):\n\n  * Proto Generator: `github.com/golang/protobuf/protoc-gen-go`.\n  * Proto Runtime: `github.com/golang/protobuf/proto`.\n\nNOTE: Different versions of Protobuf APIv1 can breaking changes, make sure to check their release notes when upgrading.\n\n\n### Protocol Spec Compatibility\n\nThe [Twirp Spec Protocol](https://twitchtv.github.io/twirp/docs/spec_v7.html) is the main point of compatibility for Twirp clients and services, across different versions and implementations in different languages. The Spec was first released as v5, and later updated to V7.\n\nTwirp (for Go) versions of the runtime library and generator labeled with `v5.x.x` are all compliant with the V5 spec and also with the V7 spec (V7 is backwards compatible). Any old service implementing V5 also works with the V7 spec. See [V7 release notes](https://github.com/twitchtv/twirp/releases/tag/v7.0.0) for compatibility details and upgrade instructions.\n\nGolang versions of the runtime library and generator labeled with `v7.x.x` and above (`v8+`), are compliant with the V7 spec.\n\n\n"
  },
  {
    "path": "errors.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\n// Package twirp provides core types used in generated Twirp servers and client.\n//\n// Twirp services handle errors using the `twirp.Error` interface.\n//\n// For example, a server method may return an InvalidArgumentError:\n//\n//     if req.Order != \"DESC\" && req.Order != \"ASC\" {\n//         return nil, twirp.InvalidArgumentError(\"Order\", \"must be DESC or ASC\")\n//     }\n//\n// And the same twirp.Error is returned by the client, for example:\n//\n//     resp, err := twirpClient.RPCMethod(ctx, req)\n//     if err != nil {\n//         if twerr, ok := err.(twirp.Error); ok {\n//             switch twerr.Code() {\n//             case twirp.InvalidArgument:\n//                 log.Error(\"invalid argument \"+twirp.Meta(\"argument\"))\n//             default:\n//                 log.Error(twerr.Error())\n//             }\n//         }\n//     }\n//\n// Clients may also return Internal errors if something failed on the system:\n// the server, the network, or the client itself (i.e. failure parsing\n// response).\n//\npackage twirp\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strconv\"\n)\n\n// Error represents an error in a Twirp service call.\ntype Error interface {\n\t// Code is of the valid error codes.\n\tCode() ErrorCode\n\n\t// Msg returns a human-readable, unstructured messages describing the error.\n\tMsg() string\n\n\t// WithMeta returns a copy of the Error with the given key-value pair attached\n\t// as metadata. If the key is already set, it is overwritten.\n\tWithMeta(key string, val string) Error\n\n\t// Meta returns the stored value for the given key. If the key has no set\n\t// value, Meta returns an empty string. There is no way to distinguish between\n\t// an unset value and an explicit empty string.\n\tMeta(key string) string\n\n\t// MetaMap returns the complete key-value metadata map stored on the error.\n\tMetaMap() map[string]string\n\n\t// Error returns a string of the form \"twirp error <Code>: <Msg>\"\n\tError() string\n}\n\n// code.Error(msg) builds a new Twirp error with code and msg. Example:\n//   twirp.NotFound.Error(\"Resource not found\")\n//   twirp.Internal.Error(\"Oops\")\nfunc (code ErrorCode) Error(msg string) Error {\n\treturn NewError(code, msg)\n}\n\n// code.Errorf(msg, args...) builds a new Twirp error with code and formatted msg.\n// The format may include \"%w\" to wrap other errors. Examples:\n//   twirp.Internal.Error(\"Oops: %w\", originalErr)\n//   twirp.NotFound.Error(\"Resource not found with id: %q\", resourceID)\nfunc (code ErrorCode) Errorf(msgFmt string, a ...interface{}) Error {\n\treturn NewErrorf(code, msgFmt, a...)\n}\n\n// WrapError allows Twirp errors to wrap other errors.\n// The wrapped error can be extracted later with (github.com/pkg/errors).Unwrap\n// or errors.Is from the standard errors package on Go 1.13+.\nfunc WrapError(twerr Error, err error) Error {\n\treturn &wrappedErr{\n\t\twrapper: twerr,\n\t\tcause:   err,\n\t}\n}\n\n// NewError builds a twirp.Error. The code must be one of the valid predefined constants.\n// To add metadata, use .WithMeta(key, value) method after building the error.\nfunc NewError(code ErrorCode, msg string) Error {\n\tif !IsValidErrorCode(code) {\n\t\treturn &twerr{code: Internal, msg: \"invalid error type \" + string(code)}\n\t}\n\treturn &twerr{code: code, msg: msg}\n}\n\n// NewErrorf builds a twirp.Error with a formatted msg.\n// The format may include \"%w\" to wrap other errors. Examples:\n//   twirp.NewErrorf(twirp.Internal, \"Oops: %w\", originalErr)\n//   twirp.NewErrorf(twirp.NotFound, \"resource with id: %q\", resourceID)\nfunc NewErrorf(code ErrorCode, msgFmt string, a ...interface{}) Error {\n\terr := fmt.Errorf(msgFmt, a...)      // format error message, may include \"%w\" with an original error\n\ttwerr := NewError(code, err.Error()) // use the error as msg\n\treturn WrapError(twerr, err)         // wrap so the original error can be identified with errors.Is\n}\n\n// NotFoundError is a convenience constructor for NotFound errors.\nfunc NotFoundError(msg string) Error {\n\treturn NewError(NotFound, msg)\n}\n\n// InvalidArgumentError is a convenience constructor for InvalidArgument errors.\n// The argument name is included on the \"argument\" metadata for convenience.\nfunc InvalidArgumentError(argument string, validationMsg string) Error {\n\terr := NewError(InvalidArgument, argument+\" \"+validationMsg)\n\terr = err.WithMeta(\"argument\", argument)\n\treturn err\n}\n\n// RequiredArgumentError builds an InvalidArgument error.\n// Useful when a request argument is expected to have a non-zero value.\nfunc RequiredArgumentError(argument string) Error {\n\treturn InvalidArgumentError(argument, \"is required\")\n}\n\n// InternalError is a convenience constructor for Internal errors.\nfunc InternalError(msg string) Error {\n\treturn NewError(Internal, msg)\n}\n\n// InternalErrorf uses the formatted message as the internal error msg.\n// The format may include \"%w\" to wrap other errors. Examples:\n//   twirp.InternalErrorf(\"database error: %w\", err)\n//   twirp.InternalErrorf(\"failed to load resource %q: %w\", resourceID, originalErr)\nfunc InternalErrorf(msgFmt string, a ...interface{}) Error {\n\treturn NewErrorf(Internal, msgFmt, a...)\n}\n\n// InternalErrorWith makes an internal error, wrapping the original error and using it\n// for the error message, and with metadata \"cause\" with the original error type.\n// This function is used by Twirp services to wrap non-Twirp errors as internal errors.\n// The wrapped error can be extracted later with (github.com/pkg/errors).Unwrap\n// or errors.Is from the standard errors package on Go 1.13+.\nfunc InternalErrorWith(err error) Error {\n\ttwerr := NewError(Internal, err.Error())\n\ttwerr = twerr.WithMeta(\"cause\", fmt.Sprintf(\"%T\", err)) // to easily tell apart wrapped internal errors from explicit ones\n\treturn WrapError(twerr, err)\n}\n\n// ErrorCode represents a Twirp error type.\ntype ErrorCode string\n\n// Valid Twirp error types. Most error types are equivalent to gRPC status codes\n// and follow the same semantics.\nconst (\n\t// Canceled indicates the operation was cancelled (typically by the caller).\n\tCanceled ErrorCode = \"canceled\"\n\n\t// Unknown error. For example when handling errors raised by APIs that do not\n\t// return enough error information.\n\tUnknown ErrorCode = \"unknown\"\n\n\t// InvalidArgument indicates client specified an invalid argument. It\n\t// indicates arguments that are problematic regardless of the state of the\n\t// system (i.e. a malformed file name, required argument, number out of range,\n\t// etc.).\n\tInvalidArgument ErrorCode = \"invalid_argument\"\n\n\t// Malformed indicates an error occurred while decoding the client's request.\n\t// This may mean that the message was encoded improperly, or that there is a\n\t// disagreement in message format between the client and server.\n\tMalformed ErrorCode = \"malformed\"\n\n\t// DeadlineExceeded means operation expired before completion. For operations\n\t// that change the state of the system, this error may be returned even if the\n\t// operation has completed successfully (timeout).\n\tDeadlineExceeded ErrorCode = \"deadline_exceeded\"\n\n\t// NotFound means some requested entity was not found.\n\tNotFound ErrorCode = \"not_found\"\n\n\t// BadRoute means that the requested URL path wasn't routable to a Twirp\n\t// service and method. This is returned by the generated server, and usually\n\t// shouldn't be returned by applications. Instead, applications should use\n\t// NotFound or Unimplemented.\n\tBadRoute ErrorCode = \"bad_route\"\n\n\t// AlreadyExists means an attempt to create an entity failed because one\n\t// already exists.\n\tAlreadyExists ErrorCode = \"already_exists\"\n\n\t// PermissionDenied indicates the caller does not have permission to execute\n\t// the specified operation. It must not be used if the caller cannot be\n\t// identified (Unauthenticated).\n\tPermissionDenied ErrorCode = \"permission_denied\"\n\n\t// Unauthenticated indicates the request does not have valid authentication\n\t// credentials for the operation.\n\tUnauthenticated ErrorCode = \"unauthenticated\"\n\n\t// ResourceExhausted indicates some resource has been exhausted or rate-limited,\n\t// perhaps a per-user quota, or perhaps the entire file system is out of space.\n\tResourceExhausted ErrorCode = \"resource_exhausted\"\n\n\t// FailedPrecondition indicates operation was rejected because the system is\n\t// not in a state required for the operation's execution. For example, doing\n\t// an rmdir operation on a directory that is non-empty, or on a non-directory\n\t// object, or when having conflicting read-modify-write on the same resource.\n\tFailedPrecondition ErrorCode = \"failed_precondition\"\n\n\t// Aborted indicates the operation was aborted, typically due to a concurrency\n\t// issue like sequencer check failures, transaction aborts, etc.\n\tAborted ErrorCode = \"aborted\"\n\n\t// OutOfRange means operation was attempted past the valid range. For example,\n\t// seeking or reading past end of a paginated collection.\n\t//\n\t// Unlike InvalidArgument, this error indicates a problem that may be fixed if\n\t// the system state changes (i.e. adding more items to the collection).\n\t//\n\t// There is a fair bit of overlap between FailedPrecondition and OutOfRange.\n\t// We recommend using OutOfRange (the more specific error) when it applies so\n\t// that callers who are iterating through a space can easily look for an\n\t// OutOfRange error to detect when they are done.\n\tOutOfRange ErrorCode = \"out_of_range\"\n\n\t// Unimplemented indicates operation is not implemented or not\n\t// supported/enabled in this service.\n\tUnimplemented ErrorCode = \"unimplemented\"\n\n\t// Internal errors. When some invariants expected by the underlying system\n\t// have been broken. In other words, something bad happened in the library or\n\t// backend service. Do not confuse with HTTP Internal Server Error; an\n\t// Internal error could also happen on the client code, i.e. when parsing a\n\t// server response.\n\tInternal ErrorCode = \"internal\"\n\n\t// Unavailable indicates the service is currently unavailable. This is a most\n\t// likely a transient condition and may be corrected by retrying with a\n\t// backoff.\n\tUnavailable ErrorCode = \"unavailable\"\n\n\t// DataLoss indicates unrecoverable data loss or corruption.\n\tDataLoss ErrorCode = \"data_loss\"\n\n\t// NoError is the zero-value, is considered an empty error and should not be\n\t// used.\n\tNoError ErrorCode = \"\"\n)\n\n// ServerHTTPStatusFromErrorCode maps a Twirp error type into a similar HTTP\n// response status. It is used by the Twirp server handler to set the HTTP\n// response status code. Returns 0 if the ErrorCode is invalid.\nfunc ServerHTTPStatusFromErrorCode(code ErrorCode) int {\n\tswitch code {\n\tcase Canceled:\n\t\treturn 408 // RequestTimeout\n\tcase Unknown:\n\t\treturn 500 // Internal Server Error\n\tcase InvalidArgument:\n\t\treturn 400 // BadRequest\n\tcase Malformed:\n\t\treturn 400 // BadRequest\n\tcase DeadlineExceeded:\n\t\treturn 408 // RequestTimeout\n\tcase NotFound:\n\t\treturn 404 // Not Found\n\tcase BadRoute:\n\t\treturn 404 // Not Found\n\tcase AlreadyExists:\n\t\treturn 409 // Conflict\n\tcase PermissionDenied:\n\t\treturn 403 // Forbidden\n\tcase Unauthenticated:\n\t\treturn 401 // Unauthorized\n\tcase ResourceExhausted:\n\t\treturn 429 // Too Many Requests\n\tcase FailedPrecondition:\n\t\treturn 412 // Precondition Failed\n\tcase Aborted:\n\t\treturn 409 // Conflict\n\tcase OutOfRange:\n\t\treturn 400 // Bad Request\n\tcase Unimplemented:\n\t\treturn 501 // Not Implemented\n\tcase Internal:\n\t\treturn 500 // Internal Server Error\n\tcase Unavailable:\n\t\treturn 503 // Service Unavailable\n\tcase DataLoss:\n\t\treturn 500 // Internal Server Error\n\tcase NoError:\n\t\treturn 200 // OK\n\tdefault:\n\t\treturn 0 // Invalid!\n\t}\n}\n\n// IsValidErrorCode returns true if is one of the valid predefined constants.\nfunc IsValidErrorCode(code ErrorCode) bool {\n\treturn ServerHTTPStatusFromErrorCode(code) != 0\n}\n\n// twirp.Error implementation\ntype twerr struct {\n\tcode ErrorCode\n\tmsg  string\n\tmeta map[string]string\n}\n\nfunc (e *twerr) Code() ErrorCode { return e.code }\nfunc (e *twerr) Msg() string     { return e.msg }\n\nfunc (e *twerr) Meta(key string) string {\n\tif e.meta != nil {\n\t\treturn e.meta[key] // also returns \"\" if key is not in meta map\n\t}\n\treturn \"\"\n}\n\nfunc (e *twerr) WithMeta(key string, value string) Error {\n\tnewErr := &twerr{\n\t\tcode: e.code,\n\t\tmsg:  e.msg,\n\t\tmeta: make(map[string]string, len(e.meta)),\n\t}\n\tfor k, v := range e.meta {\n\t\tnewErr.meta[k] = v\n\t}\n\tnewErr.meta[key] = value\n\treturn newErr\n}\n\nfunc (e *twerr) MetaMap() map[string]string {\n\treturn e.meta\n}\n\nfunc (e *twerr) Error() string {\n\treturn fmt.Sprintf(\"twirp error %s: %s\", e.code, e.msg)\n}\n\n// wrappedErr is the error returned by twirp.InternalErrorWith(err), which is used by clients.\n// Implements Unwrap() to allow go 1.13+ errors.Is/As checks,\n// and Cause() to allow (github.com/pkg/errors).Unwrap.\ntype wrappedErr struct {\n\twrapper Error\n\tcause   error\n}\n\nfunc (e *wrappedErr) Code() ErrorCode            { return e.wrapper.Code() }\nfunc (e *wrappedErr) Msg() string                { return e.wrapper.Msg() }\nfunc (e *wrappedErr) Meta(key string) string     { return e.wrapper.Meta(key) }\nfunc (e *wrappedErr) MetaMap() map[string]string { return e.wrapper.MetaMap() }\nfunc (e *wrappedErr) Error() string              { return e.wrapper.Error() }\nfunc (e *wrappedErr) WithMeta(key string, val string) Error {\n\treturn &wrappedErr{\n\t\twrapper: e.wrapper.WithMeta(key, val),\n\t\tcause:   e.cause,\n\t}\n}\nfunc (e *wrappedErr) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedErr) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware).\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) error {\n\tvar twerr Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = InternalErrorWith(err)\n\t}\n\n\tstatusCode := ServerHTTPStatusFromErrorCode(twerr.Code())\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\treturn writeErr\n\t}\n\treturn nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n"
  },
  {
    "path": "errors_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage twirp_test\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"net/http/httptest\"\n\t\"sync\"\n\t\"testing\"\n\n\tpkgerrors \"github.com/pkg/errors\"\n\t\"github.com/twitchtv/twirp\"\n)\n\nfunc TestErrorConstructors(t *testing.T) {\n\tvar twerr twirp.Error\n\terr := errors.New(\"The OG error\")\n\n\t// code.Error\n\n\ttwerr = twirp.NotFound.Error(\"oops\")\n\tassertTwirpError(t, twerr, twirp.NotFound, \"oops\")\n\n\t// code.Errorf\n\n\ttwerr = twirp.Aborted.Errorf(\"oops %d %s\", 11, \"times\")\n\tassertTwirpError(t, twerr, twirp.Aborted, \"oops 11 times\")\n\n\ttwerr = twirp.Internal.Errorf(\"oops: %w\", err)\n\tassertTwirpError(t, twerr, twirp.Internal, \"oops: The OG error\")\n\tif !errors.Is(twerr, err) {\n\t\tt.Errorf(\"expected wrap the original error\")\n\t}\n\n\t// twirp.NewError\n\n\ttwerr = twirp.NewError(twirp.NotFound, \"oops\")\n\tassertTwirpError(t, twerr, twirp.NotFound, \"oops\")\n\n\t// twirp.NewErrorf\n\n\ttwerr = twirp.NewErrorf(twirp.Aborted, \"oops %d %s\", 11, \"times\")\n\tassertTwirpError(t, twerr, twirp.Aborted, \"oops 11 times\")\n\n\ttwerr = twirp.NewErrorf(twirp.Internal, \"oops: %w\", err)\n\tassertTwirpError(t, twerr, twirp.Internal, \"oops: The OG error\")\n\tif !errors.Is(twerr, err) {\n\t\tt.Errorf(\"expected wrap the original error\")\n\t}\n\n\t// Convenience constructors\n\n\ttwerr = twirp.NotFoundError(\"oops\")\n\tassertTwirpError(t, twerr, twirp.NotFound, \"oops\")\n\n\ttwerr = twirp.InvalidArgumentError(\"my_arg\", \"is invalid\")\n\tassertTwirpError(t, twerr, twirp.InvalidArgument, \"my_arg is invalid\")\n\tassertTwirpErrorMeta(t, twerr, \"argument\", \"my_arg\")\n\n\ttwerr = twirp.RequiredArgumentError(\"my_arg\")\n\tassertTwirpError(t, twerr, twirp.InvalidArgument, \"my_arg is required\")\n\tassertTwirpErrorMeta(t, twerr, \"argument\", \"my_arg\")\n\n\ttwerr = twirp.InternalError(\"oops\")\n\tassertTwirpError(t, twerr, twirp.Internal, \"oops\")\n\n\ttwerr = twirp.InternalErrorf(\"oops: %w\", err)\n\tassertTwirpError(t, twerr, twirp.Internal, \"oops: The OG error\")\n\tif !errors.Is(twerr, err) {\n\t\tt.Errorf(\"expected wrap the original error\")\n\t}\n\n\ttwerr = twirp.InternalErrorWith(err)\n\tassertTwirpError(t, twerr, twirp.Internal, \"The OG error\")\n\tif !errors.Is(twerr, err) {\n\t\tt.Errorf(\"expected wrap the original error\")\n\t}\n\tassertTwirpErrorMeta(t, twerr, \"cause\", \"*errors.errorString\")\n}\n\nfunc TestWithMetaRaces(t *testing.T) {\n\terr := twirp.NewError(twirp.Internal, \"msg\")\n\terr = err.WithMeta(\"k1\", \"v1\")\n\n\tvar wg sync.WaitGroup\n\tfor i := 0; i < 1000; i++ {\n\t\twg.Add(1)\n\t\tgo func(i int) {\n\t\t\t_ = err.WithMeta(fmt.Sprintf(\"k-%d\", i), \"v\")\n\t\t\twg.Done()\n\t\t}(i)\n\t}\n\n\twg.Wait()\n\n\tif len(err.MetaMap()) != 1 {\n\t\tt.Errorf(\"err was mutated\")\n\t}\n}\n\nfunc TestPkgErrorCause(t *testing.T) {\n\trootCause := pkgerrors.New(\"this is only a test\")\n\ttwerr := twirp.InternalErrorWith(rootCause)\n\tcause := pkgerrors.Cause(twerr)\n\tif cause != rootCause {\n\t\tt.Errorf(\"got wrong cause for err. have=%q, want=%q\", cause, rootCause)\n\t}\n}\n\nfunc TestWrapError(t *testing.T) {\n\trootCause := errors.New(\"cause\")\n\ttwerr := twirp.NewError(twirp.NotFound, \"it ain't there\")\n\terr := twirp.WrapError(twerr, rootCause)\n\tcause := pkgerrors.Cause(err)\n\tif cause != rootCause {\n\t\tt.Errorf(\"got wrong cause. got=%q, want=%q\", cause, rootCause)\n\t}\n\twantMsg := \"twirp error not_found: it ain't there\"\n\tif gotMsg := err.Error(); gotMsg != wantMsg {\n\t\tt.Errorf(\"got wrong error text. got=%q, want=%q\", gotMsg, wantMsg)\n\t}\n}\n\ntype myError string\n\nfunc (e myError) Error() string {\n\treturn string(e)\n}\n\nfunc TestInternalErrorWith_Unwrap(t *testing.T) {\n\tmyErr := myError(\"myError\")\n\twrErr := fmt.Errorf(\"wrapped: %w\", myErr) // double wrap\n\ttwerr := twirp.InternalErrorWith(wrErr)\n\n\tif !errors.Is(twerr, myErr) {\n\t\tt.Errorf(\"expected errors.Is to match the error wrapped by twirp.InternalErrorWith\")\n\t}\n\n\tvar errTarget myError\n\tif !errors.As(twerr, &errTarget) {\n\t\tt.Errorf(\"expected errors.As to match the error wrapped by twirp.InternalErrorWith\")\n\t}\n\tif errTarget.Error() != myErr.Error() {\n\t\tt.Errorf(\"invalid value for errTarget.Error(). have=%q, want=%q\", errTarget.Error(), myErr.Error())\n\t}\n}\n\ntype errorResponseWriter struct {\n\t*httptest.ResponseRecorder\n}\n\nfunc (errorResponseWriter) Write([]byte) (int, error) {\n\treturn 0, errors.New(\"this is only a test\")\n}\n\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\nfunc TestWriteError(t *testing.T) {\n\tresp := httptest.NewRecorder()\n\ttwerr := twirp.NewError(twirp.Internal, \"test middleware error\")\n\terr := twirp.WriteError(resp, twerr)\n\tif err != nil {\n\t\tt.Errorf(\"got an error from WriteError when not expecting one: %s\", err)\n\t\treturn\n\t}\n\n\ttwerrCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tif resp.Code != twerrCode {\n\t\tt.Errorf(\"got wrong status. have=%d, want=%d\", resp.Code, twerrCode)\n\t\treturn\n\t}\n\n\tvar gotTwerrJSON twerrJSON\n\terr = json.NewDecoder(resp.Body).Decode(&gotTwerrJSON)\n\tif err != nil {\n\t\tt.Errorf(\"got an error decoding response body: %s\", err)\n\t\treturn\n\t}\n\n\tif twirp.ErrorCode(gotTwerrJSON.Code) != twerr.Code() {\n\t\tt.Errorf(\"got wrong error code. have=%s, want=%s\", gotTwerrJSON.Code, twerr.Code())\n\t\treturn\n\t}\n\n\tif gotTwerrJSON.Msg != twerr.Msg() {\n\t\tt.Errorf(\"got wrong error message. have=%s, want=%s\", gotTwerrJSON.Msg, twerr.Msg())\n\t\treturn\n\t}\n\n\terrResp := &errorResponseWriter{ResponseRecorder: resp}\n\n\t// Writing again should error out as headers are being rewritten\n\terr = twirp.WriteError(errResp, twerr)\n\tif err == nil {\n\t\tt.Errorf(\"did not get error on write. have=nil, want=some error\")\n\t}\n}\n\nfunc TestWriteError_WithNonTwirpError(t *testing.T) {\n\tresp := httptest.NewRecorder()\n\tnonTwerr := errors.New(\"not a twirp error\")\n\terr := twirp.WriteError(resp, nonTwerr)\n\tif err != nil {\n\t\tt.Errorf(\"got an error from WriteError when not expecting one: %s\", err)\n\t\treturn\n\t}\n\n\tif resp.Code != 500 {\n\t\tt.Errorf(\"got wrong status. have=%d, want=%d\", resp.Code, 500)\n\t\treturn\n\t}\n\n\tvar gotTwerrJSON twerrJSON\n\terr = json.NewDecoder(resp.Body).Decode(&gotTwerrJSON)\n\tif err != nil {\n\t\tt.Errorf(\"got an error decoding response body: %s\", err)\n\t\treturn\n\t}\n\n\tif twirp.ErrorCode(gotTwerrJSON.Code) != twirp.Internal {\n\t\tt.Errorf(\"got wrong error code. have=%s, want=%s\", gotTwerrJSON.Code, twirp.Internal)\n\t\treturn\n\t}\n\n\tif gotTwerrJSON.Msg != \"\"+nonTwerr.Error() {\n\t\tt.Errorf(\"got wrong error message. have=%s, want=%s\", gotTwerrJSON.Msg, nonTwerr.Error())\n\t\treturn\n\t}\n}\n\n// Test helpers\n\nfunc assertTwirpError(t *testing.T, twerr twirp.Error, code twirp.ErrorCode, msg string) {\n\tt.Helper()\n\tif twerr.Code() != code {\n\t\tt.Errorf(\"wrong code. have=%q, want=%q\", twerr.Code(), code)\n\t}\n\tif twerr.Msg() != msg {\n\t\tt.Errorf(\"wrong msg. have=%q, want=%q\", twerr.Msg(), msg)\n\t}\n}\n\nfunc assertTwirpErrorMeta(t *testing.T, twerr twirp.Error, key string, value string) {\n\tt.Helper()\n\tif twerr.Meta(key) != value {\n\t\tt.Errorf(\"wrong meta. have=%q, want=%q\", twerr.Meta(key), value)\n\t}\n}\n"
  },
  {
    "path": "example/cmd/client/main.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\n\t\"github.com/twitchtv/twirp\"\n\t\"github.com/twitchtv/twirp/example\"\n)\n\nfunc main() {\n\tclient := example.NewHaberdasherJSONClient(\"http://localhost:8080\", &http.Client{})\n\n\tvar (\n\t\that *example.Hat\n\t\terr error\n\t)\n\tfor i := 0; i < 5; i++ {\n\t\that, err = client.MakeHat(context.Background(), &example.Size{Inches: 12})\n\t\tif err != nil {\n\t\t\tif twerr, ok := err.(twirp.Error); ok {\n\t\t\t\tif twerr.Meta(\"retryable\") != \"\" {\n\t\t\t\t\t// Log the error and go again.\n\t\t\t\t\tlog.Printf(\"got error %q, retrying\", twerr)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\t// This was some fatal error!\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\tfmt.Printf(\"%+v\", hat)\n}\n"
  },
  {
    "path": "example/cmd/server/README.md",
    "content": "# twirp example server #\n\nThis binary is an example twirp server. It's meant mostly to be read\nand to be used in conjunction with the neighboring client binary.\n\nWhen a request is made, the server will log the statsd messages it\nwould have sent, so you'll see stuff like this:\n\n    -> % ./server\n    incr twirp.total.requests: 1 @ 1.000000\n    incr twirp.MakeHat.requests: 1 @ 1.000000\n    incr twirp.total.responses: 1 @ 1.000000\n    incr twirp.MakeHat.responses: 1 @ 1.000000\n    incr twirp.status_codes.total.200: 1 @ 1.000000\n    incr twirp.status_codes.MakeHat.200: 1 @ 1.000000\n    time twirp.all_methods.response: 370.695µs @ 1.000000\n    time twirp.MakeHat.response: 370.695µs @ 1.000000\n    time twirp.status_codes.all_methods.200: 370.695µs @ 1.000000\n    time twirp.status_codes.MakeHat.200: 370.695µs @ 1.000000\n"
  },
  {
    "path": "example/cmd/server/main.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"math/rand\"\n\t\"net/http\"\n\t\"os\"\n\n\t\"github.com/twitchtv/twirp\"\n\t\"github.com/twitchtv/twirp/example\"\n\t\"github.com/twitchtv/twirp/hooks/statsd\"\n)\n\ntype randomHaberdasher struct{}\n\nfunc (h *randomHaberdasher) MakeHat(ctx context.Context, size *example.Size) (*example.Hat, error) {\n\tif size.Inches <= 0 {\n\t\treturn nil, twirp.InvalidArgumentError(\"Inches\", \"I can't make a hat that small!\")\n\t}\n\tcolors := []string{\"white\", \"black\", \"brown\", \"red\", \"blue\"}\n\tnames := []string{\"bowler\", \"baseball cap\", \"top hat\", \"derby\"}\n\treturn &example.Hat{\n\t\tSize:  size.Inches,\n\t\tColor: colors[rand.Intn(len(colors))],\n\t\tName:  names[rand.Intn(len(names))],\n\t}, nil\n}\n\nfunc main() {\n\thook := statsd.NewStatsdServerHooks(LoggingStatter{os.Stderr})\n\tserver := example.NewHaberdasherServer(&randomHaberdasher{}, hook)\n\tlog.Fatal(http.ListenAndServe(\":8080\", server))\n}\n"
  },
  {
    "path": "example/cmd/server/statter.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"time\"\n)\n\ntype LoggingStatter struct {\n\tio.Writer\n}\n\nfunc (ls LoggingStatter) Inc(metric string, val int64, rate float32) error {\n\t_, err := fmt.Fprintf(ls, \"incr %s: %d @ %f\\n\", metric, val, rate)\n\treturn err\n}\n\nfunc (ls LoggingStatter) TimingDuration(metric string, val time.Duration, rate float32) error {\n\t_, err := fmt.Fprintf(ls, \"time %s: %s @ %f\\n\", metric, val, rate)\n\treturn err\n}\n"
  },
  {
    "path": "example/gen.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage example\n\n//go:generate protoc --go_out=paths=source_relative:. --twirp_out=paths=source_relative:. service.proto\n"
  },
  {
    "path": "example/service.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: service.proto\n\npackage example\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\n// A Hat is a piece of headwear made by a Haberdasher.\ntype Hat struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// The size of a hat should always be in inches.\n\tSize int32 `protobuf:\"varint,1,opt,name=size,proto3\" json:\"size,omitempty\"`\n\t// The color of a hat will never be 'invisible', but other than\n\t// that, anything is fair game.\n\tColor string `protobuf:\"bytes,2,opt,name=color,proto3\" json:\"color,omitempty\"`\n\t// The name of a hat is it's type. Like, 'bowler', or something.\n\tName string `protobuf:\"bytes,3,opt,name=name,proto3\" json:\"name,omitempty\"`\n}\n\nfunc (x *Hat) Reset() {\n\t*x = Hat{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_service_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Hat) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Hat) ProtoMessage() {}\n\nfunc (x *Hat) ProtoReflect() protoreflect.Message {\n\tmi := &file_service_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Hat.ProtoReflect.Descriptor instead.\nfunc (*Hat) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{0}\n}\n\nfunc (x *Hat) GetSize() int32 {\n\tif x != nil {\n\t\treturn x.Size\n\t}\n\treturn 0\n}\n\nfunc (x *Hat) GetColor() string {\n\tif x != nil {\n\t\treturn x.Color\n\t}\n\treturn \"\"\n}\n\nfunc (x *Hat) GetName() string {\n\tif x != nil {\n\t\treturn x.Name\n\t}\n\treturn \"\"\n}\n\n// Size is passed when requesting a new hat to be made. It's always\n// measured in inches.\ntype Size struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tInches int32 `protobuf:\"varint,1,opt,name=inches,proto3\" json:\"inches,omitempty\"`\n}\n\nfunc (x *Size) Reset() {\n\t*x = Size{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_service_proto_msgTypes[1]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Size) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Size) ProtoMessage() {}\n\nfunc (x *Size) ProtoReflect() protoreflect.Message {\n\tmi := &file_service_proto_msgTypes[1]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Size.ProtoReflect.Descriptor instead.\nfunc (*Size) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{1}\n}\n\nfunc (x *Size) GetInches() int32 {\n\tif x != nil {\n\t\treturn x.Inches\n\t}\n\treturn 0\n}\n\nvar File_service_proto protoreflect.FileDescriptor\n\nvar file_service_proto_rawDesc = []byte{\n\t0x0a, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,\n\t0x14, 0x74, 0x77, 0x69, 0x74, 0x63, 0x68, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x65, 0x78,\n\t0x61, 0x6d, 0x70, 0x6c, 0x65, 0x22, 0x43, 0x0a, 0x03, 0x48, 0x61, 0x74, 0x12, 0x12, 0x0a, 0x04,\n\t0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65,\n\t0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,\n\t0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03,\n\t0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x1e, 0x0a, 0x04, 0x53, 0x69,\n\t0x7a, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01,\n\t0x28, 0x05, 0x52, 0x06, 0x69, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x32, 0x4f, 0x0a, 0x0b, 0x48, 0x61,\n\t0x62, 0x65, 0x72, 0x64, 0x61, 0x73, 0x68, 0x65, 0x72, 0x12, 0x40, 0x0a, 0x07, 0x4d, 0x61, 0x6b,\n\t0x65, 0x48, 0x61, 0x74, 0x12, 0x1a, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x63, 0x68, 0x2e, 0x74, 0x77,\n\t0x69, 0x72, 0x70, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x53, 0x69, 0x7a, 0x65,\n\t0x1a, 0x19, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x63, 0x68, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e,\n\t0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x48, 0x61, 0x74, 0x42, 0x0a, 0x5a, 0x08, 0x2f,\n\t0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar (\n\tfile_service_proto_rawDescOnce sync.Once\n\tfile_service_proto_rawDescData = file_service_proto_rawDesc\n)\n\nfunc file_service_proto_rawDescGZIP() []byte {\n\tfile_service_proto_rawDescOnce.Do(func() {\n\t\tfile_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_proto_rawDescData)\n\t})\n\treturn file_service_proto_rawDescData\n}\n\nvar file_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2)\nvar file_service_proto_goTypes = []interface{}{\n\t(*Hat)(nil),  // 0: twitch.twirp.example.Hat\n\t(*Size)(nil), // 1: twitch.twirp.example.Size\n}\nvar file_service_proto_depIdxs = []int32{\n\t1, // 0: twitch.twirp.example.Haberdasher.MakeHat:input_type -> twitch.twirp.example.Size\n\t0, // 1: twitch.twirp.example.Haberdasher.MakeHat:output_type -> twitch.twirp.example.Hat\n\t1, // [1:2] is the sub-list for method output_type\n\t0, // [0:1] 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_service_proto_init() }\nfunc file_service_proto_init() {\n\tif File_service_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Hat); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Size); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_service_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   2,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_service_proto_goTypes,\n\t\tDependencyIndexes: file_service_proto_depIdxs,\n\t\tMessageInfos:      file_service_proto_msgTypes,\n\t}.Build()\n\tFile_service_proto = out.File\n\tfile_service_proto_rawDesc = nil\n\tfile_service_proto_goTypes = nil\n\tfile_service_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "example/service.proto",
    "content": "syntax = \"proto3\";\n\npackage twitch.twirp.example;\noption go_package = \"/example\";\n\n// A Hat is a piece of headwear made by a Haberdasher.\nmessage Hat {\n  // The size of a hat should always be in inches.\n  int32 size = 1;\n\n  // The color of a hat will never be 'invisible', but other than\n  // that, anything is fair game.\n  string color = 2;\n\n  // The name of a hat is it's type. Like, 'bowler', or something.\n  string name = 3;\n}\n\n// Size is passed when requesting a new hat to be made. It's always\n// measured in inches.\nmessage Size {\n  int32 inches = 1;\n}\n\n// A Haberdasher makes hats for clients.\nservice Haberdasher {\n  // MakeHat produces a hat of mysterious, randomly-selected color!\n  rpc MakeHat(Size) returns (Hat);\n}\n"
  },
  {
    "path": "example/service.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: service.proto\n\npackage example\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// =====================\n// Haberdasher Interface\n// =====================\n\n// A Haberdasher makes hats for clients.\ntype Haberdasher interface {\n\t// MakeHat produces a hat of mysterious, randomly-selected color!\n\tMakeHat(context.Context, *Size) (*Hat, error)\n}\n\n// ===========================\n// Haberdasher Protobuf Client\n// ===========================\n\ntype haberdasherProtobufClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewHaberdasherProtobufClient creates a Protobuf client that implements the Haberdasher interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewHaberdasherProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Haberdasher {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twitch.twirp.example\", \"Haberdasher\")\n\turls := [1]string{\n\t\tserviceURL + \"MakeHat\",\n\t}\n\n\treturn &haberdasherProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *haberdasherProtobufClient) MakeHat(ctx context.Context, in *Size) (*Hat, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twitch.twirp.example\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Haberdasher\")\n\tctx = ctxsetters.WithMethodName(ctx, \"MakeHat\")\n\tcaller := c.callMakeHat\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Size) (*Hat, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Size)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Size) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callMakeHat(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Hat)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Hat) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *haberdasherProtobufClient) callMakeHat(ctx context.Context, in *Size) (*Hat, error) {\n\tout := new(Hat)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// =======================\n// Haberdasher JSON Client\n// =======================\n\ntype haberdasherJSONClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewHaberdasherJSONClient creates a JSON client that implements the Haberdasher interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewHaberdasherJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Haberdasher {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twitch.twirp.example\", \"Haberdasher\")\n\turls := [1]string{\n\t\tserviceURL + \"MakeHat\",\n\t}\n\n\treturn &haberdasherJSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *haberdasherJSONClient) MakeHat(ctx context.Context, in *Size) (*Hat, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twitch.twirp.example\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Haberdasher\")\n\tctx = ctxsetters.WithMethodName(ctx, \"MakeHat\")\n\tcaller := c.callMakeHat\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Size) (*Hat, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Size)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Size) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callMakeHat(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Hat)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Hat) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *haberdasherJSONClient) callMakeHat(ctx context.Context, in *Size) (*Hat, error) {\n\tout := new(Hat)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ==========================\n// Haberdasher Server Handler\n// ==========================\n\ntype haberdasherServer struct {\n\tHaberdasher\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewHaberdasherServer builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewHaberdasherServer(svc Haberdasher, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &haberdasherServer{\n\t\tHaberdasher:      svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *haberdasherServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *haberdasherServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// HaberdasherPathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst HaberdasherPathPrefix = \"/twirp/twitch.twirp.example.Haberdasher/\"\n\nfunc (s *haberdasherServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"twitch.twirp.example\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Haberdasher\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"twitch.twirp.example.Haberdasher\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"MakeHat\":\n\t\ts.serveMakeHat(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *haberdasherServer) serveMakeHat(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveMakeHatJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveMakeHatProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *haberdasherServer) serveMakeHatJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"MakeHat\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(Size)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.Haberdasher.MakeHat\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Size) (*Hat, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Size)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Size) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Haberdasher.MakeHat(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Hat)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Hat) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Hat\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Hat and nil error while calling MakeHat. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *haberdasherServer) serveMakeHatProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"MakeHat\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(Size)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.Haberdasher.MakeHat\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Size) (*Hat, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Size)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Size) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Haberdasher.MakeHat(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Hat)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Hat) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Hat\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Hat and nil error while calling MakeHat. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *haberdasherServer) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *haberdasherServer) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *haberdasherServer) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"twitch.twirp.example\", \"Haberdasher\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 186 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2d, 0x4e, 0x2d, 0x2a,\n\t0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x29, 0x29, 0xcf, 0x2c, 0x49,\n\t0xce, 0xd0, 0x2b, 0x29, 0xcf, 0x2c, 0x2a, 0xd0, 0x4b, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x55,\n\t0x72, 0xe6, 0x62, 0xf6, 0x48, 0x2c, 0x11, 0x12, 0xe2, 0x62, 0x29, 0xce, 0xac, 0x4a, 0x95, 0x60,\n\t0x54, 0x60, 0xd4, 0x60, 0x0d, 0x02, 0xb3, 0x85, 0x44, 0xb8, 0x58, 0x93, 0xf3, 0x73, 0xf2, 0x8b,\n\t0x24, 0x98, 0x14, 0x18, 0x35, 0x38, 0x83, 0x20, 0x1c, 0x90, 0xca, 0xbc, 0xc4, 0xdc, 0x54, 0x09,\n\t0x66, 0xb0, 0x20, 0x98, 0xad, 0x24, 0xc7, 0xc5, 0x12, 0x0c, 0xd2, 0x21, 0xc6, 0xc5, 0x96, 0x99,\n\t0x97, 0x9c, 0x91, 0x5a, 0x0c, 0x35, 0x07, 0xca, 0x33, 0xf2, 0xe7, 0xe2, 0xf6, 0x48, 0x4c, 0x4a,\n\t0x2d, 0x4a, 0x49, 0x2c, 0xce, 0x48, 0x2d, 0x12, 0x72, 0xe0, 0x62, 0xf7, 0x4d, 0xcc, 0x4e, 0x05,\n\t0xd9, 0x2b, 0xa5, 0x87, 0xcd, 0x55, 0x7a, 0x20, 0xd3, 0xa4, 0x24, 0xb1, 0xcb, 0x79, 0x24, 0x96,\n\t0x38, 0x71, 0x45, 0x71, 0xe8, 0x43, 0xf9, 0x49, 0x6c, 0x60, 0xef, 0x19, 0x03, 0x02, 0x00, 0x00,\n\t0xff, 0xff, 0x02, 0x7a, 0x15, 0x14, 0xef, 0x00, 0x00, 0x00,\n}\n"
  },
  {
    "path": "hooks/statsd/statsd.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage statsd\n\nimport (\n\t\"context\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/twitchtv/twirp\"\n)\n\nvar reqStartTimestampKey = new(int)\n\nfunc markReqStart(ctx context.Context) context.Context {\n\treturn context.WithValue(ctx, reqStartTimestampKey, time.Now())\n}\n\nfunc getReqStart(ctx context.Context) (time.Time, bool) {\n\tt, ok := ctx.Value(reqStartTimestampKey).(time.Time)\n\treturn t, ok\n}\n\ntype Statter interface {\n\tInc(metric string, val int64, rate float32) error\n\tTimingDuration(metric string, val time.Duration, rate float32) error\n}\n\n// NewStatsdServerHooks provides a twirp.ServerHooks struct which\n// sends data to statsd.\nfunc NewStatsdServerHooks(stats Statter) *twirp.ServerHooks {\n\thooks := &twirp.ServerHooks{}\n\t// RequestReceived: inc twirp.total.req_recv\n\thooks.RequestReceived = func(ctx context.Context) (context.Context, error) {\n\t\tctx = markReqStart(ctx)\n\t\tstats.Inc(\"twirp.total.requests\", 1, 1.0)\n\t\treturn ctx, nil\n\t}\n\n\t// RequestRouted: inc twirp.<method>.req_recv\n\thooks.RequestRouted = func(ctx context.Context) (context.Context, error) {\n\t\tmethod, ok := twirp.MethodName(ctx)\n\t\tif !ok {\n\t\t\treturn ctx, nil\n\t\t}\n\t\tstats.Inc(\"twirp.\"+sanitize(method)+\".requests\", 1, 1.0)\n\t\treturn ctx, nil\n\t}\n\n\t// ResponseSent:\n\t// - inc twirp.total.responses\n\t// - inc twirp.<method>.responses\n\t// - inc twirp.status_codes.total.<code>\n\t// - inc twirp.status_codes.<method>.<code>\n\t// - time twirp.all_methods.response\n\t// - time twirp.<method>.response\n\t// - time twirp.status_codes.all_methods.<code>\n\t// - time twirp.status_codes.<method>.<code>\n\thooks.ResponseSent = func(ctx context.Context) {\n\t\t// Three pieces of data to get, none are guaranteed to be present:\n\t\t// - time that the request started\n\t\t// - method that was called\n\t\t// - status code of response\n\t\tvar (\n\t\t\tstart  time.Time\n\t\t\tmethod string\n\t\t\tstatus string\n\n\t\t\thaveStart  bool\n\t\t\thaveMethod bool\n\t\t\thaveStatus bool\n\t\t)\n\n\t\tstart, haveStart = getReqStart(ctx)\n\t\tmethod, haveMethod = twirp.MethodName(ctx)\n\t\tstatus, haveStatus = twirp.StatusCode(ctx)\n\n\t\tmethod = sanitize(method)\n\t\tstatus = sanitize(status)\n\n\t\tstats.Inc(\"twirp.total.responses\", 1, 1.0)\n\n\t\tif haveMethod {\n\t\t\tstats.Inc(\"twirp.\"+method+\".responses\", 1, 1.0)\n\t\t}\n\t\tif haveStatus {\n\t\t\tstats.Inc(\"twirp.status_codes.total.\"+status, 1, 1.0)\n\t\t}\n\t\tif haveMethod && haveStatus {\n\t\t\tstats.Inc(\"twirp.status_codes.\"+method+\".\"+status, 1, 1.0)\n\t\t}\n\n\t\tif haveStart {\n\t\t\tdur := time.Now().Sub(start)\n\t\t\tstats.TimingDuration(\"twirp.all_methods.response\", dur, 1.0)\n\n\t\t\tif haveMethod {\n\t\t\t\tstats.TimingDuration(\"twirp.\"+method+\".response\", dur, 1.0)\n\t\t\t}\n\t\t\tif haveStatus {\n\t\t\t\tstats.TimingDuration(\"twirp.status_codes.all_methods.\"+status, dur, 1.0)\n\t\t\t}\n\t\t\tif haveMethod && haveStatus {\n\t\t\t\tstats.TimingDuration(\"twirp.status_codes.\"+method+\".\"+status, dur, 1.0)\n\t\t\t}\n\t\t}\n\t}\n\treturn hooks\n}\n\nfunc sanitize(s string) string {\n\treturn strings.Map(sanitizeRune, s)\n}\n\nfunc sanitizeRune(r rune) rune {\n\tswitch {\n\tcase 'a' <= r && r <= 'z':\n\t\treturn r\n\tcase '0' <= r && r <= '9':\n\t\treturn r\n\tcase 'A' <= r && r <= 'Z':\n\t\treturn r\n\tdefault:\n\t\treturn '_'\n\t}\n}\n"
  },
  {
    "path": "hooks/statsd/statsd_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage statsd\n\nimport (\n\t\"context\"\n\t\"net/http/httptest\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/twitchtv/twirp\"\n\t\"github.com/twitchtv/twirp/internal/twirptest\"\n)\n\nfunc TestSanitize(t *testing.T) {\n\ttype test struct {\n\t\tin   string\n\t\twant string\n\t}\n\tcases := []test{\n\t\t{\"\", \"\"},\n\t\t{\"SomeString\", \"SomeString\"},\n\t\t{\"with whitespace\", \"with_whitespace\"},\n\t\t{\"with.punctuation\", \"with_punctuation\"},\n\t\t{\"with世界unicode\", \"with__unicode\"},\n\t\t{\"with123numbers\", \"with123numbers\"},\n\t}\n\tfor _, c := range cases {\n\t\thave := sanitize(c.in)\n\t\tif have != c.want {\n\t\t\tt.Errorf(\"in=%q  have=%q  want=%q\", c.in, have, c.want)\n\t\t}\n\t}\n}\n\nfunc TestTimingHooks(t *testing.T) {\n\tstatter := &fakeStatter{}\n\thooks := NewStatsdServerHooks(statter)\n\n\tserver, client := serverAndClient(hooks)\n\tdefer server.Close()\n\n\t_, err := client.MakeHat(context.Background(), &twirptest.Size{})\n\tif err != nil {\n\t\tt.Fatalf(\"twirptest Client err=%q\", err)\n\t}\n\n\texpectedIncrements := []string{\n\t\t\"twirp.total.requests\",\n\t\t\"twirp.MakeHat.requests\",\n\t\t\"twirp.total.responses\",\n\t\t\"twirp.MakeHat.responses\",\n\t\t\"twirp.status_codes.total.200\",\n\t\t\"twirp.status_codes.MakeHat.200\",\n\t}\n\tfor _, inc := range expectedIncrements {\n\t\tif !statter.receivedInc(inc) {\n\t\t\tt.Errorf(\"statter did not receive increment %q\", inc)\n\t\t}\n\t}\n\texpectedTimers := []string{\n\t\t\"twirp.all_methods.response\",\n\t\t\"twirp.MakeHat.response\",\n\t\t\"twirp.status_codes.all_methods.200\",\n\t\t\"twirp.status_codes.MakeHat.200\",\n\t}\n\tfor _, tim := range expectedTimers {\n\t\tif !statter.receivedTiming(tim) {\n\t\t\tt.Errorf(\"statter did not receive timing %q\", tim)\n\t\t}\n\t}\n}\n\nfunc serverAndClient(hooks *twirp.ServerHooks) (*httptest.Server, twirptest.Haberdasher) {\n\treturn twirptest.ServerAndClient(twirptest.NoopHatmaker(), hooks)\n}\n\ntype increment struct {\n\tmetric string\n\tval    int64\n\trate   float32\n}\n\ntype timing struct {\n\tmetric string\n\tval    time.Duration\n\trate   float32\n}\n\ntype fakeStatter struct {\n\tincs  []increment\n\ttimes []timing\n}\n\nfunc (s *fakeStatter) Inc(metric string, val int64, rate float32) error {\n\ts.incs = append(s.incs, increment{metric, val, rate})\n\treturn nil\n}\nfunc (s *fakeStatter) TimingDuration(metric string, val time.Duration, rate float32) error {\n\ts.times = append(s.times, timing{metric, val, rate})\n\treturn nil\n}\n\nfunc (s *fakeStatter) receivedInc(metric string) bool {\n\tfor _, i := range s.incs {\n\t\tif i.metric == metric {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunc (s *fakeStatter) receivedTiming(metric string) bool {\n\tfor _, t := range s.times {\n\t\tif t.metric == metric {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n"
  },
  {
    "path": "interceptors.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\npackage twirp\n\nimport (\n\t\"context\"\n)\n\n// Interceptor is a form of middleware for Twirp requests, that can be installed on both\n// clients and servers. To intercept RPC calls in the client, use the option\n// `twirp.WithClientInterceptors` on the client constructor. To intercept RPC calls in the server,\n// use the option `twirp.WithServerInterceptors` on the server constructor.\n//\n// Just like http middleware, interceptors can mutate requests and responses.\n// This can enable some powerful integrations, but it should be used with much care\n// because it may result in code that is very hard to debug.\n//\n// Example of an interceptor that logs every request and response:\n//\n//   func LogInterceptor(l *log.Logger) twirp.Interceptor {\n//     return func(next twirp.Method) twirp.Method {\n//       return func(ctx context.Context, req interface{}) (interface{}, error) {\n//         l.Printf(\"Service: %s, Method: %s, Request: %v\",\n//             twirp.ServiceName(ctx), twirp.MethodName(ctx), req)\n//         resp, err := next(ctx, req)\n//         l.Printf(\"Response: %v, Error: %v\", resp)\n//         return resp, err\n//       }\n//     }\n//   }\n//\ntype Interceptor func(Method) Method\n\n// Method is a generic representation of a Twirp-generated RPC method.\n// It is used to define Interceptors.\ntype Method func(ctx context.Context, request interface{}) (interface{}, error)\n\n// ChainInterceptors chains multiple Interceptors into a single Interceptor.\n// The first interceptor wraps the second one, and so on.\n// Returns nil if interceptors is empty. Nil interceptors are ignored.\nfunc ChainInterceptors(interceptors ...Interceptor) Interceptor {\n\tfiltered := make([]Interceptor, 0, len(interceptors))\n\tfor _, interceptor := range interceptors {\n\t\tif interceptor != nil {\n\t\t\tfiltered = append(filtered, interceptor)\n\t\t}\n\t}\n\tswitch n := len(filtered); n {\n\tcase 0:\n\t\treturn nil\n\tcase 1:\n\t\treturn filtered[0]\n\tdefault:\n\t\tfirst := filtered[0]\n\t\treturn func(next Method) Method {\n\t\t\tfor i := len(filtered) - 1; i > 0; i-- {\n\t\t\t\tnext = filtered[i](next)\n\t\t\t}\n\t\t\treturn first(next)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "interceptors_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\npackage twirp\n\nimport (\n\t\"context\"\n\t\"testing\"\n)\n\nfunc TestChainInterceptors(t *testing.T) {\n\tif chain := ChainInterceptors(); chain != nil {\n\t\tt.Errorf(\"ChainInterceptors(0) expected to be nil, but was %v\", chain)\n\t}\n\tif chain := ChainInterceptors(nil); chain != nil {\n\t\tt.Errorf(\"ChainInterceptors(0) expected to be nil, but was %v\", chain)\n\t}\n\tif chain := ChainInterceptors(nil, nil); chain != nil {\n\t\tt.Errorf(\"ChainInterceptors(0) expected to be nil, but was %v\", chain)\n\t}\n\n\tinterceptor1 := func(next Method) Method {\n\t\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t\tresponse, err := next(ctx, request.(string)+\"a\")\n\t\t\treturn response.(string) + \"1\", err\n\t\t}\n\t}\n\tinterceptor2 := func(next Method) Method {\n\t\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t\tresponse, err := next(ctx, request.(string)+\"b\")\n\t\t\treturn response.(string) + \"2\", err\n\t\t}\n\t}\n\tinterceptor3 := func(next Method) Method {\n\t\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t\tresponse, err := next(ctx, request.(string)+\"c\")\n\t\t\treturn response.(string) + \"3\", err\n\t\t}\n\t}\n\tmethod := func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treturn request.(string) + \"x\", nil\n\t}\n\tfor _, testCase := range []struct {\n\t\tinterceptors []Interceptor\n\t\twant         string\n\t}{\n\t\t{\n\t\t\tinterceptors: []Interceptor{interceptor1},\n\t\t\twant:         \"ax1\",\n\t\t},\n\t\t{\n\t\t\tinterceptors: []Interceptor{interceptor1, interceptor2},\n\t\t\twant:         \"abx21\",\n\t\t},\n\t\t{\n\t\t\tinterceptors: []Interceptor{interceptor1, interceptor2, interceptor3},\n\t\t\twant:         \"abcx321\",\n\t\t},\n\t\t{\n\t\t\tinterceptors: []Interceptor{interceptor1, interceptor2, nil, interceptor3},\n\t\t\twant:         \"abcx321\",\n\t\t},\n\t\t{\n\t\t\tinterceptors: []Interceptor{interceptor1, interceptor1, interceptor1},\n\t\t\twant:         \"aaax111\",\n\t\t},\n\t} {\n\t\tresponse, err := ChainInterceptors(testCase.interceptors...)(method)(context.Background(), \"\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"ChainInterceptors(%d) method has unexpected err %v\", len(testCase.interceptors), err)\n\t\t}\n\t\tif response != testCase.want {\n\t\t\tt.Errorf(\"ChainInterceptors(%d) has unexpected value, have=%v, want=%v\", len(testCase.interceptors), response, testCase.want)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "internal/contextkeys/keys.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\n// Package contextkeys stores the keys to the context accessor\n// functions, letting generated code safely set values in contexts\n// without exposing the setters to the outside world.\npackage contextkeys\n\ntype contextKey int\n\nconst (\n\tMethodNameKey contextKey = 1 + iota\n\tServiceNameKey\n\tPackageNameKey\n\tStatusCodeKey\n\tRequestHeaderKey\n\tResponseWriterKey\n)\n"
  },
  {
    "path": "internal/descriptors/descriptors.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\n// package descriptors provides tools for manipulating and inspecting protobuf\n// descriptors.\npackage descriptors\n\nimport (\n\t\"bytes\"\n\t\"compress/gzip\"\n\t\"io\"\n\n\t\"google.golang.org/protobuf/proto\"\n\tprotobuf \"google.golang.org/protobuf/types/descriptorpb\"\n\n\t\"github.com/pkg/errors\"\n)\n\n// UnpackFile reads gz as a gzipped, protobuf-encoded FileDescriptorProto. This\n// is the format used to store descriptors in protoc-gen-go and\n// protoc-gen-twirp.\nfunc UnpackFile(gz []byte) (*protobuf.FileDescriptorProto, error) {\n\tr, err := gzip.NewReader(bytes.NewReader(gz))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to open gzip reader\")\n\t}\n\tdefer r.Close()\n\n\tb, err := io.ReadAll(r)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to uncompress descriptor\")\n\t}\n\n\tfd := new(protobuf.FileDescriptorProto)\n\tif err := proto.Unmarshal(b, fd); err != nil {\n\t\treturn nil, errors.Wrap(err, \"malformed FileDescriptorProto\")\n\t}\n\n\treturn fd, nil\n}\n\n// A DescribableMessage provides a gzipped, protobuf-encoded\n// FileDescriptorProto, and a series of ints which index into the File to\n// provide the address of a DescriptorProto describing a message.\n//\n// This interface should be fulfilled by any message structs generated by\n// protoc-gen-go.\ntype DescribableMessage interface {\n\tDescriptor() ([]byte, []int)\n}\n\n// MessageDescriptor returns the DescriptorProto describing a message value, and\n// the FileDescriptorProto in which the message is defined.\nfunc MessageDescriptor(msg DescribableMessage) (*protobuf.FileDescriptorProto, *protobuf.DescriptorProto, error) {\n\tgz, path := msg.Descriptor()\n\tfd, err := UnpackFile(gz)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"unable to unpack gzipped descriptor\")\n\t}\n\n\td, err := MessageInFile(fd, path)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"unable to find message\")\n\t}\n\treturn fd, d, nil\n}\n\n// MessageInFile finds a message in fd using the given path as an address.\nfunc MessageInFile(fd *protobuf.FileDescriptorProto, path []int) (*protobuf.DescriptorProto, error) {\n\tif path[0] > len(fd.MessageType) {\n\t\treturn nil, errors.Errorf(\"message index %d out of bounds on file\", path[0])\n\t}\n\td := fd.MessageType[path[0]]\n\tfor _, i := range path[1:] {\n\t\tif i < 0 || i > len(d.NestedType) {\n\t\t\treturn nil, errors.Errorf(\"nested message index %d out of bounds on type %q\", i, d.GetName())\n\t\t}\n\t\td = d.NestedType[i]\n\t}\n\treturn d, nil\n\n}\n\n// A DescribableEnum provides a gzipped, protobuf-encoded FileDescriptorProto,\n// and a series of ints which index into the File to provide the address of an\n// EnumDescriptorProto describing an enum.\n//\n// This interface should be fulfilled by any enums generated by protoc-gen-go.\ntype DescribableEnum interface {\n\tEnumDescriptor() ([]byte, []int)\n}\n\n// EnumDescriptor returns the EnumDescriptorProto describing an enum value, and\n// the FileDescriptorProto in which the enum is defined.\nfunc EnumDescriptor(enum DescribableEnum) (*protobuf.FileDescriptorProto, *protobuf.EnumDescriptorProto, error) {\n\tgz, path := enum.EnumDescriptor()\n\tfd, err := UnpackFile(gz)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"unable to unpack gzipped descriptor\")\n\t}\n\ted, err := EnumInFile(fd, path)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"unable to find enum\")\n\t}\n\treturn fd, ed, nil\n}\n\n// EnumInFile uses the given path to find an enum in the given file.\nfunc EnumInFile(fd *protobuf.FileDescriptorProto, path []int) (*protobuf.EnumDescriptorProto, error) {\n\tif len(path) == 1 {\n\t\t// This is an enum declared at the top level of a file.\n\t\tif path[0] < 0 || path[0] > len(fd.EnumType) {\n\t\t\treturn nil, errors.Errorf(\"enum index %d out of bounds on file\", path[0])\n\t\t}\n\t\treturn fd.EnumType[path[0]], nil\n\t}\n\n\t// This is an enum declared inside a message. We need to find the message, and\n\t// then the enum within it.\n\t//\n\t// The last element of the path will be the index of the enum inside a message\n\t// descriptor's EnumType slice. Everything before that indexes us through\n\t// messages.\n\tmsgPath := path[0 : len(path)-1]\n\tmd, err := MessageInFile(fd, msgPath)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to find enum inside message\")\n\t}\n\tenumIdx := path[len(path)-1]\n\tif enumIdx < 0 || enumIdx > len(md.EnumType) {\n\t\treturn nil, errors.Errorf(\"enum index %d out of bounds on message type %q\", enumIdx, md.GetName())\n\t}\n\treturn md.EnumType[enumIdx], nil\n}\n\n// A DescribableService provides a gzipped, protobuf-encoded\n// FileDescriptorProto, and an int which indexes into the File to provide the\n// address of a ServiceDescriptorProto describing a service.\n//\n// This interface should be fulfilled by any servers generated by\n// protoc-gen-twirp.\ntype DescribableService interface {\n\tServiceDescriptor() ([]byte, int)\n}\n\n// ServiceDescriptor returns the ServiceDescriptorProto describing a service\n// value, and the FileDescriptorProto in which the service is defined.\nfunc ServiceDescriptor(svc DescribableService) (*protobuf.FileDescriptorProto, *protobuf.ServiceDescriptorProto, error) {\n\tgz, idx := svc.ServiceDescriptor()\n\tfd, err := UnpackFile(gz)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"unable to unpack gzipped descriptor\")\n\t}\n\n\tsd, err := ServiceInFile(fd, idx)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"unable to find service\")\n\t}\n\n\treturn fd, sd, nil\n}\n\n// ServiceInFile uses the given index to find the service within the given\n// FileDescriptorProto.\nfunc ServiceInFile(fd *protobuf.FileDescriptorProto, index int) (*protobuf.ServiceDescriptorProto, error) {\n\tif index > len(fd.Service) {\n\t\treturn nil, errors.Errorf(\"service index %d out of bounds on file\", index)\n\t}\n\treturn fd.Service[index], nil\n}\n"
  },
  {
    "path": "internal/gen/logging.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage gen\n\nimport (\n\t\"log\"\n\t\"os\"\n\t\"strings\"\n)\n\nfunc Fail(msgs ...string) {\n\ts := strings.Join(msgs, \" \")\n\tlog.Print(\"error:\", s)\n\tos.Exit(1)\n}\n\nfunc Error(err error, msgs ...string) {\n\ts := strings.Join(msgs, \" \") + \":\" + err.Error()\n\tlog.Print(\"error:\", s)\n\tos.Exit(1)\n}\n"
  },
  {
    "path": "internal/gen/main.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage gen\n\nimport (\n\t\"io\"\n\t\"os\"\n\n\t\"google.golang.org/protobuf/proto\"\n\tdescriptor \"google.golang.org/protobuf/types/descriptorpb\"\n\tplugin \"google.golang.org/protobuf/types/pluginpb\"\n)\n\ntype Generator interface {\n\tGenerate(in *plugin.CodeGeneratorRequest) *plugin.CodeGeneratorResponse\n}\n\nfunc Main(g Generator) {\n\treq := readGenRequest(os.Stdin)\n\tresp := g.Generate(req)\n\twriteResponse(os.Stdout, resp)\n}\n\nfunc FilesToGenerate(req *plugin.CodeGeneratorRequest) []*descriptor.FileDescriptorProto {\n\tgenFiles := make([]*descriptor.FileDescriptorProto, 0)\nOuter:\n\tfor _, name := range req.FileToGenerate {\n\t\tfor _, f := range req.ProtoFile {\n\t\t\tif f.GetName() == name {\n\t\t\t\tgenFiles = append(genFiles, f)\n\t\t\t\tcontinue Outer\n\t\t\t}\n\t\t}\n\t\tFail(\"could not find file named\", name)\n\t}\n\n\treturn genFiles\n}\n\nfunc readGenRequest(r io.Reader) *plugin.CodeGeneratorRequest {\n\tdata, err := io.ReadAll(r)\n\tif err != nil {\n\t\tError(err, \"reading input\")\n\t}\n\n\treq := new(plugin.CodeGeneratorRequest)\n\tif err = proto.Unmarshal(data, req); err != nil {\n\t\tError(err, \"parsing input proto\")\n\t}\n\n\tif len(req.FileToGenerate) == 0 {\n\t\tFail(\"no files to generate\")\n\t}\n\n\treturn req\n}\n\nfunc writeResponse(w io.Writer, resp *plugin.CodeGeneratorResponse) {\n\tdata, err := proto.Marshal(resp)\n\tif err != nil {\n\t\tError(err, \"marshaling response\")\n\t}\n\t_, err = w.Write(data)\n\tif err != nil {\n\t\tError(err, \"writing response\")\n\t}\n}\n"
  },
  {
    "path": "internal/gen/stringutils/stringutils.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage stringutils\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"strings\"\n\t\"unicode\"\n)\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 converts a string from snake_case to CamelCased.\n//\n// If there is an interior underscore followed by a lower case letter, drop the\n// underscore and convert the letter to upper case. There is a remote\n// possibility of this rewrite causing a name collision, but it's so remote\n// we're prepared to pretend it's nonexistent - since the C++ generator\n// lowercases names, it's extremely unlikely to have two fields with different\n// capitalizations. 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//\n\t// That is, we process a word at a time, where words are marked by _ or upper\n\t// 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. The next\n\t\t// 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 \"_\" and then camelcased.\nfunc CamelCaseSlice(elem []string) string { return CamelCase(strings.Join(elem, \"_\")) }\n\n// DotJoin joins a slice of strings with '.'\nfunc DotJoin(elem []string) string { return strings.Join(elem, \".\") }\n\n// AlphaDigitize replaces non-letter, non-digit, non-underscore characters with\n// underscore.\nfunc AlphaDigitize(r rune) rune {\n\tif unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' {\n\t\treturn r\n\t}\n\treturn '_'\n}\n\n// CleanIdentifier makes sure s is a valid 'identifier' string: it contains only\n// letters, numbers, and underscore.\nfunc CleanIdentifier(s string) string {\n\treturn strings.Map(AlphaDigitize, s)\n}\n\n// BaseName the last path element of a slash-delimited name, with the last\n// 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// SnakeCase converts a string from CamelCase to snake_case.\nfunc SnakeCase(s string) string {\n\tvar buf bytes.Buffer\n\tfor i, r := range s {\n\t\tif unicode.IsUpper(r) && i > 0 {\n\t\t\tfmt.Fprintf(&buf, \"_\")\n\t\t}\n\t\tr = unicode.ToLower(r)\n\t\tfmt.Fprintf(&buf, \"%c\", r)\n\t}\n\treturn buf.String()\n}\n"
  },
  {
    "path": "internal/gen/typemap/testdata/gen.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage testdata\n\n//go:generate protoc --descriptor_set_out=fileset.pb --include_imports --include_source_info ./service.proto\n"
  },
  {
    "path": "internal/gen/typemap/testdata/importer.proto",
    "content": "syntax = \"proto3\";\n\npackage twirp.internal.gen.typemap.testdata.importer;\n\nimport \"root_pkg.proto\";\n\nmessage ImporterMsg {\n  root_pkg.RootMsg a = 1;\n\n  message ImporterInner {}\n}\n"
  },
  {
    "path": "internal/gen/typemap/testdata/public_importer.proto",
    "content": "syntax = \"proto3\";\n\npackage twirp.internal.gen.typemap.testdata.public_importer;\n\nimport public \"root_pkg.proto\";\nimport public \"importer.proto\";\n\nmessage PublicImporterMsgA {\n  importer.ImporterMsg a = 1;\n}\n\nmessage PublicImporterMsgB {\n  root_pkg.RootMsg a = 1;\n}\n"
  },
  {
    "path": "internal/gen/typemap/testdata/public_reimporter.proto",
    "content": "syntax = \"proto3\";\n\npackage twirp.internal.gen.typemap.testdata.public_reimporter;\n\nimport public \"public_importer.proto\";\n\nmessage PublicReimporterMsg {\n  public_importer.PublicImporterMsgA a = 1;\n  public_importer.PublicImporterMsgB b = 2;\n  root_pkg.RootMsg c = 3;\n  importer.ImporterMsg d = 4;\n}\n"
  },
  {
    "path": "internal/gen/typemap/testdata/root_pkg.proto",
    "content": "syntax = \"proto3\";\n\npackage twirp.internal.gen.typemap.testdata.root_pkg;\n\n// RootMsg leading\nmessage RootMsg {}\n"
  },
  {
    "path": "internal/gen/typemap/testdata/service.proto",
    "content": "syntax = \"proto3\";\n\npackage twirp.internal.gen.typemap.testdata.public_reimporter;\n\nimport public \"public_reimporter.proto\";\n\nmessage ServiceMsg {\n  public_importer.PublicImporterMsgA a = 1;\n  public_importer.PublicImporterMsgB b = 2;\n  root_pkg.RootMsg c = 3;\n  importer.ImporterMsg d = 4;\n}\n\nmessage Parent {\n  message NestedOuter{\n    message NestedInner{}\n  }\n}\n\nservice EmptyService {}\n\nservice ServiceWithOneMethod{\n  // Method1 leading\n  rpc Method1(root_pkg.RootMsg) returns (importer.ImporterMsg);\n  // Method1 trailing\n}\n\n// ServiceWithManyMethods leading\nservice ServiceWithManyMethods{\n  // Method1 leading\n  rpc Method1(root_pkg.RootMsg) returns (importer.ImporterMsg);\n  // Method2 leading\n  rpc Method2(Parent) returns (Parent.NestedOuter);\n  // Method2 trailing\n\n  rpc Method3(importer.ImporterMsg.ImporterInner) returns (Parent.NestedOuter.NestedInner);\n}\n"
  },
  {
    "path": "internal/gen/typemap/typemap.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage typemap\n\nimport (\n\t\"github.com/pkg/errors\"\n\tdescriptor \"google.golang.org/protobuf/types/descriptorpb\"\n)\n\ntype Registry struct {\n\tallFiles    []*descriptor.FileDescriptorProto\n\tfilesByName map[string]*descriptor.FileDescriptorProto\n\n\t// Mapping of fully-qualified names to their definitions\n\tmessagesByProtoName map[string]*MessageDefinition\n}\n\nfunc New(files []*descriptor.FileDescriptorProto) *Registry {\n\tr := &Registry{\n\t\tallFiles:            files,\n\t\tfilesByName:         make(map[string]*descriptor.FileDescriptorProto),\n\t\tmessagesByProtoName: make(map[string]*MessageDefinition),\n\t}\n\n\t// First, index the file descriptors by name. We need this so\n\t// messageDefsForFile can correctly scan imports.\n\tfor _, f := range files {\n\t\tr.filesByName[f.GetName()] = f\n\t}\n\n\t// Next, index all the message definitions by their fully-qualified proto\n\t// names.\n\tfor _, f := range files {\n\t\tdefs := messageDefsForFile(f, r.filesByName)\n\t\tfor name, def := range defs {\n\t\t\tr.messagesByProtoName[name] = def\n\t\t}\n\t}\n\treturn r\n}\n\nfunc (r *Registry) FileComments(file *descriptor.FileDescriptorProto) (DefinitionComments, error) {\n\treturn commentsAtPath([]int32{packagePath}, file), nil\n}\n\nfunc (r *Registry) ServiceComments(file *descriptor.FileDescriptorProto, svc *descriptor.ServiceDescriptorProto) (DefinitionComments, error) {\n\tfor i, s := range file.Service {\n\t\tif s == svc {\n\t\t\tpath := []int32{servicePath, int32(i)}\n\t\t\treturn commentsAtPath(path, file), nil\n\t\t}\n\t}\n\treturn DefinitionComments{}, errors.Errorf(\"service not found in file\")\n}\n\nfunc (r *Registry) MethodComments(file *descriptor.FileDescriptorProto, svc *descriptor.ServiceDescriptorProto, method *descriptor.MethodDescriptorProto) (DefinitionComments, error) {\n\tfor i, s := range file.Service {\n\t\tif s == svc {\n\t\t\tpath := []int32{servicePath, int32(i)}\n\t\t\tfor j, m := range s.Method {\n\t\t\t\tif m == method {\n\t\t\t\t\tpath = append(path, serviceMethodPath, int32(j))\n\t\t\t\t\treturn commentsAtPath(path, file), nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn DefinitionComments{}, errors.Errorf(\"service not found in file\")\n}\n\nfunc (r *Registry) MethodInputDefinition(method *descriptor.MethodDescriptorProto) *MessageDefinition {\n\treturn r.messagesByProtoName[method.GetInputType()]\n}\n\nfunc (r *Registry) MethodOutputDefinition(method *descriptor.MethodDescriptorProto) *MessageDefinition {\n\treturn r.messagesByProtoName[method.GetOutputType()]\n}\n\nfunc (r *Registry) MessageDefinition(name string) *MessageDefinition {\n\treturn r.messagesByProtoName[name]\n}\n\ntype MessageDefinition struct {\n\t// Descriptor is is the DescriptorProto defining the message.\n\tDescriptor *descriptor.DescriptorProto\n\t// File is the File that the message was defined in. Or, if it has been\n\t// publicly imported, what File was that import performed in?\n\tFile *descriptor.FileDescriptorProto\n\t// Parent is the parent message, if this was defined as a nested message. If\n\t// this was defined at the top level, parent is nil.\n\tParent *MessageDefinition\n\t// Comments describes the comments surrounding a message's definition. If it\n\t// was publicly imported, then these comments are from the actual source file,\n\t// not the file that the import was performed in.\n\tComments DefinitionComments\n\n\t// path is the 'SourceCodeInfo' path. See the documentation for\n\t// google.golang.org/protobuf/types/descriptorpb.SourceCodeInfo for an\n\t// explanation of its format.\n\tpath []int32\n}\n\n// ProtoName returns the dot-delimited, fully-qualified protobuf name of the\n// message.\nfunc (m *MessageDefinition) ProtoName() string {\n\tprefix := \".\"\n\tif pkg := m.File.GetPackage(); pkg != \"\" {\n\t\tprefix += pkg + \".\"\n\t}\n\n\tif lineage := m.Lineage(); len(lineage) > 0 {\n\t\tfor _, parent := range lineage {\n\t\t\tprefix += parent.Descriptor.GetName() + \".\"\n\t\t}\n\t}\n\n\treturn prefix + m.Descriptor.GetName()\n}\n\n// Lineage returns m's parental chain all the way back up to a top-level message\n// definition. The first element of the returned slice is the highest-level\n// parent.\nfunc (m *MessageDefinition) Lineage() []*MessageDefinition {\n\tvar parents []*MessageDefinition\n\tfor p := m.Parent; p != nil; p = p.Parent {\n\t\tparents = append([]*MessageDefinition{p}, parents...)\n\t}\n\treturn parents\n}\n\n// descendants returns all the submessages defined within m, and all the\n// descendants of those, recursively.\nfunc (m *MessageDefinition) descendants() []*MessageDefinition {\n\tdescendants := make([]*MessageDefinition, 0)\n\tfor i, child := range m.Descriptor.NestedType {\n\t\tpath := append(m.path, []int32{messageMessagePath, int32(i)}...)\n\t\tchildDef := &MessageDefinition{\n\t\t\tDescriptor: child,\n\t\t\tFile:       m.File,\n\t\t\tParent:     m,\n\t\t\tComments:   commentsAtPath(path, m.File),\n\t\t\tpath:       path,\n\t\t}\n\t\tdescendants = append(descendants, childDef)\n\t\tdescendants = append(descendants, childDef.descendants()...)\n\t}\n\treturn descendants\n}\n\n// messageDefsForFile gathers a mapping of fully-qualified protobuf names to\n// their definitions. It scans a singles file at a time. It requires a mapping\n// of .proto file names to their definitions in order to correctly handle\n// 'import public' declarations; this mapping should include all files\n// transitively imported by f.\nfunc messageDefsForFile(f *descriptor.FileDescriptorProto, filesByName map[string]*descriptor.FileDescriptorProto) map[string]*MessageDefinition {\n\tbyProtoName := make(map[string]*MessageDefinition)\n\t// First, gather all the messages defined at the top level.\n\tfor i, d := range f.MessageType {\n\t\tpath := []int32{messagePath, int32(i)}\n\t\tdef := &MessageDefinition{\n\t\t\tDescriptor: d,\n\t\t\tFile:       f,\n\t\t\tParent:     nil,\n\t\t\tComments:   commentsAtPath(path, f),\n\t\t\tpath:       path,\n\t\t}\n\n\t\tbyProtoName[def.ProtoName()] = def\n\t\t// Next, all nested message definitions.\n\t\tfor _, child := range def.descendants() {\n\t\t\tbyProtoName[child.ProtoName()] = child\n\t\t}\n\t}\n\n\t// Finally, all messages imported publicly.\n\tfor _, depIdx := range f.PublicDependency {\n\t\tdepFileName := f.Dependency[depIdx]\n\t\tdepFile := filesByName[depFileName]\n\t\tdepDefs := messageDefsForFile(depFile, filesByName)\n\t\tfor _, def := range depDefs {\n\t\t\timported := &MessageDefinition{\n\t\t\t\tDescriptor: def.Descriptor,\n\t\t\t\tFile:       f,\n\t\t\t\tParent:     def.Parent,\n\t\t\t\tComments:   commentsAtPath(def.path, depFile),\n\t\t\t\tpath:       def.path,\n\t\t\t}\n\t\t\tbyProtoName[imported.ProtoName()] = imported\n\t\t}\n\t}\n\n\treturn byProtoName\n}\n\n// DefinitionComments contains the comments surrounding a definition in a\n// protobuf file.\n//\n// These follow the rules described by protobuf:\n//\n// A series of line comments appearing on consecutive lines, with no other\n// tokens appearing on those lines, will be treated as a single comment.\n//\n// leading_detached_comments will keep paragraphs of comments that appear\n// before (but not connected to) the current element. Each paragraph,\n// separated by empty lines, will be one comment element in the repeated\n// field.\n//\n// Only the comment content is provided; comment markers (e.g. //) are\n// stripped out.  For block comments, leading whitespace and an asterisk\n// will be stripped from the beginning of each line other than the first.\n// Newlines are included in the output.\n//\n// Examples:\n//\n//   optional int32 foo = 1;  // Comment attached to foo.\n//   // Comment attached to bar.\n//   optional int32 bar = 2;\n//\n//   optional string baz = 3;\n//   // Comment attached to baz.\n//   // Another line attached to baz.\n//\n//   // Comment attached to qux.\n//   //\n//   // Another line attached to qux.\n//   optional double qux = 4;\n//\n//   // Detached comment for corge. This is not leading or trailing comments\n//   // to qux or corge because there are blank lines separating it from\n//   // both.\n//\n//   // Detached comment for corge paragraph 2.\n//\n//   optional string corge = 5;\n//   /* Block comment attached\n//    * to corge.  Leading asterisks\n//    * will be removed. */\n//   /* Block comment attached to\n//    * grault. */\n//   optional int32 grault = 6;\n//\n//   // ignored detached comments.\ntype DefinitionComments struct {\n\tLeading         string\n\tTrailing        string\n\tLeadingDetached []string\n}\n\nfunc commentsAtPath(path []int32, sourceFile *descriptor.FileDescriptorProto) DefinitionComments {\n\tif sourceFile.SourceCodeInfo == nil {\n\t\t// The compiler didn't provide us with comments.\n\t\treturn DefinitionComments{}\n\t}\n\n\tfor _, loc := range sourceFile.SourceCodeInfo.Location {\n\t\tif pathEqual(path, loc.Path) {\n\t\t\treturn DefinitionComments{\n\t\t\t\tLeading:         loc.GetLeadingComments(),\n\t\t\t\tLeadingDetached: loc.GetLeadingDetachedComments(),\n\t\t\t\tTrailing:        loc.GetTrailingComments(),\n\t\t\t}\n\t\t}\n\t}\n\treturn DefinitionComments{}\n}\n\nfunc pathEqual(path1, path2 []int32) bool {\n\tif len(path1) != len(path2) {\n\t\treturn false\n\t}\n\tfor i, v := range path1 {\n\t\tif path2[i] != v {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nconst (\n\t// tag numbers in FileDescriptorProto\n\tpackagePath = 2 // package\n\tmessagePath = 4 // message_type\n\tenumPath    = 5 // enum_type\n\tservicePath = 6 // service\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 ServiceDescriptorProto\n\tserviceNamePath    = 1 // name\n\tserviceMethodPath  = 2 // method\n\tserviceOptionsPath = 3 // options\n\t// tag numbers in MethodDescriptorProto\n\tmethodNamePath   = 1 // name\n\tmethodInputPath  = 2 // input_type\n\tmethodOutputPath = 3 // output_type\n)\n"
  },
  {
    "path": "internal/gen/typemap/typemap_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage typemap\n\nimport (\n\t\"os\"\n\t\"path/filepath\"\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/require\"\n\t\"google.golang.org/protobuf/proto\"\n\tdescriptor \"google.golang.org/protobuf/types/descriptorpb\"\n)\n\nfunc loadTestPb(t *testing.T) []*descriptor.FileDescriptorProto {\n\tf, err := os.ReadFile(filepath.Join(\"testdata\", \"fileset.pb\"))\n\trequire.NoError(t, err, \"unable to read testdata protobuf file\")\n\n\tset := new(descriptor.FileDescriptorSet)\n\terr = proto.Unmarshal(f, set)\n\trequire.NoError(t, err, \"unable to unmarshal testdata protobuf file\")\n\n\treturn set.File\n}\n\nfunc protoFile(files []*descriptor.FileDescriptorProto, name string) *descriptor.FileDescriptorProto {\n\tfor _, f := range files {\n\t\tif filepath.Base(f.GetName()) == name {\n\t\t\treturn f\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc service(f *descriptor.FileDescriptorProto, name string) *descriptor.ServiceDescriptorProto {\n\tfor _, s := range f.Service {\n\t\tif s.GetName() == name {\n\t\t\treturn s\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc method(s *descriptor.ServiceDescriptorProto, name string) *descriptor.MethodDescriptorProto {\n\tfor _, m := range s.Method {\n\t\tif m.GetName() == name {\n\t\t\treturn m\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc TestNewRegistry(t *testing.T) {\n\tfiles := loadTestPb(t)\n\tfile := protoFile(files, \"service.proto\")\n\tservice := service(file, \"ServiceWithManyMethods\")\n\n\treg := New(files)\n\n\tcomments, err := reg.ServiceComments(file, service)\n\trequire.NoError(t, err, \"unable to load service comments\")\n\tassert.Equal(t, \" ServiceWithManyMethods leading\\n\", comments.Leading)\n\n\tmethod1 := method(service, \"Method1\")\n\trequire.NotNil(t, method1)\n\n\tmethod1Input := reg.MethodInputDefinition(method1)\n\trequire.NotNil(t, method1Input)\n\tassert.Equal(t, \"RootMsg\", method1Input.Descriptor.GetName())\n}\n"
  },
  {
    "path": "internal/gen/version.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage gen\n\nconst Version = \"v8.1.3\"\n"
  },
  {
    "path": "internal/gen/wrappers.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n//\n//\n// This file contains some code from https://github.com/protocolbuffers/protobuf-go:\n// Copyright 2010 The Go Authors.  All rights reserved.\n// https://github.com/protocolbuffers/protobuf-go\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\npackage gen\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"path\"\n\t\"strconv\"\n\t\"strings\"\n\n\tdescriptor \"google.golang.org/protobuf/types/descriptorpb\"\n\tplugin \"google.golang.org/protobuf/types/pluginpb\"\n\n\t\"github.com/twitchtv/twirp/internal/gen/stringutils\"\n)\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// 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 WrapTypes(req *plugin.CodeGeneratorRequest) (genFiles, allFiles []*FileDescriptor, allFilesByName map[string]*FileDescriptor) {\n\tallFiles = make([]*FileDescriptor, 0, len(req.ProtoFile))\n\tallFilesByName = make(map[string]*FileDescriptor, len(allFiles))\n\n\tfor _, f := range req.ProtoFile {\n\t\t// We must wrap the descriptors before we wrap the enums\n\t\tdescs := wrapDescriptors(f)\n\t\tbuildNestedDescriptors(descs)\n\t\tenums := wrapEnumDescriptors(f, descs)\n\t\tbuildNestedEnums(descs, enums)\n\t\texts := wrapExtensions(f)\n\t\tsvcs := wrapServices(f)\n\t\tfd := &FileDescriptor{\n\t\t\tFileDescriptorProto: f,\n\t\t\tServices:            svcs,\n\t\t\tDescriptors:         descs,\n\t\t\tEnums:               enums,\n\t\t\tExtensions:          exts,\n\t\t\tproto3:              fileIsProto3(f),\n\t\t}\n\t\textractComments(fd)\n\n\t\tallFiles = append(allFiles, fd)\n\t\tallFilesByName[f.GetName()] = fd\n\t}\n\n\tfor _, fd := range allFiles {\n\t\tfd.Imported = wrapImported(fd.FileDescriptorProto, allFilesByName)\n\t}\n\n\tgenFiles = make([]*FileDescriptor, 0, len(req.FileToGenerate))\n\tfor _, fileName := range req.FileToGenerate {\n\t\tfd := allFilesByName[fileName]\n\t\tif fd == nil {\n\t\t\tFail(\"could not find file named\", fileName)\n\t\t}\n\t\tfd.Index = len(genFiles)\n\t\tgenFiles = append(genFiles, fd)\n\t}\n\n\treturn genFiles, allFiles, allFilesByName\n}\n\n// The file and package name method are common to messages and enums.\ntype common struct {\n\tfile *descriptor.FileDescriptorProto // File this object comes from.\n}\n\nfunc (c *common) File() *descriptor.FileDescriptorProto { 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) }\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\nfunc newDescriptor(desc *descriptor.DescriptorProto, parent *Descriptor, file *descriptor.FileDescriptorProto, 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 *descriptor.FileDescriptorProto) []*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 *descriptor.FileDescriptorProto, 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\nfunc 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\tFail(\"internal error: nesting failure for\", desc.GetName())\n\t\t\t}\n\t\t}\n\t}\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)\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// Construct a new EnumDescriptor\nfunc newEnumDescriptor(desc *descriptor.EnumDescriptorProto, parent *Descriptor, file *descriptor.FileDescriptorProto, 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 *descriptor.FileDescriptorProto, 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\nfunc 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\tFail(\"internal error: enum nesting failure for\", desc.GetName())\n\t\t\t}\n\t\t}\n\t}\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 stringutils.CamelCase(*e.Name) + \"_\"\n\t}\n\ttypeName := e.TypeName()\n\treturn stringutils.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// Return a slice of all the top-level ExtensionDescriptors defined within this file.\nfunc wrapExtensions(file *descriptor.FileDescriptorProto) []*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// 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] = stringutils.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\tObject Object\n}\n\n// Return a slice of all the types that are publicly imported into this file.\nfunc wrapImported(file *descriptor.FileDescriptorProto, fileMap map[string]*FileDescriptor) (sl []*ImportedDescriptor) {\n\tfor _, index := range file.PublicDependency {\n\t\tdf := fileMap[file.Dependency[index]]\n\t\tfor _, d := range df.Descriptors {\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.Enums {\n\t\t\tsl = append(sl, &ImportedDescriptor{common{file}, e})\n\t\t}\n\t\tfor _, ext := range df.Extensions {\n\t\t\tsl = append(sl, &ImportedDescriptor{common{file}, ext})\n\t\t}\n\t}\n\treturn\n}\n\nfunc (id *ImportedDescriptor) TypeName() []string { return id.Object.TypeName() }\n\n// ServiceDescriptor represents a protocol buffer service.\ntype ServiceDescriptor struct {\n\tcommon\n\t*descriptor.ServiceDescriptorProto\n\tMethods []*MethodDescriptor\n\tIndex   int // index of the ServiceDescriptorProto in its parent FileDescriptorProto\n\n\tPath string // The SourceCodeInfo path as comma-separated integers.\n}\n\nfunc (sd *ServiceDescriptor) TypeName() []string {\n\treturn []string{sd.GetName()}\n}\n\nfunc wrapServices(file *descriptor.FileDescriptorProto) (sl []*ServiceDescriptor) {\n\tfor i, svc := range file.Service {\n\t\tsd := &ServiceDescriptor{\n\t\t\tcommon:                 common{file},\n\t\t\tServiceDescriptorProto: svc,\n\t\t\tIndex:                  i,\n\t\t\tPath:                   fmt.Sprintf(\"%d,%d\", servicePath, i),\n\t\t}\n\t\tfor j, method := range svc.Method {\n\t\t\tmd := &MethodDescriptor{\n\t\t\t\tcommon:                common{file},\n\t\t\t\tMethodDescriptorProto: method,\n\t\t\t\tservice:               sd,\n\t\t\t\tPath:                  fmt.Sprintf(\"%d,%d,%d,%d\", servicePath, i, serviceMethodPath, j),\n\t\t\t}\n\t\t\tsd.Methods = append(sd.Methods, md)\n\t\t}\n\t\tsl = append(sl, sd)\n\t}\n\treturn sl\n}\n\n// MethodDescriptor represents an RPC method on a protocol buffer\n// service.\ntype MethodDescriptor struct {\n\tcommon\n\t*descriptor.MethodDescriptorProto\n\tservice *ServiceDescriptor\n\n\tPath string // The SourceCodeInfo path as comma-separated integers.\n}\n\nfunc (md *MethodDescriptor) TypeName() []string {\n\treturn []string{md.service.GetName(), md.GetName()}\n}\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\tDescriptors []*Descriptor          // All the messages defined in this file.\n\tEnums       []*EnumDescriptor      // All the enums defined in this file.\n\tExtensions  []*ExtensionDescriptor // All the top-level extensions defined in this file.\n\tImported    []*ImportedDescriptor  // All types defined in files publicly imported by this file.\n\tServices    []*ServiceDescriptor   // All the services defined in 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\tIndex int // The index of this file in the list of files to generate code for\n\n\tproto3 bool // whether to generate proto3 code for this file\n}\n\n// VarName is the variable name used in generated code to refer to the\n// compressed bytes of this descriptor. It is not exported, so it is only valid\n// inside the generated package.\n//\n// protoc-gen-go writes its own version of this file, but so does\n// protoc-gen-gogo - with a different name! Twirp aims to be compatible with\n// both; the simplest way forward is to write the file descriptor again as\n// another variable that we control.\nfunc (d *FileDescriptor) VarName() string { return fmt.Sprintf(\"twirpFileDescriptor%d\", d.Index) }\n\nfunc (d *FileDescriptor) PackageComments() string {\n\tif loc, ok := d.Comments[strconv.Itoa(packagePath)]; ok {\n\t\ttext := strings.TrimSuffix(loc.GetLeadingComments(), \"\\n\")\n\t\treturn text\n\t}\n\treturn \"\"\n}\n\nfunc (d *FileDescriptor) BaseFileName() 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\n\treturn name\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\ntype messageSymbol struct {\n\tsym                         string\n\thasExtensions, isMessageSet bool\n\thasOneof                    bool\n\tgetters                     []getterSymbol\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\n// Object is an interface abstracting the abilities shared by enums, messages, extensions and imported objects.\ntype Object interface {\n\tTypeName() []string\n\tFile() *descriptor.FileDescriptorProto\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\tservicePath = 6 // service\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 ServiceDescriptorProto\n\tserviceNamePath    = 1 // name\n\tserviceMethodPath  = 2 // method\n\tserviceOptionsPath = 3 // options\n\t// tag numbers in MethodDescriptorProto\n\tmethodNamePath   = 1 // name\n\tmethodInputPath  = 2 // input_type\n\tmethodOutputPath = 3 // output_type\n)\n"
  },
  {
    "path": "internal/twirptest/client_1_13_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\n// +build go1.13\n\npackage twirptest\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"testing\"\n\n\t\"github.com/twitchtv/twirp\"\n)\n\nfunc TestClientContextCanceled(t *testing.T) {\n\t// Context that is already canceled.\n\tctx, cancel := context.WithCancel(context.Background())\n\tcancel()\n\n\t// Make request, should immediately fail because the context is canceled.\n\tprotoCli := NewHaberdasherProtobufClient(\"\", &http.Client{})\n\t_, err := protoCli.MakeHat(ctx, &Size{})\n\n\t// The failure is a twirp internal error\n\ttwerr, ok := err.(twirp.Error)\n\tif !ok {\n\t\tt.Fatalf(\"expected twirp.Error, have=%T\", err)\n\t}\n\tif twerr.Code() != twirp.Internal {\n\t\tt.Fatalf(\"expected twirp.Error Code to be internal, have=%q\", twerr.Code())\n\t}\n\n\t// But the context.Canceled error can be identified easily with errors.Is\n\tif !errors.Is(err, context.Canceled) {\n\t\tt.Fatalf(\"expected errors.Is(err, context.Canceled) to match, but it didn't\")\n\t}\n}\n\nfunc TestClientErrorsCanBeUnwrapped(t *testing.T) {\n\trootErr := fmt.Errorf(\"some root cause\")\n\thttpClient := &http.Client{\n\t\tTransport: &failingTransport{rootErr},\n\t}\n\n\tclient := NewHaberdasherJSONClient(\"\", httpClient)\n\t_, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err == nil {\n\t\tt.Errorf(\"JSON MakeHat err is unexpectedly nil\")\n\t}\n\tif !errors.Is(err, rootErr) {\n\t\tt.Fatalf(\"expected errors.Is(err, rootErr) to match, but it didn't\")\n\t}\n}\n"
  },
  {
    "path": "internal/twirptest/client_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage twirptest\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"net/url\"\n\t\"strconv\"\n\t\"strings\"\n\t\"testing\"\n\n\t\"github.com/pkg/errors\"\n\t\"github.com/twitchtv/twirp\"\n)\n\n// reqInspector is a tool to check inspect HTTP Requests as they pass\n// through an http.Client. It implements the http.RoundTripper\n// interface by calling its callback, and then using the default\n// RoundTripper.\ntype reqInspector struct {\n\tcallback func(*http.Request)\n}\n\nfunc (i *reqInspector) RoundTrip(r *http.Request) (*http.Response, error) {\n\ti.callback(r)\n\treturn http.DefaultTransport.RoundTrip(r)\n}\n\nfunc TestClientSuccessAndErrorResponses(t *testing.T) {\n\t// Service that succeeds only if requested size is 1, otherwise errors\n\th := PickyHatmaker(1)\n\ts := httptest.NewServer(NewHaberdasherServer(h, nil))\n\tdefer s.Close()\n\n\t// Clients\n\tprotoCli := NewHaberdasherProtobufClient(s.URL, &http.Client{})\n\tjsonCli := NewHaberdasherJSONClient(s.URL, &http.Client{})\n\tctx := context.Background()\n\tvar resp *Hat\n\tvar err error\n\n\t// Test proto success\n\tresp, err = protoCli.MakeHat(ctx, &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Fatalf(\"Proto client method returned unexpected error: %s\", err)\n\t}\n\tif resp == nil {\n\t\tt.Fatalf(\"Proto client method expected to return non-nil response, but it is nil\")\n\t}\n\n\t// Test proto failure\n\tresp, err = protoCli.MakeHat(ctx, &Size{Inches: 666})\n\tif err == nil {\n\t\tt.Fatalf(\"Proto client method expected to fail, but error is nil\")\n\t}\n\tif resp != nil {\n\t\tt.Fatalf(\"Proto client method expected to return nil response on error, but returned non-nil\")\n\t}\n\n\t// Test json success\n\tresp, err = jsonCli.MakeHat(ctx, &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Fatalf(\"JSON client method returned unexpected error: %s\", err)\n\t}\n\tif resp == nil {\n\t\tt.Fatalf(\"JSON client method expected to return non-nil response, but it is nil\")\n\t}\n\n\t// Test json failure\n\tresp, err = jsonCli.MakeHat(ctx, &Size{Inches: 666})\n\tif err == nil {\n\t\tt.Fatalf(\"JSON client method expected to fail, but error is nil\")\n\t}\n\tif resp != nil {\n\t\tt.Fatalf(\"JSON client method expected to return nil response on error, but returned non-nil\")\n\t}\n}\n\nfunc TestClientSetsRequestContext(t *testing.T) {\n\t// Start up a server just so we can make a working client later.\n\th := PickyHatmaker(1)\n\ts := httptest.NewServer(NewHaberdasherServer(h, nil))\n\tdefer s.Close()\n\n\t// Make an *http.Client that validates that the key-value is present\n\t// in the context.\n\thttpClient := &http.Client{\n\t\tTransport: &reqInspector{\n\t\t\tcallback: func(req *http.Request) {\n\t\t\t\tctx := req.Context()\n\n\t\t\t\tpkgName, exists := twirp.PackageName(ctx)\n\t\t\t\tif !exists {\n\t\t\t\t\tt.Error(\"packageName not found in context\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif pkgName != \"twirp.internal.twirptest\" {\n\t\t\t\t\tt.Errorf(\"packageName has wrong value, have=%s, want=%s\", pkgName, \"twirp.internal.twirptest\")\n\t\t\t\t}\n\n\t\t\t\tserviceName, exists := twirp.ServiceName(ctx)\n\t\t\t\tif !exists {\n\t\t\t\t\tt.Error(\"serviceName not found in context\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif serviceName != \"Haberdasher\" {\n\t\t\t\t\tt.Errorf(\"serviceName has wrong value, have=%s, want=%s\", pkgName, \"Haberdasher\")\n\t\t\t\t}\n\n\t\t\t\tmethodName, exists := twirp.MethodName(ctx)\n\t\t\t\tif !exists {\n\t\t\t\t\tt.Error(\"methodName not found in context\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif methodName != \"MakeHat\" {\n\t\t\t\t\tt.Errorf(\"methodName has wrong value, have=%s, want=%s\", pkgName, \"Haberdasher\")\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t}\n\n\t// Test the JSON client and the Protobuf client.\n\tclient := NewHaberdasherJSONClient(s.URL, httpClient)\n\n\t_, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Errorf(\"MakeHat err=%s\", err)\n\t}\n\n\tclient = NewHaberdasherProtobufClient(s.URL, httpClient)\n\n\t_, err = client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Errorf(\"MakeHat err=%s\", err)\n\t}\n}\n\nfunc TestClientSetsAcceptHeader(t *testing.T) {\n\t// Start up a server just so we can make a working client later.\n\th := PickyHatmaker(1)\n\ts := httptest.NewServer(NewHaberdasherServer(h, nil))\n\tdefer s.Close()\n\n\t// Make an *http.Client that validates that the correct accept header is present\n\t// in the request.\n\thttpClient := &http.Client{\n\t\tTransport: &reqInspector{\n\t\t\tcallback: func(req *http.Request) {\n\t\t\t\tif req.Header.Get(\"Accept\") != \"application/json\" {\n\t\t\t\t\tt.Error(\"Accept header not found in req\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t}\n\n\t// Test the JSON client\n\tclient := NewHaberdasherJSONClient(s.URL, httpClient)\n\n\t_, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Errorf(\"MakeHat err=%s\", err)\n\t}\n\n\t// Make an *http.Client that validates that the correct accept header is present\n\t// in the request.\n\thttpClient = &http.Client{\n\t\tTransport: &reqInspector{\n\t\t\tcallback: func(req *http.Request) {\n\t\t\t\tif req.Header.Get(\"Accept\") != \"application/protobuf\" {\n\t\t\t\t\tt.Error(\"Accept header not found in req\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t}\n\n\t// test the Protobuf client.\n\tclient = NewHaberdasherProtobufClient(s.URL, httpClient)\n\n\t_, err = client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Errorf(\"MakeHat err=%s\", err)\n\t}\n}\n\n// If a server returns a 3xx response, give a clear error message\nfunc TestClientRedirectError(t *testing.T) {\n\ttestcase := func(code int, clientMaker func(string, HTTPClient, ...twirp.ClientOption) Haberdasher) func(*testing.T) {\n\t\treturn func(t *testing.T) {\n\t\t\t// Make a server that redirects all requests\n\t\t\tredirecter := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\thttp.Redirect(w, r, \"http://bogus/notreal\", code)\n\t\t\t})\n\t\t\ts := httptest.NewServer(redirecter)\n\t\t\tdefer s.Close()\n\n\t\t\tclient := clientMaker(s.URL, http.DefaultClient)\n\t\t\t_, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\t\t\tif err == nil {\n\t\t\t\tt.Fatal(\"MakeHat err=nil, expected an error because redirects aren't allowed\")\n\t\t\t}\n\t\t\tif twerr, ok := err.(twirp.Error); !ok {\n\t\t\t\tt.Fatalf(\"expected twirp.Error typed err, have=%T\", err)\n\t\t\t} else {\n\t\t\t\t// error message should mention the code\n\t\t\t\tif !strings.Contains(twerr.Error(), strconv.Itoa(code)) {\n\t\t\t\t\tt.Errorf(\"expected error message to mention the status code, but its missing: %q\", twerr)\n\t\t\t\t}\n\t\t\t\t// error message should mention the redirect location\n\t\t\t\tif !strings.Contains(twerr.Error(), \"http://bogus/notreal\") {\n\t\t\t\t\tt.Errorf(\"expected error message to mention the redirect location, but its missing: %q\", twerr)\n\t\t\t\t}\n\t\t\t\t// error meta should include http_error_from_intermediary\n\t\t\t\tif twerr.Meta(\"http_error_from_intermediary\") != \"true\" {\n\t\t\t\t\tt.Errorf(\"expected error.Meta('http_error_from_intermediary') to be %q, but found %q\", \"true\", twerr.Meta(\"http_error_from_intermediary\"))\n\t\t\t\t}\n\t\t\t\t// error meta should include status\n\t\t\t\tif twerr.Meta(\"status_code\") != strconv.Itoa(code) {\n\t\t\t\t\tt.Errorf(\"expected error.Meta('status_code') to be %q, but found %q\", code, twerr.Meta(\"status_code\"))\n\t\t\t\t}\n\t\t\t\t// error meta should include location\n\t\t\t\tif twerr.Meta(\"location\") != \"http://bogus/notreal\" {\n\t\t\t\t\tt.Errorf(\"expected error.Meta('location') to be the redirect from intermediary, but found %q\", twerr.Meta(\"location\"))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// It's important to test all redirect codes because Go actually handles them differently. 302 and\n\t// 303 get automatically redirected, even POSTs. The others do not (although this may change in\n\t// go1.8). We want all of them to have the same output.\n\tt.Run(\"json client\", func(t *testing.T) {\n\t\tfor code := 300; code <= 308; code++ {\n\t\t\tt.Run(strconv.Itoa(code), testcase(code, NewHaberdasherJSONClient))\n\t\t}\n\t})\n\tt.Run(\"protobuf client\", func(t *testing.T) {\n\t\tfor code := 300; code <= 308; code++ {\n\t\t\tt.Run(strconv.Itoa(code), testcase(code, NewHaberdasherProtobufClient))\n\t\t}\n\t})\n}\n\nfunc TestClientWithHooks(t *testing.T) {\n\ttests := []struct {\n\t\tdesc                       string\n\t\tin                         *Size\n\t\trequestPreparedError       error\n\t\twantRequestPreparedCalled  bool\n\t\twantResponseReceivedCalled bool\n\t\twantErrorCalled            bool\n\t}{\n\t\t{\n\t\t\tdesc:                       \"calls ResponseReceived and RequestPrepared hooks but not Error for successful calls\",\n\t\t\tin:                         &Size{Inches: 1},\n\t\t\twantRequestPreparedCalled:  true,\n\t\t\twantResponseReceivedCalled: true,\n\t\t\twantErrorCalled:            false,\n\t\t},\n\t\t{\n\t\t\tdesc:                       \"calls RequestPrepared and Error hooks for errored calls\",\n\t\t\tin:                         &Size{Inches: 666},\n\t\t\twantRequestPreparedCalled:  true,\n\t\t\twantResponseReceivedCalled: false,\n\t\t\twantErrorCalled:            true,\n\t\t},\n\t\t{\n\t\t\tdesc:                       \"calls RequestPrepared and Error hooks for error in hook\",\n\t\t\tin:                         &Size{Inches: 1},\n\t\t\twantRequestPreparedCalled:  true,\n\t\t\trequestPreparedError:       errors.New(\"test\"),\n\t\t\twantResponseReceivedCalled: false,\n\t\t\twantErrorCalled:            true,\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\th := PickyHatmaker(1)\n\t\ts := httptest.NewServer(NewHaberdasherServer(h, nil))\n\t\tdefer s.Close()\n\t\tt.Run(tt.desc, func(t *testing.T) {\n\t\t\trequestPreparedCalled := false\n\t\t\tresponseReceivedCalled := false\n\t\t\terrorCalled := false\n\n\t\t\thooks := &twirp.ClientHooks{\n\t\t\t\tRequestPrepared: func(ctx context.Context, req *http.Request) (context.Context, error) {\n\t\t\t\t\trequestPreparedCalled = true\n\t\t\t\t\treturn ctx, tt.requestPreparedError\n\t\t\t\t},\n\t\t\t\tResponseReceived: func(ctx context.Context) {\n\t\t\t\t\tresponseReceivedCalled = true\n\t\t\t\t},\n\t\t\t\tError: func(ctx context.Context, err twirp.Error) {\n\t\t\t\t\terrorCalled = true\n\t\t\t\t},\n\t\t\t}\n\n\t\t\t// Clients\n\t\t\tprotoCli := NewHaberdasherProtobufClient(s.URL, &http.Client{}, twirp.WithClientHooks(hooks))\n\t\t\tctx := context.Background()\n\n\t\t\t_, err := protoCli.MakeHat(ctx, tt.in)\n\t\t\tif tt.wantErrorCalled && err == nil {\n\t\t\t\tt.Error(\"unexpected nil error\")\n\t\t\t}\n\t\t\tif !tt.wantErrorCalled && err != nil {\n\t\t\t\tt.Errorf(\"unexpected error: %v\", err)\n\t\t\t}\n\n\t\t\tif tt.wantRequestPreparedCalled != requestPreparedCalled {\n\t\t\t\tt.Errorf(\"unexpected value for requestPreparedCalled: got %t, want %t\", requestPreparedCalled, tt.wantRequestPreparedCalled)\n\t\t\t}\n\n\t\t\tif tt.wantResponseReceivedCalled != responseReceivedCalled {\n\t\t\t\tt.Errorf(\"unexpected value for responseReceivedCalled: got %t, want %t\", responseReceivedCalled, tt.wantResponseReceivedCalled)\n\t\t\t}\n\n\t\t\tif tt.wantErrorCalled != errorCalled {\n\t\t\t\tt.Errorf(\"unexpected value for errorCalled: got %t, want %t\", errorCalled, tt.wantErrorCalled)\n\t\t\t}\n\n\t\t\trequestPreparedCalled = false\n\t\t\tresponseReceivedCalled = false\n\t\t\terrorCalled = false\n\n\t\t\tjsonCli := NewHaberdasherJSONClient(s.URL, &http.Client{}, twirp.WithClientHooks(hooks))\n\t\t\t_, err = jsonCli.MakeHat(ctx, tt.in)\n\t\t\tif tt.wantErrorCalled && err == nil {\n\t\t\t\tt.Error(\"unexpected nil error\")\n\t\t\t}\n\t\t\tif !tt.wantErrorCalled && err != nil {\n\t\t\t\tt.Errorf(\"unexpected error: %v\", err)\n\t\t\t}\n\n\t\t\tif tt.wantRequestPreparedCalled != requestPreparedCalled {\n\t\t\t\tt.Errorf(\"unexpected value for requestPreparedCalled: got %t, want %t\", requestPreparedCalled, tt.wantRequestPreparedCalled)\n\t\t\t}\n\n\t\t\tif tt.wantResponseReceivedCalled != responseReceivedCalled {\n\t\t\t\tt.Errorf(\"unexpected value for responseReceivedCalled: got %t, want %t\", responseReceivedCalled, tt.wantResponseReceivedCalled)\n\t\t\t}\n\n\t\t\tif tt.wantErrorCalled != errorCalled {\n\t\t\t\tt.Errorf(\"unexpected value for errorCalled: got %t, want %t\", errorCalled, tt.wantErrorCalled)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestClientContextToHook(t *testing.T) {\n\th := PickyHatmaker(1)\n\ts := httptest.NewServer(NewHaberdasherServer(h, nil))\n\n\ttype Key uint\n\tconst testKey Key = 0\n\trequestCalled := false\n\tresponseCalled := false\n\thooks := &twirp.ClientHooks{\n\t\tRequestPrepared: func(ctx context.Context, req *http.Request) (context.Context, error) {\n\t\t\trequestCalled = true\n\t\t\treturn context.WithValue(ctx, testKey, \"test-value\"), nil\n\t\t},\n\t\tResponseReceived: func(ctx context.Context) {\n\t\t\tresponseCalled = true\n\t\t\tctxVal := ctx.Value(testKey)\n\t\t\tif \"test-value\" != ctxVal {\n\t\t\t\tt.Errorf(\"context value set in RequestPrepared is not received in ResponseReceived: got %v, want test-value\", ctxVal)\n\t\t\t}\n\t\t},\n\t\tError: func(ctx context.Context, err twirp.Error) {},\n\t}\n\n\tprotoCli := NewHaberdasherProtobufClient(s.URL, &http.Client{}, twirp.WithClientHooks(hooks))\n\tctx := context.Background()\n\t_, err := protoCli.MakeHat(ctx, &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Error(\"unexpected error %w from MakeHat call\", err)\n\t}\n\n\tif !requestCalled {\n\t\tt.Error(\"missing RequestPrepared hook call\")\n\t}\n\tif !responseCalled {\n\t\tt.Error(\"missing ResponseReceived hook call\")\n\t}\n}\n\nfunc TestClientInterceptor(t *testing.T) {\n\tinterceptor := func(next twirp.Method) twirp.Method {\n\t\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t\tmethodName, _ := twirp.MethodName(ctx)\n\t\t\tif methodName != \"MakeHat\" {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected methodName: %q\", methodName)\n\t\t\t}\n\t\t\tserviceName, _ := twirp.ServiceName(ctx)\n\t\t\tif serviceName != \"Haberdasher\" {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected serviceName: %q\", serviceName)\n\t\t\t}\n\t\t\tpackageName, _ := twirp.PackageName(ctx)\n\t\t\tif packageName != \"twirp.internal.twirptest\" {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected packageName: %q\", packageName)\n\t\t\t}\n\t\t\tsize, ok := request.(*Size)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"could not cast %T to a *Size\", request)\n\t\t\t}\n\t\t\tsize.Inches = size.Inches + 1\n\t\t\tresponse, err := next(ctx, request)\n\t\t\that, ok := response.(*Hat)\n\t\t\tif ok && hat != nil {\n\t\t\t\that.Color = hat.Color + \"x\"\n\t\t\t\treturn hat, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\th := PickyHatmaker(3)\n\n\ts := httptest.NewServer(NewHaberdasherServer(h))\n\tdefer s.Close()\n\tclient := NewHaberdasherProtobufClient(\n\t\ts.URL,\n\t\thttp.DefaultClient,\n\t\ttwirp.WithClientInterceptors(\n\t\t\tinterceptor,\n\t\t\tinterceptor,\n\t\t),\n\t)\n\that, clientErr := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif clientErr != nil {\n\t\tt.Fatalf(\"client err=%q\", clientErr)\n\t}\n\tif hat.Size != 3 {\n\t\tt.Errorf(\"hat size expected=3 actual=%v\", hat.Size)\n\t}\n\tif hat.Color != \"bluexx\" {\n\t\tt.Errorf(\"hat color expected=bluexx actual=%v\", hat.Color)\n\t}\n\t_, clientErr = client.MakeHat(context.Background(), &Size{Inches: 3})\n\ttwerr, ok := clientErr.(twirp.Error)\n\tif !ok {\n\t\tt.Fatalf(\"expected twirp.Error type error, have %T\", clientErr)\n\t}\n\tif twerr.Code() != twirp.InvalidArgument {\n\t\tt.Errorf(\"expected error type to be InvalidArgument, buf found %q\", twerr.Code())\n\t}\n}\n\nfunc TestClientIntermediaryErrors(t *testing.T) {\n\ttestcase := func(body string, code int, expectedErrorCode twirp.ErrorCode, clientMaker func(string, HTTPClient, ...twirp.ClientOption) Haberdasher) func(*testing.T) {\n\t\treturn func(t *testing.T) {\n\t\t\t// Make a server that returns invalid twirp error responses,\n\t\t\t// simulating a network intermediary.\n\t\t\ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\tw.WriteHeader(code)\n\t\t\t\t_, err := w.Write([]byte(body))\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatalf(\"Unexpected error: %s\", err.Error())\n\t\t\t\t}\n\t\t\t}))\n\t\t\tdefer s.Close()\n\n\t\t\tclient := clientMaker(s.URL, http.DefaultClient)\n\t\t\t_, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\t\t\tif err == nil {\n\t\t\t\tt.Fatal(\"Expected error, but found nil\")\n\t\t\t}\n\t\t\tif twerr, ok := err.(twirp.Error); !ok {\n\t\t\t\tt.Fatalf(\"expected twirp.Error typed err, have=%T\", err)\n\t\t\t} else {\n\t\t\t\t// error message should mention the code\n\t\t\t\tif !strings.Contains(twerr.Msg(), fmt.Sprintf(\"Error from intermediary with HTTP status code %d\", code)) {\n\t\t\t\t\tt.Errorf(\"unexpected error message: %q\", twerr.Msg())\n\t\t\t\t}\n\t\t\t\t// error meta should include http_error_from_intermediary\n\t\t\t\tif twerr.Meta(\"http_error_from_intermediary\") != \"true\" {\n\t\t\t\t\tt.Errorf(\"expected error.Meta('http_error_from_intermediary') to be %q, but found %q\", \"true\", twerr.Meta(\"http_error_from_intermediary\"))\n\t\t\t\t}\n\t\t\t\t// error meta should include status\n\t\t\t\tif twerr.Meta(\"status_code\") != strconv.Itoa(code) {\n\t\t\t\t\tt.Errorf(\"expected error.Meta('status_code') to be %q, but found %q\", code, twerr.Meta(\"status_code\"))\n\t\t\t\t}\n\t\t\t\t// error meta should include body\n\t\t\t\tif twerr.Meta(\"body\") != body {\n\t\t\t\t\tt.Errorf(\"expected error.Meta('body') to be the response from intermediary, but found %q\", twerr.Meta(\"body\"))\n\t\t\t\t}\n\t\t\t\t// error code should be properly mapped from HTTP Code\n\t\t\t\tif twerr.Code() != expectedErrorCode {\n\t\t\t\t\tt.Errorf(\"expected to map HTTP status %q to twirp.ErrorCode %q, but found %q\", code, expectedErrorCode, twerr.Code())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// HTTP Status Code -> desired Twirp Error Code\n\tstatusCodes := map[int]twirp.ErrorCode{\n\t\t// Map meaningful HTTP codes to semantic equivalent twirp.ErrorCodes\n\t\t400: twirp.Internal,\n\t\t401: twirp.Unauthenticated,\n\t\t403: twirp.PermissionDenied,\n\t\t404: twirp.BadRoute,\n\t\t429: twirp.ResourceExhausted,\n\t\t502: twirp.Unavailable,\n\t\t503: twirp.Unavailable,\n\t\t504: twirp.Unavailable,\n\n\t\t// all other codes are unknown\n\t\t505: twirp.Unknown,\n\t\t410: twirp.Unknown,\n\t\t408: twirp.Unknown,\n\t}\n\n\t// label -> http response body\n\tbodies := map[string]string{\n\t\t\"text\":        \"error from intermediary\",\n\t\t\"emptyjson\":   \"{}\",\n\t\t\"invalidjson\": `{\"message\":\"Signature expired: 19700101T000000Z is now earlier than 20190612T110154Z (20190612T110654Z - 5 min.)\"}`,\n\t}\n\n\tclients := map[string]func(string, HTTPClient, ...twirp.ClientOption) Haberdasher{\n\t\t\"json_client\":  NewHaberdasherJSONClient,\n\t\t\"proto_client\": NewHaberdasherProtobufClient,\n\t}\n\n\tfor name, client := range clients {\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\tfor name, body := range bodies {\n\t\t\t\tt.Run(name, func(t *testing.T) {\n\t\t\t\t\tfor httpcode, twirpcode := range statusCodes {\n\t\t\t\t\t\tt.Run(fmt.Sprintf(\"%d_to_%s\", httpcode, twirpcode),\n\t\t\t\t\t\t\ttestcase(body, httpcode, twirpcode, client))\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestJSONClientAllowUnknownFields(t *testing.T) {\n\t// Make a server that always returns JSON with extra fields\n\ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tjson := `{\"size\":1, \"color\":\"black\", \"extra1\":\"foo\", \"EXTRAMORE\":\"bar\"}`\n\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t_, err := w.Write([]byte(json))\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Unexpected error: %s\", err.Error())\n\t\t}\n\t}))\n\tdefer s.Close()\n\n\tclient := NewHaberdasherJSONClient(s.URL, http.DefaultClient)\n\tresp, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error: %s\", err.Error())\n\t}\n\n\t// resp should have the values from the response json\n\tif resp.Size != 1 {\n\t\tt.Errorf(\"expected resp.Size to be %d, found %d\", 1, resp.Size)\n\t}\n\tif resp.Color != \"black\" {\n\t\tt.Errorf(\"expected resp.Color to be %q, found %q\", \"black\", resp.Color)\n\t}\n\tif resp.Name != \"\" { // not included in the response, should default to zero-value\n\t\tt.Errorf(\"expected resp.Name to be empty (zero-value), found %q\", resp.Name)\n\t}\n}\n\nfunc TestClientErrorsCanBeCaused(t *testing.T) {\n\trootErr := fmt.Errorf(\"some root cause\")\n\thttpClient := &http.Client{\n\t\tTransport: &failingTransport{rootErr},\n\t}\n\n\tclient := NewHaberdasherJSONClient(\"\", httpClient)\n\t_, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err == nil {\n\t\tt.Errorf(\"JSON MakeHat err is unexpectedly nil\")\n\t}\n\tcause := errCause(err)\n\tif cause != rootErr {\n\t\tt.Errorf(\"JSON MakeHat err cause is %q, want %q\", cause, rootErr)\n\t}\n\n\tclient = NewHaberdasherProtobufClient(\"\", httpClient)\n\t_, err = client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err == nil {\n\t\tt.Errorf(\"Protobuf MakeHat err is unexpectedly nil\")\n\t}\n\tcause = errCause(err)\n\tif cause != rootErr {\n\t\tt.Errorf(\"Protobuf MakeHat err cause is %q, want %q\", cause, rootErr)\n\t}\n}\n\nfunc TestCustomHTTPClientInterface(t *testing.T) {\n\t// Start up a server just so we can make a working client later.\n\th := PickyHatmaker(1)\n\ts := httptest.NewServer(NewHaberdasherServer(h, nil))\n\tdefer s.Close()\n\n\t// Create a custom wrapper to wrap our default client\n\thttpClient := &wrappedHTTPClient{\n\t\tclient:    http.DefaultClient,\n\t\twasCalled: false,\n\t}\n\n\t// Test the JSON client and the Protobuf client with a custom http.Client interface\n\tclient := NewHaberdasherJSONClient(s.URL, httpClient)\n\n\t_, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Errorf(\"MakeHat err=%s\", err)\n\t}\n\n\t// Check if the Do function within the http.Client wrapper gets actually called\n\tif !httpClient.wasCalled {\n\t\tt.Errorf(\"HTTPClient.Do function was not called within the JSONClient\")\n\t}\n\n\t// Reset bool for second test\n\thttpClient.wasCalled = false\n\n\tclient = NewHaberdasherProtobufClient(s.URL, httpClient)\n\n\t_, err = client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Errorf(\"MakeHat err=%s\", err)\n\t}\n\n\t// Check if the Do function within the http.Client wrapper gets actually called\n\tif !httpClient.wasCalled {\n\t\tt.Errorf(\"HTTPClient.Do function was not called within the ProtobufClient\")\n\t}\n}\n\n// failingTransport is a http.RoundTripper which always returns an error.\ntype failingTransport struct {\n\terr error // the error to return\n}\n\nfunc (t failingTransport) RoundTrip(*http.Request) (*http.Response, error) {\n\treturn nil, t.err\n}\n\nfunc errCause(err error) error {\n\tcause := errors.Cause(err)\n\tif uerr, ok := cause.(*url.Error); ok {\n\t\t// in go1.8+, http.Client errors are wrapped in *url.Error\n\t\tcause = uerr.Err\n\t}\n\treturn cause\n}\n\n// wrappedHTTPClient implements HTTPClient, but can be inspected during tests.\ntype wrappedHTTPClient struct {\n\tclient    *http.Client\n\twasCalled bool\n}\n\nfunc (c *wrappedHTTPClient) Do(req *http.Request) (resp *http.Response, err error) {\n\tc.wasCalled = true\n\treturn c.client.Do(req)\n}\n"
  },
  {
    "path": "internal/twirptest/empty_service/compile_test.go",
    "content": "// Copyright 2019 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage empty_service\n\nimport \"testing\"\n\nfunc TestCompilation(t *testing.T) {\n\t// Test passes if this package compiles\n}\n"
  },
  {
    "path": "internal/twirptest/empty_service/empty_service.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: empty_service.proto\n\npackage empty_service\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\nvar File_empty_service_proto protoreflect.FileDescriptor\n\nvar file_empty_service_proto_rawDesc = []byte{\n\t0x0a, 0x13, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x25, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74,\n\t0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e,\n\t0x65, 0x6d, 0x70, 0x74, 0x79, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x32, 0x07, 0x0a, 0x05,\n\t0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x10, 0x5a, 0x0e, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f,\n\t0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar file_empty_service_proto_goTypes = []interface{}{}\nvar file_empty_service_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_empty_service_proto_init() }\nfunc file_empty_service_proto_init() {\n\tif File_empty_service_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_empty_service_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   0,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_empty_service_proto_goTypes,\n\t\tDependencyIndexes: file_empty_service_proto_depIdxs,\n\t}.Build()\n\tFile_empty_service_proto = out.File\n\tfile_empty_service_proto_rawDesc = nil\n\tfile_empty_service_proto_goTypes = nil\n\tfile_empty_service_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/empty_service/empty_service.proto",
    "content": "syntax = \"proto3\";\n\npackage twirp.internal.twirptest.emptyservice;\n\n// Test to make sure that a service with no methods doesn't break.\noption go_package = \"/empty_service\";\n\nservice Empty{}\n"
  },
  {
    "path": "internal/twirptest/empty_service/empty_service.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: empty_service.proto\n\npackage empty_service\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// ===============\n// Empty Interface\n// ===============\n\ntype Empty interface {\n}\n\n// =====================\n// Empty Protobuf Client\n// =====================\n\ntype emptyProtobufClient struct {\n\tclient      HTTPClient\n\turls        [0]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewEmptyProtobufClient creates a Protobuf client that implements the Empty interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewEmptyProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Empty {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\turls := [0]string{}\n\n\treturn &emptyProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\n// =================\n// Empty JSON Client\n// =================\n\ntype emptyJSONClient struct {\n\tclient      HTTPClient\n\turls        [0]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewEmptyJSONClient creates a JSON client that implements the Empty interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewEmptyJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Empty {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\turls := [0]string{}\n\n\treturn &emptyJSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\n// ====================\n// Empty Server Handler\n// ====================\n\ntype emptyServer struct {\n\tEmpty\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewEmptyServer builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewEmptyServer(svc Empty, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &emptyServer{\n\t\tEmpty:            svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *emptyServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *emptyServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// EmptyPathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst EmptyPathPrefix = \"/twirp/twirp.internal.twirptest.emptyservice.Empty/\"\n\nfunc (s *emptyServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.emptyservice\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Empty\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"twirp.internal.twirptest.emptyservice.Empty\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *emptyServer) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *emptyServer) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *emptyServer) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"twirp.internal.twirptest.emptyservice\", \"Empty\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 92 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4e, 0xcd, 0x2d, 0x28,\n\t0xa9, 0x8c, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17,\n\t0x52, 0x2d, 0x29, 0xcf, 0x2c, 0x2a, 0xd0, 0xcb, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1,\n\t0x03, 0x73, 0x4b, 0x52, 0x8b, 0x4b, 0xf4, 0xc0, 0xaa, 0xa1, 0x8a, 0x8d, 0xd8, 0xb9, 0x58, 0x5d,\n\t0x41, 0x7c, 0x27, 0x81, 0x28, 0x3e, 0x7d, 0x14, 0x73, 0x92, 0xd8, 0xc0, 0x06, 0x19, 0x03, 0x02,\n\t0x00, 0x00, 0xff, 0xff, 0x08, 0xd8, 0xe5, 0xa8, 0x5f, 0x00, 0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/twirptest/empty_service/gen.go",
    "content": "// Copyright 2019 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage empty_service\n\n//go:generate protoc --go_out=paths=source_relative:. --twirp_out=paths=source_relative:. empty_service.proto\n"
  },
  {
    "path": "internal/twirptest/gen.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage twirptest\n\n//go:generate protoc --go_out=paths=source_relative:. --twirp_out=paths=source_relative:. service.proto\n"
  },
  {
    "path": "internal/twirptest/google_protobuf_imports/compile_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage google_protobuf_imports\n\nimport \"testing\"\n\nfunc TestCompilation(t *testing.T) {\n\t// Test passes if this package compiles\n}\n"
  },
  {
    "path": "internal/twirptest/google_protobuf_imports/gen.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage google_protobuf_imports\n\n//go:generate protoc --go_out=paths=source_relative:. --twirp_out=paths=source_relative:. service.proto\n"
  },
  {
    "path": "internal/twirptest/google_protobuf_imports/service.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: service.proto\n\npackage google_protobuf_imports\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\twrapperspb \"google.golang.org/protobuf/types/known/wrapperspb\"\n\treflect \"reflect\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\nvar File_service_proto protoreflect.FileDescriptor\n\nvar file_service_proto_rawDesc = []byte{\n\t0x0a, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,\n\t0x22, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e,\n\t0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x75, 0x73, 0x65, 0x5f, 0x65, 0x6d,\n\t0x70, 0x74, 0x79, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,\n\t0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,\n\t0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x32, 0x43, 0x0a, 0x03, 0x53, 0x76, 0x63, 0x12, 0x3c, 0x0a, 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12,\n\t0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,\n\t0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x16, 0x2e,\n\t0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,\n\t0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x1a, 0x5a, 0x18, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74,\n\t0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar file_service_proto_goTypes = []interface{}{\n\t(*wrapperspb.StringValue)(nil), // 0: google.protobuf.StringValue\n\t(*emptypb.Empty)(nil),          // 1: google.protobuf.Empty\n}\nvar file_service_proto_depIdxs = []int32{\n\t0, // 0: twirp.internal.twirptest.use_empty.Svc.Send:input_type -> google.protobuf.StringValue\n\t1, // 1: twirp.internal.twirptest.use_empty.Svc.Send:output_type -> google.protobuf.Empty\n\t1, // [1:2] is the sub-list for method output_type\n\t0, // [0:1] 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_service_proto_init() }\nfunc file_service_proto_init() {\n\tif File_service_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_service_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   0,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_service_proto_goTypes,\n\t\tDependencyIndexes: file_service_proto_depIdxs,\n\t}.Build()\n\tFile_service_proto = out.File\n\tfile_service_proto_rawDesc = nil\n\tfile_service_proto_goTypes = nil\n\tfile_service_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/google_protobuf_imports/service.proto",
    "content": "syntax = \"proto3\";\n\npackage twirp.internal.twirptest.use_empty;\noption go_package = \"/google_protobuf_imports\";\n\nimport \"google/protobuf/empty.proto\";\nimport \"google/protobuf/wrappers.proto\";\n\nservice Svc {\n  rpc Send(google.protobuf.StringValue) returns(google.protobuf.Empty);\n}\n"
  },
  {
    "path": "internal/twirptest/google_protobuf_imports/service.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: service.proto\n\npackage google_protobuf_imports\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport google_protobuf \"google.golang.org/protobuf/types/known/emptypb\"\nimport google_protobuf1 \"google.golang.org/protobuf/types/known/wrapperspb\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// =============\n// Svc Interface\n// =============\n\ntype Svc interface {\n\tSend(context.Context, *google_protobuf1.StringValue) (*google_protobuf.Empty, error)\n}\n\n// ===================\n// Svc Protobuf Client\n// ===================\n\ntype svcProtobufClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvcProtobufClient creates a Protobuf client that implements the Svc interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewSvcProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.use_empty\", \"Svc\")\n\turls := [1]string{\n\t\tserviceURL + \"Send\",\n\t}\n\n\treturn &svcProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svcProtobufClient) Send(ctx context.Context, in *google_protobuf1.StringValue) (*google_protobuf.Empty, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.use_empty\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *google_protobuf1.StringValue) (*google_protobuf.Empty, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*google_protobuf1.StringValue)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*google_protobuf1.StringValue) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*google_protobuf.Empty)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*google_protobuf.Empty) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svcProtobufClient) callSend(ctx context.Context, in *google_protobuf1.StringValue) (*google_protobuf.Empty, error) {\n\tout := new(google_protobuf.Empty)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ===============\n// Svc JSON Client\n// ===============\n\ntype svcJSONClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvcJSONClient creates a JSON client that implements the Svc interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewSvcJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.use_empty\", \"Svc\")\n\turls := [1]string{\n\t\tserviceURL + \"Send\",\n\t}\n\n\treturn &svcJSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svcJSONClient) Send(ctx context.Context, in *google_protobuf1.StringValue) (*google_protobuf.Empty, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.use_empty\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *google_protobuf1.StringValue) (*google_protobuf.Empty, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*google_protobuf1.StringValue)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*google_protobuf1.StringValue) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*google_protobuf.Empty)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*google_protobuf.Empty) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svcJSONClient) callSend(ctx context.Context, in *google_protobuf1.StringValue) (*google_protobuf.Empty, error) {\n\tout := new(google_protobuf.Empty)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ==================\n// Svc Server Handler\n// ==================\n\ntype svcServer struct {\n\tSvc\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewSvcServer builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewSvcServer(svc Svc, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &svcServer{\n\t\tSvc:              svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *svcServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *svcServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// SvcPathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst SvcPathPrefix = \"/twirp/twirp.internal.twirptest.use_empty.Svc/\"\n\nfunc (s *svcServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.use_empty\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"twirp.internal.twirptest.use_empty.Svc\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"Send\":\n\t\ts.serveSend(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *svcServer) serveSend(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveSendJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveSendProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *svcServer) serveSendJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(google_protobuf1.StringValue)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.Svc.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *google_protobuf1.StringValue) (*google_protobuf.Empty, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*google_protobuf1.StringValue)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*google_protobuf1.StringValue) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*google_protobuf.Empty)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*google_protobuf.Empty) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *google_protobuf.Empty\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *google_protobuf.Empty and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svcServer) serveSendProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(google_protobuf1.StringValue)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.Svc.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *google_protobuf1.StringValue) (*google_protobuf.Empty, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*google_protobuf1.StringValue)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*google_protobuf1.StringValue) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*google_protobuf.Empty)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*google_protobuf.Empty) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *google_protobuf.Empty\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *google_protobuf.Empty and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svcServer) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *svcServer) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *svcServer) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"twirp.internal.twirptest.use_empty\", \"Svc\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 169 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2d, 0x4e, 0x2d, 0x2a,\n\t0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x2a, 0x29, 0xcf, 0x2c, 0x2a,\n\t0xd0, 0xcb, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x03, 0x73, 0x4b, 0x52, 0x8b, 0x4b,\n\t0xf4, 0x4a, 0x8b, 0x53, 0xe3, 0x53, 0x73, 0x0b, 0x4a, 0x2a, 0xa5, 0xa4, 0xd3, 0xf3, 0xf3, 0xd3,\n\t0x73, 0x52, 0xf5, 0xc1, 0x3a, 0x92, 0x4a, 0xd3, 0xf4, 0xc1, 0xc2, 0x10, 0x03, 0xa4, 0xe4, 0xd0,\n\t0x25, 0xcb, 0x8b, 0x12, 0x0b, 0x0a, 0x52, 0x8b, 0x8a, 0x21, 0xf2, 0x46, 0xce, 0x5c, 0xcc, 0xc1,\n\t0x65, 0xc9, 0x42, 0x36, 0x5c, 0x2c, 0xc1, 0xa9, 0x79, 0x29, 0x42, 0x32, 0x7a, 0x10, 0xf5, 0x7a,\n\t0x30, 0xf5, 0x7a, 0xc1, 0x25, 0x45, 0x99, 0x79, 0xe9, 0x61, 0x89, 0x39, 0xa5, 0xa9, 0x52, 0x62,\n\t0x18, 0xb2, 0xae, 0x20, 0xab, 0x9c, 0xa4, 0xa2, 0x24, 0xf4, 0x21, 0x32, 0xf1, 0x30, 0x99, 0xf8,\n\t0xcc, 0xdc, 0x82, 0xfc, 0xa2, 0x92, 0xe2, 0x24, 0x36, 0xb0, 0x88, 0x31, 0x20, 0x00, 0x00, 0xff,\n\t0xff, 0x09, 0x85, 0xee, 0x47, 0xd9, 0x00, 0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/twirptest/hatmakers.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage twirptest\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"time\"\n\n\t\"github.com/twitchtv/twirp\"\n)\n\ntype hatmaker func(ctx context.Context, s *Size) (*Hat, error)\n\nfunc (h hatmaker) MakeHat(ctx context.Context, s *Size) (*Hat, error) { return h(ctx, s) }\n\n// HaberdasherFunc is a convenience to convert a function into a Haberdasher service.\nfunc HaberdasherFunc(f func(ctx context.Context, s *Size) (*Hat, error)) Haberdasher {\n\treturn hatmaker(f)\n}\n\n// Always makes a blank hat.\nfunc NoopHatmaker() Haberdasher {\n\treturn hatmaker(func(context.Context, *Size) (*Hat, error) {\n\t\treturn &Hat{}, nil\n\t})\n}\n\n// Makes a hat, as long as its the size they like\nfunc PickyHatmaker(want int32) Haberdasher {\n\treturn hatmaker(func(ctx context.Context, s *Size) (*Hat, error) {\n\t\tif s.Inches != want {\n\t\t\treturn nil, twirp.InvalidArgumentError(\"Inches\", \"I can't make a hat that size!\")\n\t\t}\n\t\treturn &Hat{Size: s.Inches, Color: \"blue\", Name: \"top hat\"}, nil\n\t})\n}\n\n// Makes a hat, but sure takes their time\nfunc SlowHatmaker(dur time.Duration) Haberdasher {\n\treturn hatmaker(func(ctx context.Context, s *Size) (*Hat, error) {\n\t\ttime.Sleep(dur)\n\t\treturn &Hat{Size: s.Inches, Color: \"blue\", Name: \"top hat\"}, nil\n\t})\n}\n\n// Always errors.\nfunc ErroringHatmaker(err error) Haberdasher {\n\treturn hatmaker(func(ctx context.Context, s *Size) (*Hat, error) {\n\t\treturn nil, err\n\t})\n}\n\n// Panics.\nfunc PanickyHatmaker(p interface{}) Haberdasher {\n\treturn hatmaker(func(ctx context.Context, s *Size) (*Hat, error) {\n\t\tpanic(p)\n\t})\n}\n\n// Returns nil, nil\nfunc NilHatmaker() Haberdasher {\n\treturn hatmaker(func(context.Context, *Size) (*Hat, error) {\n\t\treturn nil, nil\n\t})\n}\n\nfunc ServerAndClient(h Haberdasher, hooks *twirp.ServerHooks) (*httptest.Server, Haberdasher) {\n\ts := httptest.NewServer(NewHaberdasherServer(h, hooks))\n\tc := NewHaberdasherProtobufClient(s.URL, http.DefaultClient)\n\treturn s, c\n}\n\nfunc TwirpServerAndClient(hooks *twirp.ServerHooks) (*httptest.Server, Haberdasher) {\n\treturn ServerAndClient(NoopHatmaker(), hooks)\n}\n"
  },
  {
    "path": "internal/twirptest/importable/compile_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage importable\n\nimport \"testing\"\n\nfunc TestCompilation(t *testing.T) {\n\t// Test passes if this package compiles\n}\n"
  },
  {
    "path": "internal/twirptest/importable/gen.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage importable\n\n//go:generate protoc --go_out=paths=source_relative:. --twirp_out=paths=source_relative:. importable.proto\n"
  },
  {
    "path": "internal/twirptest/importable/importable.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: importable.proto\n\n// Test to make sure that importing other packages doesnt break\n\npackage importable\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\ntype Msg struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n}\n\nfunc (x *Msg) Reset() {\n\t*x = Msg{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_importable_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Msg) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Msg) ProtoMessage() {}\n\nfunc (x *Msg) ProtoReflect() protoreflect.Message {\n\tmi := &file_importable_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Msg.ProtoReflect.Descriptor instead.\nfunc (*Msg) Descriptor() ([]byte, []int) {\n\treturn file_importable_proto_rawDescGZIP(), []int{0}\n}\n\nvar File_importable_proto protoreflect.FileDescriptor\n\nvar file_importable_proto_rawDesc = []byte{\n\t0x0a, 0x10, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,\n\t0x74, 0x6f, 0x12, 0x23, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e,\n\t0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70,\n\t0x6f, 0x72, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x05, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x32, 0x61,\n\t0x0a, 0x03, 0x53, 0x76, 0x63, 0x12, 0x5a, 0x0a, 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x28, 0x2e,\n\t0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74,\n\t0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x61,\n\t0x62, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x1a, 0x28, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e,\n\t0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65,\n\t0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x4d, 0x73,\n\t0x67, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,\n\t0x74, 0x77, 0x69, 0x74, 0x63, 0x68, 0x74, 0x76, 0x2f, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2f, 0x69,\n\t0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73,\n\t0x74, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72,\n\t0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar (\n\tfile_importable_proto_rawDescOnce sync.Once\n\tfile_importable_proto_rawDescData = file_importable_proto_rawDesc\n)\n\nfunc file_importable_proto_rawDescGZIP() []byte {\n\tfile_importable_proto_rawDescOnce.Do(func() {\n\t\tfile_importable_proto_rawDescData = protoimpl.X.CompressGZIP(file_importable_proto_rawDescData)\n\t})\n\treturn file_importable_proto_rawDescData\n}\n\nvar file_importable_proto_msgTypes = make([]protoimpl.MessageInfo, 1)\nvar file_importable_proto_goTypes = []interface{}{\n\t(*Msg)(nil), // 0: twirp.internal.twirptest.importable.Msg\n}\nvar file_importable_proto_depIdxs = []int32{\n\t0, // 0: twirp.internal.twirptest.importable.Svc.Send:input_type -> twirp.internal.twirptest.importable.Msg\n\t0, // 1: twirp.internal.twirptest.importable.Svc.Send:output_type -> twirp.internal.twirptest.importable.Msg\n\t1, // [1:2] is the sub-list for method output_type\n\t0, // [0:1] 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_importable_proto_init() }\nfunc file_importable_proto_init() {\n\tif File_importable_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_importable_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Msg); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_importable_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   1,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_importable_proto_goTypes,\n\t\tDependencyIndexes: file_importable_proto_depIdxs,\n\t\tMessageInfos:      file_importable_proto_msgTypes,\n\t}.Build()\n\tFile_importable_proto = out.File\n\tfile_importable_proto_rawDesc = nil\n\tfile_importable_proto_goTypes = nil\n\tfile_importable_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/importable/importable.proto",
    "content": "syntax = \"proto3\";\n\n// Test to make sure that importing other packages doesnt break\npackage twirp.internal.twirptest.importable;\noption go_package = \"github.com/twitchtv/twirp/internal/twirptest/importable\";\n\nmessage Msg {}\n\nservice Svc {\n  rpc Send(Msg) returns(Msg);\n}\n"
  },
  {
    "path": "internal/twirptest/importable/importable.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: importable.proto\n\n// Test to make sure that importing other packages doesnt break\n\npackage importable\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// =============\n// Svc Interface\n// =============\n\ntype Svc interface {\n\tSend(context.Context, *Msg) (*Msg, error)\n}\n\n// ===================\n// Svc Protobuf Client\n// ===================\n\ntype svcProtobufClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvcProtobufClient creates a Protobuf client that implements the Svc interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewSvcProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.importable\", \"Svc\")\n\turls := [1]string{\n\t\tserviceURL + \"Send\",\n\t}\n\n\treturn &svcProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svcProtobufClient) Send(ctx context.Context, in *Msg) (*Msg, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.importable\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svcProtobufClient) callSend(ctx context.Context, in *Msg) (*Msg, error) {\n\tout := new(Msg)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ===============\n// Svc JSON Client\n// ===============\n\ntype svcJSONClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvcJSONClient creates a JSON client that implements the Svc interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewSvcJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.importable\", \"Svc\")\n\turls := [1]string{\n\t\tserviceURL + \"Send\",\n\t}\n\n\treturn &svcJSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svcJSONClient) Send(ctx context.Context, in *Msg) (*Msg, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.importable\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svcJSONClient) callSend(ctx context.Context, in *Msg) (*Msg, error) {\n\tout := new(Msg)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ==================\n// Svc Server Handler\n// ==================\n\ntype svcServer struct {\n\tSvc\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewSvcServer builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewSvcServer(svc Svc, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &svcServer{\n\t\tSvc:              svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *svcServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *svcServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// SvcPathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst SvcPathPrefix = \"/twirp/twirp.internal.twirptest.importable.Svc/\"\n\nfunc (s *svcServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.importable\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"twirp.internal.twirptest.importable.Svc\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"Send\":\n\t\ts.serveSend(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *svcServer) serveSend(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveSendJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveSendProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *svcServer) serveSendJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.Svc.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svcServer) serveSendProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.Svc.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svcServer) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *svcServer) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *svcServer) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"twirp.internal.twirptest.importable\", \"Svc\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 143 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0xcc, 0x2d, 0xc8,\n\t0x2f, 0x2a, 0x49, 0x4c, 0xca, 0x49, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x2e, 0x29,\n\t0xcf, 0x2c, 0x2a, 0xd0, 0xcb, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x03, 0x73, 0x4b,\n\t0x52, 0x8b, 0x4b, 0xf4, 0x10, 0x4a, 0x95, 0x58, 0xb9, 0x98, 0x7d, 0x8b, 0xd3, 0x8d, 0x12, 0xb9,\n\t0x98, 0x83, 0xcb, 0x92, 0x85, 0xa2, 0xb8, 0x58, 0x82, 0x53, 0xf3, 0x52, 0x84, 0x34, 0xf4, 0x88,\n\t0xd0, 0xab, 0xe7, 0x5b, 0x9c, 0x2e, 0x45, 0xb4, 0x4a, 0x27, 0xcb, 0x28, 0xf3, 0xf4, 0xcc, 0x92,\n\t0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0x92, 0xf2, 0xcc, 0x92, 0xe4, 0x8c, 0x92, 0x32,\n\t0x7d, 0xb0, 0x7a, 0x7d, 0x98, 0x76, 0x7d, 0xb8, 0x76, 0x7d, 0x84, 0xf6, 0x24, 0x36, 0xb0, 0x87,\n\t0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf3, 0xa1, 0x41, 0x82, 0xe4, 0x00, 0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/twirptest/importer/compile_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage importer\n\nimport \"testing\"\n\nfunc TestCompilation(t *testing.T) {\n\t// Test passes if this package compiles\n}\n"
  },
  {
    "path": "internal/twirptest/importer/gen.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage importer\n\n//go:generate protoc -I=. -I=../importable --go_out=paths=source_relative:. --twirp_out=paths=source_relative:. importer.proto\n"
  },
  {
    "path": "internal/twirptest/importer/importer.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: importer.proto\n\n// Test to make sure that importing other packages doesnt break\n\npackage importer\n\nimport (\n\timportable \"github.com/twitchtv/twirp/internal/twirptest/importable\"\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\nvar File_importer_proto protoreflect.FileDescriptor\n\nvar file_importer_proto_rawDesc = []byte{\n\t0x0a, 0x0e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x12, 0x21, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,\n\t0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72,\n\t0x74, 0x65, 0x72, 0x1a, 0x10, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x62, 0x0a, 0x04, 0x53, 0x76, 0x63, 0x32, 0x12, 0x5a, 0x0a,\n\t0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x28, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e,\n\t0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74,\n\t0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x1a,\n\t0x28, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,\n\t0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72,\n\t0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, 0x74,\n\t0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x77, 0x69, 0x74, 0x63, 0x68, 0x74, 0x76,\n\t0x2f, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f,\n\t0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74,\n\t0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar file_importer_proto_goTypes = []interface{}{\n\t(*importable.Msg)(nil), // 0: twirp.internal.twirptest.importable.Msg\n}\nvar file_importer_proto_depIdxs = []int32{\n\t0, // 0: twirp.internal.twirptest.importer.Svc2.Send:input_type -> twirp.internal.twirptest.importable.Msg\n\t0, // 1: twirp.internal.twirptest.importer.Svc2.Send:output_type -> twirp.internal.twirptest.importable.Msg\n\t1, // [1:2] is the sub-list for method output_type\n\t0, // [0:1] 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_importer_proto_init() }\nfunc file_importer_proto_init() {\n\tif File_importer_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_importer_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   0,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_importer_proto_goTypes,\n\t\tDependencyIndexes: file_importer_proto_depIdxs,\n\t}.Build()\n\tFile_importer_proto = out.File\n\tfile_importer_proto_rawDesc = nil\n\tfile_importer_proto_goTypes = nil\n\tfile_importer_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/importer/importer.proto",
    "content": "syntax = \"proto3\";\n\n// Test to make sure that importing other packages doesnt break\npackage twirp.internal.twirptest.importer;\noption go_package = \"github.com/twitchtv/twirp/internal/twirptest/importer\";\n\nimport \"importable.proto\";\n\nservice Svc2 {\n  rpc Send(importable.Msg) returns(importable.Msg);\n}\n"
  },
  {
    "path": "internal/twirptest/importer/importer.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: importer.proto\n\n// Test to make sure that importing other packages doesnt break\n\npackage importer\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport twirp_internal_twirptest_importable \"github.com/twitchtv/twirp/internal/twirptest/importable\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// ==============\n// Svc2 Interface\n// ==============\n\ntype Svc2 interface {\n\tSend(context.Context, *twirp_internal_twirptest_importable.Msg) (*twirp_internal_twirptest_importable.Msg, error)\n}\n\n// ====================\n// Svc2 Protobuf Client\n// ====================\n\ntype svc2ProtobufClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvc2ProtobufClient creates a Protobuf client that implements the Svc2 interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewSvc2ProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc2 {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.importer\", \"Svc2\")\n\turls := [1]string{\n\t\tserviceURL + \"Send\",\n\t}\n\n\treturn &svc2ProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svc2ProtobufClient) Send(ctx context.Context, in *twirp_internal_twirptest_importable.Msg) (*twirp_internal_twirptest_importable.Msg, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.importer\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc2\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *twirp_internal_twirptest_importable.Msg) (*twirp_internal_twirptest_importable.Msg, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*twirp_internal_twirptest_importable.Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*twirp_internal_twirptest_importable.Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*twirp_internal_twirptest_importable.Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*twirp_internal_twirptest_importable.Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svc2ProtobufClient) callSend(ctx context.Context, in *twirp_internal_twirptest_importable.Msg) (*twirp_internal_twirptest_importable.Msg, error) {\n\tout := new(twirp_internal_twirptest_importable.Msg)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ================\n// Svc2 JSON Client\n// ================\n\ntype svc2JSONClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvc2JSONClient creates a JSON client that implements the Svc2 interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewSvc2JSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc2 {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.importer\", \"Svc2\")\n\turls := [1]string{\n\t\tserviceURL + \"Send\",\n\t}\n\n\treturn &svc2JSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svc2JSONClient) Send(ctx context.Context, in *twirp_internal_twirptest_importable.Msg) (*twirp_internal_twirptest_importable.Msg, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.importer\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc2\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *twirp_internal_twirptest_importable.Msg) (*twirp_internal_twirptest_importable.Msg, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*twirp_internal_twirptest_importable.Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*twirp_internal_twirptest_importable.Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*twirp_internal_twirptest_importable.Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*twirp_internal_twirptest_importable.Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svc2JSONClient) callSend(ctx context.Context, in *twirp_internal_twirptest_importable.Msg) (*twirp_internal_twirptest_importable.Msg, error) {\n\tout := new(twirp_internal_twirptest_importable.Msg)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ===================\n// Svc2 Server Handler\n// ===================\n\ntype svc2Server struct {\n\tSvc2\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewSvc2Server builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewSvc2Server(svc Svc2, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &svc2Server{\n\t\tSvc2:             svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *svc2Server) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *svc2Server) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// Svc2PathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst Svc2PathPrefix = \"/twirp/twirp.internal.twirptest.importer.Svc2/\"\n\nfunc (s *svc2Server) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.importer\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc2\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"twirp.internal.twirptest.importer.Svc2\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"Send\":\n\t\ts.serveSend(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *svc2Server) serveSend(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveSendJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveSendProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *svc2Server) serveSendJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(twirp_internal_twirptest_importable.Msg)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.Svc2.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *twirp_internal_twirptest_importable.Msg) (*twirp_internal_twirptest_importable.Msg, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*twirp_internal_twirptest_importable.Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*twirp_internal_twirptest_importable.Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc2.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*twirp_internal_twirptest_importable.Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*twirp_internal_twirptest_importable.Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *twirp_internal_twirptest_importable.Msg\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *twirp_internal_twirptest_importable.Msg and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svc2Server) serveSendProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(twirp_internal_twirptest_importable.Msg)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.Svc2.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *twirp_internal_twirptest_importable.Msg) (*twirp_internal_twirptest_importable.Msg, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*twirp_internal_twirptest_importable.Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*twirp_internal_twirptest_importable.Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc2.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*twirp_internal_twirptest_importable.Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*twirp_internal_twirptest_importable.Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *twirp_internal_twirptest_importable.Msg\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *twirp_internal_twirptest_importable.Msg and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svc2Server) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *svc2Server) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *svc2Server) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"twirp.internal.twirptest.importer\", \"Svc2\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 146 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcb, 0xcc, 0x2d, 0xc8,\n\t0x2f, 0x2a, 0x49, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x2c, 0x29, 0xcf, 0x2c,\n\t0x2a, 0xd0, 0xcb, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x03, 0x73, 0x4b, 0x52, 0x8b,\n\t0x4b, 0xf4, 0x60, 0x0a, 0xa5, 0x04, 0x20, 0xac, 0xc4, 0xa4, 0x9c, 0x54, 0x88, 0x26, 0xa3, 0x24,\n\t0x2e, 0x96, 0xe0, 0xb2, 0x64, 0x23, 0xa1, 0x28, 0x2e, 0x96, 0xe0, 0xd4, 0xbc, 0x14, 0x21, 0x0d,\n\t0x3d, 0x02, 0xa6, 0x80, 0xf5, 0xfa, 0x16, 0xa7, 0x4b, 0x11, 0xad, 0xd2, 0xc9, 0x3c, 0xca, 0x34,\n\t0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0xbf, 0xa4, 0x3c, 0xb3, 0x24, 0x39,\n\t0xa3, 0xa4, 0x4c, 0x1f, 0xac, 0x5e, 0x1f, 0xa6, 0x5d, 0x1f, 0xae, 0x5d, 0x1f, 0xe6, 0xdc, 0x24,\n\t0x36, 0xb0, 0x1b, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x14, 0x68, 0x43, 0x4d, 0xea, 0x00,\n\t0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/twirptest/importer_local/compile_test.go",
    "content": "// Copyright 2019 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage importer_local\n\nimport \"testing\"\n\nfunc TestCompilation(t *testing.T) {\n\t// Test passes if this package compiles\n}\n"
  },
  {
    "path": "internal/twirptest/importer_local/gen.go",
    "content": "// Copyright 2019 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage importer_local\n\n//go:generate protoc --go_out=paths=source_relative:. --twirp_out=paths=source_relative:. importer_local_msgdef.proto\n//go:generate protoc --go_out=paths=source_relative:. --twirp_out=paths=source_relative:. importer_local.proto\n"
  },
  {
    "path": "internal/twirptest/importer_local/importer_local.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: importer_local.proto\n\npackage importer_local\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\nvar File_importer_local_proto protoreflect.FileDescriptor\n\nvar file_importer_local_proto_rawDesc = []byte{\n\t0x0a, 0x14, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x6c,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x27, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e,\n\t0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74,\n\t0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x1a,\n\t0x1b, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f,\n\t0x6d, 0x73, 0x67, 0x64, 0x65, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x69, 0x0a, 0x03,\n\t0x53, 0x76, 0x63, 0x12, 0x62, 0x0a, 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x2c, 0x2e, 0x74, 0x77,\n\t0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69,\n\t0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f,\n\t0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x2e, 0x4d, 0x73, 0x67, 0x1a, 0x2c, 0x2e, 0x74, 0x77, 0x69, 0x72,\n\t0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70,\n\t0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x6c, 0x6f,\n\t0x63, 0x61, 0x6c, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75,\n\t0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x77, 0x69, 0x74, 0x63, 0x68, 0x74, 0x76, 0x2f, 0x74,\n\t0x77, 0x69, 0x72, 0x70, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x77,\n\t0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72,\n\t0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar file_importer_local_proto_goTypes = []interface{}{\n\t(*Msg)(nil), // 0: twirp.internal.twirptest.importer_local.Msg\n}\nvar file_importer_local_proto_depIdxs = []int32{\n\t0, // 0: twirp.internal.twirptest.importer_local.Svc.Send:input_type -> twirp.internal.twirptest.importer_local.Msg\n\t0, // 1: twirp.internal.twirptest.importer_local.Svc.Send:output_type -> twirp.internal.twirptest.importer_local.Msg\n\t1, // [1:2] is the sub-list for method output_type\n\t0, // [0:1] 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_importer_local_proto_init() }\nfunc file_importer_local_proto_init() {\n\tif File_importer_local_proto != nil {\n\t\treturn\n\t}\n\tfile_importer_local_msgdef_proto_init()\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_importer_local_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   0,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_importer_local_proto_goTypes,\n\t\tDependencyIndexes: file_importer_local_proto_depIdxs,\n\t}.Build()\n\tFile_importer_local_proto = out.File\n\tfile_importer_local_proto_rawDesc = nil\n\tfile_importer_local_proto_goTypes = nil\n\tfile_importer_local_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/importer_local/importer_local.proto",
    "content": "syntax = \"proto3\";\n\npackage twirp.internal.twirptest.importer_local;\noption go_package = \"github.com/twitchtv/twirp/internal/twirptest/importer_local\";\n\nimport \"importer_local_msgdef.proto\";\n\nservice Svc {\n  rpc Send(Msg) returns (Msg);\n}\n"
  },
  {
    "path": "internal/twirptest/importer_local/importer_local.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: importer_local.proto\n\npackage importer_local\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// =============\n// Svc Interface\n// =============\n\ntype Svc interface {\n\tSend(context.Context, *Msg) (*Msg, error)\n}\n\n// ===================\n// Svc Protobuf Client\n// ===================\n\ntype svcProtobufClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvcProtobufClient creates a Protobuf client that implements the Svc interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewSvcProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.importer_local\", \"Svc\")\n\turls := [1]string{\n\t\tserviceURL + \"Send\",\n\t}\n\n\treturn &svcProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svcProtobufClient) Send(ctx context.Context, in *Msg) (*Msg, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.importer_local\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svcProtobufClient) callSend(ctx context.Context, in *Msg) (*Msg, error) {\n\tout := new(Msg)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ===============\n// Svc JSON Client\n// ===============\n\ntype svcJSONClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvcJSONClient creates a JSON client that implements the Svc interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewSvcJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.importer_local\", \"Svc\")\n\turls := [1]string{\n\t\tserviceURL + \"Send\",\n\t}\n\n\treturn &svcJSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svcJSONClient) Send(ctx context.Context, in *Msg) (*Msg, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.importer_local\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svcJSONClient) callSend(ctx context.Context, in *Msg) (*Msg, error) {\n\tout := new(Msg)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ==================\n// Svc Server Handler\n// ==================\n\ntype svcServer struct {\n\tSvc\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewSvcServer builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewSvcServer(svc Svc, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &svcServer{\n\t\tSvc:              svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *svcServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *svcServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// SvcPathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst SvcPathPrefix = \"/twirp/twirp.internal.twirptest.importer_local.Svc/\"\n\nfunc (s *svcServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.importer_local\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"twirp.internal.twirptest.importer_local.Svc\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"Send\":\n\t\ts.serveSend(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *svcServer) serveSend(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveSendJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveSendProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *svcServer) serveSendJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.Svc.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svcServer) serveSendProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.Svc.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svcServer) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *svcServer) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *svcServer) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"twirp.internal.twirptest.importer_local\", \"Svc\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 154 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc9, 0xcc, 0x2d, 0xc8,\n\t0x2f, 0x2a, 0x49, 0x2d, 0x8a, 0xcf, 0xc9, 0x4f, 0x4e, 0xcc, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9,\n\t0x17, 0x52, 0x2f, 0x29, 0xcf, 0x2c, 0x2a, 0xd0, 0xcb, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc,\n\t0xd1, 0x03, 0x73, 0x4b, 0x52, 0x8b, 0x4b, 0xf4, 0x50, 0x95, 0x4b, 0x49, 0xa3, 0xf2, 0xe3, 0x73,\n\t0x8b, 0xd3, 0x53, 0x52, 0xd3, 0x20, 0xa6, 0x18, 0x65, 0x72, 0x31, 0x07, 0x97, 0x25, 0x0b, 0x25,\n\t0x71, 0xb1, 0x04, 0xa7, 0xe6, 0xa5, 0x08, 0xe9, 0xe8, 0x11, 0x69, 0xaa, 0x9e, 0x6f, 0x71, 0xba,\n\t0x14, 0x49, 0xaa, 0x9d, 0x6c, 0xa3, 0xac, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3,\n\t0x73, 0xf5, 0x4b, 0xca, 0x33, 0x4b, 0x92, 0x33, 0x4a, 0xca, 0xf4, 0xc1, 0x7a, 0xf4, 0x61, 0x46,\n\t0xe8, 0xc3, 0x8d, 0xd0, 0x47, 0x35, 0x22, 0x89, 0x0d, 0xec, 0x60, 0x63, 0x40, 0x00, 0x00, 0x00,\n\t0xff, 0xff, 0x9a, 0xfb, 0xc0, 0xc5, 0x0e, 0x01, 0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/twirptest/importer_local/importer_local_msgdef.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: importer_local_msgdef.proto\n\npackage importer_local\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\ntype Msg struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n}\n\nfunc (x *Msg) Reset() {\n\t*x = Msg{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_importer_local_msgdef_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Msg) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Msg) ProtoMessage() {}\n\nfunc (x *Msg) ProtoReflect() protoreflect.Message {\n\tmi := &file_importer_local_msgdef_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Msg.ProtoReflect.Descriptor instead.\nfunc (*Msg) Descriptor() ([]byte, []int) {\n\treturn file_importer_local_msgdef_proto_rawDescGZIP(), []int{0}\n}\n\nvar File_importer_local_msgdef_proto protoreflect.FileDescriptor\n\nvar file_importer_local_msgdef_proto_rawDesc = []byte{\n\t0x0a, 0x1b, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x6c,\n\t0x5f, 0x6d, 0x73, 0x67, 0x64, 0x65, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x27, 0x74,\n\t0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77,\n\t0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72,\n\t0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x22, 0x05, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x42, 0x3d, 0x5a,\n\t0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x77, 0x69, 0x74,\n\t0x63, 0x68, 0x74, 0x76, 0x2f, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72,\n\t0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x69, 0x6d,\n\t0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72,\n\t0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar (\n\tfile_importer_local_msgdef_proto_rawDescOnce sync.Once\n\tfile_importer_local_msgdef_proto_rawDescData = file_importer_local_msgdef_proto_rawDesc\n)\n\nfunc file_importer_local_msgdef_proto_rawDescGZIP() []byte {\n\tfile_importer_local_msgdef_proto_rawDescOnce.Do(func() {\n\t\tfile_importer_local_msgdef_proto_rawDescData = protoimpl.X.CompressGZIP(file_importer_local_msgdef_proto_rawDescData)\n\t})\n\treturn file_importer_local_msgdef_proto_rawDescData\n}\n\nvar file_importer_local_msgdef_proto_msgTypes = make([]protoimpl.MessageInfo, 1)\nvar file_importer_local_msgdef_proto_goTypes = []interface{}{\n\t(*Msg)(nil), // 0: twirp.internal.twirptest.importer_local.Msg\n}\nvar file_importer_local_msgdef_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_importer_local_msgdef_proto_init() }\nfunc file_importer_local_msgdef_proto_init() {\n\tif File_importer_local_msgdef_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_importer_local_msgdef_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Msg); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_importer_local_msgdef_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   1,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_importer_local_msgdef_proto_goTypes,\n\t\tDependencyIndexes: file_importer_local_msgdef_proto_depIdxs,\n\t\tMessageInfos:      file_importer_local_msgdef_proto_msgTypes,\n\t}.Build()\n\tFile_importer_local_msgdef_proto = out.File\n\tfile_importer_local_msgdef_proto_rawDesc = nil\n\tfile_importer_local_msgdef_proto_goTypes = nil\n\tfile_importer_local_msgdef_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/importer_local/importer_local_msgdef.proto",
    "content": "syntax = \"proto3\";\n\npackage twirp.internal.twirptest.importer_local;\noption go_package = \"github.com/twitchtv/twirp/internal/twirptest/importer_local\";\n\nmessage Msg {}\n"
  },
  {
    "path": "internal/twirptest/importmapping/compile_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage importmapping\n\nimport \"testing\"\n\nfunc TestCompilation(t *testing.T) {\n\t// Test passes if this package compiles\n}\n"
  },
  {
    "path": "internal/twirptest/importmapping/gen.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage importmapping\n\n//go:generate ./gen.sh\n"
  },
  {
    "path": "internal/twirptest/importmapping/gen.sh",
    "content": "#!/usr/bin/env bash\nset -euo pipefail\n\nprotoc --go_out=. --twirp_out=. \\\n    --go_opt=paths=source_relative \\\n    --go_opt=My/y.proto=github.com/twitchtv/twirp/internal/twirptest/importmapping/y \\\n    --twirp_opt=paths=source_relative \\\n    --twirp_opt=My/y.proto=github.com/twitchtv/twirp/internal/twirptest/importmapping/y \\\n    y/y.proto\n\nprotoc --go_out=. --twirp_out=. \\\n    --go_opt=paths=source_relative \\\n    --go_opt=My/y.proto=github.com/twitchtv/twirp/internal/twirptest/importmapping/y \\\n    --go_opt=Mx/x.proto=github.com/twitchtv/twirp/internal/twirptest/importmapping/x \\\n    --twirp_opt=paths=source_relative \\\n    --twirp_opt=My/y.proto=github.com/twitchtv/twirp/internal/twirptest/importmapping/y \\\n    --twirp_opt=Mx/x.proto=github.com/twitchtv/twirp/internal/twirptest/importmapping/x \\\n    x/x.proto\n"
  },
  {
    "path": "internal/twirptest/importmapping/protoc_gen-x.sh",
    "content": "#!/usr/bin/env bash\n\nset -euo pipefail\n\n# Pull into variable since both protoc-gen-go and protoc-gen-twirp need the map.\nY_IMPORT_MAPPING=\"y/y.proto=github.com/twitchtv/twirp/internal/twirptest/importmapping/y\"\n\nPROTOC_GEN_GO_PARAMS=\"M${Y_IMPORT_MAPPING}\" \\\nPROTOC_GEN_TWIRP_PARAMS=\"go_import_mapping@${Y_IMPORT_MAPPING}\" \\\n../../protoc_gen.sh x/x.proto\n"
  },
  {
    "path": "internal/twirptest/importmapping/x/x.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: x/x.proto\n\npackage x\n\nimport (\n\ty \"github.com/twitchtv/twirp/internal/twirptest/importmapping/y\"\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\nvar File_x_x_proto protoreflect.FileDescriptor\n\nvar file_x_x_proto_rawDesc = []byte{\n\t0x0a, 0x09, 0x78, 0x2f, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x28, 0x74, 0x77, 0x69,\n\t0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72,\n\t0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x6d, 0x61, 0x70, 0x70,\n\t0x69, 0x6e, 0x67, 0x2e, 0x78, 0x1a, 0x09, 0x79, 0x2f, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x32, 0x6e, 0x0a, 0x04, 0x53, 0x76, 0x63, 0x31, 0x12, 0x66, 0x0a, 0x04, 0x53, 0x65, 0x6e, 0x64,\n\t0x12, 0x2e, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61,\n\t0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f,\n\t0x72, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x59,\n\t0x1a, 0x2e, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61,\n\t0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f,\n\t0x72, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x59,\n\t0x42, 0x1f, 0x5a, 0x1d, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,\n\t0x77, 0x69, 0x6c, 0x6c, 0x2f, 0x62, 0x65, 0x2f, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x2f,\n\t0x78, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar file_x_x_proto_goTypes = []interface{}{\n\t(*y.MsgY)(nil), // 0: twirp.internal.twirptest.importmapping.y.MsgY\n}\nvar file_x_x_proto_depIdxs = []int32{\n\t0, // 0: twirp.internal.twirptest.importmapping.x.Svc1.Send:input_type -> twirp.internal.twirptest.importmapping.y.MsgY\n\t0, // 1: twirp.internal.twirptest.importmapping.x.Svc1.Send:output_type -> twirp.internal.twirptest.importmapping.y.MsgY\n\t1, // [1:2] is the sub-list for method output_type\n\t0, // [0:1] 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_x_x_proto_init() }\nfunc file_x_x_proto_init() {\n\tif File_x_x_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_x_x_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   0,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_x_x_proto_goTypes,\n\t\tDependencyIndexes: file_x_x_proto_depIdxs,\n\t}.Build()\n\tFile_x_x_proto = out.File\n\tfile_x_x_proto_rawDesc = nil\n\tfile_x_x_proto_goTypes = nil\n\tfile_x_x_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/importmapping/x/x.proto",
    "content": "syntax = \"proto3\";\n\npackage twirp.internal.twirptest.importmapping.x;\noption go_package = \"example.com/will/be/ignored/x\";\n\nimport \"y/y.proto\";\n\nservice Svc1 {\n  rpc Send(y.MsgY) returns (y.MsgY);\n}\n"
  },
  {
    "path": "internal/twirptest/importmapping/x/x.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: x/x.proto\n\npackage x\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport twirp_internal_twirptest_importmapping_y \"github.com/twitchtv/twirp/internal/twirptest/importmapping/y\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// ==============\n// Svc1 Interface\n// ==============\n\ntype Svc1 interface {\n\tSend(context.Context, *twirp_internal_twirptest_importmapping_y.MsgY) (*twirp_internal_twirptest_importmapping_y.MsgY, error)\n}\n\n// ====================\n// Svc1 Protobuf Client\n// ====================\n\ntype svc1ProtobufClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvc1ProtobufClient creates a Protobuf client that implements the Svc1 interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewSvc1ProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc1 {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.importmapping.x\", \"Svc1\")\n\turls := [1]string{\n\t\tserviceURL + \"Send\",\n\t}\n\n\treturn &svc1ProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svc1ProtobufClient) Send(ctx context.Context, in *twirp_internal_twirptest_importmapping_y.MsgY) (*twirp_internal_twirptest_importmapping_y.MsgY, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.importmapping.x\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc1\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *twirp_internal_twirptest_importmapping_y.MsgY) (*twirp_internal_twirptest_importmapping_y.MsgY, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*twirp_internal_twirptest_importmapping_y.MsgY)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*twirp_internal_twirptest_importmapping_y.MsgY) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*twirp_internal_twirptest_importmapping_y.MsgY)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*twirp_internal_twirptest_importmapping_y.MsgY) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svc1ProtobufClient) callSend(ctx context.Context, in *twirp_internal_twirptest_importmapping_y.MsgY) (*twirp_internal_twirptest_importmapping_y.MsgY, error) {\n\tout := new(twirp_internal_twirptest_importmapping_y.MsgY)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ================\n// Svc1 JSON Client\n// ================\n\ntype svc1JSONClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvc1JSONClient creates a JSON client that implements the Svc1 interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewSvc1JSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc1 {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.importmapping.x\", \"Svc1\")\n\turls := [1]string{\n\t\tserviceURL + \"Send\",\n\t}\n\n\treturn &svc1JSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svc1JSONClient) Send(ctx context.Context, in *twirp_internal_twirptest_importmapping_y.MsgY) (*twirp_internal_twirptest_importmapping_y.MsgY, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.importmapping.x\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc1\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *twirp_internal_twirptest_importmapping_y.MsgY) (*twirp_internal_twirptest_importmapping_y.MsgY, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*twirp_internal_twirptest_importmapping_y.MsgY)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*twirp_internal_twirptest_importmapping_y.MsgY) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*twirp_internal_twirptest_importmapping_y.MsgY)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*twirp_internal_twirptest_importmapping_y.MsgY) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svc1JSONClient) callSend(ctx context.Context, in *twirp_internal_twirptest_importmapping_y.MsgY) (*twirp_internal_twirptest_importmapping_y.MsgY, error) {\n\tout := new(twirp_internal_twirptest_importmapping_y.MsgY)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ===================\n// Svc1 Server Handler\n// ===================\n\ntype svc1Server struct {\n\tSvc1\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewSvc1Server builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewSvc1Server(svc Svc1, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &svc1Server{\n\t\tSvc1:             svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *svc1Server) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *svc1Server) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// Svc1PathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst Svc1PathPrefix = \"/twirp/twirp.internal.twirptest.importmapping.x.Svc1/\"\n\nfunc (s *svc1Server) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.importmapping.x\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc1\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"twirp.internal.twirptest.importmapping.x.Svc1\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"Send\":\n\t\ts.serveSend(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *svc1Server) serveSend(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveSendJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveSendProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *svc1Server) serveSendJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(twirp_internal_twirptest_importmapping_y.MsgY)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.Svc1.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *twirp_internal_twirptest_importmapping_y.MsgY) (*twirp_internal_twirptest_importmapping_y.MsgY, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*twirp_internal_twirptest_importmapping_y.MsgY)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*twirp_internal_twirptest_importmapping_y.MsgY) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc1.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*twirp_internal_twirptest_importmapping_y.MsgY)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*twirp_internal_twirptest_importmapping_y.MsgY) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *twirp_internal_twirptest_importmapping_y.MsgY\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *twirp_internal_twirptest_importmapping_y.MsgY and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svc1Server) serveSendProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(twirp_internal_twirptest_importmapping_y.MsgY)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.Svc1.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *twirp_internal_twirptest_importmapping_y.MsgY) (*twirp_internal_twirptest_importmapping_y.MsgY, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*twirp_internal_twirptest_importmapping_y.MsgY)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*twirp_internal_twirptest_importmapping_y.MsgY) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc1.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*twirp_internal_twirptest_importmapping_y.MsgY)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*twirp_internal_twirptest_importmapping_y.MsgY) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *twirp_internal_twirptest_importmapping_y.MsgY\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *twirp_internal_twirptest_importmapping_y.MsgY and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svc1Server) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *svc1Server) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *svc1Server) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"twirp.internal.twirptest.importmapping.x\", \"Svc1\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 150 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x8e, 0xb1, 0xaa, 0xc2, 0x40,\n\t0x10, 0x45, 0x9b, 0xf0, 0x20, 0x29, 0x53, 0x06, 0x1e, 0xb6, 0x56, 0x33, 0xa8, 0x7f, 0x60, 0x6f,\n\t0x95, 0x4a, 0xbb, 0x4d, 0x32, 0x2e, 0x03, 0xbb, 0xb3, 0xc3, 0x66, 0x30, 0xbb, 0x7f, 0x2f, 0xc4,\n\t0x1f, 0xd0, 0xf2, 0xc2, 0x3d, 0x87, 0xd3, 0xb5, 0x05, 0x0b, 0x68, 0x4e, 0x96, 0xfa, 0xa3, 0x6d,\n\t0x9c, 0x15, 0x58, 0x8c, 0xb2, 0xb8, 0x00, 0xfb, 0x34, 0x5a, 0x0d, 0x38, 0x6a, 0xca, 0x16, 0x9d,\n\t0x2a, 0x8b, 0x87, 0x32, 0xb4, 0x15, 0xeb, 0x07, 0x3a, 0x4b, 0xd7, 0x8c, 0xaf, 0xf9, 0xd4, 0x3f,\n\t0xbb, 0x66, 0x24, 0x59, 0x7a, 0x80, 0x2f, 0x2d, 0x15, 0x6e, 0xab, 0xbf, 0x0f, 0x3f, 0xfe, 0xaf,\n\t0x87, 0xc7, 0x3f, 0x15, 0x17, 0x35, 0x10, 0xcc, 0x29, 0xe2, 0xc6, 0x21, 0xe0, 0x44, 0xc8, 0x5e,\n\t0x52, 0xa6, 0x05, 0xcb, 0xf4, 0xb7, 0x77, 0x5d, 0xde, 0x01, 0x00, 0x00, 0xff, 0xff, 0x77, 0x79,\n\t0x60, 0xd7, 0xd9, 0x00, 0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/twirptest/importmapping/y/y.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: y/y.proto\n\npackage y\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\ntype MsgY struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n}\n\nfunc (x *MsgY) Reset() {\n\t*x = MsgY{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_y_y_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *MsgY) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*MsgY) ProtoMessage() {}\n\nfunc (x *MsgY) ProtoReflect() protoreflect.Message {\n\tmi := &file_y_y_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use MsgY.ProtoReflect.Descriptor instead.\nfunc (*MsgY) Descriptor() ([]byte, []int) {\n\treturn file_y_y_proto_rawDescGZIP(), []int{0}\n}\n\nvar File_y_y_proto protoreflect.FileDescriptor\n\nvar file_y_y_proto_rawDesc = []byte{\n\t0x0a, 0x09, 0x79, 0x2f, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x28, 0x74, 0x77, 0x69,\n\t0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72,\n\t0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x6d, 0x61, 0x70, 0x70,\n\t0x69, 0x6e, 0x67, 0x2e, 0x79, 0x22, 0x06, 0x0a, 0x04, 0x4d, 0x73, 0x67, 0x59, 0x42, 0x1f, 0x5a,\n\t0x1d, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x77, 0x69, 0x6c,\n\t0x6c, 0x2f, 0x62, 0x65, 0x2f, 0x69, 0x67, 0x6e, 0x6f, 0x72, 0x65, 0x64, 0x2f, 0x79, 0x62, 0x06,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar (\n\tfile_y_y_proto_rawDescOnce sync.Once\n\tfile_y_y_proto_rawDescData = file_y_y_proto_rawDesc\n)\n\nfunc file_y_y_proto_rawDescGZIP() []byte {\n\tfile_y_y_proto_rawDescOnce.Do(func() {\n\t\tfile_y_y_proto_rawDescData = protoimpl.X.CompressGZIP(file_y_y_proto_rawDescData)\n\t})\n\treturn file_y_y_proto_rawDescData\n}\n\nvar file_y_y_proto_msgTypes = make([]protoimpl.MessageInfo, 1)\nvar file_y_y_proto_goTypes = []interface{}{\n\t(*MsgY)(nil), // 0: twirp.internal.twirptest.importmapping.y.MsgY\n}\nvar file_y_y_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_y_y_proto_init() }\nfunc file_y_y_proto_init() {\n\tif File_y_y_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_y_y_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*MsgY); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_y_y_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   1,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_y_y_proto_goTypes,\n\t\tDependencyIndexes: file_y_y_proto_depIdxs,\n\t\tMessageInfos:      file_y_y_proto_msgTypes,\n\t}.Build()\n\tFile_y_y_proto = out.File\n\tfile_y_y_proto_rawDesc = nil\n\tfile_y_y_proto_goTypes = nil\n\tfile_y_y_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/importmapping/y/y.proto",
    "content": "syntax = \"proto3\";\n\npackage twirp.internal.twirptest.importmapping.y;\noption go_package = \"example.com/will/be/ignored/y\";\n\nmessage MsgY {}\n"
  },
  {
    "path": "internal/twirptest/json_serialization/gen.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage json_serialization\n\n//go:generate protoc --go_out=paths=source_relative:. --twirp_out=paths=source_relative:. json_serialization.proto\n"
  },
  {
    "path": "internal/twirptest/json_serialization/json_serialization.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: json_serialization.proto\n\npackage json_serialization\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\ntype Msg_FooBar int32\n\nconst (\n\tMsg_FOO Msg_FooBar = 0\n\tMsg_BAR Msg_FooBar = 1\n)\n\n// Enum value maps for Msg_FooBar.\nvar (\n\tMsg_FooBar_name = map[int32]string{\n\t\t0: \"FOO\",\n\t\t1: \"BAR\",\n\t}\n\tMsg_FooBar_value = map[string]int32{\n\t\t\"FOO\": 0,\n\t\t\"BAR\": 1,\n\t}\n)\n\nfunc (x Msg_FooBar) Enum() *Msg_FooBar {\n\tp := new(Msg_FooBar)\n\t*p = x\n\treturn p\n}\n\nfunc (x Msg_FooBar) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (Msg_FooBar) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_json_serialization_proto_enumTypes[0].Descriptor()\n}\n\nfunc (Msg_FooBar) Type() protoreflect.EnumType {\n\treturn &file_json_serialization_proto_enumTypes[0]\n}\n\nfunc (x Msg_FooBar) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Use Msg_FooBar.Descriptor instead.\nfunc (Msg_FooBar) EnumDescriptor() ([]byte, []int) {\n\treturn file_json_serialization_proto_rawDescGZIP(), []int{0, 0}\n}\n\ntype Msg struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tQuery      string     `protobuf:\"bytes,1,opt,name=query,proto3\" json:\"query,omitempty\"`\n\tPageNumber int32      `protobuf:\"varint,2,opt,name=page_number,json=pageNumber,proto3\" json:\"page_number,omitempty\"`\n\tHell       float64    `protobuf:\"fixed64,3,opt,name=hell,proto3\" json:\"hell,omitempty\"`\n\tFoobar     Msg_FooBar `protobuf:\"varint,4,opt,name=foobar,proto3,enum=Msg_FooBar\" json:\"foobar,omitempty\"`\n\tSnippets   []string   `protobuf:\"bytes,5,rep,name=snippets,proto3\" json:\"snippets,omitempty\"`\n\tAllEmpty   bool       `protobuf:\"varint,6,opt,name=all_empty,json=allEmpty,proto3\" json:\"all_empty,omitempty\"`\n}\n\nfunc (x *Msg) Reset() {\n\t*x = Msg{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_json_serialization_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Msg) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Msg) ProtoMessage() {}\n\nfunc (x *Msg) ProtoReflect() protoreflect.Message {\n\tmi := &file_json_serialization_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Msg.ProtoReflect.Descriptor instead.\nfunc (*Msg) Descriptor() ([]byte, []int) {\n\treturn file_json_serialization_proto_rawDescGZIP(), []int{0}\n}\n\nfunc (x *Msg) GetQuery() string {\n\tif x != nil {\n\t\treturn x.Query\n\t}\n\treturn \"\"\n}\n\nfunc (x *Msg) GetPageNumber() int32 {\n\tif x != nil {\n\t\treturn x.PageNumber\n\t}\n\treturn 0\n}\n\nfunc (x *Msg) GetHell() float64 {\n\tif x != nil {\n\t\treturn x.Hell\n\t}\n\treturn 0\n}\n\nfunc (x *Msg) GetFoobar() Msg_FooBar {\n\tif x != nil {\n\t\treturn x.Foobar\n\t}\n\treturn Msg_FOO\n}\n\nfunc (x *Msg) GetSnippets() []string {\n\tif x != nil {\n\t\treturn x.Snippets\n\t}\n\treturn nil\n}\n\nfunc (x *Msg) GetAllEmpty() bool {\n\tif x != nil {\n\t\treturn x.AllEmpty\n\t}\n\treturn false\n}\n\ntype Result struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n}\n\nfunc (x *Result) Reset() {\n\t*x = Result{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_json_serialization_proto_msgTypes[1]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Result) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Result) ProtoMessage() {}\n\nfunc (x *Result) ProtoReflect() protoreflect.Message {\n\tmi := &file_json_serialization_proto_msgTypes[1]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Result.ProtoReflect.Descriptor instead.\nfunc (*Result) Descriptor() ([]byte, []int) {\n\treturn file_json_serialization_proto_rawDescGZIP(), []int{1}\n}\n\nvar File_json_serialization_proto protoreflect.FileDescriptor\n\nvar file_json_serialization_proto_rawDesc = []byte{\n\t0x0a, 0x18, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x61,\n\t0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xca, 0x01, 0x0a, 0x03, 0x4d,\n\t0x73, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,\n\t0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x61, 0x67, 0x65,\n\t0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x70,\n\t0x61, 0x67, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x65, 0x6c,\n\t0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x68, 0x65, 0x6c, 0x6c, 0x12, 0x23, 0x0a,\n\t0x06, 0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0b, 0x2e,\n\t0x4d, 0x73, 0x67, 0x2e, 0x46, 0x6f, 0x6f, 0x42, 0x61, 0x72, 0x52, 0x06, 0x66, 0x6f, 0x6f, 0x62,\n\t0x61, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x6e, 0x69, 0x70, 0x70, 0x65, 0x74, 0x73, 0x18, 0x05,\n\t0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x73, 0x6e, 0x69, 0x70, 0x70, 0x65, 0x74, 0x73, 0x12, 0x1b,\n\t0x0a, 0x09, 0x61, 0x6c, 0x6c, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28,\n\t0x08, 0x52, 0x08, 0x61, 0x6c, 0x6c, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1a, 0x0a, 0x06, 0x46,\n\t0x6f, 0x6f, 0x42, 0x61, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x46, 0x4f, 0x4f, 0x10, 0x00, 0x12, 0x07,\n\t0x0a, 0x03, 0x42, 0x41, 0x52, 0x10, 0x01, 0x22, 0x08, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c,\n\t0x74, 0x32, 0x2d, 0x0a, 0x11, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69,\n\t0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x08, 0x45, 0x63, 0x68, 0x6f, 0x4a, 0x53,\n\t0x4f, 0x4e, 0x12, 0x04, 0x2e, 0x4d, 0x73, 0x67, 0x1a, 0x04, 0x2e, 0x4d, 0x73, 0x67, 0x22, 0x00,\n\t0x42, 0x15, 0x5a, 0x13, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c,\n\t0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar (\n\tfile_json_serialization_proto_rawDescOnce sync.Once\n\tfile_json_serialization_proto_rawDescData = file_json_serialization_proto_rawDesc\n)\n\nfunc file_json_serialization_proto_rawDescGZIP() []byte {\n\tfile_json_serialization_proto_rawDescOnce.Do(func() {\n\t\tfile_json_serialization_proto_rawDescData = protoimpl.X.CompressGZIP(file_json_serialization_proto_rawDescData)\n\t})\n\treturn file_json_serialization_proto_rawDescData\n}\n\nvar file_json_serialization_proto_enumTypes = make([]protoimpl.EnumInfo, 1)\nvar file_json_serialization_proto_msgTypes = make([]protoimpl.MessageInfo, 2)\nvar file_json_serialization_proto_goTypes = []interface{}{\n\t(Msg_FooBar)(0), // 0: Msg.FooBar\n\t(*Msg)(nil),     // 1: Msg\n\t(*Result)(nil),  // 2: Result\n}\nvar file_json_serialization_proto_depIdxs = []int32{\n\t0, // 0: Msg.foobar:type_name -> Msg.FooBar\n\t1, // 1: JSONSerialization.EchoJSON:input_type -> Msg\n\t1, // 2: JSONSerialization.EchoJSON:output_type -> Msg\n\t2, // [2:3] is the sub-list for method output_type\n\t1, // [1:2] is the sub-list for method input_type\n\t1, // [1:1] is the sub-list for extension type_name\n\t1, // [1:1] is the sub-list for extension extendee\n\t0, // [0:1] is the sub-list for field type_name\n}\n\nfunc init() { file_json_serialization_proto_init() }\nfunc file_json_serialization_proto_init() {\n\tif File_json_serialization_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_json_serialization_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Msg); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_json_serialization_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Result); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_json_serialization_proto_rawDesc,\n\t\t\tNumEnums:      1,\n\t\t\tNumMessages:   2,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_json_serialization_proto_goTypes,\n\t\tDependencyIndexes: file_json_serialization_proto_depIdxs,\n\t\tEnumInfos:         file_json_serialization_proto_enumTypes,\n\t\tMessageInfos:      file_json_serialization_proto_msgTypes,\n\t}.Build()\n\tFile_json_serialization_proto = out.File\n\tfile_json_serialization_proto_rawDesc = nil\n\tfile_json_serialization_proto_goTypes = nil\n\tfile_json_serialization_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/json_serialization/json_serialization.proto",
    "content": "syntax = \"proto3\";\n\n// Test JSON serialization for all types of fields\noption go_package = \"/json_serialization\";\n\nservice JSONSerialization{\n  rpc EchoJSON(Msg) returns (Msg) {}\n}\n\nmessage Msg {\n  string query = 1;\n  int32 page_number = 2;\n  double hell = 3;\n  enum FooBar {\n    FOO = 0;\n    BAR = 1;\n  }\n  FooBar foobar = 4;\n  repeated string snippets = 5;\n\n  bool all_empty = 6;\n}\n\nmessage Result {\n\n}\n"
  },
  {
    "path": "internal/twirptest/json_serialization/json_serialization.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: json_serialization.proto\n\npackage json_serialization\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// ===========================\n// JSONSerialization Interface\n// ===========================\n\ntype JSONSerialization interface {\n\tEchoJSON(context.Context, *Msg) (*Msg, error)\n}\n\n// =================================\n// JSONSerialization Protobuf Client\n// =================================\n\ntype jSONSerializationProtobufClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewJSONSerializationProtobufClient creates a Protobuf client that implements the JSONSerialization interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewJSONSerializationProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) JSONSerialization {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"\", \"JSONSerialization\")\n\turls := [1]string{\n\t\tserviceURL + \"EchoJSON\",\n\t}\n\n\treturn &jSONSerializationProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *jSONSerializationProtobufClient) EchoJSON(ctx context.Context, in *Msg) (*Msg, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"\")\n\tctx = ctxsetters.WithServiceName(ctx, \"JSONSerialization\")\n\tctx = ctxsetters.WithMethodName(ctx, \"EchoJSON\")\n\tcaller := c.callEchoJSON\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callEchoJSON(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *jSONSerializationProtobufClient) callEchoJSON(ctx context.Context, in *Msg) (*Msg, error) {\n\tout := new(Msg)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// =============================\n// JSONSerialization JSON Client\n// =============================\n\ntype jSONSerializationJSONClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewJSONSerializationJSONClient creates a JSON client that implements the JSONSerialization interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewJSONSerializationJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) JSONSerialization {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"\", \"JSONSerialization\")\n\turls := [1]string{\n\t\tserviceURL + \"EchoJSON\",\n\t}\n\n\treturn &jSONSerializationJSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *jSONSerializationJSONClient) EchoJSON(ctx context.Context, in *Msg) (*Msg, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"\")\n\tctx = ctxsetters.WithServiceName(ctx, \"JSONSerialization\")\n\tctx = ctxsetters.WithMethodName(ctx, \"EchoJSON\")\n\tcaller := c.callEchoJSON\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callEchoJSON(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *jSONSerializationJSONClient) callEchoJSON(ctx context.Context, in *Msg) (*Msg, error) {\n\tout := new(Msg)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ================================\n// JSONSerialization Server Handler\n// ================================\n\ntype jSONSerializationServer struct {\n\tJSONSerialization\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewJSONSerializationServer builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewJSONSerializationServer(svc JSONSerialization, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &jSONSerializationServer{\n\t\tJSONSerialization: svc,\n\t\thooks:             serverOpts.Hooks,\n\t\tinterceptor:       twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:        pathPrefix,\n\t\tjsonSkipDefaults:  jsonSkipDefaults,\n\t\tjsonCamelCase:     jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *jSONSerializationServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *jSONSerializationServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// JSONSerializationPathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst JSONSerializationPathPrefix = \"/twirp/JSONSerialization/\"\n\nfunc (s *jSONSerializationServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"\")\n\tctx = ctxsetters.WithServiceName(ctx, \"JSONSerialization\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"JSONSerialization\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"EchoJSON\":\n\t\ts.serveEchoJSON(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *jSONSerializationServer) serveEchoJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveEchoJSONJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveEchoJSONProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *jSONSerializationServer) serveEchoJSONJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"EchoJSON\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.JSONSerialization.EchoJSON\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.JSONSerialization.EchoJSON(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg and nil error while calling EchoJSON. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *jSONSerializationServer) serveEchoJSONProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"EchoJSON\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.JSONSerialization.EchoJSON\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.JSONSerialization.EchoJSON(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg and nil error while calling EchoJSON. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *jSONSerializationServer) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *jSONSerializationServer) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *jSONSerializationServer) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"\", \"JSONSerialization\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 267 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0xcf, 0x4a, 0xf3, 0x40,\n\t0x14, 0xc5, 0x3b, 0x5f, 0xfe, 0x7c, 0xc9, 0x2d, 0x48, 0xbd, 0x2a, 0x0c, 0x71, 0xe1, 0x10, 0x37,\n\t0xb3, 0x31, 0x42, 0x7d, 0x02, 0x03, 0xed, 0x42, 0x68, 0x03, 0xd3, 0x9d, 0x9b, 0x30, 0x91, 0x31,\n\t0x8d, 0x4c, 0x33, 0x71, 0x26, 0x59, 0xd4, 0x47, 0xf4, 0xa9, 0x24, 0xa9, 0x88, 0xe0, 0xe6, 0x72,\n\t0x7e, 0xe7, 0xc0, 0xe5, 0xde, 0x03, 0xf4, 0xcd, 0x99, 0xb6, 0x74, 0xca, 0x36, 0x52, 0x37, 0x1f,\n\t0xb2, 0x6f, 0x4c, 0x9b, 0x75, 0xd6, 0xf4, 0x26, 0xfd, 0x24, 0xe0, 0x6d, 0x5c, 0x8d, 0x97, 0x10,\n\t0xbc, 0x0f, 0xca, 0x1e, 0x29, 0x61, 0x84, 0xc7, 0xe2, 0x04, 0x78, 0x03, 0xf3, 0x4e, 0xd6, 0xaa,\n\t0x6c, 0x87, 0x43, 0xa5, 0x2c, 0xfd, 0xc7, 0x08, 0x0f, 0x04, 0x8c, 0xd6, 0x76, 0x72, 0x10, 0xc1,\n\t0xdf, 0x2b, 0xad, 0xa9, 0xc7, 0x08, 0x27, 0x62, 0xd2, 0x78, 0x0b, 0xe1, 0xab, 0x31, 0x95, 0xb4,\n\t0xd4, 0x67, 0x84, 0x9f, 0x2d, 0xe7, 0xd9, 0xc6, 0xd5, 0xd9, 0xda, 0x98, 0x5c, 0x5a, 0xf1, 0x1d,\n\t0x61, 0x02, 0x91, 0x6b, 0x9b, 0xae, 0x53, 0xbd, 0xa3, 0x01, 0xf3, 0x78, 0x2c, 0x7e, 0x18, 0xaf,\n\t0x21, 0x96, 0x5a, 0x97, 0xea, 0xd0, 0xf5, 0x47, 0x1a, 0x32, 0xc2, 0x23, 0x11, 0x49, 0xad, 0x57,\n\t0x23, 0xa7, 0x09, 0x84, 0xa7, 0x55, 0xf8, 0x1f, 0xbc, 0x75, 0x51, 0x2c, 0x66, 0xa3, 0xc8, 0x1f,\n\t0xc5, 0x82, 0xa4, 0x11, 0x84, 0x42, 0xb9, 0x41, 0xf7, 0xcb, 0x3b, 0x38, 0x7f, 0xda, 0x15, 0xdb,\n\t0xdd, 0xef, 0x8f, 0x91, 0x42, 0xb4, 0x7a, 0xd9, 0x9b, 0x31, 0x40, 0x7f, 0x3c, 0x2a, 0x99, 0x66,\n\t0x3a, 0xcb, 0xaf, 0x9e, 0x2f, 0xee, 0xff, 0x56, 0x54, 0x85, 0x53, 0x47, 0x0f, 0x5f, 0x01, 0x00,\n\t0x00, 0xff, 0xff, 0xc5, 0x38, 0x86, 0xbf, 0x3f, 0x01, 0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/twirptest/json_serialization/json_serialization_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage json_serialization\n\nimport (\n\tbytes \"bytes\"\n\t\"context\"\n\tjson \"encoding/json\"\n\tio \"io\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"testing\"\n\n\t\"github.com/twitchtv/twirp\"\n)\n\ntype JSONSerializationService struct{}\n\nfunc (h *JSONSerializationService) EchoJSON(ctx context.Context, req *Msg) (*Msg, error) {\n\tif req.AllEmpty {\n\t\treturn &Msg{}, nil\n\t}\n\n\treturn &Msg{\n\t\tQuery:      req.Query,\n\t\tPageNumber: req.PageNumber,\n\t\tHell:       req.Hell,\n\t\tFoobar:     req.Foobar,\n\t\tSnippets:   req.Snippets,\n\t}, nil\n}\n\nfunc TestJSONSerializationServiceWithDefaults(t *testing.T) {\n\ts := httptest.NewServer(NewJSONSerializationServer(&JSONSerializationService{}))\n\tdefer s.Close()\n\n\t// Manual JSON request to get empty response\n\t// Response should include empty fields by default\n\treqBody := bytes.NewBuffer([]byte(\n\t\t`{\"allEmpty\": true}`,\n\t))\n\treq, _ := http.NewRequest(\"POST\", s.URL+\"/twirp/JSONSerialization/EchoJSON\", reqBody)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tt.Fatalf(\"manual EchoJSON err=%q\", err)\n\t}\n\tif resp.StatusCode != 200 {\n\t\tt.Fatalf(\"manual EchoJSON invalid status, have=%d, want=200\", resp.StatusCode)\n\t}\n\n\tobjmap := readJSONAsMap(t, resp.Body)\n\tfor _, field := range []string{\"query\", \"page_number\", \"hell\", \"foobar\", \"snippets\", \"all_empty\"} {\n\t\tif _, ok := objmap[field]; !ok {\n\t\t\tt.Fatalf(\"expected JSON response to include field %q\", field)\n\t\t}\n\t}\n\n\t// JSON Client\n\tclient := NewJSONSerializationJSONClient(s.URL, http.DefaultClient)\n\n\t// Check empty fields\n\tmsg, err := client.EchoJSON(context.Background(), &Msg{\n\t\tAllEmpty: true,\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"client.EchoJSON err=%q\", err)\n\t}\n\tif have, want := msg.Query, \"\"; have != want {\n\t\tt.Fatalf(\"invalid msg.Query, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := msg.PageNumber, int32(0); have != want {\n\t\tt.Fatalf(\"invalid msg.PageNumber, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := msg.Hell, float64(0); have != want {\n\t\tt.Fatalf(\"invalid msg.Hell, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := msg.Foobar, Msg_FOO; have != want {\n\t\tt.Fatalf(\"invalid msg.Foobar, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := len(msg.Snippets), 0; have != want {\n\t\tt.Fatalf(\"invalid len(msg.Snippets), have=%v, want=%v\", have, want)\n\t}\n\n\t// Check sending some values and reading the echo\n\tmsg2, err := client.EchoJSON(context.Background(), &Msg{\n\t\tQuery:      \"my query\",\n\t\tPageNumber: 33,\n\t\tHell:       666.666,\n\t\tFoobar:     Msg_BAR,\n\t\tSnippets:   []string{\"s1\", \"s2\"},\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"client.DoJSON err=%q\", err)\n\t}\n\tif have, want := msg2.Query, \"my query\"; have != want {\n\t\tt.Fatalf(\"invalid msg.Query, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := msg2.PageNumber, int32(33); have != want {\n\t\tt.Fatalf(\"invalid msg.PageNumber, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := msg2.Hell, 666.666; have != want {\n\t\tt.Fatalf(\"invalid msg.Hell, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := msg2.Foobar, Msg_BAR; have != want {\n\t\tt.Fatalf(\"invalid msg.Foobar, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := len(msg2.Snippets), 2; have != want {\n\t\tt.Fatalf(\"invalid len(msg.Snippets), have=%v, want=%v\", have, want)\n\t}\n\tif have, want := msg2.Snippets[0], \"s1\"; have != want {\n\t\tt.Fatalf(\"invalid msg2.Snippets[0], have=%v, want=%v\", have, want)\n\t}\n}\n\nfunc TestJSONSerializationServiceSkipDefaults(t *testing.T) {\n\ts := httptest.NewServer(\n\t\tNewJSONSerializationServer(\n\t\t\t&JSONSerializationService{},\n\t\t\ttwirp.WithServerJSONSkipDefaults(true),\n\t\t),\n\t)\n\tdefer s.Close()\n\n\t// Manual JSON request to get empty response.\n\t// Response should skip empty fields, in this case be completely empty\n\treqBody := bytes.NewBuffer([]byte(\n\t\t`{\"allEmpty\": true}`,\n\t))\n\treq, _ := http.NewRequest(\"POST\", s.URL+\"/twirp/JSONSerialization/EchoJSON\", reqBody)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tt.Fatalf(\"manual EchoJSON err=%q\", err)\n\t}\n\tif resp.StatusCode != 200 {\n\t\tt.Fatalf(\"manual EchoJSON invalid status, have=%d, want=200\", resp.StatusCode)\n\t}\n\tbuf := new(bytes.Buffer)\n\t_, _ = buf.ReadFrom(resp.Body)\n\tif buf.String() != \"{}\" {\n\t\tt.Fatalf(\"manual EchoJSON response with JSONSkipDefaults expected to be '{}'. But it is=%q\", buf.String())\n\t}\n\n\t// JSON Client\n\tclient := NewJSONSerializationJSONClient(s.URL, http.DefaultClient)\n\n\t// Check empty fields\n\tmsg, err := client.EchoJSON(context.Background(), &Msg{\n\t\tAllEmpty: true,\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"client.DoJSON err=%q\", err)\n\t}\n\tif have, want := msg.Query, \"\"; have != want {\n\t\tt.Fatalf(\"invalid msg.Query, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := msg.PageNumber, int32(0); have != want {\n\t\tt.Fatalf(\"invalid msg.PageNumber, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := msg.Hell, float64(0); have != want {\n\t\tt.Fatalf(\"invalid msg.Hell, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := msg.Foobar, Msg_FOO; have != want {\n\t\tt.Fatalf(\"invalid msg.Foobar, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := len(msg.Snippets), 0; have != want {\n\t\tt.Fatalf(\"invalid len(msg.Snippets), have=%v, want=%v\", have, want)\n\t}\n\n\t// Check sending some values and reading the echo\n\tmsg2, err := client.EchoJSON(context.Background(), &Msg{\n\t\tQuery:      \"my query\",\n\t\tPageNumber: 33,\n\t\tHell:       666.666,\n\t\tFoobar:     Msg_BAR,\n\t\tSnippets:   []string{\"s1\", \"s2\"},\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"client.DoJSON err=%q\", err)\n\t}\n\tif have, want := msg2.Query, \"my query\"; have != want {\n\t\tt.Fatalf(\"invalid msg.Query, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := msg2.PageNumber, int32(33); have != want {\n\t\tt.Fatalf(\"invalid msg.PageNumber, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := msg2.Hell, 666.666; have != want {\n\t\tt.Fatalf(\"invalid msg.Hell, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := msg2.Foobar, Msg_BAR; have != want {\n\t\tt.Fatalf(\"invalid msg.Foobar, have=%v, want=%v\", have, want)\n\t}\n\tif have, want := len(msg2.Snippets), 2; have != want {\n\t\tt.Fatalf(\"invalid len(msg.Snippets), have=%v, want=%v\", have, want)\n\t}\n\tif have, want := msg2.Snippets[0], \"s1\"; have != want {\n\t\tt.Fatalf(\"invalid msg2.Snippets[0], have=%v, want=%v\", have, want)\n\t}\n}\n\nfunc TestJSONSerializationCamelCase(t *testing.T) {\n\ts := httptest.NewServer(\n\t\tNewJSONSerializationServer(\n\t\t\t&JSONSerializationService{},\n\t\t\ttwirp.WithServerJSONCamelCaseNames(true),\n\t\t),\n\t)\n\tdefer s.Close()\n\n\treqBody := bytes.NewBuffer([]byte(`{\"pageNumber\": 123}`))\n\treq, _ := http.NewRequest(\"POST\", s.URL+\"/twirp/JSONSerialization/EchoJSON\", reqBody)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tt.Fatalf(\"manual EchoJSON err=%q\", err)\n\t}\n\tif resp.StatusCode != 200 {\n\t\tt.Fatalf(\"manual EchoJSON invalid status, have=%d, want=200\", resp.StatusCode)\n\t}\n\n\tobjmap := readJSONAsMap(t, resp.Body)\n\n\t// response includes camelCase names\n\tfor _, field := range []string{\"query\", \"pageNumber\", \"hell\", \"foobar\", \"snippets\", \"allEmpty\"} {\n\t\tif _, ok := objmap[field]; !ok {\n\t\t\tt.Fatalf(\"expected JSON response to include camelCase field %q\", field)\n\t\t}\n\t}\n\n\t// response does not include original snake_case names\n\tfor _, field := range []string{\"page_number\", \"all_empty\"} {\n\t\tif _, ok := objmap[field]; ok {\n\t\t\tt.Fatalf(\"expected JSON response to NOT include snake_case field %q\", field)\n\t\t}\n\t}\n}\n\n//\n// Test helpers\n//\n\nfunc readJSONAsMap(t *testing.T, body io.Reader) map[string]json.RawMessage {\n\tbuf := new(bytes.Buffer)\n\t_, _ = buf.ReadFrom(body)\n\tvar objmap map[string]json.RawMessage\n\terr := json.Unmarshal(buf.Bytes(), &objmap)\n\tif err != nil {\n\t\tt.Fatalf(\"json.Unmarshal err=%q\", err)\n\t}\n\treturn objmap\n}\n"
  },
  {
    "path": "internal/twirptest/multiple/gen.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage multiple\n\n//go:generate protoc --go_out=paths=source_relative:. --twirp_out=paths=source_relative:. multiple1.proto multiple2.proto\n"
  },
  {
    "path": "internal/twirptest/multiple/multiple1.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: multiple1.proto\n\n// Multiple proto files in one package\n\npackage multiple\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\ntype Msg1 struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n}\n\nfunc (x *Msg1) Reset() {\n\t*x = Msg1{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_multiple1_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Msg1) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Msg1) ProtoMessage() {}\n\nfunc (x *Msg1) ProtoReflect() protoreflect.Message {\n\tmi := &file_multiple1_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Msg1.ProtoReflect.Descriptor instead.\nfunc (*Msg1) Descriptor() ([]byte, []int) {\n\treturn file_multiple1_proto_rawDescGZIP(), []int{0}\n}\n\nvar File_multiple1_proto protoreflect.FileDescriptor\n\nvar file_multiple1_proto_rawDesc = []byte{\n\t0x0a, 0x0f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74,\n\t0x6f, 0x12, 0x21, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61,\n\t0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x6d, 0x75, 0x6c, 0x74,\n\t0x69, 0x70, 0x6c, 0x65, 0x22, 0x06, 0x0a, 0x04, 0x4d, 0x73, 0x67, 0x31, 0x32, 0x60, 0x0a, 0x04,\n\t0x53, 0x76, 0x63, 0x31, 0x12, 0x58, 0x0a, 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x27, 0x2e, 0x74,\n\t0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77,\n\t0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65,\n\t0x2e, 0x4d, 0x73, 0x67, 0x31, 0x1a, 0x27, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e,\n\t0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74,\n\t0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x31, 0x42, 0x0b,\n\t0x5a, 0x09, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f,\n\t0x74, 0x6f, 0x33,\n}\n\nvar (\n\tfile_multiple1_proto_rawDescOnce sync.Once\n\tfile_multiple1_proto_rawDescData = file_multiple1_proto_rawDesc\n)\n\nfunc file_multiple1_proto_rawDescGZIP() []byte {\n\tfile_multiple1_proto_rawDescOnce.Do(func() {\n\t\tfile_multiple1_proto_rawDescData = protoimpl.X.CompressGZIP(file_multiple1_proto_rawDescData)\n\t})\n\treturn file_multiple1_proto_rawDescData\n}\n\nvar file_multiple1_proto_msgTypes = make([]protoimpl.MessageInfo, 1)\nvar file_multiple1_proto_goTypes = []interface{}{\n\t(*Msg1)(nil), // 0: twirp.internal.twirptest.multiple.Msg1\n}\nvar file_multiple1_proto_depIdxs = []int32{\n\t0, // 0: twirp.internal.twirptest.multiple.Svc1.Send:input_type -> twirp.internal.twirptest.multiple.Msg1\n\t0, // 1: twirp.internal.twirptest.multiple.Svc1.Send:output_type -> twirp.internal.twirptest.multiple.Msg1\n\t1, // [1:2] is the sub-list for method output_type\n\t0, // [0:1] 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_multiple1_proto_init() }\nfunc file_multiple1_proto_init() {\n\tif File_multiple1_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_multiple1_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Msg1); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_multiple1_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   1,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_multiple1_proto_goTypes,\n\t\tDependencyIndexes: file_multiple1_proto_depIdxs,\n\t\tMessageInfos:      file_multiple1_proto_msgTypes,\n\t}.Build()\n\tFile_multiple1_proto = out.File\n\tfile_multiple1_proto_rawDesc = nil\n\tfile_multiple1_proto_goTypes = nil\n\tfile_multiple1_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/multiple/multiple1.proto",
    "content": "syntax = \"proto3\";\n\n// Multiple proto files in one package\npackage twirp.internal.twirptest.multiple;\noption go_package = \"/multiple\";\n\nmessage Msg1 {}\n\nservice Svc1 {\n  rpc Send(Msg1) returns (Msg1);\n}\n"
  },
  {
    "path": "internal/twirptest/multiple/multiple1.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: multiple1.proto\n\n// Multiple proto files in one package\n\npackage multiple\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// ==============\n// Svc1 Interface\n// ==============\n\ntype Svc1 interface {\n\tSend(context.Context, *Msg1) (*Msg1, error)\n}\n\n// ====================\n// Svc1 Protobuf Client\n// ====================\n\ntype svc1ProtobufClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvc1ProtobufClient creates a Protobuf client that implements the Svc1 interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewSvc1ProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc1 {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.multiple\", \"Svc1\")\n\turls := [1]string{\n\t\tserviceURL + \"Send\",\n\t}\n\n\treturn &svc1ProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svc1ProtobufClient) Send(ctx context.Context, in *Msg1) (*Msg1, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.multiple\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc1\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg1) (*Msg1, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg1)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg1) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg1)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg1) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svc1ProtobufClient) callSend(ctx context.Context, in *Msg1) (*Msg1, error) {\n\tout := new(Msg1)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ================\n// Svc1 JSON Client\n// ================\n\ntype svc1JSONClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvc1JSONClient creates a JSON client that implements the Svc1 interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewSvc1JSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc1 {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.multiple\", \"Svc1\")\n\turls := [1]string{\n\t\tserviceURL + \"Send\",\n\t}\n\n\treturn &svc1JSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svc1JSONClient) Send(ctx context.Context, in *Msg1) (*Msg1, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.multiple\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc1\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg1) (*Msg1, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg1)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg1) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg1)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg1) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svc1JSONClient) callSend(ctx context.Context, in *Msg1) (*Msg1, error) {\n\tout := new(Msg1)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ===================\n// Svc1 Server Handler\n// ===================\n\ntype svc1Server struct {\n\tSvc1\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewSvc1Server builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewSvc1Server(svc Svc1, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &svc1Server{\n\t\tSvc1:             svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *svc1Server) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *svc1Server) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// Svc1PathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst Svc1PathPrefix = \"/twirp/twirp.internal.twirptest.multiple.Svc1/\"\n\nfunc (s *svc1Server) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.multiple\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc1\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"twirp.internal.twirptest.multiple.Svc1\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"Send\":\n\t\ts.serveSend(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *svc1Server) serveSend(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveSendJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveSendProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *svc1Server) serveSendJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg1)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.Svc1.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg1) (*Msg1, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg1)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg1) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc1.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg1)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg1) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg1\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg1 and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svc1Server) serveSendProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg1)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.Svc1.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg1) (*Msg1, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg1)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg1) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc1.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg1)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg1) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg1\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg1 and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svc1Server) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *svc1Server) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *svc1Server) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"twirp.internal.twirptest.multiple\", \"Svc1\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 115 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcf, 0x2d, 0xcd, 0x29,\n\t0xc9, 0x2c, 0xc8, 0x49, 0x35, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x2c, 0x29, 0xcf,\n\t0x2c, 0x2a, 0xd0, 0xcb, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x03, 0x73, 0x4b, 0x52,\n\t0x8b, 0x4b, 0xf4, 0x60, 0x2a, 0x95, 0xd8, 0xb8, 0x58, 0x7c, 0x8b, 0xd3, 0x0d, 0x8d, 0x12, 0xb8,\n\t0x58, 0x82, 0xcb, 0x92, 0x0d, 0x85, 0x22, 0xb8, 0x58, 0x82, 0x53, 0xf3, 0x52, 0x84, 0xd4, 0xf5,\n\t0x08, 0xea, 0xd5, 0x03, 0x69, 0x94, 0x22, 0x56, 0xa1, 0x13, 0x77, 0x14, 0xa7, 0x3e, 0x4c, 0x24,\n\t0x89, 0x0d, 0xec, 0x40, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1c, 0xeb, 0xea, 0x24, 0xb3,\n\t0x00, 0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/twirptest/multiple/multiple2.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: multiple2.proto\n\n// Multiple proto files in one package\n\npackage multiple\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\ntype Msg2 struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n}\n\nfunc (x *Msg2) Reset() {\n\t*x = Msg2{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_multiple2_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Msg2) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Msg2) ProtoMessage() {}\n\nfunc (x *Msg2) ProtoReflect() protoreflect.Message {\n\tmi := &file_multiple2_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Msg2.ProtoReflect.Descriptor instead.\nfunc (*Msg2) Descriptor() ([]byte, []int) {\n\treturn file_multiple2_proto_rawDescGZIP(), []int{0}\n}\n\nvar File_multiple2_proto protoreflect.FileDescriptor\n\nvar file_multiple2_proto_rawDesc = []byte{\n\t0x0a, 0x0f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74,\n\t0x6f, 0x12, 0x21, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61,\n\t0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x6d, 0x75, 0x6c, 0x74,\n\t0x69, 0x70, 0x6c, 0x65, 0x1a, 0x0f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x31, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x06, 0x0a, 0x04, 0x4d, 0x73, 0x67, 0x32, 0x32, 0xcc, 0x01,\n\t0x0a, 0x04, 0x53, 0x76, 0x63, 0x32, 0x12, 0x58, 0x0a, 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x27,\n\t0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e,\n\t0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70,\n\t0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x32, 0x1a, 0x27, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e,\n\t0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65,\n\t0x73, 0x74, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x32,\n\t0x12, 0x6a, 0x0a, 0x16, 0x53, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x50,\n\t0x72, 0x6f, 0x74, 0x6f, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x27, 0x2e, 0x74, 0x77, 0x69,\n\t0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72,\n\t0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x2e, 0x4d,\n\t0x73, 0x67, 0x31, 0x1a, 0x27, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65,\n\t0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x6d,\n\t0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x31, 0x42, 0x0b, 0x5a, 0x09,\n\t0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x33,\n}\n\nvar (\n\tfile_multiple2_proto_rawDescOnce sync.Once\n\tfile_multiple2_proto_rawDescData = file_multiple2_proto_rawDesc\n)\n\nfunc file_multiple2_proto_rawDescGZIP() []byte {\n\tfile_multiple2_proto_rawDescOnce.Do(func() {\n\t\tfile_multiple2_proto_rawDescData = protoimpl.X.CompressGZIP(file_multiple2_proto_rawDescData)\n\t})\n\treturn file_multiple2_proto_rawDescData\n}\n\nvar file_multiple2_proto_msgTypes = make([]protoimpl.MessageInfo, 1)\nvar file_multiple2_proto_goTypes = []interface{}{\n\t(*Msg2)(nil), // 0: twirp.internal.twirptest.multiple.Msg2\n\t(*Msg1)(nil), // 1: twirp.internal.twirptest.multiple.Msg1\n}\nvar file_multiple2_proto_depIdxs = []int32{\n\t0, // 0: twirp.internal.twirptest.multiple.Svc2.Send:input_type -> twirp.internal.twirptest.multiple.Msg2\n\t1, // 1: twirp.internal.twirptest.multiple.Svc2.SamePackageProtoImport:input_type -> twirp.internal.twirptest.multiple.Msg1\n\t0, // 2: twirp.internal.twirptest.multiple.Svc2.Send:output_type -> twirp.internal.twirptest.multiple.Msg2\n\t1, // 3: twirp.internal.twirptest.multiple.Svc2.SamePackageProtoImport:output_type -> twirp.internal.twirptest.multiple.Msg1\n\t2, // [2:4] is the sub-list for method output_type\n\t0, // [0:2] 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_multiple2_proto_init() }\nfunc file_multiple2_proto_init() {\n\tif File_multiple2_proto != nil {\n\t\treturn\n\t}\n\tfile_multiple1_proto_init()\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_multiple2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Msg2); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_multiple2_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   1,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_multiple2_proto_goTypes,\n\t\tDependencyIndexes: file_multiple2_proto_depIdxs,\n\t\tMessageInfos:      file_multiple2_proto_msgTypes,\n\t}.Build()\n\tFile_multiple2_proto = out.File\n\tfile_multiple2_proto_rawDesc = nil\n\tfile_multiple2_proto_goTypes = nil\n\tfile_multiple2_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/multiple/multiple2.proto",
    "content": "syntax = \"proto3\";\n\n// Multiple proto files in one package\npackage twirp.internal.twirptest.multiple;\noption go_package = \"/multiple\";\n\nimport \"multiple1.proto\";\n\nmessage Msg2 {}\n\nservice Svc2 {\n  rpc Send(Msg2) returns (Msg2);\n  rpc SamePackageProtoImport(Msg1) returns (Msg1);\n}\n"
  },
  {
    "path": "internal/twirptest/multiple/multiple2.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: multiple2.proto\n\n// Multiple proto files in one package\n\npackage multiple\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// ==============\n// Svc2 Interface\n// ==============\n\ntype Svc2 interface {\n\tSend(context.Context, *Msg2) (*Msg2, error)\n\n\tSamePackageProtoImport(context.Context, *Msg1) (*Msg1, error)\n}\n\n// ====================\n// Svc2 Protobuf Client\n// ====================\n\ntype svc2ProtobufClient struct {\n\tclient      HTTPClient\n\turls        [2]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvc2ProtobufClient creates a Protobuf client that implements the Svc2 interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewSvc2ProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc2 {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.multiple\", \"Svc2\")\n\turls := [2]string{\n\t\tserviceURL + \"Send\",\n\t\tserviceURL + \"SamePackageProtoImport\",\n\t}\n\n\treturn &svc2ProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svc2ProtobufClient) Send(ctx context.Context, in *Msg2) (*Msg2, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.multiple\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc2\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg2) (*Msg2, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg2)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg2) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg2)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg2) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svc2ProtobufClient) callSend(ctx context.Context, in *Msg2) (*Msg2, error) {\n\tout := new(Msg2)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\nfunc (c *svc2ProtobufClient) SamePackageProtoImport(ctx context.Context, in *Msg1) (*Msg1, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.multiple\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc2\")\n\tctx = ctxsetters.WithMethodName(ctx, \"SamePackageProtoImport\")\n\tcaller := c.callSamePackageProtoImport\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg1) (*Msg1, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg1)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg1) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSamePackageProtoImport(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg1)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg1) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svc2ProtobufClient) callSamePackageProtoImport(ctx context.Context, in *Msg1) (*Msg1, error) {\n\tout := new(Msg1)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ================\n// Svc2 JSON Client\n// ================\n\ntype svc2JSONClient struct {\n\tclient      HTTPClient\n\turls        [2]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvc2JSONClient creates a JSON client that implements the Svc2 interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewSvc2JSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc2 {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.multiple\", \"Svc2\")\n\turls := [2]string{\n\t\tserviceURL + \"Send\",\n\t\tserviceURL + \"SamePackageProtoImport\",\n\t}\n\n\treturn &svc2JSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svc2JSONClient) Send(ctx context.Context, in *Msg2) (*Msg2, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.multiple\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc2\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg2) (*Msg2, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg2)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg2) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg2)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg2) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svc2JSONClient) callSend(ctx context.Context, in *Msg2) (*Msg2, error) {\n\tout := new(Msg2)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\nfunc (c *svc2JSONClient) SamePackageProtoImport(ctx context.Context, in *Msg1) (*Msg1, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.multiple\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc2\")\n\tctx = ctxsetters.WithMethodName(ctx, \"SamePackageProtoImport\")\n\tcaller := c.callSamePackageProtoImport\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg1) (*Msg1, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg1)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg1) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSamePackageProtoImport(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg1)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg1) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svc2JSONClient) callSamePackageProtoImport(ctx context.Context, in *Msg1) (*Msg1, error) {\n\tout := new(Msg1)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ===================\n// Svc2 Server Handler\n// ===================\n\ntype svc2Server struct {\n\tSvc2\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewSvc2Server builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewSvc2Server(svc Svc2, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &svc2Server{\n\t\tSvc2:             svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *svc2Server) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *svc2Server) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// Svc2PathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst Svc2PathPrefix = \"/twirp/twirp.internal.twirptest.multiple.Svc2/\"\n\nfunc (s *svc2Server) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.multiple\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc2\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"twirp.internal.twirptest.multiple.Svc2\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"Send\":\n\t\ts.serveSend(ctx, resp, req)\n\t\treturn\n\tcase \"SamePackageProtoImport\":\n\t\ts.serveSamePackageProtoImport(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *svc2Server) serveSend(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveSendJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveSendProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *svc2Server) serveSendJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg2)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.Svc2.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg2) (*Msg2, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg2)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg2) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc2.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg2)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg2) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg2\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg2 and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svc2Server) serveSendProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg2)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.Svc2.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg2) (*Msg2, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg2)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg2) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc2.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg2)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg2) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg2\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg2 and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svc2Server) serveSamePackageProtoImport(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveSamePackageProtoImportJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveSamePackageProtoImportProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *svc2Server) serveSamePackageProtoImportJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"SamePackageProtoImport\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg1)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.Svc2.SamePackageProtoImport\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg1) (*Msg1, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg1)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg1) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc2.SamePackageProtoImport(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg1)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg1) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg1\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg1 and nil error while calling SamePackageProtoImport. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svc2Server) serveSamePackageProtoImportProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"SamePackageProtoImport\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg1)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.Svc2.SamePackageProtoImport\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg1) (*Msg1, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg1)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg1) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc2.SamePackageProtoImport(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg1)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg1) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg1\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg1 and nil error while calling SamePackageProtoImport. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svc2Server) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor1, 0\n}\n\nfunc (s *svc2Server) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *svc2Server) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"twirp.internal.twirptest.multiple\", \"Svc2\")\n}\n\nvar twirpFileDescriptor1 = []byte{\n\t// 153 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcf, 0x2d, 0xcd, 0x29,\n\t0xc9, 0x2c, 0xc8, 0x49, 0x35, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x2c, 0x29, 0xcf,\n\t0x2c, 0x2a, 0xd0, 0xcb, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x03, 0x73, 0x4b, 0x52,\n\t0x8b, 0x4b, 0xf4, 0x60, 0x2a, 0xa5, 0xe0, 0x7a, 0x0c, 0x21, 0x7a, 0x94, 0xd8, 0xb8, 0x58, 0x7c,\n\t0x8b, 0xd3, 0x8d, 0x8c, 0xce, 0x30, 0x72, 0xb1, 0x04, 0x97, 0x25, 0x1b, 0x09, 0x45, 0x70, 0xb1,\n\t0x04, 0xa7, 0xe6, 0xa5, 0x08, 0xa9, 0xeb, 0x11, 0x34, 0x4d, 0x0f, 0xa4, 0x53, 0x8a, 0x58, 0x85,\n\t0x42, 0x59, 0x5c, 0x62, 0xc1, 0x89, 0xb9, 0xa9, 0x01, 0x89, 0xc9, 0xd9, 0x89, 0xe9, 0xa9, 0x01,\n\t0x20, 0xeb, 0x3d, 0x73, 0x0b, 0xf2, 0x8b, 0x4a, 0x88, 0xb5, 0xcb, 0x90, 0x58, 0xbb, 0x0c, 0x9d,\n\t0xb8, 0xa3, 0x38, 0xf5, 0x61, 0x22, 0x49, 0x6c, 0x60, 0xaf, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff,\n\t0xff, 0x7b, 0x20, 0x14, 0xe1, 0x31, 0x01, 0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/twirptest/multiple/multiple_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage multiple\n\nimport \"testing\"\n\nfunc TestCompilation(t *testing.T) {\n\t// Test passes if this package compiles\n}\n"
  },
  {
    "path": "internal/twirptest/no_package_name/gen.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage no_package_name\n\n//go:generate protoc --go_out=module=github.com/twitchtv/twirp/internal/twirptest/no_package_name:. --twirp_out=module=github.com/twitchtv/twirp/internal/twirptest/no_package_name:. no_package_name.proto\n"
  },
  {
    "path": "internal/twirptest/no_package_name/no_package_name.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: no_package_name.proto\n\npackage no_package_name\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\ntype Msg struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n}\n\nfunc (x *Msg) Reset() {\n\t*x = Msg{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_no_package_name_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Msg) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Msg) ProtoMessage() {}\n\nfunc (x *Msg) ProtoReflect() protoreflect.Message {\n\tmi := &file_no_package_name_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Msg.ProtoReflect.Descriptor instead.\nfunc (*Msg) Descriptor() ([]byte, []int) {\n\treturn file_no_package_name_proto_rawDescGZIP(), []int{0}\n}\n\nvar File_no_package_name_proto protoreflect.FileDescriptor\n\nvar file_no_package_name_proto_rawDesc = []byte{\n\t0x0a, 0x15, 0x6e, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d,\n\t0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x05, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x32, 0x19,\n\t0x0a, 0x03, 0x53, 0x76, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x04, 0x2e,\n\t0x4d, 0x73, 0x67, 0x1a, 0x04, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x3e, 0x5a, 0x3c, 0x67, 0x69, 0x74,\n\t0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x77, 0x69, 0x74, 0x63, 0x68, 0x74, 0x76,\n\t0x2f, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f,\n\t0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x6e, 0x6f, 0x5f, 0x70, 0x61, 0x63,\n\t0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x33,\n}\n\nvar (\n\tfile_no_package_name_proto_rawDescOnce sync.Once\n\tfile_no_package_name_proto_rawDescData = file_no_package_name_proto_rawDesc\n)\n\nfunc file_no_package_name_proto_rawDescGZIP() []byte {\n\tfile_no_package_name_proto_rawDescOnce.Do(func() {\n\t\tfile_no_package_name_proto_rawDescData = protoimpl.X.CompressGZIP(file_no_package_name_proto_rawDescData)\n\t})\n\treturn file_no_package_name_proto_rawDescData\n}\n\nvar file_no_package_name_proto_msgTypes = make([]protoimpl.MessageInfo, 1)\nvar file_no_package_name_proto_goTypes = []interface{}{\n\t(*Msg)(nil), // 0: Msg\n}\nvar file_no_package_name_proto_depIdxs = []int32{\n\t0, // 0: Svc.Send:input_type -> Msg\n\t0, // 1: Svc.Send:output_type -> Msg\n\t1, // [1:2] is the sub-list for method output_type\n\t0, // [0:1] 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_no_package_name_proto_init() }\nfunc file_no_package_name_proto_init() {\n\tif File_no_package_name_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_no_package_name_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Msg); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_no_package_name_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   1,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_no_package_name_proto_goTypes,\n\t\tDependencyIndexes: file_no_package_name_proto_depIdxs,\n\t\tMessageInfos:      file_no_package_name_proto_msgTypes,\n\t}.Build()\n\tFile_no_package_name_proto = out.File\n\tfile_no_package_name_proto_rawDesc = nil\n\tfile_no_package_name_proto_goTypes = nil\n\tfile_no_package_name_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/no_package_name/no_package_name.proto",
    "content": "syntax = \"proto3\";\n\n// No package name\n\noption go_package = \"github.com/twitchtv/twirp/internal/twirptest/no_package_name\";\n\nmessage Msg {}\n\nservice Svc {\n  rpc Send(Msg) returns(Msg);\n}\n"
  },
  {
    "path": "internal/twirptest/no_package_name/no_package_name.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: no_package_name.proto\n\npackage no_package_name\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// =============\n// Svc Interface\n// =============\n\ntype Svc interface {\n\tSend(context.Context, *Msg) (*Msg, error)\n}\n\n// ===================\n// Svc Protobuf Client\n// ===================\n\ntype svcProtobufClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvcProtobufClient creates a Protobuf client that implements the Svc interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewSvcProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"\", \"Svc\")\n\turls := [1]string{\n\t\tserviceURL + \"Send\",\n\t}\n\n\treturn &svcProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svcProtobufClient) Send(ctx context.Context, in *Msg) (*Msg, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svcProtobufClient) callSend(ctx context.Context, in *Msg) (*Msg, error) {\n\tout := new(Msg)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ===============\n// Svc JSON Client\n// ===============\n\ntype svcJSONClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvcJSONClient creates a JSON client that implements the Svc interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewSvcJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"\", \"Svc\")\n\turls := [1]string{\n\t\tserviceURL + \"Send\",\n\t}\n\n\treturn &svcJSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svcJSONClient) Send(ctx context.Context, in *Msg) (*Msg, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tcaller := c.callSend\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callSend(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svcJSONClient) callSend(ctx context.Context, in *Msg) (*Msg, error) {\n\tout := new(Msg)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ==================\n// Svc Server Handler\n// ==================\n\ntype svcServer struct {\n\tSvc\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewSvcServer builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewSvcServer(svc Svc, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &svcServer{\n\t\tSvc:              svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *svcServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *svcServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// SvcPathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst SvcPathPrefix = \"/twirp/Svc/\"\n\nfunc (s *svcServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"Svc\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"Send\":\n\t\ts.serveSend(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *svcServer) serveSend(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveSendJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveSendProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *svcServer) serveSendJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.Svc.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svcServer) serveSendProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Send\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.Svc.Send\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc.Send(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg and nil error while calling Send. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svcServer) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *svcServer) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *svcServer) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"\", \"Svc\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 128 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcd, 0xcb, 0x8f, 0x2f,\n\t0x48, 0x4c, 0xce, 0x4e, 0x4c, 0x4f, 0x8d, 0xcf, 0x4b, 0xcc, 0x4d, 0xd5, 0x2b, 0x28, 0xca, 0x2f,\n\t0xc9, 0x57, 0x62, 0xe5, 0x62, 0xf6, 0x2d, 0x4e, 0x37, 0x92, 0xe4, 0x62, 0x0e, 0x2e, 0x4b, 0x16,\n\t0x12, 0xe2, 0x62, 0x09, 0x4e, 0xcd, 0x4b, 0x11, 0x62, 0xd1, 0xf3, 0x2d, 0x4e, 0x97, 0x02, 0x93,\n\t0x4e, 0x76, 0x51, 0x36, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x25,\n\t0xe5, 0x99, 0x25, 0xc9, 0x19, 0x25, 0x65, 0x20, 0x46, 0x51, 0x81, 0x7e, 0x66, 0x5e, 0x49, 0x6a,\n\t0x51, 0x5e, 0x62, 0x0e, 0x84, 0x5b, 0x92, 0x5a, 0x5c, 0xa2, 0x8f, 0x66, 0x4f, 0x12, 0x1b, 0xd8,\n\t0x22, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xaa, 0x74, 0xcd, 0x8f, 0x81, 0x00, 0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/twirptest/no_package_name_importer/compile_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage no_package_name_importer\n\nimport \"testing\"\n\nfunc TestCompilation(t *testing.T) {\n\t// Test passes if this package compiles\n}\n"
  },
  {
    "path": "internal/twirptest/no_package_name_importer/gen.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage no_package_name_importer\n\n//go:generate protoc --proto_path=../ --go_out=module=github.com/twitchtv/twirp/internal/twirptest:../ --twirp_out=module=github.com/twitchtv/twirp/internal/twirptest:../ ../no_package_name_importer/no_package_name_importer.proto\n"
  },
  {
    "path": "internal/twirptest/no_package_name_importer/no_package_name_importer.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: no_package_name_importer/no_package_name_importer.proto\n\npackage no_package_name_importer\n\nimport (\n\tno_package_name \"github.com/twitchtv/twirp/internal/twirptest/no_package_name\"\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\nvar File_no_package_name_importer_no_package_name_importer_proto protoreflect.FileDescriptor\n\nvar file_no_package_name_importer_no_package_name_importer_proto_rawDesc = []byte{\n\t0x0a, 0x37, 0x6e, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d,\n\t0x65, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x6e, 0x6f, 0x5f, 0x70, 0x61,\n\t0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x6d, 0x70, 0x6f, 0x72,\n\t0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x25, 0x6e, 0x6f, 0x5f, 0x70, 0x61,\n\t0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x2f, 0x6e, 0x6f, 0x5f, 0x70, 0x61,\n\t0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x32, 0x1c, 0x0a, 0x04, 0x53, 0x76, 0x63, 0x32, 0x12, 0x14, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x68,\n\t0x6f, 0x64, 0x12, 0x04, 0x2e, 0x4d, 0x73, 0x67, 0x1a, 0x04, 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x47,\n\t0x5a, 0x45, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x77, 0x69,\n\t0x74, 0x63, 0x68, 0x74, 0x76, 0x2f, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2f, 0x69, 0x6e, 0x74, 0x65,\n\t0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x6e,\n\t0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x69,\n\t0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar file_no_package_name_importer_no_package_name_importer_proto_goTypes = []interface{}{\n\t(*no_package_name.Msg)(nil), // 0: Msg\n}\nvar file_no_package_name_importer_no_package_name_importer_proto_depIdxs = []int32{\n\t0, // 0: Svc2.Method:input_type -> Msg\n\t0, // 1: Svc2.Method:output_type -> Msg\n\t1, // [1:2] is the sub-list for method output_type\n\t0, // [0:1] 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_no_package_name_importer_no_package_name_importer_proto_init() }\nfunc file_no_package_name_importer_no_package_name_importer_proto_init() {\n\tif File_no_package_name_importer_no_package_name_importer_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_no_package_name_importer_no_package_name_importer_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   0,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_no_package_name_importer_no_package_name_importer_proto_goTypes,\n\t\tDependencyIndexes: file_no_package_name_importer_no_package_name_importer_proto_depIdxs,\n\t}.Build()\n\tFile_no_package_name_importer_no_package_name_importer_proto = out.File\n\tfile_no_package_name_importer_no_package_name_importer_proto_rawDesc = nil\n\tfile_no_package_name_importer_no_package_name_importer_proto_goTypes = nil\n\tfile_no_package_name_importer_no_package_name_importer_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/no_package_name_importer/no_package_name_importer.proto",
    "content": "syntax = \"proto3\";\n\n// Import another proto file that doesn't have a package name\n\nimport \"no_package_name/no_package_name.proto\"; // import is relative to protoc's option --proto_path\n\noption go_package = \"github.com/twitchtv/twirp/internal/twirptest/no_package_name_importer\";\n\nservice Svc2 {\n  rpc Method(Msg) returns (Msg);\n}\n"
  },
  {
    "path": "internal/twirptest/no_package_name_importer/no_package_name_importer.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: no_package_name_importer/no_package_name_importer.proto\n\npackage no_package_name_importer\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport no_package_name \"github.com/twitchtv/twirp/internal/twirptest/no_package_name\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// ==============\n// Svc2 Interface\n// ==============\n\ntype Svc2 interface {\n\tMethod(context.Context, *no_package_name.Msg) (*no_package_name.Msg, error)\n}\n\n// ====================\n// Svc2 Protobuf Client\n// ====================\n\ntype svc2ProtobufClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvc2ProtobufClient creates a Protobuf client that implements the Svc2 interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewSvc2ProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc2 {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"\", \"Svc2\")\n\turls := [1]string{\n\t\tserviceURL + \"Method\",\n\t}\n\n\treturn &svc2ProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svc2ProtobufClient) Method(ctx context.Context, in *no_package_name.Msg) (*no_package_name.Msg, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc2\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Method\")\n\tcaller := c.callMethod\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *no_package_name.Msg) (*no_package_name.Msg, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*no_package_name.Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*no_package_name.Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callMethod(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*no_package_name.Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*no_package_name.Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svc2ProtobufClient) callMethod(ctx context.Context, in *no_package_name.Msg) (*no_package_name.Msg, error) {\n\tout := new(no_package_name.Msg)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ================\n// Svc2 JSON Client\n// ================\n\ntype svc2JSONClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewSvc2JSONClient creates a JSON client that implements the Svc2 interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewSvc2JSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Svc2 {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"\", \"Svc2\")\n\turls := [1]string{\n\t\tserviceURL + \"Method\",\n\t}\n\n\treturn &svc2JSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *svc2JSONClient) Method(ctx context.Context, in *no_package_name.Msg) (*no_package_name.Msg, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc2\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Method\")\n\tcaller := c.callMethod\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *no_package_name.Msg) (*no_package_name.Msg, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*no_package_name.Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*no_package_name.Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callMethod(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*no_package_name.Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*no_package_name.Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *svc2JSONClient) callMethod(ctx context.Context, in *no_package_name.Msg) (*no_package_name.Msg, error) {\n\tout := new(no_package_name.Msg)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ===================\n// Svc2 Server Handler\n// ===================\n\ntype svc2Server struct {\n\tSvc2\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewSvc2Server builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewSvc2Server(svc Svc2, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &svc2Server{\n\t\tSvc2:             svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *svc2Server) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *svc2Server) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// Svc2PathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst Svc2PathPrefix = \"/twirp/Svc2/\"\n\nfunc (s *svc2Server) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Svc2\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"Svc2\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"Method\":\n\t\ts.serveMethod(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *svc2Server) serveMethod(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveMethodJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveMethodProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *svc2Server) serveMethodJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Method\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(no_package_name.Msg)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.Svc2.Method\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *no_package_name.Msg) (*no_package_name.Msg, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*no_package_name.Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*no_package_name.Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc2.Method(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*no_package_name.Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*no_package_name.Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *no_package_name.Msg\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *no_package_name.Msg and nil error while calling Method. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svc2Server) serveMethodProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Method\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(no_package_name.Msg)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.Svc2.Method\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *no_package_name.Msg) (*no_package_name.Msg, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*no_package_name.Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*no_package_name.Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Svc2.Method(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*no_package_name.Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*no_package_name.Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *no_package_name.Msg\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *no_package_name.Msg and nil error while calling Method. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *svc2Server) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *svc2Server) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *svc2Server) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"\", \"Svc2\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 143 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0xcf, 0xcb, 0x8f, 0x2f,\n\t0x48, 0x4c, 0xce, 0x4e, 0x4c, 0x4f, 0x8d, 0xcf, 0x4b, 0xcc, 0x4d, 0x8d, 0xcf, 0xcc, 0x2d, 0xc8,\n\t0x2f, 0x2a, 0x49, 0x2d, 0xd2, 0xc7, 0x25, 0xa1, 0x57, 0x50, 0x94, 0x5f, 0x92, 0x2f, 0xa5, 0x8a,\n\t0x26, 0x8f, 0xae, 0x1e, 0xa2, 0xcc, 0x48, 0x86, 0x8b, 0x25, 0xb8, 0x2c, 0xd9, 0x48, 0x48, 0x84,\n\t0x8b, 0xcd, 0x37, 0xb5, 0x24, 0x23, 0x3f, 0x45, 0x88, 0x45, 0xcf, 0xb7, 0x38, 0x5d, 0x0a, 0x4c,\n\t0x3a, 0xb9, 0x47, 0xb9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x97,\n\t0x94, 0x67, 0x96, 0x24, 0x67, 0x94, 0x94, 0x81, 0x18, 0x45, 0x05, 0xfa, 0x99, 0x79, 0x25, 0xa9,\n\t0x45, 0x79, 0x89, 0x39, 0x10, 0x6e, 0x49, 0x6a, 0x71, 0x09, 0x4e, 0x37, 0x25, 0xb1, 0x81, 0x6d,\n\t0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xef, 0x2f, 0x52, 0x09, 0xcf, 0x00, 0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/twirptest/service.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: service.proto\n\npackage twirptest\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\ntype Hat struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tSize  int32  `protobuf:\"varint,1,opt,name=size,proto3\" json:\"size,omitempty\"`\n\tColor string `protobuf:\"bytes,2,opt,name=color,proto3\" json:\"color,omitempty\"`\n\tName  string `protobuf:\"bytes,3,opt,name=name,proto3\" json:\"name,omitempty\"`\n}\n\nfunc (x *Hat) Reset() {\n\t*x = Hat{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_service_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Hat) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Hat) ProtoMessage() {}\n\nfunc (x *Hat) ProtoReflect() protoreflect.Message {\n\tmi := &file_service_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Hat.ProtoReflect.Descriptor instead.\nfunc (*Hat) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{0}\n}\n\nfunc (x *Hat) GetSize() int32 {\n\tif x != nil {\n\t\treturn x.Size\n\t}\n\treturn 0\n}\n\nfunc (x *Hat) GetColor() string {\n\tif x != nil {\n\t\treturn x.Color\n\t}\n\treturn \"\"\n}\n\nfunc (x *Hat) GetName() string {\n\tif x != nil {\n\t\treturn x.Name\n\t}\n\treturn \"\"\n}\n\ntype Size struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tInches int32 `protobuf:\"varint,1,opt,name=inches,proto3\" json:\"inches,omitempty\"`\n}\n\nfunc (x *Size) Reset() {\n\t*x = Size{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_service_proto_msgTypes[1]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Size) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Size) ProtoMessage() {}\n\nfunc (x *Size) ProtoReflect() protoreflect.Message {\n\tmi := &file_service_proto_msgTypes[1]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Size.ProtoReflect.Descriptor instead.\nfunc (*Size) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{1}\n}\n\nfunc (x *Size) GetInches() int32 {\n\tif x != nil {\n\t\treturn x.Inches\n\t}\n\treturn 0\n}\n\nvar File_service_proto protoreflect.FileDescriptor\n\nvar file_service_proto_rawDesc = []byte{\n\t0x0a, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,\n\t0x18, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e,\n\t0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x22, 0x43, 0x0a, 0x03, 0x48, 0x61, 0x74,\n\t0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,\n\t0x73, 0x69, 0x7a, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20,\n\t0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,\n\t0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x1e,\n\t0x0a, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x63, 0x68, 0x65, 0x73,\n\t0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x69, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x32, 0x57,\n\t0x0a, 0x0b, 0x48, 0x61, 0x62, 0x65, 0x72, 0x64, 0x61, 0x73, 0x68, 0x65, 0x72, 0x12, 0x48, 0x0a,\n\t0x07, 0x4d, 0x61, 0x6b, 0x65, 0x48, 0x61, 0x74, 0x12, 0x1e, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70,\n\t0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74,\n\t0x65, 0x73, 0x74, 0x2e, 0x53, 0x69, 0x7a, 0x65, 0x1a, 0x1d, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70,\n\t0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74,\n\t0x65, 0x73, 0x74, 0x2e, 0x48, 0x61, 0x74, 0x42, 0x0c, 0x5a, 0x0a, 0x2f, 0x74, 0x77, 0x69, 0x72,\n\t0x70, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar (\n\tfile_service_proto_rawDescOnce sync.Once\n\tfile_service_proto_rawDescData = file_service_proto_rawDesc\n)\n\nfunc file_service_proto_rawDescGZIP() []byte {\n\tfile_service_proto_rawDescOnce.Do(func() {\n\t\tfile_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_proto_rawDescData)\n\t})\n\treturn file_service_proto_rawDescData\n}\n\nvar file_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2)\nvar file_service_proto_goTypes = []interface{}{\n\t(*Hat)(nil),  // 0: twirp.internal.twirptest.Hat\n\t(*Size)(nil), // 1: twirp.internal.twirptest.Size\n}\nvar file_service_proto_depIdxs = []int32{\n\t1, // 0: twirp.internal.twirptest.Haberdasher.MakeHat:input_type -> twirp.internal.twirptest.Size\n\t0, // 1: twirp.internal.twirptest.Haberdasher.MakeHat:output_type -> twirp.internal.twirptest.Hat\n\t1, // [1:2] is the sub-list for method output_type\n\t0, // [0:1] 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_service_proto_init() }\nfunc file_service_proto_init() {\n\tif File_service_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Hat); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Size); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_service_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   2,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_service_proto_goTypes,\n\t\tDependencyIndexes: file_service_proto_depIdxs,\n\t\tMessageInfos:      file_service_proto_msgTypes,\n\t}.Build()\n\tFile_service_proto = out.File\n\tfile_service_proto_rawDesc = nil\n\tfile_service_proto_goTypes = nil\n\tfile_service_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/service.proto",
    "content": "syntax = \"proto3\";\n\npackage twirp.internal.twirptest;\noption go_package = \"/twirptest\";\n\nmessage Hat {\n  int32 size = 1;\n  string color = 2;\n  string name = 3;\n}\n\nmessage Size {\n  int32 inches = 1;\n}\n\n// A Haberdasher makes hats for clients.\nservice Haberdasher {\n  // MakeHat produces a hat of mysterious, randomly-selected color!\n  rpc MakeHat(Size) returns (Hat);\n}\n"
  },
  {
    "path": "internal/twirptest/service.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: service.proto\n\npackage twirptest\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// =====================\n// Haberdasher Interface\n// =====================\n\n// A Haberdasher makes hats for clients.\ntype Haberdasher interface {\n\t// MakeHat produces a hat of mysterious, randomly-selected color!\n\tMakeHat(context.Context, *Size) (*Hat, error)\n}\n\n// ===========================\n// Haberdasher Protobuf Client\n// ===========================\n\ntype haberdasherProtobufClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewHaberdasherProtobufClient creates a Protobuf client that implements the Haberdasher interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewHaberdasherProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Haberdasher {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest\", \"Haberdasher\")\n\turls := [1]string{\n\t\tserviceURL + \"MakeHat\",\n\t}\n\n\treturn &haberdasherProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *haberdasherProtobufClient) MakeHat(ctx context.Context, in *Size) (*Hat, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Haberdasher\")\n\tctx = ctxsetters.WithMethodName(ctx, \"MakeHat\")\n\tcaller := c.callMakeHat\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Size) (*Hat, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Size)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Size) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callMakeHat(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Hat)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Hat) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *haberdasherProtobufClient) callMakeHat(ctx context.Context, in *Size) (*Hat, error) {\n\tout := new(Hat)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// =======================\n// Haberdasher JSON Client\n// =======================\n\ntype haberdasherJSONClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewHaberdasherJSONClient creates a JSON client that implements the Haberdasher interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewHaberdasherJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Haberdasher {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest\", \"Haberdasher\")\n\turls := [1]string{\n\t\tserviceURL + \"MakeHat\",\n\t}\n\n\treturn &haberdasherJSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *haberdasherJSONClient) MakeHat(ctx context.Context, in *Size) (*Hat, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Haberdasher\")\n\tctx = ctxsetters.WithMethodName(ctx, \"MakeHat\")\n\tcaller := c.callMakeHat\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Size) (*Hat, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Size)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Size) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callMakeHat(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Hat)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Hat) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *haberdasherJSONClient) callMakeHat(ctx context.Context, in *Size) (*Hat, error) {\n\tout := new(Hat)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ==========================\n// Haberdasher Server Handler\n// ==========================\n\ntype haberdasherServer struct {\n\tHaberdasher\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewHaberdasherServer builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewHaberdasherServer(svc Haberdasher, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &haberdasherServer{\n\t\tHaberdasher:      svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *haberdasherServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *haberdasherServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// HaberdasherPathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst HaberdasherPathPrefix = \"/twirp/twirp.internal.twirptest.Haberdasher/\"\n\nfunc (s *haberdasherServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Haberdasher\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"twirp.internal.twirptest.Haberdasher\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"MakeHat\":\n\t\ts.serveMakeHat(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *haberdasherServer) serveMakeHat(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveMakeHatJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveMakeHatProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *haberdasherServer) serveMakeHatJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"MakeHat\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(Size)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.Haberdasher.MakeHat\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Size) (*Hat, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Size)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Size) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Haberdasher.MakeHat(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Hat)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Hat) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Hat\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Hat and nil error while calling MakeHat. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *haberdasherServer) serveMakeHatProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"MakeHat\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(Size)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.Haberdasher.MakeHat\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Size) (*Hat, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Size)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Size) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Haberdasher.MakeHat(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Hat)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Hat) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Hat\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Hat and nil error while calling MakeHat. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *haberdasherServer) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *haberdasherServer) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *haberdasherServer) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"twirp.internal.twirptest\", \"Haberdasher\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 187 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2d, 0x4e, 0x2d, 0x2a,\n\t0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x28, 0x29, 0xcf, 0x2c, 0x2a,\n\t0xd0, 0xcb, 0xcc, 0x2b, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x03, 0x73, 0x4b, 0x52, 0x8b, 0x4b,\n\t0x94, 0x9c, 0xb9, 0x98, 0x3d, 0x12, 0x4b, 0x84, 0x84, 0xb8, 0x58, 0x8a, 0x33, 0xab, 0x52, 0x25,\n\t0x18, 0x15, 0x18, 0x35, 0x58, 0x83, 0xc0, 0x6c, 0x21, 0x11, 0x2e, 0xd6, 0xe4, 0xfc, 0x9c, 0xfc,\n\t0x22, 0x09, 0x26, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x08, 0x07, 0xa4, 0x32, 0x2f, 0x31, 0x37, 0x55,\n\t0x82, 0x19, 0x2c, 0x08, 0x66, 0x2b, 0xc9, 0x71, 0xb1, 0x04, 0x83, 0x74, 0x88, 0x71, 0xb1, 0x65,\n\t0xe6, 0x25, 0x67, 0xa4, 0x16, 0x43, 0xcd, 0x81, 0xf2, 0x8c, 0xc2, 0xb9, 0xb8, 0x3d, 0x12, 0x93,\n\t0x52, 0x8b, 0x52, 0x12, 0x8b, 0x33, 0x52, 0x8b, 0x84, 0x3c, 0xb8, 0xd8, 0x7d, 0x13, 0xb3, 0x53,\n\t0x41, 0xf6, 0xca, 0xe9, 0xe1, 0x72, 0x99, 0x1e, 0xc8, 0x44, 0x29, 0x59, 0xdc, 0xf2, 0x1e, 0x89,\n\t0x25, 0x4e, 0x3c, 0x51, 0x5c, 0xfa, 0x70, 0x91, 0x24, 0x36, 0xb0, 0x67, 0x8d, 0x01, 0x01, 0x00,\n\t0x00, 0xff, 0xff, 0xba, 0x05, 0x11, 0xed, 0xfd, 0x00, 0x00, 0x00,\n}\n"
  },
  {
    "path": "internal/twirptest/service_method_same_name/compile_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage service_method_same_name\n\nimport \"testing\"\n\nfunc TestCompilation(t *testing.T) {\n\t// Test passes if this package compiles\n}\n"
  },
  {
    "path": "internal/twirptest/service_method_same_name/gen.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage service_method_same_name\n\n//go:generate protoc --go_out=paths=source_relative:. --twirp_out=paths=source_relative:. service_method_same_name.proto\n"
  },
  {
    "path": "internal/twirptest/service_method_same_name/service_method_same_name.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: service_method_same_name.proto\n\npackage service_method_same_name\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\ntype Msg struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n}\n\nfunc (x *Msg) Reset() {\n\t*x = Msg{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_service_method_same_name_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Msg) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Msg) ProtoMessage() {}\n\nfunc (x *Msg) ProtoReflect() protoreflect.Message {\n\tmi := &file_service_method_same_name_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Msg.ProtoReflect.Descriptor instead.\nfunc (*Msg) Descriptor() ([]byte, []int) {\n\treturn file_service_method_same_name_proto_rawDescGZIP(), []int{0}\n}\n\nvar File_service_method_same_name_proto protoreflect.FileDescriptor\n\nvar file_service_method_same_name_proto_rawDesc = []byte{\n\t0x0a, 0x1e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64,\n\t0x5f, 0x73, 0x61, 0x6d, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x22, 0x05, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x32, 0x1c, 0x0a, 0x04, 0x45, 0x63, 0x68, 0x6f, 0x12,\n\t0x14, 0x0a, 0x04, 0x45, 0x63, 0x68, 0x6f, 0x12, 0x04, 0x2e, 0x4d, 0x73, 0x67, 0x1a, 0x04, 0x2e,\n\t0x4d, 0x73, 0x67, 0x22, 0x00, 0x42, 0x1b, 0x5a, 0x19, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,\n\t0x65, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x73, 0x61, 0x6d, 0x65, 0x5f, 0x6e, 0x61,\n\t0x6d, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar (\n\tfile_service_method_same_name_proto_rawDescOnce sync.Once\n\tfile_service_method_same_name_proto_rawDescData = file_service_method_same_name_proto_rawDesc\n)\n\nfunc file_service_method_same_name_proto_rawDescGZIP() []byte {\n\tfile_service_method_same_name_proto_rawDescOnce.Do(func() {\n\t\tfile_service_method_same_name_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_method_same_name_proto_rawDescData)\n\t})\n\treturn file_service_method_same_name_proto_rawDescData\n}\n\nvar file_service_method_same_name_proto_msgTypes = make([]protoimpl.MessageInfo, 1)\nvar file_service_method_same_name_proto_goTypes = []interface{}{\n\t(*Msg)(nil), // 0: Msg\n}\nvar file_service_method_same_name_proto_depIdxs = []int32{\n\t0, // 0: Echo.Echo:input_type -> Msg\n\t0, // 1: Echo.Echo:output_type -> Msg\n\t1, // [1:2] is the sub-list for method output_type\n\t0, // [0:1] 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_service_method_same_name_proto_init() }\nfunc file_service_method_same_name_proto_init() {\n\tif File_service_method_same_name_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_service_method_same_name_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Msg); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_service_method_same_name_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   1,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_service_method_same_name_proto_goTypes,\n\t\tDependencyIndexes: file_service_method_same_name_proto_depIdxs,\n\t\tMessageInfos:      file_service_method_same_name_proto_msgTypes,\n\t}.Build()\n\tFile_service_method_same_name_proto = out.File\n\tfile_service_method_same_name_proto_rawDesc = nil\n\tfile_service_method_same_name_proto_goTypes = nil\n\tfile_service_method_same_name_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/service_method_same_name/service_method_same_name.proto",
    "content": "syntax = \"proto3\";\n\n// Test to make sure that a method with the same name as its service doesn't break.\noption go_package = \"/service_method_same_name\";\n\nmessage Msg {}\n\nservice Echo {\n  rpc Echo(Msg) returns (Msg) {}\n}\n"
  },
  {
    "path": "internal/twirptest/service_method_same_name/service_method_same_name.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: service_method_same_name.proto\n\npackage service_method_same_name\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// ==============\n// Echo Interface\n// ==============\n\ntype Echo interface {\n\tEcho(context.Context, *Msg) (*Msg, error)\n}\n\n// ====================\n// Echo Protobuf Client\n// ====================\n\ntype echoProtobufClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewEchoProtobufClient creates a Protobuf client that implements the Echo interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewEchoProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Echo {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"\", \"Echo\")\n\turls := [1]string{\n\t\tserviceURL + \"Echo\",\n\t}\n\n\treturn &echoProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *echoProtobufClient) Echo(ctx context.Context, in *Msg) (*Msg, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Echo\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Echo\")\n\tcaller := c.callEcho\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callEcho(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *echoProtobufClient) callEcho(ctx context.Context, in *Msg) (*Msg, error) {\n\tout := new(Msg)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ================\n// Echo JSON Client\n// ================\n\ntype echoJSONClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewEchoJSONClient creates a JSON client that implements the Echo interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewEchoJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Echo {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tserviceURL += baseServicePath(pathPrefix, \"\", \"Echo\")\n\turls := [1]string{\n\t\tserviceURL + \"Echo\",\n\t}\n\n\treturn &echoJSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *echoJSONClient) Echo(ctx context.Context, in *Msg) (*Msg, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Echo\")\n\tctx = ctxsetters.WithMethodName(ctx, \"Echo\")\n\tcaller := c.callEcho\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callEcho(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *echoJSONClient) callEcho(ctx context.Context, in *Msg) (*Msg, error) {\n\tout := new(Msg)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ===================\n// Echo Server Handler\n// ===================\n\ntype echoServer struct {\n\tEcho\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewEchoServer builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewEchoServer(svc Echo, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &echoServer{\n\t\tEcho:             svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *echoServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *echoServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// EchoPathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst EchoPathPrefix = \"/twirp/Echo/\"\n\nfunc (s *echoServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"\")\n\tctx = ctxsetters.WithServiceName(ctx, \"Echo\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"Echo\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"Echo\":\n\t\ts.serveEcho(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *echoServer) serveEcho(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveEchoJSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveEchoProtobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *echoServer) serveEchoJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Echo\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.Echo.Echo\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Echo.Echo(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg and nil error while calling Echo. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *echoServer) serveEchoProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"Echo\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(Msg)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.Echo.Echo\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *Msg) (*Msg, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*Msg)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*Msg) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.Echo.Echo(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*Msg)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*Msg) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *Msg\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *Msg and nil error while calling Echo. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *echoServer) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *echoServer) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *echoServer) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"\", \"Echo\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 97 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x4e, 0x2d, 0x2a,\n\t0xcb, 0x4c, 0x4e, 0x8d, 0xcf, 0x4d, 0x2d, 0xc9, 0xc8, 0x4f, 0x89, 0x2f, 0x4e, 0xcc, 0x4d, 0x8d,\n\t0xcf, 0x4b, 0xcc, 0x4d, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x57, 0x62, 0xe5, 0x62, 0xf6, 0x2d,\n\t0x4e, 0x37, 0x92, 0xe1, 0x62, 0x71, 0x4d, 0xce, 0xc8, 0x17, 0x12, 0x81, 0xd2, 0x2c, 0x7a, 0xbe,\n\t0xc5, 0xe9, 0x52, 0x60, 0x52, 0x89, 0xc1, 0x49, 0x3a, 0x4a, 0x52, 0x1f, 0x97, 0x39, 0x49, 0x6c,\n\t0x60, 0x83, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x97, 0x74, 0x2e, 0x74, 0x6a, 0x00, 0x00,\n\t0x00,\n}\n"
  },
  {
    "path": "internal/twirptest/service_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage twirptest\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"crypto/tls\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"log\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"os\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"strings\"\n\t\"sync\"\n\t\"testing\"\n\t\"time\"\n\n\tpkgerrors \"github.com/pkg/errors\"\n\t\"google.golang.org/protobuf/encoding/protojson\"\n\n\t\"github.com/twitchtv/twirp\"\n\t\"github.com/twitchtv/twirp/internal/descriptors\"\n)\n\nfunc TestServeJSON(t *testing.T) {\n\th := PickyHatmaker(1)\n\ts := httptest.NewServer(NewHaberdasherServer(h, nil))\n\tdefer s.Close()\n\n\tclient := NewHaberdasherJSONClient(s.URL, http.DefaultClient)\n\n\that, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Fatalf(\"JSON Client err=%q\", err)\n\t}\n\tif hat.Size != 1 {\n\t\tt.Errorf(\"wrong hat size returned\")\n\t}\n\n\t_, err = client.MakeHat(context.Background(), &Size{Inches: -1})\n\tif err == nil {\n\t\tt.Errorf(\"JSON Client expected err, got nil\")\n\t}\n}\n\nfunc TestServerJSONWithMalformedRequest(t *testing.T) {\n\t// Trivial Haberdasher server\n\th := HaberdasherFunc(func(ctx context.Context, s *Size) (*Hat, error) {\n\t\treturn &Hat{}, nil\n\t})\n\ts := httptest.NewServer(NewHaberdasherServer(h))\n\tdefer s.Close()\n\t// Make JSON request with incorrectly-typed field\n\treqJSON := `{\"inches\":\"should_be_number\"}`\n\turl := s.URL + HaberdasherPathPrefix + \"MakeHat\"\n\tresp, err := http.Post(url, \"application/json\", bytes.NewBufferString(reqJSON))\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error: %q\", err.Error())\n\t}\n\tdefer func() {\n\t\tif err = resp.Body.Close(); err != nil {\n\t\t\tt.Fatalf(\"Closing body: %q\", err.Error())\n\t\t}\n\t}()\n\t// Make sure that a 400 status code was returned\n\tif resp.StatusCode != http.StatusBadRequest {\n\t\tt.Fatalf(\"Expected 400 BadRequest when sending malformed request, got %d\", resp.StatusCode)\n\t}\n\t// Make sure the response is meaningful\n\trespBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not even read bytes from response: %q\", err.Error())\n\t}\n\tif !strings.Contains(string(respBytes), \"the json request could not be decoded\") {\n\t\tt.Fatalf(`Expected response to contain \"the json request could not be decoded\", got: %q`, string(respBytes))\n\t}\n}\n\nfunc TestServerJSONWithUnknownFields(t *testing.T) {\n\t// Haberdasher server that returns same size it was requested\n\th := HaberdasherFunc(func(ctx context.Context, s *Size) (*Hat, error) {\n\t\treturn &Hat{Size: s.Inches}, nil\n\t})\n\ts := httptest.NewServer(NewHaberdasherServer(h))\n\tdefer s.Close()\n\n\t// Make JSON request with unknown fields (\"size\" should default to zero-value)\n\treqJSON := `{\"unknown_field1\":\"foo\", \"EXTRASTUFF\":\"bar\"}`\n\turl := s.URL + HaberdasherPathPrefix + \"MakeHat\"\n\tresp, err := http.Post(url, \"application/json\", bytes.NewBufferString(reqJSON))\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error: %q\", err.Error())\n\t}\n\tdefer func() {\n\t\tif err = resp.Body.Close(); err != nil {\n\t\t\tt.Fatalf(\"Closing body: %q\", err.Error())\n\t\t}\n\t}()\n\n\t// Make sure that the returned hat is valid and has empty (zero-value) size\n\trespBytes, err := io.ReadAll(resp.Body) // read manually first in case jsonpb.Unmarshal so it can be printed for debugging\n\tif err != nil {\n\t\tt.Fatalf(\"Could not even read bytes from response: %q\", err.Error())\n\t}\n\that := new(Hat)\n\tif err = protojson.Unmarshal(respBytes, hat); err != nil {\n\t\tt.Fatalf(\"Could not unmarshall response as Hat: %s\", respBytes)\n\t}\n\tif hat.Size != 0 {\n\t\tt.Errorf(\"Expected empty size (zero-value), found %q\", hat.Size)\n\t}\n}\n\nfunc TestServerProtobufMalformedRequest(t *testing.T) {\n\t// Trivial Haberdasher server\n\th := HaberdasherFunc(func(ctx context.Context, s *Size) (*Hat, error) {\n\t\treturn &Hat{}, nil\n\t})\n\ts := httptest.NewServer(NewHaberdasherServer(h))\n\tdefer s.Close()\n\turl := s.URL + HaberdasherPathPrefix + \"MakeHat\"\n\tresp, err := http.Post(url, \"application/protobuf\", bytes.NewBuffer([]byte{1}))\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error: %q\", err.Error())\n\t}\n\tdefer func() {\n\t\tif err = resp.Body.Close(); err != nil {\n\t\t\tt.Fatalf(\"Closing body: %q\", err.Error())\n\t\t}\n\t}()\n\t// Make sure that a 400 status code was returned\n\tif resp.StatusCode != http.StatusBadRequest {\n\t\tt.Fatalf(\"Expected 400 BadRequest when sending malformed request, got %d\", resp.StatusCode)\n\t}\n\t// Make sure the response is meaningful\n\trespBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not even read bytes from response: %q\", err.Error())\n\t}\n\tif !strings.Contains(string(respBytes), \"the protobuf request could not be decoded\") {\n\t\tt.Fatalf(`Expected response to contain \"the protobuf request could not be decoded\", got: %q`, string(respBytes))\n\t}\n}\n\nfunc TestServeProtobuf(t *testing.T) {\n\th := PickyHatmaker(1)\n\ts := httptest.NewServer(NewHaberdasherServer(h))\n\tdefer s.Close()\n\n\tclient := NewHaberdasherProtobufClient(s.URL, http.DefaultClient)\n\n\that, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Fatalf(\"Protobuf Client err=%q\", err)\n\t}\n\tif hat.Size != 1 {\n\t\tt.Errorf(\"wrong hat size returned\")\n\t}\n\n\t_, err = client.MakeHat(context.Background(), &Size{Inches: -1})\n\tif err == nil {\n\t\tt.Errorf(\"Protobuf Client expected err, got nil\")\n\t}\n}\n\ntype contentTypeOverriderClient struct {\n\tcontentType string\n\tbase        HTTPClient\n}\n\nfunc (c *contentTypeOverriderClient) Do(req *http.Request) (*http.Response, error) {\n\treq.Header.Set(\"Content-Type\", c.contentType)\n\treturn c.base.Do(req)\n}\n\nfunc TestContentTypes(t *testing.T) {\n\th := PickyHatmaker(1)\n\ts := httptest.NewServer(NewHaberdasherServer(h))\n\tdefer s.Close()\n\n\tmakeClientWithMimeType := func(mime string) Haberdasher {\n\t\treturn NewHaberdasherJSONClient(s.URL, &contentTypeOverriderClient{\n\t\t\tcontentType: mime,\n\t\t\tbase:        http.DefaultClient,\n\t\t})\n\t}\n\texpectNoError := func(t *testing.T, mime string) {\n\t\t_, err := makeClientWithMimeType(mime).MakeHat(context.Background(), &Size{Inches: 1})\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Client using valid mime type %s err=%q\", mime, err)\n\t\t}\n\t}\n\n\tvalidMimeTypes := []string{\n\t\t\"application/json; charset=UTF-8\",\n\t\t\"application/json\",\n\t}\n\tfor _, mime := range validMimeTypes {\n\t\texpectNoError(t, mime)\n\t}\n\n\tinvalidMimeTypes := []string{\n\t\t\"application/jsonp\",\n\t}\n\tfor _, mime := range invalidMimeTypes {\n\t\texpectBadRouteError(t, makeClientWithMimeType(mime))\n\t}\n}\n\nfunc TestDeadline(t *testing.T) {\n\ttimeout := 1 * time.Millisecond\n\tresponseTime := 50 * timeout\n\th := SlowHatmaker(responseTime)\n\ts, client := ServerAndClient(h, nil)\n\tdefer s.Close()\n\n\tctx := context.Background()\n\tctx, cancel := context.WithTimeout(ctx, timeout)\n\tdefer cancel()\n\n\tdone := make(chan struct{})\n\tgo func() {\n\t\t_, err := client.MakeHat(ctx, &Size{Inches: 1})\n\t\tif err == nil {\n\t\t\tt.Errorf(\"should have timed out, but got nil err\")\n\t\t}\n\t\tclose(done)\n\t}()\n\n\tselect {\n\tcase <-done:\n\t\t// pass\n\tcase <-time.After(responseTime):\n\t\tt.Errorf(\"should have timed out within %s, but %s has elapsed!\", timeout, responseTime)\n\t}\n}\n\n// helper type for the requestRecorder to keep track of which hooks have been\n// called.\ntype hookCall string\n\nconst (\n\treceived hookCall = \"RequestReceived\"\n\trouted   hookCall = \"RequestRouted\"\n\tprepared hookCall = \"ResponsePrepared\"\n\tsent     hookCall = \"ResponseSent\"\n\terrored  hookCall = \"Error\"\n)\n\ntype requestRecorder struct {\n\tsync.Mutex\n\tcalls []hookCall\n}\n\nfunc (r *requestRecorder) reset() {\n\tr.Lock()\n\tr.calls = nil\n\tr.Unlock()\n}\n\nfunc (r *requestRecorder) assertHookCalls(t *testing.T, want []hookCall) {\n\tr.Lock()\n\tdefer r.Unlock()\n\n\tif len(r.calls) != len(want) {\n\t\tt.Error(\"hook calls are wrong\")\n\t\tt.Logf(\"have: %v\", r.calls)\n\t\tt.Logf(\"want: %v\", want)\n\t\tt.FailNow()\n\t}\n\n\tfor i, haveCall := range r.calls {\n\t\twantCall := want[i]\n\t\tif haveCall != wantCall {\n\t\t\tt.Error(\"hook calls are wrong\")\n\t\t\tt.Logf(\"have: %v\", r.calls)\n\t\t\tt.Logf(\"want: %v\", want)\n\t\t\tt.FailNow()\n\t\t}\n\t}\n}\n\nfunc recorderHooks() (*twirp.ServerHooks, *requestRecorder) {\n\trecs := &requestRecorder{}\n\n\thooks := &twirp.ServerHooks{\n\t\tRequestReceived: func(ctx context.Context) (context.Context, error) {\n\t\t\trecs.Lock()\n\t\t\trecs.calls = append(recs.calls, received)\n\t\t\trecs.Unlock()\n\t\t\treturn ctx, nil\n\t\t},\n\t\tRequestRouted: func(ctx context.Context) (context.Context, error) {\n\t\t\trecs.Lock()\n\t\t\trecs.calls = append(recs.calls, routed)\n\t\t\trecs.Unlock()\n\t\t\treturn ctx, nil\n\t\t},\n\t\tResponsePrepared: func(ctx context.Context) context.Context {\n\t\t\trecs.Lock()\n\t\t\trecs.calls = append(recs.calls, prepared)\n\t\t\trecs.Unlock()\n\t\t\treturn ctx\n\t\t},\n\t\tResponseSent: func(ctx context.Context) {\n\t\t\trecs.Lock()\n\t\t\trecs.calls = append(recs.calls, sent)\n\t\t\trecs.Unlock()\n\t\t},\n\t\tError: func(ctx context.Context, _ twirp.Error) context.Context {\n\t\t\trecs.Lock()\n\t\t\trecs.calls = append(recs.calls, errored)\n\t\t\trecs.Unlock()\n\t\t\treturn ctx\n\t\t},\n\t}\n\treturn hooks, recs\n}\n\nfunc TestHooks(t *testing.T) {\n\thooks, recorder := recorderHooks()\n\th := PickyHatmaker(1)\n\n\ts := httptest.NewServer(NewHaberdasherServer(h, hooks))\n\tdefer s.Close()\n\tclient := NewHaberdasherProtobufClient(s.URL, http.DefaultClient)\n\n\tt.Run(\"happy path\", func(t *testing.T) {\n\t\trecorder.reset()\n\t\t_, clientErr := client.MakeHat(context.Background(), &Size{Inches: 1})\n\t\tif clientErr != nil {\n\t\t\tt.Fatalf(\"client err=%q\", clientErr)\n\t\t}\n\t\trecorder.assertHookCalls(t, []hookCall{\n\t\t\treceived, routed, prepared, sent,\n\t\t})\n\t})\n\n\tt.Run(\"application error\", func(t *testing.T) {\n\t\trecorder.reset()\n\t\t_, clientErr := client.MakeHat(context.Background(), &Size{Inches: -1})\n\t\tif clientErr == nil {\n\t\t\tt.Fatal(\"client err expected with negative Size parameter, but have nil\")\n\t\t}\n\t\trecorder.assertHookCalls(t, []hookCall{\n\t\t\treceived, routed, errored, sent,\n\t\t})\n\t})\n\n\tt.Run(\"bad http method\", func(t *testing.T) {\n\t\trecorder.reset()\n\t\t// Use a client that sends GET requests instead of POST.\n\t\trw := &reqRewriter{\n\t\t\tbase: http.DefaultTransport,\n\t\t\trewrite: func(r *http.Request) *http.Request {\n\t\t\t\tr.Method = \"GET\"\n\t\t\t\treturn r\n\t\t\t},\n\t\t}\n\t\thttpClient := &http.Client{Transport: rw}\n\t\tclient := NewHaberdasherProtobufClient(s.URL, httpClient)\n\n\t\t_, clientErr := client.MakeHat(context.Background(), &Size{Inches: -1})\n\t\tif clientErr == nil {\n\t\t\tt.Fatal(\"client err expected with bad HTTP method, but have nil\")\n\t\t}\n\t\trecorder.assertHookCalls(t, []hookCall{\n\t\t\treceived, errored, sent,\n\t\t})\n\t})\n\n\tt.Run(\"bad url\", func(t *testing.T) {\n\t\trecorder.reset()\n\t\t// Use a client that sends requests to the wrong URL\n\t\trw := &reqRewriter{\n\t\t\tbase: http.DefaultTransport,\n\t\t\trewrite: func(r *http.Request) *http.Request {\n\t\t\t\tr.URL.Path = r.URL.Path + \"bogus\"\n\t\t\t\treturn r\n\t\t\t},\n\t\t}\n\t\thttpClient := &http.Client{Transport: rw}\n\t\tclient := NewHaberdasherProtobufClient(s.URL, httpClient)\n\n\t\t_, clientErr := client.MakeHat(context.Background(), &Size{Inches: -1})\n\t\tif clientErr == nil {\n\t\t\tt.Fatal(\"client err expected with bad URL, but have nil\")\n\t\t}\n\t\trecorder.assertHookCalls(t, []hookCall{\n\t\t\treceived, errored, sent,\n\t\t})\n\t})\n\n\tt.Run(\"missing headers\", func(t *testing.T) {\n\t\trecorder.reset()\n\t\t// Use a client that sends requests without headers\n\t\trw := &reqRewriter{\n\t\t\tbase: http.DefaultTransport,\n\t\t\trewrite: func(r *http.Request) *http.Request {\n\t\t\t\tr.Header = make(http.Header)\n\t\t\t\treturn r\n\t\t\t},\n\t\t}\n\t\thttpClient := &http.Client{Transport: rw}\n\t\tclient := NewHaberdasherProtobufClient(s.URL, httpClient)\n\n\t\t_, clientErr := client.MakeHat(context.Background(), &Size{Inches: -1})\n\t\tif clientErr == nil {\n\t\t\tt.Fatal(\"client err expected with missing headers, but have nil\")\n\t\t}\n\t\trecorder.assertHookCalls(t, []hookCall{\n\t\t\treceived, errored, sent,\n\t\t})\n\t})\n\n\tt.Run(\"partial request body\", func(t *testing.T) {\n\t\trecorder.reset()\n\t\t// Use a client that sends 1 byte of the body and then stops\n\t\trw := &reqRewriter{\n\t\t\tbase: http.DefaultTransport,\n\t\t\trewrite: func(r *http.Request) *http.Request {\n\t\t\t\tr.ContentLength = 1\n\t\t\t\tr.Body = io.NopCloser(io.LimitReader(r.Body, 1))\n\t\t\t\treturn r\n\t\t\t},\n\t\t}\n\t\thttpClient := &http.Client{Transport: rw}\n\t\tclient := NewHaberdasherProtobufClient(s.URL, httpClient)\n\n\t\t_, clientErr := client.MakeHat(context.Background(), &Size{Inches: -1})\n\t\tif clientErr == nil {\n\t\t\tt.Fatal(\"client err expected with partial request body, but have nil\")\n\t\t}\n\t\trecorder.assertHookCalls(t, []hookCall{\n\t\t\treceived, routed, errored, sent,\n\t\t})\n\t})\n}\n\n// Test that a Twirp server will work even if it receives a ServiceHooks with a\n// nil function for one of its hooks.\nfunc TestNilHooks(t *testing.T) {\n\tvar testcase = func(hooks *twirp.ServerHooks) func(*testing.T) {\n\t\treturn func(t *testing.T) {\n\t\t\th := PickyHatmaker(1)\n\t\t\ts := httptest.NewServer(NewHaberdasherServer(h, hooks))\n\t\t\tdefer s.Close()\n\t\t\tc := NewHaberdasherProtobufClient(s.URL, http.DefaultClient)\n\t\t\t_, err := c.MakeHat(context.Background(), &Size{Inches: 1})\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"client err=%q\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\th, _ := recorderHooks()\n\th.RequestReceived = nil\n\tt.Run(\"nil RequestReceived\", testcase(h))\n\n\th, _ = recorderHooks()\n\th.RequestRouted = nil\n\tt.Run(\"nil RequestRouted\", testcase(h))\n\n\th, _ = recorderHooks()\n\th.ResponsePrepared = nil\n\tt.Run(\"nil ResponsePrepared\", testcase(h))\n\n\th, _ = recorderHooks()\n\th.ResponseSent = nil\n\tt.Run(\"nil ResponseSent\", testcase(h))\n\n\th, _ = recorderHooks()\n\th.Error = nil\n\tt.Run(\"nil Error\", testcase(h))\n}\n\nfunc TestErroringHooks(t *testing.T) {\n\tt.Run(\"RequestReceived error\", func(t *testing.T) {\n\t\t// Set up hooks that error on request received. The request should be\n\t\t// aborted at that point, the Error hook should be triggered, and the client\n\t\t// should see an error.\n\t\thooks := &twirp.ServerHooks{}\n\t\thookErr := twirp.NewError(twirp.Unauthenticated, \"error in hook\")\n\t\terrorHookCalled := false\n\t\thooks.RequestReceived = func(ctx context.Context) (context.Context, error) {\n\t\t\treturn ctx, hookErr\n\t\t}\n\t\thooks.RequestRouted = func(ctx context.Context) (context.Context, error) {\n\t\t\tt.Errorf(\"request was routed\")\n\t\t\treturn ctx, nil\n\t\t}\n\t\thooks.Error = func(ctx context.Context, err twirp.Error) context.Context {\n\t\t\tif err != hookErr {\n\t\t\t\tt.Errorf(\"Error hook did not receive error from RequestReceived. have=%v, want=%v\", err, hookErr)\n\t\t\t}\n\t\t\terrorHookCalled = true\n\t\t\treturn ctx\n\t\t}\n\n\t\th := PickyHatmaker(1)\n\t\ts := httptest.NewServer(NewHaberdasherServer(h, hooks))\n\t\tdefer s.Close()\n\t\tc := NewHaberdasherProtobufClient(s.URL, http.DefaultClient)\n\t\t_, err := c.MakeHat(context.Background(), &Size{Inches: 1})\n\t\tif err == nil {\n\t\t\tt.Fatalf(\"client err=nil, expected=%v\", hookErr)\n\t\t}\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"client err type=%T, expected twirp.Error\", err)\n\t\t}\n\n\t\tif twerr.Code() != twirp.Unauthenticated {\n\t\t\tt.Errorf(\"client err code=%v, expected=%v\", twerr.Code(), twirp.Unauthenticated)\n\t\t}\n\n\t\tif !errorHookCalled {\n\t\t\tt.Error(\"Error hook was not triggered\")\n\t\t}\n\t})\n\n\tt.Run(\"RequestRouted error\", func(t *testing.T) {\n\t\t// Set up hooks that error on request routed. The request should be aborted\n\t\t// at that point, the Error hook should be triggered, and the client should\n\t\t// see an error.\n\t\thooks := &twirp.ServerHooks{}\n\t\thookErr := twirp.NewError(twirp.Unauthenticated, \"error in hook\")\n\t\terrorHookCalled := false\n\t\thooks.RequestRouted = func(ctx context.Context) (context.Context, error) {\n\t\t\treturn ctx, hookErr\n\t\t}\n\t\thooks.Error = func(ctx context.Context, err twirp.Error) context.Context {\n\t\t\tif err != hookErr {\n\t\t\t\tt.Errorf(\"Error hook did not receive error from RequestRouted. have=%v, want=%v\", err, hookErr)\n\t\t\t}\n\t\t\terrorHookCalled = true\n\t\t\treturn ctx\n\t\t}\n\n\t\th := PickyHatmaker(1)\n\t\ts := httptest.NewServer(NewHaberdasherServer(h, hooks))\n\t\tdefer s.Close()\n\t\tc := NewHaberdasherProtobufClient(s.URL, http.DefaultClient)\n\t\t_, err := c.MakeHat(context.Background(), &Size{Inches: 1})\n\t\tif err == nil {\n\t\t\tt.Fatalf(\"client err=nil, expected=%v\", hookErr)\n\t\t}\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"client err type=%T, expected twirp.Error\", err)\n\t\t}\n\n\t\tif twerr.Code() != twirp.Unauthenticated {\n\t\t\tt.Errorf(\"client err code=%v, expected=%v\", twerr.Code(), twirp.Unauthenticated)\n\t\t}\n\n\t\tif !errorHookCalled {\n\t\t\tt.Error(\"Error hook was not triggered\")\n\t\t}\n\t})\n}\n\nfunc TestInterceptor(t *testing.T) {\n\tinterceptor := func(next twirp.Method) twirp.Method {\n\t\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\t\tmethodName, _ := twirp.MethodName(ctx)\n\t\t\tif methodName != \"MakeHat\" {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected methodName: %q\", methodName)\n\t\t\t}\n\t\t\tserviceName, _ := twirp.ServiceName(ctx)\n\t\t\tif serviceName != \"Haberdasher\" {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected serviceName: %q\", serviceName)\n\t\t\t}\n\t\t\tpackageName, _ := twirp.PackageName(ctx)\n\t\t\tif packageName != \"twirp.internal.twirptest\" {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected packageName: %q\", packageName)\n\t\t\t}\n\t\t\tsize, ok := request.(*Size)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"could not cast %T to a *Size\", request)\n\t\t\t}\n\t\t\tsize.Inches = size.Inches + 1\n\t\t\tresponse, err := next(ctx, request)\n\t\t\that, ok := response.(*Hat)\n\t\t\tif ok && hat != nil {\n\t\t\t\that.Color = hat.Color + \"x\"\n\t\t\t\treturn hat, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\th := PickyHatmaker(3)\n\n\ts := httptest.NewServer(NewHaberdasherServer(h))\n\tdefer s.Close()\n\tclient := NewHaberdasherProtobufClient(s.URL, http.DefaultClient)\n\that, clientErr := client.MakeHat(context.Background(), &Size{Inches: 3})\n\tif clientErr != nil {\n\t\tt.Fatalf(\"client err=%q\", clientErr)\n\t}\n\tif hat.Size != 3 {\n\t\tt.Errorf(\"hat size expected=3 actual=%v\", hat.Size)\n\t}\n\n\ts = httptest.NewServer(\n\t\tNewHaberdasherServer(\n\t\t\th,\n\t\t\ttwirp.WithServerInterceptors(\n\t\t\t\tinterceptor,\n\t\t\t\tinterceptor,\n\t\t\t),\n\t\t),\n\t)\n\tdefer s.Close()\n\tclient = NewHaberdasherProtobufClient(s.URL, http.DefaultClient)\n\that, clientErr = client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif clientErr != nil {\n\t\tt.Fatalf(\"client err=%q\", clientErr)\n\t}\n\tif hat.Size != 3 {\n\t\tt.Errorf(\"hat size expected=3 actual=%v\", hat.Size)\n\t}\n\tif hat.Color != \"bluexx\" {\n\t\tt.Errorf(\"hat color expected=bluexx actual=%v\", hat.Color)\n\t}\n\t_, clientErr = client.MakeHat(context.Background(), &Size{Inches: 3})\n\ttwerr, ok := clientErr.(twirp.Error)\n\tif !ok {\n\t\tt.Fatalf(\"expected twirp.Error type error, have %T\", clientErr)\n\t}\n\tif twerr.Code() != twirp.InvalidArgument {\n\t\tt.Errorf(\"expected error type to be InvalidArgument, buf found %q\", twerr.Code())\n\t}\n}\n\nfunc TestInternalErrorPassing(t *testing.T) {\n\te := twirp.InternalError(\"fatal :(\")\n\n\th := ErroringHatmaker(e)\n\ts, c := ServerAndClient(h, nil)\n\tdefer s.Close()\n\n\t_, err := c.MakeHat(context.Background(), &Size{})\n\tif err == nil {\n\t\tt.Fatal(\"expected err, have nil\")\n\t}\n\n\ttwerr, ok := err.(twirp.Error)\n\tif !ok {\n\t\tt.Fatalf(\"expected twirp.Error type error, have %T\", err)\n\t}\n\n\tif twerr.Code() != twirp.Internal {\n\t\tt.Errorf(\"expected error type to be Internal, buf found %q\", twerr.Code())\n\t}\n\tif twerr.Meta(\"retryable\") != \"\" {\n\t\tt.Errorf(\"expected error to be non-retryable, but it is (should not have meta)\")\n\t}\n\tif twerr.Msg() != \"fatal :(\" {\n\t\tt.Errorf(\"expected error message to be passed through, but have=%q\", twerr.Msg())\n\t}\n}\n\nfunc TestErrorWithRetryableMeta(t *testing.T) {\n\teMsg := \"try again!\"\n\te := twirp.NewError(twirp.Unavailable, eMsg)\n\te = e.WithMeta(\"retryable\", \"true\")\n\n\th := ErroringHatmaker(e)\n\ts, c := ServerAndClient(h, nil)\n\tdefer s.Close()\n\n\t_, err := c.MakeHat(context.Background(), &Size{})\n\tif err == nil {\n\t\tt.Fatal(\"expected err, have nil\")\n\t}\n\n\ttwerr, ok := err.(twirp.Error)\n\tif !ok {\n\t\tt.Fatalf(\"expected twirp.Error type error, have %T\", err)\n\t}\n\n\tif twerr.Meta(\"retryable\") != \"true\" {\n\t\tt.Errorf(\"expected error to be retryable, but it isnt\")\n\t}\n\tif twerr.Msg() != eMsg {\n\t\tt.Errorf(\"expected error Msg to be %q, but found %q\", eMsg, twerr.Msg())\n\t}\n}\n\nfunc TestErrorCodePassing(t *testing.T) {\n\te := twirp.NewError(twirp.AlreadyExists, \"hand-picked ErrorCode\")\n\n\th := ErroringHatmaker(e)\n\ts, c := ServerAndClient(h, nil)\n\tdefer s.Close()\n\n\t_, err := c.MakeHat(context.Background(), &Size{})\n\tif err == nil {\n\t\tt.Fatal(\"expected err, have nil\")\n\t}\n\n\ttwerr, ok := err.(twirp.Error)\n\tif !ok {\n\t\tt.Fatalf(\"expected twirp.Error type error, have %T\", err)\n\t}\n\n\tif twerr.Code() != twirp.AlreadyExists {\n\t\tt.Errorf(\"expected ErrorCode to be passed through to the client to be %q, but have %q\", twirp.AlreadyExists, twerr.Code())\n\t}\n}\n\n// Non twirp errors returned by the servers should become twirp Internal errors.\nfunc TestNonTwirpErrorWrappedAsInternal(t *testing.T) {\n\te := errors.New(\"I am not a twirp error, should become internal\")\n\n\th := ErroringHatmaker(e)\n\ts, c := ServerAndClient(h, nil)\n\tdefer s.Close()\n\n\t_, err := c.MakeHat(context.Background(), &Size{})\n\tif err == nil {\n\t\tt.Fatal(\"expected err, found nil\")\n\t}\n\n\ttwerr, ok := err.(twirp.Error)\n\tif !ok {\n\t\tt.Fatalf(\"expected error type to be 'twirp.Error', but found %T\", err)\n\t}\n\n\tif twerr.Code() != twirp.Internal {\n\t\tt.Errorf(\"expected ErrorCode to be %q, but found %q\", twirp.Internal, twerr.Code())\n\t}\n\n\tif twerr.Msg() != e.Error() { // NOTE: that twerr.Error() is not e.Error() because it has a \"twirp error Internal: *\" prefix\n\t\tt.Errorf(\"expected Msg to be %q, but found %q\", e.Error(), twerr.Msg())\n\t}\n}\n\n// Clients should be able to connect over HTTPS\nfunc TestConnectTLS(t *testing.T) {\n\th := PickyHatmaker(1)\n\ts := httptest.NewUnstartedServer(NewHaberdasherServer(h))\n\ts.TLS = &tls.Config{}\n\ts.StartTLS()\n\tdefer s.Close()\n\n\tif !strings.HasPrefix(s.URL, \"https\") {\n\t\tt.Fatal(\"test server not serving over HTTPS\")\n\t}\n\n\thttpsClient := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\t},\n\t}\n\n\tclient := NewHaberdasherJSONClient(s.URL, httpsClient)\n\n\that, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Fatalf(\"JSON Client err=%q\", err)\n\t}\n\tif hat.Size != 1 {\n\t\tt.Errorf(\"wrong hat size returned\")\n\t}\n\n\t_, err = client.MakeHat(context.Background(), &Size{Inches: -1})\n\tif err == nil {\n\t\tt.Errorf(\"JSON Client expected err, got nil\")\n\t}\n}\n\nfunc TestRoutingPathPrefix(t *testing.T) {\n\tctx := context.Background()\n\tr := &Size{Inches: 1}\n\n\tmyCustomPrefix := \"/my/custom/prefix\"\n\th := PickyHatmaker(1)\n\tserver := NewHaberdasherServer(h, twirp.WithServerPathPrefix(myCustomPrefix))\n\n\tif have, want := server.PathPrefix(), \"/my/custom/prefix/twirp.internal.twirptest.Haberdasher/\"; have != want {\n\t\tt.Fatalf(\"invalid server.PathPrefix(), have=%q, want=%q\", have, want)\n\t}\n\n\tvar lastPath string\n\tpathTracker := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tlastPath = r.URL.Path\n\t\tserver.ServeHTTP(w, r)\n\t})\n\n\ts := httptest.NewServer(pathTracker)\n\tdefer s.Close()\n\n\t// Clients need to use the same prefix to hit the service\n\tc1 := NewHaberdasherJSONClient(s.URL, http.DefaultClient, twirp.WithClientPathPrefix(myCustomPrefix))\n\tif _, err := c1.MakeHat(ctx, r); err != nil {\n\t\tt.Fatalf(\"Routing err: %v\", err)\n\t}\n\tif have, want := lastPath, \"/my/custom/prefix/twirp.internal.twirptest.Haberdasher/MakeHat\"; have != want {\n\t\tt.Fatalf(\"invalid URL path, have=%q, want=%q\", have, want)\n\t}\n\n\t// Clients using the default \"/twirp\" prefix should not hit the service\n\tc2 := NewHaberdasherProtobufClient(s.URL, http.DefaultClient)\n\tif _, err := c2.MakeHat(ctx, r); err == nil {\n\t\tt.Fatalf(\"Expected bad_route error because service has a different path prefix, got nil\")\n\t}\n\tif have, want := lastPath, \"/twirp/twirp.internal.twirptest.Haberdasher/MakeHat\"; have != want {\n\t\tt.Fatalf(\"invalid URL path, have=%q, want=%q\", have, want)\n\t}\n\n\t// Clients using no prefix (empty) should not hit the service\n\tc3 := NewHaberdasherProtobufClient(s.URL, http.DefaultClient, twirp.WithClientPathPrefix(\"\"))\n\tif _, err := c3.MakeHat(ctx, r); err == nil {\n\t\tt.Fatalf(\"Expected bad_route error because service has a different path prefix, got nil\")\n\t}\n\tif have, want := lastPath, \"/twirp.internal.twirptest.Haberdasher/MakeHat\"; have != want {\n\t\tt.Fatalf(\"invalid URL path, have=%q, want=%q\", have, want)\n\t}\n}\n\nfunc TestRoutingPathPrefixDefault(t *testing.T) {\n\tctx := context.Background()\n\tr := &Size{Inches: 1}\n\n\tserver := NewHaberdasherServer(PickyHatmaker(1))\n\ts := httptest.NewServer(server)\n\tdefer s.Close()\n\n\t// Check default value\n\tif have, want := server.PathPrefix(), \"/twirp/twirp.internal.twirptest.Haberdasher/\"; have != want {\n\t\tt.Fatalf(\"invalid server.PathPrefix(), have=%q, want=%q\", have, want)\n\t}\n\n\t// Clients use the /twirp prefix by default\n\tc1 := NewHaberdasherJSONClient(s.URL, http.DefaultClient)\n\tif _, err := c1.MakeHat(ctx, r); err != nil {\n\t\tt.Fatalf(\"Routing err: %v\", err)\n\t}\n\n\t// Clients can specifically set the \"/twirp\" prefix\n\tc2 := NewHaberdasherProtobufClient(s.URL, http.DefaultClient, twirp.WithClientPathPrefix(\"/twirp\"))\n\tif _, err := c2.MakeHat(ctx, r); err != nil {\n\t\tt.Fatalf(\"Routing err: %v\", err)\n\t}\n\n\t// Clients using a different prefix do not hit the service\n\tc3 := NewHaberdasherProtobufClient(s.URL, http.DefaultClient, twirp.WithClientPathPrefix(\"/anotherprefix\"))\n\tif _, err := c3.MakeHat(ctx, r); err == nil {\n\t\tt.Fatalf(\"Expected bad_route error because service has a different path prefix, got nil\")\n\t}\n}\n\n// Twirp routes with prefixes: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n// using a mux to match the same prefix on the server\nfunc TestMuxingRoutingPathPrefixes(t *testing.T) {\n\tctx := context.Background()\n\n\tmux := http.NewServeMux()\n\n\t// Handle route prefix, using the same prefix on the server: only hats of size 1\n\tserver1 := NewHaberdasherServer(PickyHatmaker(1), twirp.WithServerPathPrefix(\"/pickyone\"))\n\tmux.Handle(\"/pickyone/\", server1)\n\n\t// Handle route prefix, using the .PathPrefix() method on the server: only hats of size 99\n\tserver99 := NewHaberdasherServer(PickyHatmaker(99), twirp.WithServerPathPrefix(\"/pickyninenine\"))\n\tmux.Handle(server99.PathPrefix(), server99)\n\n\t// Handle route with no prefix: hats of size zero\n\tserver0 := NewHaberdasherServer(PickyHatmaker(0), twirp.WithServerPathPrefix(\"\"))\n\tmux.Handle(\"/\", server0)\n\n\ts := httptest.NewServer(mux)\n\tdefer s.Close()\n\n\t// Client with default baseURL and /twirp prefix is not able to hit any service\n\tc1 := NewHaberdasherProtobufClient(s.URL, http.DefaultClient)\n\tif _, err := c1.MakeHat(ctx, &Size{Inches: 1}); err == nil {\n\t\tt.Fatalf(\"Expected routing error, got nil\")\n\t}\n\n\t// Client with custom prefix hits one server, but not the others\n\tc2 := NewHaberdasherProtobufClient(s.URL, http.DefaultClient, twirp.WithClientPathPrefix(\"/pickyone\"))\n\tif _, err := c2.MakeHat(ctx, &Size{Inches: 1}); err != nil {\n\t\tt.Fatalf(\"Unexpected err: %v\", err)\n\t}\n\tif _, err := c2.MakeHat(ctx, &Size{Inches: 99}); err == nil { // PickyHatmaker(1) returns an error with size 99\n\t\tt.Fatalf(\"Expected picky hat size error, got nil\")\n\t}\n\n\t// Client with custom prefix on the picky 99\n\tc3 := NewHaberdasherJSONClient(s.URL, http.DefaultClient, twirp.WithClientPathPrefix(\"/pickyninenine\"))\n\tif _, err := c3.MakeHat(ctx, &Size{Inches: 99}); err != nil {\n\t\tt.Fatalf(\"Unexpected err: %v\", err)\n\t}\n\tif _, err := c3.MakeHat(ctx, &Size{Inches: 1}); err == nil { // PickyHatmaker(99) returns an error with size 1\n\t\tt.Fatalf(\"Expected picky hat size error, got nil\")\n\t}\n\n\t// Client with mepty prefix should hit picky 0\n\tc4 := NewHaberdasherJSONClient(s.URL, http.DefaultClient, twirp.WithClientPathPrefix(\"\"))\n\tif _, err := c4.MakeHat(ctx, &Size{Inches: 0}); err != nil {\n\t\tt.Fatalf(\"Unexpected err: %v\", err)\n\t}\n\tif _, err := c4.MakeHat(ctx, &Size{Inches: 1}); err == nil { // PickyHatmaker(0) returns an error with size 1\n\t\tt.Fatalf(\"Expected picky hat size error, got nil\")\n\t}\n\n\t// Nested prefixes should not work, even if they math the mux routing rules.\n\t// This is needed to ensure backwards compatibility with the previous mandatory /twirp prefix.\n\tc5 := NewHaberdasherProtobufClient(s.URL, http.DefaultClient, twirp.WithClientPathPrefix(\"/pickyone/but/way/too/nested\"))\n\tif _, err := c5.MakeHat(ctx, &Size{Inches: 1}); err == nil { // should return bad route error\n\t\tt.Fatalf(\"Expected bad route error, got nil\")\n\t} else {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok || twerr.Code() != twirp.BadRoute {\n\t\t\tt.Fatalf(\"Expected bad route error, got %v\", err)\n\t\t}\n\t}\n}\n\n// It should be possible to serve twirp alongside non-twirp handlers\nfunc TestMuxingTwirpServerConst(t *testing.T) {\n\t// Create a twirp endpoint.\n\ttwirpHandler := NewHaberdasherServer(PickyHatmaker(1))\n\n\ttestMuxingTwirpServer(t, HaberdasherPathPrefix, twirpHandler)\n}\n\nfunc TestMuxingTwirpServerPrefixMethod(t *testing.T) {\n\t// Create a twirp endpoint.\n\ttwirpHandler := NewHaberdasherServer(PickyHatmaker(1))\n\n\ttestMuxingTwirpServer(t, twirpHandler.PathPrefix(), twirpHandler)\n}\n\nfunc testMuxingTwirpServer(t *testing.T, prefix string, handler TwirpServer) {\n\t// Create a healthcheck endpoint. Record that it got called in a boolean.\n\thealthcheckCalled := false\n\thealthcheck := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\thealthcheckCalled = true\n\t\tw.WriteHeader(200)\n\t\t_, err := w.Write([]byte(\"Looking good, Louis!\"))\n\t\tif err != nil {\n\t\t\tt.Errorf(\"err writing response: %s\", err)\n\t\t}\n\t})\n\n\t// Serve the healthcheck at /health and the twirp handler at the\n\t// provided URL prefix.\n\tmux := http.NewServeMux()\n\tmux.Handle(\"/health\", healthcheck)\n\tmux.Handle(prefix, handler)\n\n\ts := httptest.NewServer(mux)\n\tdefer s.Close()\n\n\t// Try to do a twirp request. It should get routed just fine.\n\tclient := NewHaberdasherJSONClient(s.URL, http.DefaultClient)\n\n\t_, twerr := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif twerr != nil {\n\t\tt.Errorf(\"twirp client err=%q\", twerr)\n\t}\n\n\t// Try to request the /health endpoint. It should get routed just\n\t// fine too.\n\tresp, err := http.Get(s.URL + \"/health\")\n\tif err != nil {\n\t\tt.Errorf(\"health check endpoint err=%q\", err)\n\t} else {\n\t\tif resp.StatusCode != 200 {\n\t\t\tbody, err := io.ReadAll(resp.Body)\n\t\t\tt.Errorf(\"got a non-200 response from /health: %d\", resp.StatusCode)\n\t\t\tt.Logf(\"response body: %s\", body)\n\t\t\tt.Logf(\"response read err: %s\", err)\n\t\t}\n\t\tif !healthcheckCalled {\n\t\t\tt.Error(\"health check endpoint was never called\")\n\t\t}\n\t}\n}\n\n// Default ContextSource should be RequestContextSource, this means that\n// when serving in a mux with middleware, the modified request context should\n// be available on the method handler.\nfunc TestMuxingTwirpServerDefaultRequestContext(t *testing.T) {\n\thandlerCalled := false // to verity that the handler assertions were executed (avoid false positives)\n\n\t// Make a handler that can check if the context was modified\n\ttwirpHandler := NewHaberdasherServer(HaberdasherFunc(func(ctx context.Context, s *Size) (*Hat, error) {\n\t\thandlerCalled = true // verify it was called\n\t\tif ctx.Value(\"modified by middleware\") != \"yes\" {\n\t\t\tt.Error(\"expected ctx to be modified by the middleware\")\n\t\t}\n\t\treturn &Hat{Size: 999}, nil\n\t}), nil)\n\n\t// Wrap with middleware that modifies the request context\n\tmiddlewareWrapper := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tr = r.WithContext(context.WithValue(r.Context(), \"modified by middleware\", \"yes\"))\n\t\ttwirpHandler.ServeHTTP(w, r)\n\t})\n\n\t// Serve in a mux\n\tmux := http.NewServeMux()\n\tmux.Handle(HaberdasherPathPrefix, middlewareWrapper)\n\ts := httptest.NewServer(mux)\n\tdefer s.Close()\n\n\t// And make a request to run the expectations\n\tclient := NewHaberdasherJSONClient(s.URL, http.DefaultClient)\n\t_, twerr := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif twerr != nil {\n\t\tt.Errorf(\"twirp client err=%q\", twerr)\n\t}\n\tif !handlerCalled {\n\t\tt.Error(\"For some reason the twirp request did not make it to the handler\")\n\t}\n}\n\n// WriteError should allow middleware to easily respond with a properly formatted error response\nfunc TestWriteErrorFromHTTPMiddleware(t *testing.T) {\n\t// Make a fake server that returns a Twirp error from the HTTP stack, without using an actual Twirp implementation.\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(HaberdasherPathPrefix+\"MakeHat\", func(w http.ResponseWriter, r *http.Request) {\n\t\tWriteError(w, twirp.NewError(twirp.Unauthenticated, \"You Shall Not Pass!!!\"))\n\t})\n\tserver := httptest.NewServer(mux)\n\tdefer server.Close()\n\n\t// A Twirp client is still able to receive the error\n\tclient := NewHaberdasherJSONClient(server.URL, http.DefaultClient)\n\t_, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err == nil {\n\t\tt.Fatal(\"an error was expected\")\n\t}\n\ttwerr, ok := err.(twirp.Error)\n\tif !ok {\n\t\tt.Fatalf(\"expected twirp.Error type error, have %T\", err)\n\t}\n\tif twerr.Code() != twirp.Unauthenticated {\n\t\tt.Errorf(\"twirp ErrorCode expected to be %q, but found %q\", twirp.Unauthenticated, twerr.Code())\n\t}\n\tif twerr.Msg() != \"You Shall Not Pass!!!\" {\n\t\tt.Errorf(\"twirp client err has unexpected message %q, want %q\", twerr.Msg(), \"You Shall Not Pass!!!\")\n\t}\n}\n\n// WriteError wraps non-twirp errors as twirp.Internal\nfunc TestWriteErrorFromHTTPMiddlewareInternal(t *testing.T) {\n\t// Make a fake server that returns an error from the HTTP stack, without using an actual Twirp implementation.\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(HaberdasherPathPrefix+\"MakeHat\", func(w http.ResponseWriter, r *http.Request) {\n\t\tWriteError(w, errors.New(\"should become a twirp.Internal\"))\n\t})\n\tserver := httptest.NewServer(mux)\n\tdefer server.Close()\n\n\t// A Twirp client is still able to receive the error as a twirp.Internal\n\tclient := NewHaberdasherJSONClient(server.URL, http.DefaultClient)\n\t_, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err == nil {\n\t\tt.Fatal(\"an error was expected\")\n\t}\n\ttwerr, ok := err.(twirp.Error)\n\tif !ok {\n\t\tt.Fatalf(\"expected twirp.Error type error, have %T\", err)\n\t}\n\tif twerr.Code() != twirp.Internal {\n\t\tt.Errorf(\"twirp ErrorCode expected to be %q, but found %q\", twirp.Internal, twerr.Code())\n\t}\n\tif twerr.Msg() != \"should become a twirp.Internal\" {\n\t\tt.Errorf(\"twirp client err has unexpected message %q, want %q\", twerr.Msg(), \"should become a twirp.Internal\")\n\t}\n}\n\n// If an application panics in its handler, it should return an internal error with \"Internal service panic\" msg.\nfunc TestPanicsReturnInternalErrors(t *testing.T) {\n\thooks, recorder := recorderHooks()\n\ts := NewHaberdasherServer(PanickyHatmaker(\"OH NO!\"), hooks)\n\n\t// Wrap the twirp server with a handler to stop the panicking from\n\t// crashing the httptest server and failing our test.\n\th := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif r := recover(); r == nil {\n\t\t\t\tt.Error(\"http server never panicked\")\n\t\t\t}\n\t\t}()\n\t\ts.ServeHTTP(w, r)\n\t})\n\n\tserver := httptest.NewServer(h)\n\tdefer server.Close()\n\n\tclient := NewHaberdasherJSONClient(server.URL, http.DefaultClient)\n\n\that, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err == nil {\n\t\tt.Logf(\"hat: %+v\", hat)\n\t\tt.Fatal(\"twirp client err is nil for panicking handler\")\n\t}\n\n\ttwerr, ok := err.(twirp.Error)\n\tif !ok {\n\t\tt.Fatalf(\"expected twirp.Error type error, have %T\", err)\n\t}\n\n\tif twerr.Code() != twirp.Internal {\n\t\tt.Errorf(\"twirp ErrorCode expected to be %q, but found %q\", twirp.Internal, twerr.Code())\n\t}\n\tif twerr.Msg() != \"Internal service panic\" {\n\t\tt.Errorf(\"twirp client err has unexpected message %q, want %q\", twerr.Msg(), \"Internal service panic\")\n\t}\n\n\trecorder.assertHookCalls(t, []hookCall{received, routed, errored, sent})\n}\n\n// If an application panics in its handler, the Error hooks should trigger and have access to the panic source.\nfunc TestPanicsTriggerErrorHooks(t *testing.T) {\n\tpanicValue := errors.New(\"This Is Fine Meme\")\n\terrHookCalled := false\n\terrHook := &twirp.ServerHooks{\n\t\tError: func(ctx context.Context, twerr twirp.Error) context.Context {\n\t\t\terrHookCalled = true\n\t\t\t// The error should have a .Cause containing the panic value for inspection\n\t\t\terr := pkgerrors.Cause(twerr)\n\t\t\tif err != panicValue {\n\t\t\t\tt.Fatalf(\"Unexpected error cause from panic: %v\", err)\n\t\t\t}\n\t\t\treturn ctx\n\t\t},\n\t}\n\n\ts := NewHaberdasherServer(PanickyHatmaker(panicValue), errHook)\n\n\t// Wrap the twirp server with a handler to stop the panicking from\n\t// crashing the httptest server and failing our test.\n\th := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif r := recover(); r == nil {\n\t\t\t\tt.Error(\"http server never panicked\")\n\t\t\t}\n\t\t}()\n\t\ts.ServeHTTP(w, r)\n\t})\n\n\tserver := httptest.NewServer(h)\n\tdefer server.Close()\n\n\tclients := map[string]Haberdasher{\n\t\t\"protobuf\": NewHaberdasherProtobufClient(server.URL, http.DefaultClient),\n\t\t\"json\":     NewHaberdasherJSONClient(server.URL, http.DefaultClient),\n\t}\n\tfor name, c := range clients {\n\t\t_, err := c.MakeHat(context.Background(), &Size{Inches: 1})\n\t\tif err == nil {\n\t\t\tt.Fatalf(\"%s client: err was expected for panicking handler, found nil\", name)\n\t\t}\n\t\tif !errHookCalled {\n\t\t\tt.Fatalf(\"%s client: expected error hook to be called for panicking handler\", name)\n\t\t}\n\t\terrHookCalled = false // Reset for the next loop iteration\n\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\tt.Fatalf(\"%s client: expected twirp.Error type error, have %T\", name, err)\n\t\t}\n\t\tif twerr.Code() != twirp.Internal {\n\t\t\tt.Errorf(\"%s client: ErrorCode expected to be %q, but found %q\", name, twirp.Internal, twerr.Code())\n\t\t}\n\t\tif twerr.Msg() != \"Internal service panic\" {\n\t\t\tt.Errorf(\"%s client: err has unexpected message %q, want %q\", name, twerr.Msg(), \"Internal service panic\")\n\t\t}\n\t}\n}\n\nfunc TestCustomRequestHeaders(t *testing.T) {\n\t// Create a set of headers to be sent on all requests\n\tcustomHeader := make(http.Header)\n\tcustomHeader.Set(\"key1\", \"val1\")\n\tcustomHeader.Add(\"multikey\", \"val1\")\n\tcustomHeader.Add(\"multikey\", \"val2\")\n\n\thaberdasher := NewHaberdasherServer(PickyHatmaker(1))\n\t// Make a wrapping handler that checks headers for this test\n\thandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t// All key-vals in the custom header should appear in the request\n\t\tfor k, v := range customHeader {\n\t\t\tif !reflect.DeepEqual(r.Header[k], v) {\n\t\t\t\tt.Errorf(\"missing header  key=%q  wanted-val=%q  have-val=%q\", k, v, r.Header[k])\n\t\t\t}\n\t\t}\n\t\thaberdasher.ServeHTTP(w, r)\n\t})\n\n\ts := httptest.NewServer(handler)\n\tdefer s.Close()\n\n\tclients := map[string]Haberdasher{\n\t\t\"protobuf\": NewHaberdasherProtobufClient(s.URL, http.DefaultClient),\n\t\t\"json\":     NewHaberdasherJSONClient(s.URL, http.DefaultClient),\n\t}\n\tfor name, c := range clients {\n\t\tt.Logf(\"client=%q\", name)\n\t\tctx := context.Background()\n\t\tctx, err := twirp.WithHTTPRequestHeaders(ctx, customHeader)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%q client WithHTTPRequestHeaders err=%q\", name, err)\n\t\t}\n\t\t_, err = c.MakeHat(ctx, &Size{Inches: 1})\n\t\tif err != nil {\n\t\t\tt.Errorf(\"%q client err=%q\", name, err)\n\t\t}\n\t}\n}\n\nfunc TestCustomResponseHeaders(t *testing.T) {\n\t// service that adds headers key1 and key2\n\thaberdasher := NewHaberdasherServer(HaberdasherFunc(func(ctx context.Context, s *Size) (*Hat, error) {\n\t\tvar err error\n\t\terrMsg := \"unexpected error returned by SetHTTPResponseHeader: \"\n\n\t\terr = twirp.SetHTTPResponseHeader(ctx, \"key1\", \"val1\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(errMsg + err.Error())\n\t\t}\n\n\t\terr = twirp.SetHTTPResponseHeader(ctx, \"key2\", \"before_override\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(errMsg + err.Error())\n\t\t}\n\t\terr = twirp.SetHTTPResponseHeader(ctx, \"key2\", \"val2\") // should override\n\t\tif err != nil {\n\t\t\tt.Fatalf(errMsg + err.Error())\n\t\t}\n\n\t\tchildContext := context.WithValue(ctx, \"foo\", \"var\")\n\t\terr = twirp.SetHTTPResponseHeader(childContext, \"key3\", \"val3\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(errMsg + err.Error())\n\t\t}\n\n\t\terr = twirp.SetHTTPResponseHeader(context.Background(), \"key4\", \"should_be_ignored\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(errMsg + err.Error())\n\t\t}\n\n\t\terr = twirp.AddHTTPResponseHeader(ctx, \"key5\", \"val5\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(errMsg + err.Error())\n\t\t}\n\t\terr = twirp.AddHTTPResponseHeader(ctx, \"key5\", \"val7\") // should append\n\t\tif err != nil {\n\t\t\tt.Fatalf(errMsg + err.Error())\n\t\t}\n\n\t\terr = twirp.SetHTTPResponseHeader(context.Background(), \"Content-Type\", \"should_return_error\")\n\t\tif err == nil {\n\t\t\tt.Fatalf(\"SetHTTPResponseHeader expected to return an error on Content-Type header, found nil\")\n\t\t}\n\n\t\treturn &Hat{Size: 999}, nil\n\t}), nil)\n\n\t// Make a wrapping handler that checks header responses for this test\n\thandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\thaberdasher.ServeHTTP(w, r)\n\n\t\tif w.Header().Get(\"key1\") != \"val1\" {\n\t\t\tt.Errorf(\"expected 'key1' header to be 'val1', but found %q\", w.Header().Get(\"key1\"))\n\t\t}\n\t\tif w.Header().Get(\"key2\") != \"val2\" {\n\t\t\tt.Errorf(\"expected 'key2' header to be 'val2', but found %q\", w.Header().Get(\"key2\"))\n\t\t}\n\t\tif w.Header().Get(\"key3\") != \"val3\" {\n\t\t\tt.Errorf(\"expected 'key3' header to be 'val3', but found %q\", w.Header().Get(\"key3\"))\n\t\t}\n\t\tif w.Header().Get(\"key4\") == \"should_be_ignored\" {\n\t\t\tt.Error(\"expected 'key4' header to be empty, it should be ignored if the context is not coming from the handler\")\n\t\t}\n\t\tif w.Header().Get(\"key5\") != \"val5\" {\n\t\t\tt.Errorf(\"expected 'key5' header to be 'val5', but found %q\", w.Header().Get(\"key5\"))\n\t\t}\n\t})\n\n\ts := httptest.NewServer(handler)\n\tdefer s.Close()\n\n\tc := NewHaberdasherProtobufClient(s.URL, http.DefaultClient)\n\tresp, err := c.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Errorf(\"unexpected service error: %q\", err)\n\t}\n\tif resp.Size != 999 { // make sure that the fake handler and its assertions were called\n\t\tt.Errorf(\"expected resp.Size to be 999 (coming from fake handler), but found %d\", resp.Size)\n\t}\n}\n\n// A nil response should cause an 'Internal Error' response, not a\n// panic.\nfunc TestNilResponse(t *testing.T) {\n\th := NewHaberdasherServer(NilHatmaker())\n\n\tpanicChecker := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tdefer func() {\n\t\t\tif p := recover(); p != nil {\n\t\t\t\tt.Errorf(\"handler panicked: %s\", p)\n\t\t\t}\n\t\t}()\n\t\th.ServeHTTP(w, r)\n\t})\n\ts := httptest.NewServer(panicChecker)\n\tdefer s.Close()\n\n\tclients := map[string]Haberdasher{\n\t\t\"protobuf\": NewHaberdasherProtobufClient(s.URL, http.DefaultClient),\n\t\t\"json\":     NewHaberdasherJSONClient(s.URL, http.DefaultClient),\n\t}\n\tfor name, c := range clients {\n\t\t_, err := c.MakeHat(context.Background(), &Size{Inches: 1})\n\t\tif err == nil {\n\t\t\tt.Errorf(\"%q client err=nil, which is unexpected\", name)\n\t\t}\n\t}\n}\n\nvar expectBadRouteError = func(t *testing.T, client Haberdasher) {\n\t_, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err == nil {\n\t\tt.Fatalf(\"err=nil, expected bad_route\")\n\t}\n\n\ttwerr, ok := err.(twirp.Error)\n\tif !ok {\n\t\tt.Fatalf(\"err has type=%T, expected twirp.Error\", err)\n\t}\n\n\tif twerr.Code() != twirp.BadRoute {\n\t\tt.Errorf(\"err has code=%v, expected %v\", twerr.Code(), twirp.BadRoute)\n\t}\n}\n\nfunc TestBadRoute(t *testing.T) {\n\th := PickyHatmaker(1)\n\ts := httptest.NewServer(NewHaberdasherServer(h))\n\tdefer s.Close()\n\n\t// Create a transport that we can use to force the wrong HTTP method and URL\n\t// in test cases.\n\trw := &reqRewriter{base: http.DefaultTransport}\n\thttpClient := &http.Client{Transport: rw}\n\n\tclients := map[string]Haberdasher{\n\t\t\"json\":     NewHaberdasherJSONClient(s.URL, httpClient),\n\t\t\"protobuf\": NewHaberdasherProtobufClient(s.URL, httpClient),\n\t}\n\n\tfor name, client := range clients {\n\t\tt.Run(name+\" client\", func(t *testing.T) {\n\t\t\tt.Run(\"good route\", func(t *testing.T) {\n\t\t\t\trw.rewrite = func(r *http.Request) *http.Request { return r }\n\t\t\t\t_, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Errorf(\"unexpected error with vanilla client and transport: %v\", err)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tt.Run(\"bad URL path\", func(t *testing.T) {\n\t\t\t\trw.rewrite = func(r *http.Request) *http.Request {\n\t\t\t\t\tr.URL.Path = r.URL.Path + \"bogus\"\n\t\t\t\t\treturn r\n\t\t\t\t}\n\t\t\t\texpectBadRouteError(t, client)\n\t\t\t})\n\n\t\t\tt.Run(\"bad HTTP method\", func(t *testing.T) {\n\t\t\t\trw.rewrite = func(r *http.Request) *http.Request {\n\t\t\t\t\tr.Method = \"GET\"\n\t\t\t\t\treturn r\n\t\t\t\t}\n\t\t\t\texpectBadRouteError(t, client)\n\t\t\t})\n\n\t\t\tt.Run(\"bad content-type\", func(t *testing.T) {\n\t\t\t\trw.rewrite = func(r *http.Request) *http.Request {\n\t\t\t\t\tr.Header.Set(\"Content-Type\", \"application/bogus\")\n\t\t\t\t\treturn r\n\t\t\t\t}\n\t\t\t\texpectBadRouteError(t, client)\n\t\t\t})\n\t\t})\n\t}\n}\n\n// reqRewriter is a http.RoundTripper which can be used to mess with a request\n// before it actually gets sent. This is useful as a transport for http.Clients\n// in tests because it lets us modify the HTTP method, path, and headers of a\n// request, while still being sure that the other unchanged fields are set by a\n// generated client.\ntype reqRewriter struct {\n\tbase    http.RoundTripper\n\trewrite func(r *http.Request) *http.Request\n}\n\nfunc (rw *reqRewriter) RoundTrip(req *http.Request) (*http.Response, error) {\n\treq = rw.rewrite(req)\n\treturn rw.base.RoundTrip(req)\n}\n\nfunc TestReflection(t *testing.T) {\n\th := PickyHatmaker(1)\n\ts := NewHaberdasherServer(h)\n\n\tt.Run(\"ServiceDescriptor\", func(t *testing.T) {\n\t\tfd, sd, err := descriptors.ServiceDescriptor(s)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"unable to load descriptor: %v\", err)\n\t\t}\n\t\tif have, want := fd.GetPackage(), \"twirp.internal.twirptest\"; have != want {\n\t\t\tt.Errorf(\"bad package name, have=%q, want=%q\", have, want)\n\t\t}\n\n\t\tif have, want := sd.GetName(), \"Haberdasher\"; have != want {\n\t\t\tt.Errorf(\"bad service name, have=%q, want=%q\", have, want)\n\t\t}\n\t\tif len(sd.Method) != 1 {\n\t\t\tt.Errorf(\"unexpected number of methods, have=%d, want=1\", len(sd.Method))\n\t\t}\n\t\tif have, want := sd.Method[0].GetName(), \"MakeHat\"; have != want {\n\t\t\tt.Errorf(\"bad method name, have=%q, want=%q\", have, want)\n\t\t}\n\t})\n\tt.Run(\"ProtoGenTwirpVersion\", func(t *testing.T) {\n\t\t// Should match whatever is in the file at protoc-gen-twirp/version.go\n\t\tfile, err := os.ReadFile(\"../gen/version.go\")\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"unable to load version file: %v\", err)\n\t\t}\n\t\trexp, err := regexp.Compile(`const Version = \"(.*)\"`)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"unable to compile twirpVersion regex: %v\", err)\n\t\t}\n\t\tmatches := rexp.FindSubmatch(file)\n\t\tif matches == nil {\n\t\t\tt.Fatal(\"unable to find twirp version from version.go file\")\n\t\t}\n\n\t\twant := string(matches[1])\n\t\thave := s.ProtocGenTwirpVersion()\n\t\tif have != want {\n\t\t\tt.Errorf(\"bad version, have=%q, want=%q\", have, want)\n\t\t}\n\t})\n}\n\nfunc TestContextValues(t *testing.T) {\n\th := HaberdasherFunc(func(ctx context.Context, _ *Size) (*Hat, error) {\n\t\tconst (\n\t\t\twantPkg    = \"twirp.internal.twirptest\"\n\t\t\twantSvc    = \"Haberdasher\"\n\t\t\twantMethod = \"MakeHat\"\n\t\t)\n\t\tif pkg, _ := twirp.PackageName(ctx); pkg != wantPkg {\n\t\t\tt.Errorf(\"twirp.PackageName(ctx)  have=%q, want=%q\", pkg, wantPkg)\n\t\t}\n\t\tif svc, _ := twirp.ServiceName(ctx); svc != wantSvc {\n\t\t\tt.Errorf(\"twirp.ServiceName(ctx)  have=%q, want=%q\", svc, wantSvc)\n\t\t}\n\t\tif meth, _ := twirp.MethodName(ctx); meth != wantMethod {\n\t\t\tt.Errorf(\"twirp.MethodName(ctx)  have=%q, want=%q\", meth, wantMethod)\n\t\t}\n\t\treturn &Hat{}, nil\n\t})\n\ts := httptest.NewServer(NewHaberdasherServer(h))\n\tdefer s.Close()\n\n\tclient := NewHaberdasherProtobufClient(s.URL, http.DefaultClient)\n\n\t_, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err != nil {\n\t\tt.Errorf(\"Client err=%q\", err)\n\t}\n}\n\nfunc TestPanicFlushing(t *testing.T) {\n\th := PanickyHatmaker(\"bang!\")\n\ts := httptest.NewUnstartedServer(NewHaberdasherServer(h))\n\tdefer s.Close()\n\t// If the server config's ErrorLog is left nil, then it will log the panic and\n\t// a stack trace straight to stderr. Override it to log to test output.\n\ts.Config.ErrorLog = testLogger(t)\n\ts.Start()\n\n\tclient := NewHaberdasherProtobufClient(s.URL, http.DefaultClient)\n\that, err := client.MakeHat(context.Background(), &Size{Inches: 1})\n\tif err == nil {\n\t\tt.Logf(\"hat: %+v\", hat)\n\t\tt.Fatal(\"twirp client err is nil for panicking handler\")\n\t}\n\ttwerr, ok := err.(twirp.Error)\n\tif !ok {\n\t\tt.Fatalf(\"expected twirp.Error type error, have %T\", err)\n\t}\n\n\tif twerr.Code() != twirp.Internal {\n\t\tt.Errorf(\"twirp ErrorCode expected to be %q, but found %q\", twirp.Internal, twerr.Code())\n\t}\n\tif twerr.Msg() != \"Internal service panic\" {\n\t\tt.Errorf(\"twirp client err has unexpected message %q, want %q\", twerr.Msg(), \"Internal service panic\")\n\t}\n}\n\n// testLogger creates a *log.Logger that writes log messages to the test's\n// output. This makes log messages appear only if the test fails, and makes them\n// align correctly for nested subtests.\nfunc testLogger(t *testing.T) *log.Logger {\n\treturn log.New(testWriter{t}, \"\", log.LstdFlags)\n}\n\ntype testWriter struct{ t *testing.T }\n\nfunc (w testWriter) Write(p []byte) (int, error) {\n\tw.t.Log(string(p))\n\treturn len(p), nil\n}\n\ntype errReader struct{}\n\nfunc (errReader) Read(p []byte) (n int, err error) {\n\treturn 0, fmt.Errorf(\"test error\")\n}\n\n// Test failures when reading the request.\n// The request could be incomplete because the client timed out, which in most cases is signaled by\n// a context cancelation or timeout. In those cases, the twirp handled would properly identify and return those errors.\nfunc TestRequestBodyError(t *testing.T) {\n\ttype contextUpdate func(ctx context.Context) (context.Context, context.CancelFunc)\n\ttestCases := []struct {\n\t\ttestname          string\n\t\texpectedError     twirp.ErrorCode\n\t\terrorString       string\n\t\trequestType       string\n\t\tcontextFunc       contextUpdate\n\t\tisContextCanceled bool\n\t}{\n\t\t{\n\t\t\ttestname:          \"ProtobufFailedToReadRequestBodyError\",\n\t\t\texpectedError:     twirp.Malformed,\n\t\t\terrorString:       \"failed to read request body\",\n\t\t\trequestType:       \"application/protobuf\",\n\t\t\tcontextFunc:       func(ctx context.Context) (context.Context, context.CancelFunc) { return ctx, func() {} },\n\t\t\tisContextCanceled: false,\n\t\t},\n\t\t{\n\t\t\ttestname:      \"ProtobufDeadlineExceededError\",\n\t\t\texpectedError: twirp.DeadlineExceeded,\n\t\t\terrorString:   \"failed to read request: deadline exceeded\",\n\t\t\trequestType:   \"application/protobuf\",\n\t\t\tcontextFunc: func(ctx context.Context) (context.Context, context.CancelFunc) {\n\t\t\t\treturn context.WithTimeout(ctx, 0*time.Millisecond)\n\t\t\t},\n\t\t\tisContextCanceled: false,\n\t\t},\n\t\t{\n\t\t\ttestname:      \"ProtobufFailedToReadRequestBodyError\",\n\t\t\texpectedError: twirp.Canceled,\n\t\t\terrorString:   \"failed to read request: context canceled\",\n\t\t\trequestType:   \"application/protobuf\",\n\t\t\tcontextFunc: func(ctx context.Context) (context.Context, context.CancelFunc) {\n\t\t\t\treturn context.WithCancel(ctx)\n\t\t\t},\n\t\t\tisContextCanceled: true,\n\t\t},\n\t\t{\n\t\t\ttestname:          \"JSONFailedToReadRequestBodyError\",\n\t\t\texpectedError:     twirp.Malformed,\n\t\t\terrorString:       \"the json request could not be decoded\",\n\t\t\trequestType:       \"application/json\",\n\t\t\tcontextFunc:       func(ctx context.Context) (context.Context, context.CancelFunc) { return ctx, func() {} },\n\t\t\tisContextCanceled: false,\n\t\t},\n\t\t{\n\t\t\ttestname:      \"JSONDeadlineExceededError\",\n\t\t\texpectedError: twirp.DeadlineExceeded,\n\t\t\terrorString:   \"failed to read request: deadline exceeded\",\n\t\t\trequestType:   \"application/json\",\n\t\t\tcontextFunc: func(ctx context.Context) (context.Context, context.CancelFunc) {\n\t\t\t\treturn context.WithTimeout(ctx, 0*time.Millisecond)\n\t\t\t},\n\t\t\tisContextCanceled: false,\n\t\t},\n\t\t{\n\t\t\ttestname:      \"JSONFailedToReadRequestBodyError\",\n\t\t\texpectedError: twirp.Canceled,\n\t\t\terrorString:   \"failed to read request: context canceled\",\n\t\t\trequestType:   \"application/json\",\n\t\t\tcontextFunc: func(ctx context.Context) (context.Context, context.CancelFunc) {\n\t\t\t\treturn context.WithCancel(ctx)\n\t\t\t},\n\t\t\tisContextCanceled: true,\n\t\t},\n\t}\n\tfor _, tc := range testCases {\n\t\tt.Run(tc.testname, func(t *testing.T) {\n\t\t\t// test case validate request body read error handling\n\t\t\tvar s Haberdasher\n\t\t\thooks := &twirp.ServerHooks{Error: func(ctx context.Context, err twirp.Error) context.Context {\n\t\t\t\tif ctxErr := tc.expectedError; err.Code() != ctxErr {\n\t\t\t\t\tt.Errorf(\"twirp ErrorCode expected to be %q, but found %q\", ctxErr, err.Code())\n\t\t\t\t}\n\t\t\t\tif ctxErr := tc.errorString; err.Msg() != ctxErr {\n\t\t\t\t\tt.Errorf(\"twirp client err has unexpected message %q, want %q\", err.Msg(), ctxErr)\n\t\t\t\t}\n\t\t\t\treturn ctx\n\t\t\t}}\n\t\t\tserver := NewHaberdasherServer(s, hooks)\n\t\t\tctx := context.Background()\n\t\t\tctx, cancel := tc.contextFunc(ctx)\n\n\t\t\t// Make a request, that will call endpoint method\n\t\t\treq, _ := http.NewRequest(http.MethodPost, \"http://testing:8080/twirp/twirp.internal.twirptest.Haberdasher/MakeHat\", errReader{})\n\t\t\treq.Header.Set(\"Accept\", tc.requestType)\n\t\t\treq.Header.Set(\"Content-Type\", tc.requestType)\n\t\t\t// Associate the cancellable context we just created to the request\n\t\t\treq = req.WithContext(ctx)\n\t\t\tif tc.isContextCanceled {\n\t\t\t\tcancel()\n\t\t\t} else {\n\t\t\t\tdefer cancel()\n\t\t\t}\n\t\t\tw := httptest.NewRecorder()\n\t\t\tserver.ServeHTTP(w, req)\n\n\t\t\t// validate error code\n\t\t\texpectedErrCode := twirp.ServerHTTPStatusFromErrorCode(tc.expectedError)\n\t\t\tif w.Code != expectedErrCode {\n\t\t\t\tt.Errorf(\"HTTP ErrorCode expected to be %q, but found %q\", expectedErrCode, w.Code)\n\t\t\t}\n\n\t\t\t// validate error message\n\t\t\trespBytes, err := io.ReadAll(w.Body)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"Could not even read bytes from response: %q\", err.Error())\n\t\t\t}\n\n\t\t\texpectedErrMessage := tc.errorString\n\t\t\tif !strings.Contains(string(respBytes), expectedErrMessage) {\n\t\t\t\tt.Errorf(\"HTTP client err has unexpected message %q, want %q\", string(respBytes), expectedErrMessage)\n\t\t\t}\n\t\t})\n\t}\n}\n"
  },
  {
    "path": "internal/twirptest/snake_case_names/compatibility_test.go",
    "content": "// Copyright 2019 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage snake_case_names\n\nimport (\n\tcontext \"context\"\n\t\"fmt\"\n\thttp \"net/http\"\n\t\"net/http/httptest\"\n\t\"testing\"\n\n\ttwirp \"github.com/twitchtv/twirp\"\n)\n\ntype HaberdasherService struct{}\n\nfunc (h *HaberdasherService) MakeHatV1(ctx context.Context, s *MakeHatArgsV1_SizeV1) (*MakeHatArgsV1_HatV1, error) {\n\treturn &MakeHatArgsV1_HatV1{\n\t\tSize: s.Inches,\n\t}, nil\n}\n\n// When the proto definition contains service and/or method names with underscores (not following proto naming\n// best practices), Go clients will mistakenly convert routes into it's CamelCased versions, but clients in other\n// languages may keep the literal casing of the routes. This test makes a go client that would send CamelCased routes\n// and checks that the generated Go server remains backwards compatible and is able to handle those routes.\nfunc TestServiceMethodNamesCamelCase(t *testing.T) {\n\ts := httptest.NewServer(NewHaberdasherV1Server(&HaberdasherService{}, nil))\n\tdefer s.Close()\n\n\tclient := NewHaberdasherV1ProtobufClient(s.URL, http.DefaultClient)\n\n\that, err := client.MakeHatV1(context.Background(), &MakeHatArgsV1_SizeV1{Inches: 1})\n\tif err != nil {\n\t\tt.Fatalf(\"go protobuf client err=%q\", err)\n\t}\n\tif hat.Size != 1 {\n\t\tt.Errorf(\"wrong hat size returned\")\n\t}\n}\n\ntype compatibilityTestClient struct {\n\tclient *http.Client\n}\n\nfunc (t compatibilityTestClient) Do(req *http.Request) (*http.Response, error) {\n\texpectedPath := \"/twirp/twirp.internal.twirptest.snake_case_names.Haberdasher_v1/MakeHat_v1\"\n\tif req.URL.Path != expectedPath {\n\t\treturn nil, fmt.Errorf(\"expected: %s, got: %s\", expectedPath, req.URL.Path)\n\t}\n\treturn t.client.Do(req)\n}\n\n// This test uses a fake client that checks if the routes are not camel cased,\n// and checks that the generated Go server is still able to handle those routes.\nfunc TestServiceMethodNamesUnderscores(t *testing.T) {\n\ts := httptest.NewServer(NewHaberdasherV1Server(&HaberdasherService{}, nil))\n\tdefer s.Close()\n\n\tclient := NewHaberdasherV1ProtobufClient(s.URL, compatibilityTestClient{client: http.DefaultClient},\n\t\ttwirp.WithClientLiteralURLs(true))\n\that, err := client.MakeHatV1(context.Background(), &MakeHatArgsV1_SizeV1{Inches: 1})\n\tif err != nil {\n\t\tt.Fatalf(\"compatible protobuf client err=%q\", err)\n\t}\n\tif hat.Size != 1 {\n\t\tt.Errorf(\"wrong hat size returned\")\n\t}\n\n\tcamelCasedClient := NewHaberdasherV1ProtobufClient(s.URL, compatibilityTestClient{client: http.DefaultClient},\n\t\ttwirp.WithClientLiteralURLs(false)) // default value, send CamelCased routes\n\t_, err = camelCasedClient.MakeHatV1(context.Background(), &MakeHatArgsV1_SizeV1{Inches: 1})\n\tif err == nil {\n\t\tt.Fatalf(\"expected error raised by the compatibilityTestClient because routes are camelcased. Got nil.\")\n\t}\n\tif err.Error() != \"twirp error internal: failed to do request: expected: /twirp/twirp.internal.twirptest.snake_case_names.Haberdasher_v1/MakeHat_v1, got: /twirp/twirp.internal.twirptest.snake_case_names.HaberdasherV1/MakeHatV1\" {\n\t\tt.Fatalf(\"expected error to be about the expected path, got err=%q\", err)\n\t}\n}\n"
  },
  {
    "path": "internal/twirptest/snake_case_names/compile_test.go",
    "content": "// Copyright 2019 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage snake_case_names\n\nimport \"testing\"\n\nfunc TestCompilation(t *testing.T) {\n\t// Test passes if this package compiles\n}\n"
  },
  {
    "path": "internal/twirptest/snake_case_names/gen.go",
    "content": "// Copyright 2019 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage snake_case_names\n\n//go:generate protoc --go_out=paths=source_relative:. --twirp_out=paths=source_relative:. snake_case_names.proto\n"
  },
  {
    "path": "internal/twirptest/snake_case_names/snake_case_names.pb.go",
    "content": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.26.0-devel\n// \tprotoc        v3.21.8\n// source: snake_case_names.proto\n\n// Test that protoc-gen-twirp follows the same behavior as protoc-gen-go\n// for converting RPCs and message names from snake case to camel case.\n\npackage snake_case_names\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\nconst (\n\t// Verify that this generated code is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)\n\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)\n)\n\ntype MakeHatArgsV1 struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n}\n\nfunc (x *MakeHatArgsV1) Reset() {\n\t*x = MakeHatArgsV1{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_snake_case_names_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *MakeHatArgsV1) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*MakeHatArgsV1) ProtoMessage() {}\n\nfunc (x *MakeHatArgsV1) ProtoReflect() protoreflect.Message {\n\tmi := &file_snake_case_names_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use MakeHatArgsV1.ProtoReflect.Descriptor instead.\nfunc (*MakeHatArgsV1) Descriptor() ([]byte, []int) {\n\treturn file_snake_case_names_proto_rawDescGZIP(), []int{0}\n}\n\ntype MakeHatArgsV1_HatV1 struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tSize  int32  `protobuf:\"varint,1,opt,name=size,proto3\" json:\"size,omitempty\"`\n\tColor string `protobuf:\"bytes,2,opt,name=color,proto3\" json:\"color,omitempty\"`\n\tName  string `protobuf:\"bytes,3,opt,name=name,proto3\" json:\"name,omitempty\"`\n}\n\nfunc (x *MakeHatArgsV1_HatV1) Reset() {\n\t*x = MakeHatArgsV1_HatV1{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_snake_case_names_proto_msgTypes[1]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *MakeHatArgsV1_HatV1) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*MakeHatArgsV1_HatV1) ProtoMessage() {}\n\nfunc (x *MakeHatArgsV1_HatV1) ProtoReflect() protoreflect.Message {\n\tmi := &file_snake_case_names_proto_msgTypes[1]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use MakeHatArgsV1_HatV1.ProtoReflect.Descriptor instead.\nfunc (*MakeHatArgsV1_HatV1) Descriptor() ([]byte, []int) {\n\treturn file_snake_case_names_proto_rawDescGZIP(), []int{0, 0}\n}\n\nfunc (x *MakeHatArgsV1_HatV1) GetSize() int32 {\n\tif x != nil {\n\t\treturn x.Size\n\t}\n\treturn 0\n}\n\nfunc (x *MakeHatArgsV1_HatV1) GetColor() string {\n\tif x != nil {\n\t\treturn x.Color\n\t}\n\treturn \"\"\n}\n\nfunc (x *MakeHatArgsV1_HatV1) GetName() string {\n\tif x != nil {\n\t\treturn x.Name\n\t}\n\treturn \"\"\n}\n\ntype MakeHatArgsV1_SizeV1 struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tInches int32 `protobuf:\"varint,1,opt,name=inches,proto3\" json:\"inches,omitempty\"`\n}\n\nfunc (x *MakeHatArgsV1_SizeV1) Reset() {\n\t*x = MakeHatArgsV1_SizeV1{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_snake_case_names_proto_msgTypes[2]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *MakeHatArgsV1_SizeV1) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*MakeHatArgsV1_SizeV1) ProtoMessage() {}\n\nfunc (x *MakeHatArgsV1_SizeV1) ProtoReflect() protoreflect.Message {\n\tmi := &file_snake_case_names_proto_msgTypes[2]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use MakeHatArgsV1_SizeV1.ProtoReflect.Descriptor instead.\nfunc (*MakeHatArgsV1_SizeV1) Descriptor() ([]byte, []int) {\n\treturn file_snake_case_names_proto_rawDescGZIP(), []int{0, 1}\n}\n\nfunc (x *MakeHatArgsV1_SizeV1) GetInches() int32 {\n\tif x != nil {\n\t\treturn x.Inches\n\t}\n\treturn 0\n}\n\nvar File_snake_case_names_proto protoreflect.FileDescriptor\n\nvar file_snake_case_names_proto_rawDesc = []byte{\n\t0x0a, 0x16, 0x73, 0x6e, 0x61, 0x6b, 0x65, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x6e, 0x61, 0x6d,\n\t0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e,\n\t0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65,\n\t0x73, 0x74, 0x2e, 0x73, 0x6e, 0x61, 0x6b, 0x65, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x6e, 0x61,\n\t0x6d, 0x65, 0x73, 0x22, 0x7b, 0x0a, 0x0e, 0x4d, 0x61, 0x6b, 0x65, 0x48, 0x61, 0x74, 0x41, 0x72,\n\t0x67, 0x73, 0x5f, 0x76, 0x31, 0x1a, 0x46, 0x0a, 0x06, 0x48, 0x61, 0x74, 0x5f, 0x76, 0x31, 0x12,\n\t0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73,\n\t0x69, 0x7a, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01,\n\t0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,\n\t0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x1a, 0x21, 0x0a,\n\t0x07, 0x53, 0x69, 0x7a, 0x65, 0x5f, 0x76, 0x31, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x63, 0x68,\n\t0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x69, 0x6e, 0x63, 0x68, 0x65, 0x73,\n\t0x32, 0xa4, 0x01, 0x0a, 0x0e, 0x48, 0x61, 0x62, 0x65, 0x72, 0x64, 0x61, 0x73, 0x68, 0x65, 0x72,\n\t0x5f, 0x76, 0x31, 0x12, 0x91, 0x01, 0x0a, 0x0a, 0x4d, 0x61, 0x6b, 0x65, 0x48, 0x61, 0x74, 0x5f,\n\t0x76, 0x31, 0x12, 0x41, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72,\n\t0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x73, 0x6e,\n\t0x61, 0x6b, 0x65, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x4d,\n\t0x61, 0x6b, 0x65, 0x48, 0x61, 0x74, 0x41, 0x72, 0x67, 0x73, 0x5f, 0x76, 0x31, 0x2e, 0x53, 0x69,\n\t0x7a, 0x65, 0x5f, 0x76, 0x31, 0x1a, 0x40, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x2e, 0x69, 0x6e,\n\t0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x74, 0x77, 0x69, 0x72, 0x70, 0x74, 0x65, 0x73, 0x74,\n\t0x2e, 0x73, 0x6e, 0x61, 0x6b, 0x65, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65,\n\t0x73, 0x2e, 0x4d, 0x61, 0x6b, 0x65, 0x48, 0x61, 0x74, 0x41, 0x72, 0x67, 0x73, 0x5f, 0x76, 0x31,\n\t0x2e, 0x48, 0x61, 0x74, 0x5f, 0x76, 0x31, 0x42, 0x14, 0x5a, 0x12, 0x2f, 0x3b, 0x73, 0x6e, 0x61,\n\t0x6b, 0x65, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x62, 0x06, 0x70,\n\t0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar (\n\tfile_snake_case_names_proto_rawDescOnce sync.Once\n\tfile_snake_case_names_proto_rawDescData = file_snake_case_names_proto_rawDesc\n)\n\nfunc file_snake_case_names_proto_rawDescGZIP() []byte {\n\tfile_snake_case_names_proto_rawDescOnce.Do(func() {\n\t\tfile_snake_case_names_proto_rawDescData = protoimpl.X.CompressGZIP(file_snake_case_names_proto_rawDescData)\n\t})\n\treturn file_snake_case_names_proto_rawDescData\n}\n\nvar file_snake_case_names_proto_msgTypes = make([]protoimpl.MessageInfo, 3)\nvar file_snake_case_names_proto_goTypes = []interface{}{\n\t(*MakeHatArgsV1)(nil),        // 0: twirp.internal.twirptest.snake_case_names.MakeHatArgs_v1\n\t(*MakeHatArgsV1_HatV1)(nil),  // 1: twirp.internal.twirptest.snake_case_names.MakeHatArgs_v1.Hat_v1\n\t(*MakeHatArgsV1_SizeV1)(nil), // 2: twirp.internal.twirptest.snake_case_names.MakeHatArgs_v1.Size_v1\n}\nvar file_snake_case_names_proto_depIdxs = []int32{\n\t2, // 0: twirp.internal.twirptest.snake_case_names.Haberdasher_v1.MakeHat_v1:input_type -> twirp.internal.twirptest.snake_case_names.MakeHatArgs_v1.Size_v1\n\t1, // 1: twirp.internal.twirptest.snake_case_names.Haberdasher_v1.MakeHat_v1:output_type -> twirp.internal.twirptest.snake_case_names.MakeHatArgs_v1.Hat_v1\n\t1, // [1:2] is the sub-list for method output_type\n\t0, // [0:1] 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_snake_case_names_proto_init() }\nfunc file_snake_case_names_proto_init() {\n\tif File_snake_case_names_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_snake_case_names_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*MakeHatArgsV1); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_snake_case_names_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*MakeHatArgsV1_HatV1); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_snake_case_names_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*MakeHatArgsV1_SizeV1); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_snake_case_names_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   3,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   1,\n\t\t},\n\t\tGoTypes:           file_snake_case_names_proto_goTypes,\n\t\tDependencyIndexes: file_snake_case_names_proto_depIdxs,\n\t\tMessageInfos:      file_snake_case_names_proto_msgTypes,\n\t}.Build()\n\tFile_snake_case_names_proto = out.File\n\tfile_snake_case_names_proto_rawDesc = nil\n\tfile_snake_case_names_proto_goTypes = nil\n\tfile_snake_case_names_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "internal/twirptest/snake_case_names/snake_case_names.proto",
    "content": "syntax = \"proto3\";\n\n// Test that protoc-gen-twirp follows the same behavior as protoc-gen-go\n// for converting RPCs and message names from snake case to camel case.\npackage twirp.internal.twirptest.snake_case_names;\noption go_package = \"/;snake_case_names\";\n\nmessage MakeHatArgs_v1 {\n    message Hat_v1 {\n      int32 size = 1;\n      string color = 2;\n      string name = 3;\n    }\n\n    message Size_v1 {\n      int32 inches = 1;\n    }\n}\n\n// A Haberdasher makes hats for clients.\nservice Haberdasher_v1 {\n  rpc MakeHat_v1 (MakeHatArgs_v1.Size_v1) returns (MakeHatArgs_v1.Hat_v1);\n}\n"
  },
  {
    "path": "internal/twirptest/snake_case_names/snake_case_names.twirp.go",
    "content": "// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.\n// source: snake_case_names.proto\n\n// Test that protoc-gen-twirp follows the same behavior as protoc-gen-go\n// for converting RPCs and message names from snake case to camel case.\n\npackage snake_case_names\n\nimport context \"context\"\nimport fmt \"fmt\"\nimport http \"net/http\"\nimport io \"io\"\nimport json \"encoding/json\"\nimport strconv \"strconv\"\nimport strings \"strings\"\n\nimport protojson \"google.golang.org/protobuf/encoding/protojson\"\nimport proto \"google.golang.org/protobuf/proto\"\nimport twirp \"github.com/twitchtv/twirp\"\nimport ctxsetters \"github.com/twitchtv/twirp/ctxsetters\"\n\nimport bytes \"bytes\"\nimport errors \"errors\"\nimport path \"path\"\nimport url \"net/url\"\n\n// Version compatibility assertion.\n// If the constant is not defined in the package, that likely means\n// the package needs to be updated to work with this generated code.\n// See https://twitchtv.github.io/twirp/docs/version_matrix.html\nconst _ = twirp.TwirpPackageMinVersion_8_1_0\n\n// =======================\n// HaberdasherV1 Interface\n// =======================\n\n// A Haberdasher makes hats for clients.\ntype HaberdasherV1 interface {\n\tMakeHatV1(context.Context, *MakeHatArgsV1_SizeV1) (*MakeHatArgsV1_HatV1, error)\n}\n\n// =============================\n// HaberdasherV1 Protobuf Client\n// =============================\n\ntype haberdasherV1ProtobufClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewHaberdasherV1ProtobufClient creates a Protobuf client that implements the HaberdasherV1 interface.\n// It communicates using Protobuf and can be configured with a custom HTTPClient.\nfunc NewHaberdasherV1ProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) HaberdasherV1 {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tif literalURLs {\n\t\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.snake_case_names\", \"Haberdasher_v1\")\n\t} else {\n\t\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.snake_case_names\", \"HaberdasherV1\")\n\t}\n\turls := [1]string{\n\t\tserviceURL + \"MakeHatV1\",\n\t}\n\tif literalURLs {\n\t\turls = [1]string{\n\t\t\tserviceURL + \"MakeHat_v1\",\n\t\t}\n\t}\n\n\treturn &haberdasherV1ProtobufClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *haberdasherV1ProtobufClient) MakeHatV1(ctx context.Context, in *MakeHatArgsV1_SizeV1) (*MakeHatArgsV1_HatV1, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.snake_case_names\")\n\tctx = ctxsetters.WithServiceName(ctx, \"HaberdasherV1\")\n\tctx = ctxsetters.WithMethodName(ctx, \"MakeHatV1\")\n\tcaller := c.callMakeHatV1\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *MakeHatArgsV1_SizeV1) (*MakeHatArgsV1_HatV1, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*MakeHatArgsV1_SizeV1)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*MakeHatArgsV1_SizeV1) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callMakeHatV1(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*MakeHatArgsV1_HatV1)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*MakeHatArgsV1_HatV1) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *haberdasherV1ProtobufClient) callMakeHatV1(ctx context.Context, in *MakeHatArgsV1_SizeV1) (*MakeHatArgsV1_HatV1, error) {\n\tout := new(MakeHatArgsV1_HatV1)\n\tctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// =========================\n// HaberdasherV1 JSON Client\n// =========================\n\ntype haberdasherV1JSONClient struct {\n\tclient      HTTPClient\n\turls        [1]string\n\tinterceptor twirp.Interceptor\n\topts        twirp.ClientOptions\n}\n\n// NewHaberdasherV1JSONClient creates a JSON client that implements the HaberdasherV1 interface.\n// It communicates using JSON and can be configured with a custom HTTPClient.\nfunc NewHaberdasherV1JSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) HaberdasherV1 {\n\tif c, ok := client.(*http.Client); ok {\n\t\tclient = withoutRedirects(c)\n\t}\n\n\tclientOpts := twirp.ClientOptions{}\n\tfor _, o := range opts {\n\t\to(&clientOpts)\n\t}\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tliteralURLs := false\n\t_ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)\n\tvar pathPrefix string\n\tif ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\t// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>\n\tserviceURL := sanitizeBaseURL(baseURL)\n\tif literalURLs {\n\t\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.snake_case_names\", \"Haberdasher_v1\")\n\t} else {\n\t\tserviceURL += baseServicePath(pathPrefix, \"twirp.internal.twirptest.snake_case_names\", \"HaberdasherV1\")\n\t}\n\turls := [1]string{\n\t\tserviceURL + \"MakeHatV1\",\n\t}\n\tif literalURLs {\n\t\turls = [1]string{\n\t\t\tserviceURL + \"MakeHat_v1\",\n\t\t}\n\t}\n\n\treturn &haberdasherV1JSONClient{\n\t\tclient:      client,\n\t\turls:        urls,\n\t\tinterceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),\n\t\topts:        clientOpts,\n\t}\n}\n\nfunc (c *haberdasherV1JSONClient) MakeHatV1(ctx context.Context, in *MakeHatArgsV1_SizeV1) (*MakeHatArgsV1_HatV1, error) {\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.snake_case_names\")\n\tctx = ctxsetters.WithServiceName(ctx, \"HaberdasherV1\")\n\tctx = ctxsetters.WithMethodName(ctx, \"MakeHatV1\")\n\tcaller := c.callMakeHatV1\n\tif c.interceptor != nil {\n\t\tcaller = func(ctx context.Context, req *MakeHatArgsV1_SizeV1) (*MakeHatArgsV1_HatV1, error) {\n\t\t\tresp, err := c.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*MakeHatArgsV1_SizeV1)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*MakeHatArgsV1_SizeV1) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn c.callMakeHatV1(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*MakeHatArgsV1_HatV1)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*MakeHatArgsV1_HatV1) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn caller(ctx, in)\n}\n\nfunc (c *haberdasherV1JSONClient) callMakeHatV1(ctx context.Context, in *MakeHatArgsV1_SizeV1) (*MakeHatArgsV1_HatV1, error) {\n\tout := new(MakeHatArgsV1_HatV1)\n\tctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)\n\tif err != nil {\n\t\ttwerr, ok := err.(twirp.Error)\n\t\tif !ok {\n\t\t\ttwerr = twirp.InternalErrorWith(err)\n\t\t}\n\t\tcallClientError(ctx, c.opts.Hooks, twerr)\n\t\treturn nil, err\n\t}\n\n\tcallClientResponseReceived(ctx, c.opts.Hooks)\n\n\treturn out, nil\n}\n\n// ============================\n// HaberdasherV1 Server Handler\n// ============================\n\ntype haberdasherV1Server struct {\n\tHaberdasherV1\n\tinterceptor      twirp.Interceptor\n\thooks            *twirp.ServerHooks\n\tpathPrefix       string // prefix for routing\n\tjsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response\n\tjsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names\n}\n\n// NewHaberdasherV1Server builds a TwirpServer that can be used as an http.Handler to handle\n// HTTP requests that are routed to the right method in the provided svc implementation.\n// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).\nfunc NewHaberdasherV1Server(svc HaberdasherV1, opts ...interface{}) TwirpServer {\n\tserverOpts := newServerOpts(opts)\n\n\t// Using ReadOpt allows backwards and forwards compatibility with new options in the future\n\tjsonSkipDefaults := false\n\t_ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tjsonCamelCase := false\n\t_ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)\n\tvar pathPrefix string\n\tif ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {\n\t\tpathPrefix = \"/twirp\" // default prefix\n\t}\n\n\treturn &haberdasherV1Server{\n\t\tHaberdasherV1:    svc,\n\t\thooks:            serverOpts.Hooks,\n\t\tinterceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),\n\t\tpathPrefix:       pathPrefix,\n\t\tjsonSkipDefaults: jsonSkipDefaults,\n\t\tjsonCamelCase:    jsonCamelCase,\n\t}\n}\n\n// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc (s *haberdasherV1Server) writeError(ctx context.Context, resp http.ResponseWriter, err error) {\n\twriteError(ctx, resp, err, s.hooks)\n}\n\n// handleRequestBodyError is used to handle error when the twirp server cannot read request\nfunc (s *haberdasherV1Server) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {\n\tif context.Canceled == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.Canceled, \"failed to read request: context canceled\"))\n\t\treturn\n\t}\n\tif context.DeadlineExceeded == ctx.Err() {\n\t\ts.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, \"failed to read request: deadline exceeded\"))\n\t\treturn\n\t}\n\ts.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))\n}\n\n// HaberdasherV1PathPrefix is a convenience constant that may identify URL paths.\n// Should be used with caution, it only matches routes generated by Twirp Go clients,\n// with the default \"/twirp\" prefix and default CamelCase service and method names.\n// More info: https://twitchtv.github.io/twirp/docs/routing.html\nconst HaberdasherV1PathPrefix = \"/twirp/twirp.internal.twirptest.snake_case_names.HaberdasherV1/\"\n\nfunc (s *haberdasherV1Server) ServeHTTP(resp http.ResponseWriter, req *http.Request) {\n\tctx := req.Context()\n\tctx = ctxsetters.WithPackageName(ctx, \"twirp.internal.twirptest.snake_case_names\")\n\tctx = ctxsetters.WithServiceName(ctx, \"HaberdasherV1\")\n\tctx = ctxsetters.WithResponseWriter(ctx, resp)\n\n\tvar err error\n\tctx, err = callRequestReceived(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tif req.Method != \"POST\" {\n\t\tmsg := fmt.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\t// Verify path format: [<prefix>]/<package>.<Service>/<Method>\n\tprefix, pkgService, method := parseTwirpPath(req.URL.Path)\n\tif pkgService != \"twirp.internal.twirptest.snake_case_names.Haberdasher_v1\" && pkgService != \"twirp.internal.twirptest.snake_case_names.HaberdasherV1\" {\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\tif prefix != s.pathPrefix {\n\t\tmsg := fmt.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n\n\tswitch method {\n\tcase \"MakeHat_v1\", \"MakeHatV1\":\n\t\ts.serveMakeHatV1(ctx, resp, req)\n\t\treturn\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"no handler for path %q\", req.URL.Path)\n\t\ts.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))\n\t\treturn\n\t}\n}\n\nfunc (s *haberdasherV1Server) serveMakeHatV1(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\theader := req.Header.Get(\"Content-Type\")\n\ti := strings.Index(header, \";\")\n\tif i == -1 {\n\t\ti = len(header)\n\t}\n\tswitch strings.TrimSpace(strings.ToLower(header[:i])) {\n\tcase \"application/json\":\n\t\ts.serveMakeHatV1JSON(ctx, resp, req)\n\tcase \"application/protobuf\":\n\t\ts.serveMakeHatV1Protobuf(ctx, resp, req)\n\tdefault:\n\t\tmsg := fmt.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))\n\t\ttwerr := badRouteError(msg, req.Method, req.URL.Path)\n\t\ts.writeError(ctx, resp, twerr)\n\t}\n}\n\nfunc (s *haberdasherV1Server) serveMakeHatV1JSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"MakeHatV1\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\td := json.NewDecoder(req.Body)\n\trawReqBody := json.RawMessage{}\n\tif err := d.Decode(&rawReqBody); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\treqContent := new(MakeHatArgsV1_SizeV1)\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)\n\t\treturn\n\t}\n\n\thandler := s.HaberdasherV1.MakeHatV1\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *MakeHatArgsV1_SizeV1) (*MakeHatArgsV1_HatV1, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*MakeHatArgsV1_SizeV1)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*MakeHatArgsV1_SizeV1) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.HaberdasherV1.MakeHatV1(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*MakeHatArgsV1_HatV1)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*MakeHatArgsV1_HatV1) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *MakeHatArgsV1_HatV1\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *MakeHatArgsV1_HatV1 and nil error while calling MakeHatV1. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}\n\trespBytes, err := marshaler.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/json\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *haberdasherV1Server) serveMakeHatV1Protobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {\n\tvar err error\n\tctx = ctxsetters.WithMethodName(ctx, \"MakeHatV1\")\n\tctx, err = callRequestRouted(ctx, s.hooks)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\n\tbuf, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\ts.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)\n\t\treturn\n\t}\n\treqContent := new(MakeHatArgsV1_SizeV1)\n\tif err = proto.Unmarshal(buf, reqContent); err != nil {\n\t\ts.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))\n\t\treturn\n\t}\n\n\thandler := s.HaberdasherV1.MakeHatV1\n\tif s.interceptor != nil {\n\t\thandler = func(ctx context.Context, req *MakeHatArgsV1_SizeV1) (*MakeHatArgsV1_HatV1, error) {\n\t\t\tresp, err := s.interceptor(\n\t\t\t\tfunc(ctx context.Context, req interface{}) (interface{}, error) {\n\t\t\t\t\ttypedReq, ok := req.(*MakeHatArgsV1_SizeV1)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion req.(*MakeHatArgsV1_SizeV1) when calling interceptor\")\n\t\t\t\t\t}\n\t\t\t\t\treturn s.HaberdasherV1.MakeHatV1(ctx, typedReq)\n\t\t\t\t},\n\t\t\t)(ctx, req)\n\t\t\tif resp != nil {\n\t\t\t\ttypedResp, ok := resp.(*MakeHatArgsV1_HatV1)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, twirp.InternalError(\"failed type assertion resp.(*MakeHatArgsV1_HatV1) when calling interceptor\")\n\t\t\t\t}\n\t\t\t\treturn typedResp, err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call service method\n\tvar respContent *MakeHatArgsV1_HatV1\n\tfunc() {\n\t\tdefer ensurePanicResponses(ctx, resp, s.hooks)\n\t\trespContent, err = handler(ctx, reqContent)\n\t}()\n\n\tif err != nil {\n\t\ts.writeError(ctx, resp, err)\n\t\treturn\n\t}\n\tif respContent == nil {\n\t\ts.writeError(ctx, resp, twirp.InternalError(\"received a nil *MakeHatArgsV1_HatV1 and nil error while calling MakeHatV1. nil responses are not supported\"))\n\t\treturn\n\t}\n\n\tctx = callResponsePrepared(ctx, s.hooks)\n\n\trespBytes, err := proto.Marshal(respContent)\n\tif err != nil {\n\t\ts.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))\n\t\treturn\n\t}\n\n\tctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)\n\tresp.Header().Set(\"Content-Type\", \"application/protobuf\")\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))\n\tresp.WriteHeader(http.StatusOK)\n\tif n, err := resp.Write(respBytes); err != nil {\n\t\tmsg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())\n\t\ttwerr := twirp.NewError(twirp.Unknown, msg)\n\t\tctx = callError(ctx, s.hooks, twerr)\n\t}\n\tcallResponseSent(ctx, s.hooks)\n}\n\nfunc (s *haberdasherV1Server) ServiceDescriptor() ([]byte, int) {\n\treturn twirpFileDescriptor0, 0\n}\n\nfunc (s *haberdasherV1Server) ProtocGenTwirpVersion() string {\n\treturn \"v8.1.3\"\n}\n\n// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"\n// that is everything in a Twirp route except for the <Method>. This can be used for routing,\n// for example to identify the requests that are targeted to this service in a mux.\nfunc (s *haberdasherV1Server) PathPrefix() string {\n\treturn baseServicePath(s.pathPrefix, \"twirp.internal.twirptest.snake_case_names\", \"HaberdasherV1\")\n}\n\n// =====\n// Utils\n// =====\n\n// HTTPClient is the interface used by generated clients to send HTTP requests.\n// It is fulfilled by *(net/http).Client, which is sufficient for most users.\n// Users can provide their own implementation for special retry policies.\n//\n// HTTPClient implementations should not follow redirects. Redirects are\n// automatically disabled if *(net/http).Client is passed to client\n// constructors. See the withoutRedirects function in this file for more\n// details.\ntype HTTPClient interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n\n// TwirpServer is the interface generated server structs will support: they're\n// HTTP handlers with additional methods for accessing metadata about the\n// service. Those accessors are a low-level API for building reflection tools.\n// Most people can think of TwirpServers as just http.Handlers.\ntype TwirpServer interface {\n\thttp.Handler\n\n\t// ServiceDescriptor returns gzipped bytes describing the .proto file that\n\t// this service was generated from. Once unzipped, the bytes can be\n\t// unmarshalled as a\n\t// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.\n\t//\n\t// The returned integer is the index of this particular service within that\n\t// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a\n\t// low-level field, expected to be used for reflection.\n\tServiceDescriptor() ([]byte, int)\n\n\t// ProtocGenTwirpVersion is the semantic version string of the version of\n\t// twirp used to generate this file.\n\tProtocGenTwirpVersion() string\n\n\t// PathPrefix returns the HTTP URL path prefix for all methods handled by this\n\t// service. This can be used with an HTTP mux to route Twirp requests.\n\t// The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"\n\t// that is, everything in a Twirp route except for the <Method> at the end.\n\tPathPrefix() string\n}\n\nfunc newServerOpts(opts []interface{}) *twirp.ServerOptions {\n\tserverOpts := &twirp.ServerOptions{}\n\tfor _, opt := range opts {\n\t\tswitch o := opt.(type) {\n\t\tcase twirp.ServerOption:\n\t\t\to(serverOpts)\n\t\tcase *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument\n\t\t\ttwirp.WithServerHooks(o)(serverOpts)\n\t\tcase nil: // backwards compatibility, allow nil value for the argument\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))\n\t\t}\n\t}\n\treturn serverOpts\n}\n\n// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).\n// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.\n// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)\nfunc WriteError(resp http.ResponseWriter, err error) {\n\twriteError(context.Background(), resp, err, nil)\n}\n\n// writeError writes Twirp errors in the response and triggers hooks.\nfunc writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) {\n\t// Convert to a twirp.Error. Non-twirp errors are converted to internal errors.\n\tvar twerr twirp.Error\n\tif !errors.As(err, &twerr) {\n\t\ttwerr = twirp.InternalErrorWith(err)\n\t}\n\n\tstatusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code())\n\tctx = ctxsetters.WithStatusCode(ctx, statusCode)\n\tctx = callError(ctx, hooks, twerr)\n\n\trespBody := marshalErrorToJSON(twerr)\n\n\tresp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON\n\tresp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))\n\tresp.WriteHeader(statusCode) // set HTTP status code and send response\n\n\t_, writeErr := resp.Write(respBody)\n\tif writeErr != nil {\n\t\t// We have three options here. We could log the error, call the Error\n\t\t// hook, or just silently ignore the error.\n\t\t//\n\t\t// Logging is unacceptable because we don't have a user-controlled\n\t\t// logger; writing out to stderr without permission is too rude.\n\t\t//\n\t\t// Calling the Error hook would confuse users: it would mean the Error\n\t\t// hook got called twice for one request, which is likely to lead to\n\t\t// duplicated log messages and metrics, no matter how well we document\n\t\t// the behavior.\n\t\t//\n\t\t// Silently ignoring the error is our least-bad option. It's highly\n\t\t// likely that the connection is broken and the original 'err' says\n\t\t// so anyway.\n\t\t_ = writeErr\n\t}\n\n\tcallResponseSent(ctx, hooks)\n}\n\n// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.\n// If the URL is unparsable, the baseURL is returned unchanged.\nfunc sanitizeBaseURL(baseURL string) string {\n\tu, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn baseURL // invalid URL will fail later when making requests\n\t}\n\tif u.Scheme == \"\" {\n\t\tu.Scheme = \"http\"\n\t}\n\treturn u.String()\n}\n\n// baseServicePath composes the path prefix for the service (without <Method>).\n// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")\n//\n//\treturns => \"/twirp/my.pkg.MyService/\"\n//\n// e.g.: baseServicePath(\"\", \"\", \"MyService\")\n//\n//\treturns => \"/MyService/\"\nfunc baseServicePath(prefix, pkg, service string) string {\n\tfullServiceName := service\n\tif pkg != \"\" {\n\t\tfullServiceName = pkg + \".\" + service\n\t}\n\treturn path.Join(\"/\", prefix, fullServiceName) + \"/\"\n}\n\n// parseTwirpPath extracts path components form a valid Twirp route.\n// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"\n// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")\nfunc parseTwirpPath(path string) (string, string, string) {\n\tparts := strings.Split(path, \"/\")\n\tif len(parts) < 2 {\n\t\treturn \"\", \"\", \"\"\n\t}\n\tmethod := parts[len(parts)-1]\n\tpkgService := parts[len(parts)-2]\n\tprefix := strings.Join(parts[0:len(parts)-2], \"/\")\n\treturn prefix, pkgService, method\n}\n\n// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in\n// a context through the twirp.WithHTTPRequestHeaders function.\n// If there are no headers set, or if they have the wrong type, nil is returned.\nfunc getCustomHTTPReqHeaders(ctx context.Context) http.Header {\n\theader, ok := twirp.HTTPRequestHeaders(ctx)\n\tif !ok || header == nil {\n\t\treturn nil\n\t}\n\tcopied := make(http.Header)\n\tfor k, vv := range header {\n\t\tif vv == nil {\n\t\t\tcopied[k] = nil\n\t\t\tcontinue\n\t\t}\n\t\tcopied[k] = make([]string, len(vv))\n\t\tcopy(copied[k], vv)\n\t}\n\treturn copied\n}\n\n// newRequest makes an http.Request from a client, adding common headers.\nfunc newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) {\n\treq, err := http.NewRequest(\"POST\", url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\tif customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {\n\t\treq.Header = customHeader\n\t}\n\treq.Header.Set(\"Accept\", contentType)\n\treq.Header.Set(\"Content-Type\", contentType)\n\treq.Header.Set(\"Twirp-Version\", \"v8.1.3\")\n\treturn req, nil\n}\n\n// JSON serialization for errors\ntype twerrJSON struct {\n\tCode string            `json:\"code\"`\n\tMsg  string            `json:\"msg\"`\n\tMeta map[string]string `json:\"meta,omitempty\"`\n}\n\n// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.\n// If serialization fails, it will use a descriptive Internal error instead.\nfunc marshalErrorToJSON(twerr twirp.Error) []byte {\n\t// make sure that msg is not too large\n\tmsg := twerr.Msg()\n\tif len(msg) > 1e6 {\n\t\tmsg = msg[:1e6]\n\t}\n\n\ttj := twerrJSON{\n\t\tCode: string(twerr.Code()),\n\t\tMsg:  msg,\n\t\tMeta: twerr.MetaMap(),\n\t}\n\n\tbuf, err := json.Marshal(&tj)\n\tif err != nil {\n\t\tbuf = []byte(\"{\\\"type\\\": \\\"\" + twirp.Internal + \"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback\n\t}\n\n\treturn buf\n}\n\n// errorFromResponse builds a twirp.Error from a non-200 HTTP response.\n// If the response has a valid serialized Twirp error, then it's returned.\n// If not, the response status code is used to generate a similar twirp\n// error. See twirpErrorFromIntermediary for more info on intermediary errors.\nfunc errorFromResponse(resp *http.Response) twirp.Error {\n\tstatusCode := resp.StatusCode\n\tstatusText := http.StatusText(statusCode)\n\n\tif isHTTPRedirect(statusCode) {\n\t\t// Unexpected redirect: it must be an error from an intermediary.\n\t\t// Twirp clients don't follow redirects automatically, Twirp only handles\n\t\t// POST requests, redirects should only happen on GET and HEAD requests.\n\t\tlocation := resp.Header.Get(\"Location\")\n\t\tmsg := fmt.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, location)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn wrapInternal(err, \"failed to read server error response body\")\n\t}\n\n\tvar tj twerrJSON\n\tdec := json.NewDecoder(bytes.NewReader(respBodyBytes))\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(&tj); err != nil || tj.Code == \"\" {\n\t\t// Invalid JSON response; it must be an error from an intermediary.\n\t\tmsg := fmt.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)\n\t\treturn twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))\n\t}\n\n\terrorCode := twirp.ErrorCode(tj.Code)\n\tif !twirp.IsValidErrorCode(errorCode) {\n\t\tmsg := \"invalid type returned from server error response: \" + tj.Code\n\t\treturn twirp.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))\n\t}\n\n\ttwerr := twirp.NewError(errorCode, tj.Msg)\n\tfor k, v := range tj.Meta {\n\t\ttwerr = twerr.WithMeta(k, v)\n\t}\n\treturn twerr\n}\n\n// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.\n// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.\n// Returned twirp Errors have some additional metadata for inspection.\nfunc twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error {\n\tvar code twirp.ErrorCode\n\tif isHTTPRedirect(status) { // 3xx\n\t\tcode = twirp.Internal\n\t} else {\n\t\tswitch status {\n\t\tcase 400: // Bad Request\n\t\t\tcode = twirp.Internal\n\t\tcase 401: // Unauthorized\n\t\t\tcode = twirp.Unauthenticated\n\t\tcase 403: // Forbidden\n\t\t\tcode = twirp.PermissionDenied\n\t\tcase 404: // Not Found\n\t\t\tcode = twirp.BadRoute\n\t\tcase 429: // Too Many Requests\n\t\t\tcode = twirp.ResourceExhausted\n\t\tcase 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout\n\t\t\tcode = twirp.Unavailable\n\t\tdefault: // All other codes\n\t\t\tcode = twirp.Unknown\n\t\t}\n\t}\n\n\ttwerr := twirp.NewError(code, msg)\n\ttwerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary\n\ttwerr = twerr.WithMeta(\"status_code\", strconv.Itoa(status))\n\tif isHTTPRedirect(status) {\n\t\ttwerr = twerr.WithMeta(\"location\", bodyOrLocation)\n\t} else {\n\t\ttwerr = twerr.WithMeta(\"body\", bodyOrLocation)\n\t}\n\treturn twerr\n}\n\nfunc isHTTPRedirect(status int) bool {\n\treturn status >= 300 && status <= 399\n}\n\n// wrapInternal wraps an error with a prefix as an Internal error.\n// The original error cause is accessible by github.com/pkg/errors.Cause.\nfunc wrapInternal(err error, prefix string) twirp.Error {\n\treturn twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})\n}\n\ntype wrappedError struct {\n\tprefix string\n\tcause  error\n}\n\nfunc (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }\nfunc (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors\n\n// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal\n// error response (status 500), and error hooks are properly called with the panic wrapped as an error.\n// The panic is re-raised so it can be handled normally with middleware.\nfunc ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) {\n\tif r := recover(); r != nil {\n\t\t// Wrap the panic as an error so it can be passed to error hooks.\n\t\t// The original error is accessible from error hooks, but not visible in the response.\n\t\terr := errFromPanic(r)\n\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}\n\t\t// Actually write the error\n\t\twriteError(ctx, resp, twerr, hooks)\n\t\t// If possible, flush the error to the wire.\n\t\tf, ok := resp.(http.Flusher)\n\t\tif ok {\n\t\t\tf.Flush()\n\t\t}\n\n\t\tpanic(r)\n\t}\n}\n\n// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.\nfunc errFromPanic(p interface{}) error {\n\tif err, ok := p.(error); ok {\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"panic: %v\", p)\n}\n\n// internalWithCause is a Twirp Internal error wrapping an original error cause,\n// but the original error message is not exposed on Msg(). The original error\n// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap\ntype internalWithCause struct {\n\tmsg   string\n\tcause error\n}\n\nfunc (e *internalWithCause) Unwrap() error                               { return e.cause } // for go1.13 + errors.Is/As\nfunc (e *internalWithCause) Cause() error                                { return e.cause } // for github.com/pkg/errors\nfunc (e *internalWithCause) Error() string                               { return e.msg + \": \" + e.cause.Error() }\nfunc (e *internalWithCause) Code() twirp.ErrorCode                       { return twirp.Internal }\nfunc (e *internalWithCause) Msg() string                                 { return e.msg }\nfunc (e *internalWithCause) Meta(key string) string                      { return \"\" }\nfunc (e *internalWithCause) MetaMap() map[string]string                  { return nil }\nfunc (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e }\n\n// malformedRequestError is used when the twirp server cannot unmarshal a request\nfunc malformedRequestError(msg string) twirp.Error {\n\treturn twirp.NewError(twirp.Malformed, msg)\n}\n\n// badRouteError is used when the twirp server cannot route a request\nfunc badRouteError(msg string, method, url string) twirp.Error {\n\terr := twirp.NewError(twirp.BadRoute, msg)\n\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)\n\treturn err\n}\n\n// withoutRedirects makes sure that the POST request can not be redirected.\n// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or\n// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the\n// method to GET and removing the body. This produces very confusing error messages, so instead we\n// set a redirect policy that always errors. This stops Go from executing the redirect.\n//\n// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect\n// policy - if so, we'll run through that policy first.\n//\n// Because this requires modifying the http.Client, we make a new copy of the client and return it.\nfunc withoutRedirects(in *http.Client) *http.Client {\n\tcopy := *in\n\tcopy.CheckRedirect = func(req *http.Request, via []*http.Request) error {\n\t\tif in.CheckRedirect != nil {\n\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it\n\t\t\t// returns, since we want to use ErrUseLastResponse.\n\t\t\terr := in.CheckRedirect(req, via)\n\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.\n\t\t}\n\t\treturn http.ErrUseLastResponse\n\t}\n\treturn &copy\n}\n\n// doProtobufRequest makes a Protobuf request to the remote Twirp service.\nfunc doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\treqBodyBytes, err := proto.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal proto request\")\n\t}\n\treqBody := bytes.NewBuffer(reqBodyBytes)\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, reqBody, \"application/protobuf\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\trespBodyBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to read response body\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif err = proto.Unmarshal(respBodyBytes, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal proto response\")\n\t}\n\treturn ctx, nil\n}\n\n// doJSONRequest makes a JSON request to the remote Twirp service.\nfunc doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) {\n\tmarshaler := &protojson.MarshalOptions{UseProtoNames: true}\n\treqBytes, err := marshaler.Marshal(in)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to marshal json request\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\treq, err := newRequest(ctx, url, bytes.NewReader(reqBytes), \"application/json\")\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"could not build request\")\n\t}\n\tctx, err = callClientRequestPrepared(ctx, hooks, req)\n\tif err != nil {\n\t\treturn ctx, err\n\t}\n\n\treq = req.WithContext(ctx)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to do request\")\n\t}\n\n\tdefer func() {\n\t\tcerr := resp.Body.Close()\n\t\tif err == nil && cerr != nil {\n\t\t\terr = wrapInternal(cerr, \"failed to close response body\")\n\t\t}\n\t}()\n\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn ctx, errorFromResponse(resp)\n\t}\n\n\td := json.NewDecoder(resp.Body)\n\trawRespBody := json.RawMessage{}\n\tif err := d.Decode(&rawRespBody); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tunmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}\n\tif err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {\n\t\treturn ctx, wrapInternal(err, \"failed to unmarshal json response\")\n\t}\n\tif err = ctx.Err(); err != nil {\n\t\treturn ctx, wrapInternal(err, \"aborted because context was done\")\n\t}\n\treturn ctx, nil\n}\n\n// Call twirp.ServerHooks.RequestReceived if the hook is available\nfunc callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestReceived == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestReceived(ctx)\n}\n\n// Call twirp.ServerHooks.RequestRouted if the hook is available\nfunc callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) {\n\tif h == nil || h.RequestRouted == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestRouted(ctx)\n}\n\n// Call twirp.ServerHooks.ResponsePrepared if the hook is available\nfunc callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context {\n\tif h == nil || h.ResponsePrepared == nil {\n\t\treturn ctx\n\t}\n\treturn h.ResponsePrepared(ctx)\n}\n\n// Call twirp.ServerHooks.ResponseSent if the hook is available\nfunc callResponseSent(ctx context.Context, h *twirp.ServerHooks) {\n\tif h == nil || h.ResponseSent == nil {\n\t\treturn\n\t}\n\th.ResponseSent(ctx)\n}\n\n// Call twirp.ServerHooks.Error if the hook is available\nfunc callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context {\n\tif h == nil || h.Error == nil {\n\t\treturn ctx\n\t}\n\treturn h.Error(ctx, err)\n}\n\nfunc callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) {\n\tif h == nil || h.ResponseReceived == nil {\n\t\treturn\n\t}\n\th.ResponseReceived(ctx)\n}\n\nfunc callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) {\n\tif h == nil || h.RequestPrepared == nil {\n\t\treturn ctx, nil\n\t}\n\treturn h.RequestPrepared(ctx, req)\n}\n\nfunc callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) {\n\tif h == nil || h.Error == nil {\n\t\treturn\n\t}\n\th.Error(ctx, err)\n}\n\nvar twirpFileDescriptor0 = []byte{\n\t// 227 bytes of a gzipped FileDescriptorProto\n\t0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2b, 0xce, 0x4b, 0xcc,\n\t0x4e, 0x8d, 0x4f, 0x4e, 0x2c, 0x4e, 0x8d, 0xcf, 0x4b, 0xcc, 0x4d, 0x2d, 0xd6, 0x2b, 0x28, 0xca,\n\t0x2f, 0xc9, 0x17, 0xd2, 0x2c, 0x29, 0xcf, 0x2c, 0x2a, 0xd0, 0xcb, 0xcc, 0x2b, 0x49, 0x2d, 0xca,\n\t0x4b, 0xcc, 0xd1, 0x03, 0x73, 0x4b, 0x52, 0x8b, 0x4b, 0xf4, 0xd0, 0x35, 0x28, 0x55, 0x73, 0xf1,\n\t0xf9, 0x26, 0x66, 0xa7, 0x7a, 0x24, 0x96, 0x38, 0x16, 0xa5, 0x17, 0xc7, 0x97, 0x19, 0x4a, 0xb9,\n\t0x71, 0xb1, 0x79, 0x24, 0x96, 0xc4, 0x97, 0x19, 0x0a, 0x09, 0x71, 0xb1, 0x14, 0x67, 0x56, 0xa5,\n\t0x4a, 0x30, 0x2a, 0x30, 0x6a, 0xb0, 0x06, 0x81, 0xd9, 0x42, 0x22, 0x5c, 0xac, 0xc9, 0xf9, 0x39,\n\t0xf9, 0x45, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x10, 0x0e, 0x48, 0x25, 0xc8, 0x38, 0x09,\n\t0x66, 0xb0, 0x20, 0x98, 0x2d, 0xa5, 0xc8, 0xc5, 0x1e, 0x9c, 0x59, 0x95, 0x0a, 0x32, 0x48, 0x8c,\n\t0x8b, 0x2d, 0x33, 0x2f, 0x39, 0x23, 0xb5, 0x18, 0x6a, 0x14, 0x94, 0x67, 0xb4, 0x84, 0x91, 0x8b,\n\t0xcf, 0x23, 0x31, 0x29, 0xb5, 0x28, 0x25, 0xb1, 0x38, 0x23, 0xb5, 0x08, 0xa4, 0x74, 0x22, 0x23,\n\t0x17, 0x17, 0xd4, 0x41, 0x20, 0xae, 0xa3, 0x1e, 0xd1, 0x5e, 0xd1, 0x43, 0xf5, 0x87, 0x1e, 0xd4,\n\t0x72, 0x29, 0x07, 0xf2, 0x8d, 0x80, 0x38, 0xc2, 0x49, 0x24, 0x4a, 0x48, 0xdf, 0x1a, 0x5d, 0x6d,\n\t0x12, 0x1b, 0x38, 0xac, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb7, 0x11, 0xfe, 0x5d, 0x85,\n\t0x01, 0x00, 0x00,\n}\n"
  },
  {
    "path": "license_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage twirp\n\nimport (\n\t\"bytes\"\n\t\"io\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"regexp\"\n\t\"strings\"\n\t\"testing\"\n)\n\nvar headerCopyright = regexp.MustCompile(`// Copyright \\d{4} Twitch Interactive, Inc.  All Rights Reserved.`)\n\nconst headerLicense = `\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n`\n\nvar generatedCodeMatcher = regexp.MustCompile(\"// Code generated .* DO NOT EDIT\")\n\nfunc TestSourceCodeLicenseHeaders(t *testing.T) {\n\terr := filepath.Walk(\".\", func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif path == \"_tools\" || path == \"vendor\" {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\n\t\tif !strings.HasSuffix(path, \".go\") {\n\t\t\t// Skip non-go files.\n\t\t\treturn nil\n\t\t}\n\n\t\tif strings.HasSuffix(path, \".twirp.go\") || strings.HasSuffix(path, \".pb.go\") {\n\t\t\treturn nil\n\t\t}\n\n\t\tfile, err := os.Open(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfileBytes, err := io.ReadAll(file)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfileBuf := bytes.NewReader(fileBytes)\n\n\t\tif generatedCodeMatcher.MatchReader(fileBuf) {\n\t\t\t// Skip generated files.\n\t\t\treturn nil\n\t\t}\n\n\t\t_, err = fileBuf.Seek(0, io.SeekStart)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !headerCopyright.MatchReader(fileBuf) {\n\t\t\tt.Errorf(\"%v is missing licensing header\", path)\n\t\t\treturn nil\n\t\t}\n\n\t\tif !bytes.Contains(fileBytes, []byte(headerLicense)) {\n\t\t\tt.Errorf(\"%v is missing licensing header\", path)\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tt.Fatalf(\"error scanning directory for source code files: %v\", err)\n\t}\n}\n"
  },
  {
    "path": "protoc-gen-twirp/command_line.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n)\n\ntype commandLineParams struct {\n\timportMap    map[string]string // Mapping from .proto file name to import path.\n\tpaths        string            // paths flag, used to control file output directory.\n\tmodule       string            // module flag, Go import path prefix that is removed from the output filename.\n\timportPrefix string            // prefix added to imported package file names.\n}\n\n// parseCommandLineParams 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 command line parameter mappings defined by those entries.\nfunc parseCommandLineParams(parameter string) (*commandLineParams, error) {\n\tps := make(map[string]string)\n\tfor _, p := range strings.Split(parameter, \",\") {\n\t\tif p == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\ti := strings.Index(p, \"=\")\n\t\tif i < 0 {\n\t\t\treturn nil, fmt.Errorf(\"invalid parameter %q: expected format of parameter to be k=v\", p)\n\t\t}\n\t\tk := p[0:i]\n\t\tv := p[i+1:]\n\t\tif v == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"invalid parameter %q: expected format of parameter to be k=v\", k)\n\t\t}\n\t\tps[k] = v\n\t}\n\n\tclp := &commandLineParams{\n\t\timportMap: make(map[string]string),\n\t}\n\tfor k, v := range ps {\n\t\tswitch {\n\t\t// Support import map 'M' prefix: https://developers.google.com/protocol-buffers/docs/reference/go-generated\n\t\tcase len(k) > 0 && k[0] == 'M':\n\t\t\tclp.importMap[k[1:]] = v // 1 is the length of 'M'.\n\t\tcase len(k) > 0 && strings.HasPrefix(k, \"go_import_mapping@\"): // twirp specific version of M parameters\n\t\t\tclp.importMap[k[18:]] = v // 18 is the length of 'go_import_mapping@'.\n\n\t\tcase k == \"paths\":\n\t\t\tswitch v {\n\t\t\tcase \"import\":\n\t\t\t\t// this is the default behavior; the output file is placed in a directory named after the option go_package\n\t\t\tcase \"source_relative\":\n\t\t\t\t// the directory prefix on the option go_package is removed from the output filename (only the last part is used)\n\t\t\t\tclp.paths = \"source_relative\"\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(\"invalid command line flag %s=%s\", k, v)\n\t\t\t}\n\n\t\t// If the module={PREFIX} flag is specified, the prefix is removed from the option go_package on the output filename\n\t\tcase k == \"module\":\n\t\t\tclp.module = v\n\n\t\t// Deprecated, but may still be useful when working with old versions of protoc-gen-go\n\t\tcase k == \"import_prefix\":\n\t\t\tclp.importPrefix = v\n\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"invalid command line flag %s=%s\", k, v)\n\t\t}\n\t}\n\treturn clp, nil\n}\n"
  },
  {
    "path": "protoc-gen-twirp/command_line_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\nimport (\n\t\"errors\"\n\t\"reflect\"\n\t\"testing\"\n)\n\nfunc TestParseCommandLineParams(t *testing.T) {\n\ttests := []struct {\n\t\tname      string\n\t\tparameter string\n\t\tparams    *commandLineParams\n\t\terr       error\n\t}{\n\t\t{\n\t\t\t\"no parameters\",\n\t\t\t\"\",\n\t\t\t&commandLineParams{\n\t\t\t\timportMap: map[string]string{},\n\t\t\t},\n\t\t\tnil,\n\t\t},\n\t\t{\n\t\t\t\"unknown parameter\",\n\t\t\t\"kkk=vvv\",\n\t\t\tnil,\n\t\t\terrors.New(`invalid command line flag kkk=vvv`),\n\t\t},\n\t\t{\n\t\t\t\"empty parameter value - no equals sign\",\n\t\t\t\"import_prefix\",\n\t\t\tnil,\n\t\t\terrors.New(`invalid parameter \"import_prefix\": expected format of parameter to be k=v`),\n\t\t},\n\t\t{\n\t\t\t\"empty parameter value - no value\",\n\t\t\t\"import_prefix=\",\n\t\t\tnil,\n\t\t\terrors.New(`invalid parameter \"import_prefix\": expected format of parameter to be k=v`),\n\t\t},\n\t\t{\n\t\t\t\"import_prefix parameter\",\n\t\t\t\"import_prefix=github.com/example/repo\",\n\t\t\t&commandLineParams{\n\t\t\t\timportMap:    map[string]string{},\n\t\t\t\timportPrefix: \"github.com/example/repo\",\n\t\t\t},\n\t\t\tnil,\n\t\t},\n\t\t{\n\t\t\t\"single import parameter starting with 'M'\",\n\t\t\t\"Mrpcutil/empty.proto=github.com/example/rpcutil\",\n\t\t\t&commandLineParams{\n\t\t\t\timportMap: map[string]string{\n\t\t\t\t\t\"rpcutil/empty.proto\": \"github.com/example/rpcutil\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tnil,\n\t\t},\n\t\t{\n\t\t\t\"multiple import parameters starting with 'M'\",\n\t\t\t\"Mrpcutil/empty.proto=github.com/example/rpcutil,Mrpc/haberdasher/service.proto=github.com/example/rpc/haberdasher\",\n\t\t\t&commandLineParams{\n\t\t\t\timportMap: map[string]string{\n\t\t\t\t\t\"rpcutil/empty.proto\":           \"github.com/example/rpcutil\",\n\t\t\t\t\t\"rpc/haberdasher/service.proto\": \"github.com/example/rpc/haberdasher\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tnil,\n\t\t},\n\t\t{\n\t\t\t\"single import parameter starting with 'go_import_mapping@'\",\n\t\t\t\"go_import_mapping@rpcutil/empty.proto=github.com/example/rpcutil\",\n\t\t\t&commandLineParams{\n\t\t\t\timportMap: map[string]string{\n\t\t\t\t\t\"rpcutil/empty.proto\": \"github.com/example/rpcutil\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tnil,\n\t\t},\n\t\t{\n\t\t\t\"multiple import parameters starting with 'go_import_mapping@'\",\n\t\t\t\"go_import_mapping@rpcutil/empty.proto=github.com/example/rpcutil,go_import_mapping@rpc/haberdasher/service.proto=github.com/example/rpc/haberdasher\",\n\t\t\t&commandLineParams{\n\t\t\t\timportMap: map[string]string{\n\t\t\t\t\t\"rpcutil/empty.proto\":           \"github.com/example/rpcutil\",\n\t\t\t\t\t\"rpc/haberdasher/service.proto\": \"github.com/example/rpc/haberdasher\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tnil,\n\t\t},\n\t\t{\n\t\t\t\"paths import\",\n\t\t\t\"paths=import\",\n\t\t\t&commandLineParams{\n\t\t\t\timportMap: map[string]string{},\n\t\t\t},\n\t\t\tnil,\n\t\t},\n\t\t{\n\t\t\t\"paths source_relative\",\n\t\t\t\"paths=source_relative\",\n\t\t\t&commandLineParams{\n\t\t\t\timportMap: map[string]string{},\n\t\t\t\tpaths:     \"source_relative\",\n\t\t\t},\n\t\t\tnil,\n\t\t},\n\t\t{\n\t\t\t\"paths invalidstuff\",\n\t\t\t\"paths=invalidstuff\",\n\t\t\tnil,\n\t\t\terrors.New(`invalid command line flag paths=invalidstuff`),\n\t\t},\n\t\t{\n\t\t\t\"module parameter\",\n\t\t\t\"module=foo/bar/fizz\",\n\t\t\t&commandLineParams{\n\t\t\t\timportMap: map[string]string{},\n\t\t\t\tmodule:    \"foo/bar/fizz\",\n\t\t\t},\n\t\t\tnil,\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tparams, err := parseCommandLineParams(tt.parameter)\n\t\t\tswitch {\n\t\t\tcase err != nil:\n\t\t\t\tif tt.err == nil {\n\t\t\t\t\tt.Fatal(err)\n\t\t\t\t}\n\t\t\t\tif err.Error() != tt.err.Error() {\n\t\t\t\t\tt.Errorf(\"got error = %v, want %v\", err, tt.err)\n\t\t\t\t}\n\t\t\tcase err == nil:\n\t\t\t\tif tt.err != nil {\n\t\t\t\t\tt.Errorf(\"got error = %v, want %v\", err, tt.err)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !reflect.DeepEqual(params, tt.params) {\n\t\t\t\tt.Errorf(\"got params = %+v, want %+v\", params, tt.params)\n\t\t\t}\n\t\t})\n\t}\n}\n"
  },
  {
    "path": "protoc-gen-twirp/generator.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"compress/gzip\"\n\t\"fmt\"\n\t\"go/parser\"\n\t\"go/printer\"\n\t\"go/token\"\n\t\"path\"\n\t\"sort\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"google.golang.org/protobuf/proto\"\n\tdescriptor \"google.golang.org/protobuf/types/descriptorpb\"\n\tplugin \"google.golang.org/protobuf/types/pluginpb\"\n\n\t\"github.com/pkg/errors\"\n\t\"github.com/twitchtv/twirp/internal/gen\"\n\t\"github.com/twitchtv/twirp/internal/gen/stringutils\"\n\t\"github.com/twitchtv/twirp/internal/gen/typemap\"\n)\n\ntype twirp struct {\n\tfilesHandled int\n\n\treg *typemap.Registry\n\n\t// Map to record whether we've built each package\n\tpkgs          map[string]string\n\tpkgNamesInUse map[string]bool\n\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\t// Package output:\n\tsourceRelativePaths bool // instruction on where to write output files\n\tmodulePrefix        string\n\n\t// Package naming:\n\tgenPkgName          string // Name of the package that we're generating\n\tfileToGoPackageName map[*descriptor.FileDescriptorProto]string\n\n\t// List of files that were inputs to the generator. We need to hold this in\n\t// the struct so we can write a header for the file that lists its inputs.\n\tgenFiles []*descriptor.FileDescriptorProto\n\n\t// Output buffer that holds the bytes we want to write out for a single file.\n\t// Gets reset after working on a file.\n\toutput *bytes.Buffer\n}\n\nfunc newGenerator() *twirp {\n\tt := &twirp{\n\t\tpkgs:                make(map[string]string),\n\t\tpkgNamesInUse:       make(map[string]bool),\n\t\timportMap:           make(map[string]string),\n\t\tfileToGoPackageName: make(map[*descriptor.FileDescriptorProto]string),\n\t\toutput:              bytes.NewBuffer(nil),\n\t}\n\n\treturn t\n}\n\nfunc (t *twirp) Generate(in *plugin.CodeGeneratorRequest) *plugin.CodeGeneratorResponse {\n\tparams, err := parseCommandLineParams(in.GetParameter())\n\tif err != nil {\n\t\tgen.Fail(\"could not parse parameters passed to --twirp_out\", err.Error())\n\t}\n\tt.importPrefix = params.importPrefix\n\tt.importMap = params.importMap\n\tt.sourceRelativePaths = params.paths == \"source_relative\"\n\tt.modulePrefix = params.module\n\n\tt.genFiles = gen.FilesToGenerate(in)\n\n\t// Collect information on types.\n\tt.reg = typemap.New(in.ProtoFile)\n\n\t// Register names of packages that we import.\n\tt.registerPackageName(\"bytes\")\n\tt.registerPackageName(\"strings\")\n\tt.registerPackageName(\"path\")\n\tt.registerPackageName(\"ctxsetters\")\n\tt.registerPackageName(\"context\")\n\tt.registerPackageName(\"http\")\n\tt.registerPackageName(\"io\")\n\tt.registerPackageName(\"json\")\n\tt.registerPackageName(\"protojson\")\n\tt.registerPackageName(\"proto\")\n\tt.registerPackageName(\"strconv\")\n\tt.registerPackageName(\"twirp\")\n\tt.registerPackageName(\"url\")\n\tt.registerPackageName(\"fmt\")\n\tt.registerPackageName(\"errors\")\n\n\t// Time to figure out package names of objects defined in protobuf. First,\n\t// we'll figure out the name for the package we're generating.\n\tgenPkgName, err := deduceGenPkgName(t.genFiles)\n\tif err != nil {\n\t\tgen.Fail(err.Error())\n\t}\n\tt.genPkgName = genPkgName\n\n\t// We also need to figure out the fully import path of the package we're\n\t// generating. It's possible to import proto definitions from different .proto\n\t// files which will be generated into the same Go package, which we need to\n\t// detect (and can only detect if files use fully-specified go_package\n\t// options).\n\tgenPkgImportPath, _, _ := goPackageOption(t.genFiles[0])\n\n\t// Next, we need to pick names for all the files that are dependencies.\n\tfor _, f := range in.ProtoFile {\n\t\t// Is this is a file we are generating? If yes, it gets the shared package name.\n\t\tif fileDescSliceContains(t.genFiles, f) {\n\t\t\tt.fileToGoPackageName[f] = t.genPkgName\n\t\t\tcontinue\n\t\t}\n\n\t\t// Is this is an imported .proto file which has the same fully-specified\n\t\t// go_package as the targeted file for generation? If yes, it gets the\n\t\t// shared package name too.\n\t\tif genPkgImportPath != \"\" {\n\t\t\timportPath, _, _ := goPackageOption(f)\n\t\t\tif importPath == genPkgImportPath {\n\t\t\t\tt.fileToGoPackageName[f] = t.genPkgName\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// This is a dependency from a different go_package. Use its package name.\n\t\tname := f.GetPackage()\n\t\tif name == \"\" {\n\t\t\tname = stringutils.BaseName(f.GetName())\n\t\t}\n\t\tname = stringutils.CleanIdentifier(name)\n\t\talias := t.registerPackageName(name)\n\t\tt.fileToGoPackageName[f] = alias\n\t}\n\n\t// Showtime! Generate the response.\n\tresp := new(plugin.CodeGeneratorResponse)\n\tresp.SupportedFeatures = proto.Uint64(uint64(plugin.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL))\n\tfor _, f := range t.genFiles {\n\t\trespFile := t.generate(f)\n\t\tif respFile != nil {\n\t\t\tresp.File = append(resp.File, respFile)\n\t\t}\n\t}\n\treturn resp\n}\n\nfunc (t *twirp) registerPackageName(name string) (alias string) {\n\talias = name\n\ti := 1\n\tfor t.pkgNamesInUse[alias] {\n\t\talias = name + strconv.Itoa(i)\n\t\ti++\n\t}\n\tt.pkgNamesInUse[alias] = true\n\tt.pkgs[name] = alias\n\treturn alias\n}\n\n// deduceGenPkgName figures out the go package name to use for generated code.\n// Will try to use the explicit go_package setting in a file (if set, must be\n// consistent in all files). If no files have go_package set, then use the\n// protobuf package name (must be consistent in all files)\nfunc deduceGenPkgName(genFiles []*descriptor.FileDescriptorProto) (string, error) {\n\tvar genPkgName string\n\tfor _, f := range genFiles {\n\t\tname, explicit := goPackageName(f)\n\t\tif explicit {\n\t\t\tname = stringutils.CleanIdentifier(name)\n\t\t\tif genPkgName != \"\" && genPkgName != name {\n\t\t\t\t// Make sure they're all set consistently.\n\t\t\t\treturn \"\", errors.Errorf(\"files have conflicting go_package settings, must be the same: %q and %q\", genPkgName, name)\n\t\t\t}\n\t\t\tgenPkgName = name\n\t\t}\n\t}\n\tif genPkgName != \"\" {\n\t\treturn genPkgName, nil\n\t}\n\n\t// If there is no explicit setting, then check the implicit package name\n\t// (derived from the protobuf package name) of the files and make sure it's\n\t// consistent.\n\tfor _, f := range genFiles {\n\t\tname, _ := goPackageName(f)\n\t\tname = stringutils.CleanIdentifier(name)\n\t\tif genPkgName != \"\" && genPkgName != name {\n\t\t\treturn \"\", errors.Errorf(\"files have conflicting package names, must be the same or overridden with go_package: %q and %q\", genPkgName, name)\n\t\t}\n\t\tgenPkgName = name\n\t}\n\n\t// All the files have the same name, so we're good.\n\treturn genPkgName, nil\n}\n\nfunc (t *twirp) generate(file *descriptor.FileDescriptorProto) *plugin.CodeGeneratorResponse_File {\n\tresp := new(plugin.CodeGeneratorResponse_File)\n\tif len(file.Service) == 0 {\n\t\treturn nil\n\t}\n\n\tt.generateFileHeader(file)\n\n\tt.generateImports(file)\n\tif t.filesHandled == 0 {\n\t\tt.generateUtilImports()\n\t}\n\n\tt.generateVersionCheck(file)\n\n\t// For each service, generate client stubs and server\n\tfor i, service := range file.Service {\n\t\tt.generateService(file, service, i)\n\t}\n\n\t// Util functions only generated once per package\n\tif t.filesHandled == 0 {\n\t\tt.generateUtils()\n\t}\n\n\tt.generateFileDescriptor(file)\n\n\tresp.Name = proto.String(t.goFileName(file))\n\tresp.Content = proto.String(t.formattedOutput())\n\tt.output.Reset()\n\n\tt.filesHandled++\n\treturn resp\n}\n\nfunc (t *twirp) generateVersionCheck(file *descriptor.FileDescriptorProto) {\n\tt.P(`// Version compatibility assertion.`)\n\tt.P(`// If the constant is not defined in the package, that likely means`)\n\tt.P(`// the package needs to be updated to work with this generated code.`)\n\tt.P(`// See https://twitchtv.github.io/twirp/docs/version_matrix.html`)\n\tt.P(`const _ = `, t.pkgs[\"twirp\"], `.TwirpPackageMinVersion_8_1_0`)\n}\n\nfunc (t *twirp) generateFileHeader(file *descriptor.FileDescriptorProto) {\n\tt.P(\"// Code generated by protoc-gen-twirp \", gen.Version, \", DO NOT EDIT.\")\n\tt.P(\"// source: \", file.GetName())\n\tt.P()\n\n\tcomment, err := t.reg.FileComments(file)\n\tif err == nil && comment.Leading != \"\" {\n\t\tfor _, line := range strings.Split(comment.Leading, \"\\n\") {\n\t\t\tif line != \"\" {\n\t\t\t\tt.P(\"// \" + strings.TrimPrefix(line, \" \"))\n\t\t\t}\n\t\t}\n\t\tt.P()\n\t}\n\n\tt.P(`package `, t.genPkgName)\n\tt.P()\n}\n\nfunc (t *twirp) generateImports(file *descriptor.FileDescriptorProto) {\n\tif len(file.Service) == 0 {\n\t\treturn\n\t}\n\n\t// stdlib imports\n\tt.P(`import `, t.pkgs[\"context\"], ` \"context\"`)\n\tt.P(`import `, t.pkgs[\"fmt\"], ` \"fmt\"`)\n\tt.P(`import `, t.pkgs[\"http\"], ` \"net/http\"`)\n\tt.P(`import `, t.pkgs[\"io\"], ` \"io\"`)\n\tt.P(`import `, t.pkgs[\"json\"], ` \"encoding/json\"`)\n\tt.P(`import `, t.pkgs[\"strconv\"], ` \"strconv\"`)\n\tt.P(`import `, t.pkgs[\"strings\"], ` \"strings\"`)\n\tt.P()\n\n\t// dependency imports\n\tt.P(`import `, t.pkgs[\"protojson\"], ` \"google.golang.org/protobuf/encoding/protojson\"`)\n\tt.P(`import `, t.pkgs[\"proto\"], ` \"google.golang.org/protobuf/proto\"`)\n\tt.P(`import `, t.pkgs[\"twirp\"], ` \"github.com/twitchtv/twirp\"`)\n\tt.P(`import `, t.pkgs[\"ctxsetters\"], ` \"github.com/twitchtv/twirp/ctxsetters\"`)\n\tt.P()\n\n\t// It's legal to import a message and use it as an input or output for a\n\t// method. Make sure to import the package of any such message. First, dedupe\n\t// them.\n\tdeps := make(map[string]string) // Map of package name to quoted import path.\n\tourImportPath := path.Dir(t.goFileName(file))\n\tfor _, s := range file.Service {\n\t\tfor _, m := range s.Method {\n\t\t\tdefs := []*typemap.MessageDefinition{\n\t\t\t\tt.reg.MethodInputDefinition(m),\n\t\t\t\tt.reg.MethodOutputDefinition(m),\n\t\t\t}\n\t\t\tfor _, def := range defs {\n\t\t\t\timportPath, _ := parseGoPackageOption(def.File.GetOptions().GetGoPackage())\n\t\t\t\tif importPath == \"\" { // no option go_package\n\t\t\t\t\timportPath := path.Dir(t.goFileName(def.File)) // use the dirname of the Go filename as import path\n\t\t\t\t\tif importPath == ourImportPath {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif substitution, ok := t.importMap[def.File.GetName()]; ok {\n\t\t\t\t\timportPath = substitution\n\t\t\t\t}\n\t\t\t\timportPath = t.importPrefix + importPath\n\n\t\t\t\tpkg := t.goPackageName(def.File)\n\t\t\t\tif pkg != t.genPkgName {\n\t\t\t\t\tdeps[pkg] = strconv.Quote(importPath)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tpkgs := make([]string, 0, len(deps))\n\tfor pkg := range deps {\n\t\tpkgs = append(pkgs, pkg)\n\t}\n\tsort.Strings(pkgs)\n\tfor _, pkg := range pkgs {\n\t\tt.P(`import `, pkg, ` `, deps[pkg])\n\t}\n\tif len(deps) > 0 {\n\t\tt.P()\n\t}\n}\n\n// generateUtilImports are imports that are only used on utility functions.\n// If there are multiple proto files being generated, they are only included in the first one of them.\nfunc (t *twirp) generateUtilImports() {\n\tt.P(`import `, t.pkgs[\"bytes\"], ` \"bytes\"`)\n\tt.P(`import `, t.pkgs[\"errors\"], ` \"errors\"`)\n\tt.P(`import `, t.pkgs[\"path\"], ` \"path\"`)\n\tt.P(`import `, t.pkgs[\"url\"], ` \"net/url\"`)\n}\n\n// Generate utility functions used in Twirp code.\n// These functions are generated only once per package; when generating for\n// multiple services they are declared only once.\nfunc (t *twirp) generateUtils() {\n\tt.sectionComment(`Utils`)\n\n\tt.P(`// HTTPClient is the interface used by generated clients to send HTTP requests.`)\n\tt.P(`// It is fulfilled by *(net/http).Client, which is sufficient for most users.`)\n\tt.P(`// Users can provide their own implementation for special retry policies.`)\n\tt.P(`// `)\n\tt.P(`// HTTPClient implementations should not follow redirects. Redirects are`)\n\tt.P(`// automatically disabled if *(net/http).Client is passed to client`)\n\tt.P(`// constructors. See the withoutRedirects function in this file for more`)\n\tt.P(`// details.`)\n\tt.P(`type HTTPClient interface {`)\n\tt.P(`\tDo(req *`, t.pkgs[\"http\"], `.Request) (*`, t.pkgs[\"http\"], `.Response, error)`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// TwirpServer is the interface generated server structs will support: they're`)\n\tt.P(`// HTTP handlers with additional methods for accessing metadata about the`)\n\tt.P(`// service. Those accessors are a low-level API for building reflection tools.`)\n\tt.P(`// Most people can think of TwirpServers as just http.Handlers.`)\n\tt.P(`type TwirpServer interface {`)\n\tt.P(`  `, t.pkgs[\"http\"], `.Handler`)\n\tt.P()\n\n\tt.P(`  // ServiceDescriptor returns gzipped bytes describing the .proto file that`)\n\tt.P(`  // this service was generated from. Once unzipped, the bytes can be`)\n\tt.P(`  // unmarshalled as a`)\n\tt.P(`  // google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.`)\n\tt.P(`  //`)\n\tt.P(`  // The returned integer is the index of this particular service within that`)\n\tt.P(`  // FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a`)\n\tt.P(`  // low-level field, expected to be used for reflection.`)\n\tt.P(`  ServiceDescriptor() ([]byte, int)`)\n\tt.P()\n\tt.P(`  // ProtocGenTwirpVersion is the semantic version string of the version of`)\n\tt.P(`  // twirp used to generate this file.`)\n\tt.P(`  ProtocGenTwirpVersion() string`)\n\tt.P()\n\tt.P(`  // PathPrefix returns the HTTP URL path prefix for all methods handled by this`)\n\tt.P(`  // service. This can be used with an HTTP mux to route Twirp requests.`)\n\tt.P(`  // The path prefix is in the form: \"/<prefix>/<package>.<Service>/\"`)\n\tt.P(`  // that is, everything in a Twirp route except for the <Method> at the end.`)\n\tt.P(`  PathPrefix() string`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`func newServerOpts(opts []interface{}) *`, t.pkgs[\"twirp\"], `.ServerOptions {`)\n\tt.P(`  serverOpts := &`, t.pkgs[\"twirp\"], `.ServerOptions{}`)\n\tt.P(`  for _, opt := range opts {`)\n\tt.P(`    switch o := opt.(type) {`)\n\tt.P(`    case `, t.pkgs[\"twirp\"], `.ServerOption:`)\n\tt.P(`      o(serverOpts)`)\n\tt.P(`    case *`, t.pkgs[\"twirp\"], `.ServerHooks: // backwards compatibility, allow to specify hooks as an argument`)\n\tt.P(`      twirp.WithServerHooks(o)(serverOpts)`)\n\tt.P(`    case nil: // backwards compatibility, allow nil value for the argument`)\n\tt.P(`      continue`)\n\tt.P(`    default:`)\n\tt.P(`      panic(`, t.pkgs[\"fmt\"], `.Sprintf(\"Invalid option type %T, please use a twirp.ServerOption\", o))`)\n\tt.P(`    }`)\n\tt.P(`  }`)\n\tt.P(`  return serverOpts`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta).`)\n\tt.P(`// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks.`)\n\tt.P(`// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)`)\n\tt.P(`func WriteError(resp `, t.pkgs[\"http\"], `.ResponseWriter, err error) {`)\n\tt.P(`  writeError(`, t.pkgs[\"context\"], `.Background(), resp, err, nil)`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// writeError writes Twirp errors in the response and triggers hooks.`)\n\tt.P(`func writeError(ctx `, t.pkgs[\"context\"], `.Context, resp `, t.pkgs[\"http\"], `.ResponseWriter, err error, hooks *`, t.pkgs[\"twirp\"], `.ServerHooks) {`)\n\tt.P(`  // Convert to a twirp.Error. Non-twirp errors are converted to internal errors.`)\n\tt.P(`  var twerr `, t.pkgs[\"twirp\"], `.Error`)\n\tt.P(`  if !`, t.pkgs[\"errors\"], `.As(err, &twerr) {`)\n\tt.P(`    twerr = `, t.pkgs[\"twirp\"], `.InternalErrorWith(err)`)\n\tt.P(`  }`)\n\tt.P(`  `)\n\tt.P(`  statusCode := `, t.pkgs[\"twirp\"], `.ServerHTTPStatusFromErrorCode(twerr.Code())`)\n\tt.P(`  ctx = `, t.pkgs[\"ctxsetters\"], `.WithStatusCode(ctx, statusCode)`)\n\tt.P(`  ctx = callError(ctx, hooks, twerr)`)\n\tt.P(`  `)\n\tt.P(`  respBody := marshalErrorToJSON(twerr)`)\n\tt.P(`  `)\n\tt.P(`  resp.Header().Set(\"Content-Type\", \"application/json\") // Error responses are always JSON`)\n\tt.P(`  resp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBody)))`)\n\tt.P(`  resp.WriteHeader(statusCode) // set HTTP status code and send response`)\n\tt.P(`  `)\n\tt.P(`  _, writeErr := resp.Write(respBody)`)\n\tt.P(`  if writeErr != nil {`)\n\tt.P(`    // We have three options here. We could log the error, call the Error`)\n\tt.P(`    // hook, or just silently ignore the error.`)\n\tt.P(`    //`)\n\tt.P(`    // Logging is unacceptable because we don't have a user-controlled `)\n\tt.P(`    // logger; writing out to stderr without permission is too rude.`)\n\tt.P(`    //`)\n\tt.P(`    // Calling the Error hook would confuse users: it would mean the Error`)\n\tt.P(`    // hook got called twice for one request, which is likely to lead to`)\n\tt.P(`    // duplicated log messages and metrics, no matter how well we document`)\n\tt.P(`    // the behavior.`)\n\tt.P(`    //`)\n\tt.P(`    // Silently ignoring the error is our least-bad option. It's highly`)\n\tt.P(`    // likely that the connection is broken and the original 'err' says`)\n\tt.P(`    // so anyway.`)\n\tt.P(`    _ = writeErr`)\n\tt.P(`  }`)\n\tt.P(`  `)\n\tt.P(`  callResponseSent(ctx, hooks)`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// sanitizeBaseURL parses the baseURL, and adds the \"http\" scheme if needed.`)\n\tt.P(`// If the URL is unparsable, the baseURL is returned unchanged.`)\n\tt.P(`func sanitizeBaseURL(baseURL string) string {`)\n\tt.P(`  u, err := `, t.pkgs[\"url\"], `.Parse(baseURL)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    return baseURL // invalid URL will fail later when making requests`)\n\tt.P(`  }`)\n\tt.P(`  if u.Scheme == \"\" {`)\n\tt.P(`    u.Scheme = \"http\"`)\n\tt.P(`  }`)\n\tt.P(`  return u.String()`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// baseServicePath composes the path prefix for the service (without <Method>).`)\n\tt.P(`// e.g.: baseServicePath(\"/twirp\", \"my.pkg\", \"MyService\")`)\n\tt.P(`//       returns => \"/twirp/my.pkg.MyService/\"`)\n\tt.P(`// e.g.: baseServicePath(\"\", \"\", \"MyService\")`)\n\tt.P(`//       returns => \"/MyService/\"`)\n\tt.P(`func baseServicePath(prefix, pkg, service string) string {`)\n\tt.P(`  fullServiceName := service`)\n\tt.P(`  if pkg != \"\" {`)\n\tt.P(`    fullServiceName = pkg + \".\" + service`)\n\tt.P(`  }`)\n\tt.P(`  return path.Join(\"/\", prefix, fullServiceName) + \"/\"`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// parseTwirpPath extracts path components form a valid Twirp route.`)\n\tt.P(`// Expected format: \"[<prefix>]/<package>.<Service>/<Method>\"`)\n\tt.P(`// e.g.: prefix, pkgService, method := parseTwirpPath(\"/twirp/pkg.Svc/MakeHat\")`)\n\tt.P(`func parseTwirpPath(path string) (string, string, string) {`)\n\tt.P(`  parts := `, t.pkgs[\"strings\"], `.Split(path, \"/\")`)\n\tt.P(`  if len(parts) < 2 {`)\n\tt.P(`    return \"\", \"\", \"\"`)\n\tt.P(`  }`)\n\tt.P(`  method := parts[len(parts)-1]`)\n\tt.P(`  pkgService := parts[len(parts)-2]`)\n\tt.P(`  prefix := `, t.pkgs[\"strings\"], `.Join(parts[0:len(parts)-2], \"/\")`)\n\tt.P(`  return prefix, pkgService, method`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in`)\n\tt.P(`// a context through the twirp.WithHTTPRequestHeaders function.`)\n\tt.P(`// If there are no headers set, or if they have the wrong type, nil is returned.`)\n\tt.P(`func getCustomHTTPReqHeaders(ctx `, t.pkgs[\"context\"], `.Context) `, t.pkgs[\"http\"], `.Header {`)\n\tt.P(`  header, ok := `, t.pkgs[\"twirp\"], `.HTTPRequestHeaders(ctx)`)\n\tt.P(`  if !ok || header == nil {`)\n\tt.P(`    return nil`)\n\tt.P(`  }`)\n\tt.P(`  copied := make(`, t.pkgs[\"http\"], `.Header)`)\n\tt.P(`  for k, vv := range header {`)\n\tt.P(`    if vv == nil {`)\n\tt.P(`      copied[k] = nil`)\n\tt.P(`      continue`)\n\tt.P(`    }`)\n\tt.P(`    copied[k] = make([]string, len(vv))`)\n\tt.P(`    copy(copied[k], vv)`)\n\tt.P(`  }`)\n\tt.P(`  return copied`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// newRequest makes an http.Request from a client, adding common headers.`)\n\tt.P(`func newRequest(ctx `, t.pkgs[\"context\"], `.Context, url string, reqBody io.Reader, contentType string) (*`, t.pkgs[\"http\"], `.Request, error) {`)\n\tt.P(`  req, err := `, t.pkgs[\"http\"], `.NewRequest(\"POST\", url, reqBody)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    return nil, err`)\n\tt.P(`  }`)\n\tt.P(`  req = req.WithContext(ctx)`)\n\tt.P(`  if customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil {`)\n\tt.P(`    req.Header = customHeader`)\n\tt.P(`  }`)\n\tt.P(`  req.Header.Set(\"Accept\", contentType)`)\n\tt.P(`  req.Header.Set(\"Content-Type\", contentType)`)\n\tt.P(`  req.Header.Set(\"Twirp-Version\", \"`, gen.Version, `\")`)\n\tt.P(`  return req, nil`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// JSON serialization for errors`)\n\tt.P(`type twerrJSON struct {`)\n\tt.P(\"  Code string            `json:\\\"code\\\"`\")\n\tt.P(\"  Msg  string            `json:\\\"msg\\\"`\")\n\tt.P(\"  Meta map[string]string `json:\\\"meta,omitempty\\\"`\")\n\tt.P(`}`)\n\tt.P()\n\tt.P(`// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body.`)\n\tt.P(`// If serialization fails, it will use a descriptive Internal error instead.`)\n\tt.P(`func marshalErrorToJSON(twerr `, t.pkgs[\"twirp\"], `.Error) []byte {`)\n\tt.P(`  // make sure that msg is not too large`)\n\tt.P(`  msg := twerr.Msg()`)\n\tt.P(`  if len(msg) > 1e6 {`)\n\tt.P(`    msg = msg[:1e6]`)\n\tt.P(`  }`)\n\tt.P(``)\n\tt.P(`  tj := twerrJSON{`)\n\tt.P(`    Code: string(twerr.Code()),`)\n\tt.P(`    Msg:  msg,`)\n\tt.P(`    Meta: twerr.MetaMap(),`)\n\tt.P(`  }`)\n\tt.P(``)\n\tt.P(`  buf, err := `, t.pkgs[\"json\"], `.Marshal(&tj)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    buf = []byte(\"{\\\"type\\\": \\\"\" + `, t.pkgs[\"twirp\"], `.Internal +\"\\\", \\\"msg\\\": \\\"There was an error but it could not be serialized into JSON\\\"}\") // fallback`)\n\tt.P(`  }`)\n\tt.P(``)\n\tt.P(`  return buf`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// errorFromResponse builds a twirp.Error from a non-200 HTTP response.`)\n\tt.P(`// If the response has a valid serialized Twirp error, then it's returned.`)\n\tt.P(`// If not, the response status code is used to generate a similar twirp`)\n\tt.P(`// error. See twirpErrorFromIntermediary for more info on intermediary errors.`)\n\tt.P(`func errorFromResponse(resp *`, t.pkgs[\"http\"], `.Response) `, t.pkgs[\"twirp\"], `.Error {`)\n\tt.P(`  statusCode := resp.StatusCode`)\n\tt.P(`  statusText := `, t.pkgs[\"http\"], `.StatusText(statusCode)`)\n\tt.P(``)\n\tt.P(`  if isHTTPRedirect(statusCode) {`)\n\tt.P(`    // Unexpected redirect: it must be an error from an intermediary.`)\n\tt.P(`    // Twirp clients don't follow redirects automatically, Twirp only handles`)\n\tt.P(`    // POST requests, redirects should only happen on GET and HEAD requests.`)\n\tt.P(`    location := resp.Header.Get(\"Location\")`)\n\tt.P(`    msg := `, t.pkgs[\"fmt\"], `.Sprintf(\"unexpected HTTP status code %d %q received, Location=%q\", statusCode, statusText, location)`)\n\tt.P(`    return twirpErrorFromIntermediary(statusCode, msg, location)`)\n\tt.P(`  }`)\n\tt.P(``)\n\tt.P(`  respBodyBytes, err := `, t.pkgs[\"io\"], `.ReadAll(resp.Body)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    return wrapInternal(err, \"failed to read server error response body\")`)\n\tt.P(`  }`)\n\tt.P(``)\n\tt.P(`  var tj twerrJSON`)\n\tt.P(`  dec := `, t.pkgs[\"json\"], `.NewDecoder(`, t.pkgs[\"bytes\"], `.NewReader(respBodyBytes))`)\n\tt.P(`  dec.DisallowUnknownFields()`)\n\tt.P(`  if err := dec.Decode(&tj); err != nil || tj.Code == \"\" {`)\n\tt.P(`    // Invalid JSON response; it must be an error from an intermediary.`)\n\tt.P(`    msg := `, t.pkgs[\"fmt\"], `.Sprintf(\"Error from intermediary with HTTP status code %d %q\", statusCode, statusText)`)\n\tt.P(`    return twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes))`)\n\tt.P(`  }`)\n\tt.P(``)\n\tt.P(`  errorCode := `, t.pkgs[\"twirp\"], `.ErrorCode(tj.Code)`)\n\tt.P(`  if !`, t.pkgs[\"twirp\"], `.IsValidErrorCode(errorCode) {`)\n\tt.P(`    msg := \"invalid type returned from server error response: \"+tj.Code`)\n\tt.P(`    return `, t.pkgs[\"twirp\"], `.InternalError(msg).WithMeta(\"body\", string(respBodyBytes))`)\n\tt.P(`  }`)\n\tt.P(``)\n\tt.P(`  twerr := `, t.pkgs[\"twirp\"], `.NewError(errorCode, tj.Msg)`)\n\tt.P(`  for k, v := range(tj.Meta) {`)\n\tt.P(`    twerr = twerr.WithMeta(k, v)`)\n\tt.P(`  }`)\n\tt.P(`  return twerr`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors.`)\n\tt.P(`// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md.`)\n\tt.P(`// Returned twirp Errors have some additional metadata for inspection.`)\n\tt.P(`func twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) `, t.pkgs[\"twirp\"], `.Error {`)\n\tt.P(`  var code `, t.pkgs[\"twirp\"], `.ErrorCode`)\n\tt.P(`  if isHTTPRedirect(status) { // 3xx`)\n\tt.P(`    code = `, t.pkgs[\"twirp\"], `.Internal`)\n\tt.P(`  } else {`)\n\tt.P(`    switch status {`)\n\tt.P(`    case 400: // Bad Request`)\n\tt.P(`      code = `, t.pkgs[\"twirp\"], `.Internal`)\n\tt.P(`    case 401: // Unauthorized`)\n\tt.P(`      code = `, t.pkgs[\"twirp\"], `.Unauthenticated`)\n\tt.P(`    case 403: // Forbidden`)\n\tt.P(`      code = `, t.pkgs[\"twirp\"], `.PermissionDenied`)\n\tt.P(`    case 404: // Not Found`)\n\tt.P(`      code = `, t.pkgs[\"twirp\"], `.BadRoute`)\n\tt.P(`    case 429: // Too Many Requests`)\n\tt.P(`      code = `, t.pkgs[\"twirp\"], `.ResourceExhausted`)\n\tt.P(`    case 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout`)\n\tt.P(`      code = `, t.pkgs[\"twirp\"], `.Unavailable`)\n\tt.P(`    default: // All other codes`)\n\tt.P(`      code = `, t.pkgs[\"twirp\"], `.Unknown`)\n\tt.P(`    }`)\n\tt.P(`  }`)\n\tt.P(``)\n\tt.P(`  twerr := `, t.pkgs[\"twirp\"], `.NewError(code, msg)`)\n\tt.P(`  twerr = twerr.WithMeta(\"http_error_from_intermediary\", \"true\") // to easily know if this error was from intermediary`)\n\tt.P(`  twerr = twerr.WithMeta(\"status_code\", `, t.pkgs[\"strconv\"], `.Itoa(status))`)\n\tt.P(`  if isHTTPRedirect(status) {`)\n\tt.P(`    twerr = twerr.WithMeta(\"location\", bodyOrLocation)`)\n\tt.P(`  } else {`)\n\tt.P(`    twerr = twerr.WithMeta(\"body\", bodyOrLocation)`)\n\tt.P(`  }`)\n\tt.P(`  return twerr`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`func isHTTPRedirect(status int) bool {`)\n\tt.P(`\treturn status >= 300 && status <= 399`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// wrapInternal wraps an error with a prefix as an Internal error.`)\n\tt.P(`// The original error cause is accessible by github.com/pkg/errors.Cause.`)\n\tt.P(`func wrapInternal(err error, prefix string) `, t.pkgs[\"twirp\"], `.Error {`)\n\tt.P(`\treturn `, t.pkgs[\"twirp\"], `.InternalErrorWith(&wrappedError{prefix: prefix, cause: err})`)\n\tt.P(`}`)\n\tt.P(`type wrappedError struct {`)\n\tt.P(`\tprefix string`)\n\tt.P(`\tcause  error`)\n\tt.P(`}`)\n\tt.P(`func (e *wrappedError) Error() string { return e.prefix + \": \" + e.cause.Error() }`)\n\tt.P(`func (e *wrappedError) Unwrap() error  { return e.cause } // for go1.13 + errors.Is/As `)\n\tt.P(`func (e *wrappedError) Cause() error  { return e.cause } // for github.com/pkg/errors`)\n\tt.P()\n\n\tt.P(`// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal`)\n\tt.P(`// error response (status 500), and error hooks are properly called with the panic wrapped as an error.`)\n\tt.P(`// The panic is re-raised so it can be handled normally with middleware.`)\n\tt.P(`func ensurePanicResponses(ctx `, t.pkgs[\"context\"], `.Context, resp `, t.pkgs[\"http\"], `.ResponseWriter, hooks *`, t.pkgs[\"twirp\"], `.ServerHooks) {`)\n\tt.P(`\tif r := recover(); r != nil {`)\n\tt.P(`\t\t// Wrap the panic as an error so it can be passed to error hooks.`)\n\tt.P(`\t\t// The original error is accessible from error hooks, but not visible in the response.`)\n\tt.P(`\t\terr := errFromPanic(r)`)\n\tt.P(`\t\ttwerr := &internalWithCause{msg: \"Internal service panic\", cause: err}`)\n\tt.P(`\t\t// Actually write the error`)\n\tt.P(`\t\twriteError(ctx, resp, twerr, hooks)`)\n\tt.P(`\t\t// If possible, flush the error to the wire.`)\n\tt.P(`\t\tf, ok := resp.(`, t.pkgs[\"http\"], `.Flusher)`)\n\tt.P(`\t\tif ok {`)\n\tt.P(`\t\t\tf.Flush()`)\n\tt.P(`\t\t}`)\n\tt.P(``)\n\tt.P(`\t\tpanic(r)`)\n\tt.P(`\t}`)\n\tt.P(`}`)\n\tt.P(``)\n\tt.P(`// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error.`)\n\tt.P(`func errFromPanic(p interface{}) error {`)\n\tt.P(`\tif err, ok := p.(error); ok {`)\n\tt.P(`\t  return err`)\n\tt.P(`\t}`)\n\tt.P(`\treturn fmt.Errorf(\"panic: %v\", p)`)\n\tt.P(`}`)\n\tt.P(``)\n\tt.P(`// internalWithCause is a Twirp Internal error wrapping an original error cause,`)\n\tt.P(`// but the original error message is not exposed on Msg(). The original error`)\n\tt.P(`// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap`)\n\tt.P(`type internalWithCause struct {`)\n\tt.P(`\tmsg    string`)\n\tt.P(`\tcause  error`)\n\tt.P(`}`)\n\tt.P(`func (e *internalWithCause) Unwrap() error  { return e.cause } // for go1.13 + errors.Is/As`)\n\tt.P(`func (e *internalWithCause) Cause() error  { return e.cause } // for github.com/pkg/errors`)\n\tt.P(`func (e *internalWithCause) Error() string { return e.msg + \": \" + e.cause.Error()}`)\n\tt.P(`func (e *internalWithCause) Code() `, t.pkgs[\"twirp\"], `.ErrorCode { return `, t.pkgs[\"twirp\"], `.Internal }`)\n\tt.P(`func (e *internalWithCause) Msg() string                { return e.msg }`)\n\tt.P(`func (e *internalWithCause) Meta(key string) string     { return \"\" }`)\n\tt.P(`func (e *internalWithCause) MetaMap() map[string]string { return nil }`)\n\tt.P(`func (e *internalWithCause) WithMeta(key string, val string) `, t.pkgs[\"twirp\"], `.Error { return e }`)\n\tt.P()\n\n\tt.P(`// malformedRequestError is used when the twirp server cannot unmarshal a request`)\n\tt.P(`func malformedRequestError(msg string) `, t.pkgs[\"twirp\"], `.Error {`)\n\tt.P(`\treturn `, t.pkgs[\"twirp\"], `.NewError(`, t.pkgs[\"twirp\"], `.Malformed, msg)`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// badRouteError is used when the twirp server cannot route a request`)\n\tt.P(`func badRouteError(msg string, method, url string) `, t.pkgs[\"twirp\"], `.Error {`)\n\tt.P(`\terr := `, t.pkgs[\"twirp\"], `.NewError(`, t.pkgs[\"twirp\"], `.BadRoute, msg)`)\n\tt.P(`\terr = err.WithMeta(\"twirp_invalid_route\", method+\" \"+url)`)\n\tt.P(`\treturn err`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// withoutRedirects makes sure that the POST request can not be redirected.`)\n\tt.P(`// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or`)\n\tt.P(`// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the`)\n\tt.P(`// method to GET and removing the body. This produces very confusing error messages, so instead we`)\n\tt.P(`// set a redirect policy that always errors. This stops Go from executing the redirect.`)\n\tt.P(`//`)\n\tt.P(`// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect`)\n\tt.P(`// policy - if so, we'll run through that policy first.`)\n\tt.P(`//`)\n\tt.P(`// Because this requires modifying the http.Client, we make a new copy of the client and return it.`)\n\tt.P(`func withoutRedirects(in *`, t.pkgs[\"http\"], `.Client) *`, t.pkgs[\"http\"], `.Client {`)\n\tt.P(`\tcopy := *in`)\n\tt.P(`\tcopy.CheckRedirect = func(req *`, t.pkgs[\"http\"], `.Request, via []*`, t.pkgs[\"http\"], `.Request) error {`)\n\tt.P(`\t\tif in.CheckRedirect != nil {`)\n\tt.P(`\t\t\t// Run the input's redirect if it exists, in case it has side effects, but ignore any error it`)\n\tt.P(`\t\t\t// returns, since we want to use ErrUseLastResponse.`)\n\tt.P(`\t\t\terr := in.CheckRedirect(req, via)`)\n\tt.P(`\t\t\t_ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use.`)\n\tt.P(`\t\t}`)\n\tt.P(`\t\treturn `, t.pkgs[\"http\"], `.ErrUseLastResponse`)\n\tt.P(`\t}`)\n\tt.P(`\treturn &copy`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// doProtobufRequest makes a Protobuf request to the remote Twirp service.`)\n\tt.P(`func doProtobufRequest(ctx `, t.pkgs[\"context\"], `.Context, client HTTPClient, hooks *`, t.pkgs[\"twirp\"], `.ClientHooks, url string, in, out `, t.pkgs[\"proto\"], `.Message) (_ `, t.pkgs[\"context\"], `.Context, err error) {`)\n\tt.P(`  reqBodyBytes, err := `, t.pkgs[\"proto\"], `.Marshal(in)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"failed to marshal proto request\")`)\n\tt.P(`  }`)\n\tt.P(`  reqBody := `, t.pkgs[\"bytes\"], `.NewBuffer(reqBodyBytes)`)\n\tt.P(`  if err = ctx.Err(); err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"aborted because context was done\")`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  req, err := newRequest(ctx, url, reqBody, \"application/protobuf\")`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"could not build request\")`)\n\tt.P(`  }`)\n\tt.P(`  ctx, err = callClientRequestPrepared(ctx, hooks, req)`)\n\tt.P(`\t if err != nil {`)\n\tt.P(`    return ctx, err`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  req = req.WithContext(ctx)`)\n\tt.P(`  resp, err := client.Do(req)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"failed to do request\")`)\n\tt.P(`  }`)\n\tt.P(`  defer func() { _ = resp.Body.Close() }()`)\n\tt.P()\n\tt.P(`  if err = ctx.Err(); err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"aborted because context was done\")`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  if resp.StatusCode != 200 {`)\n\tt.P(`    return ctx, errorFromResponse(resp)`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  respBodyBytes, err := `, t.pkgs[\"io\"], `.ReadAll(resp.Body)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"failed to read response body\")`)\n\tt.P(`  }`)\n\tt.P(`  if err = ctx.Err(); err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"aborted because context was done\")`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  if err = `, t.pkgs[\"proto\"], `.Unmarshal(respBodyBytes, out); err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"failed to unmarshal proto response\")`)\n\tt.P(`  }`)\n\tt.P(`  return ctx, nil`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// doJSONRequest makes a JSON request to the remote Twirp service.`)\n\tt.P(`func doJSONRequest(ctx `, t.pkgs[\"context\"], `.Context, client HTTPClient, hooks *`, t.pkgs[\"twirp\"], `.ClientHooks, url string, in, out `, t.pkgs[\"proto\"], `.Message) (_ `, t.pkgs[\"context\"], `.Context, err error) {`)\n\tt.P(`  marshaler := &`, t.pkgs[\"protojson\"], `.MarshalOptions{UseProtoNames: true}`)\n\tt.P(`  reqBytes, err := marshaler.Marshal(in)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"failed to marshal json request\")`)\n\tt.P(`  }`)\n\tt.P(`  if err = ctx.Err(); err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"aborted because context was done\")`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  req, err := newRequest(ctx, url, `, t.pkgs[\"bytes\"], `.NewReader(reqBytes), \"application/json\")`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"could not build request\")`)\n\tt.P(`  }`)\n\tt.P(`  ctx, err = callClientRequestPrepared(ctx, hooks, req)`)\n\tt.P(`\t if err != nil {`)\n\tt.P(`    return ctx, err`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  req = req.WithContext(ctx)`)\n\tt.P(`  resp, err := client.Do(req)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"failed to do request\")`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  defer func() {`)\n\tt.P(`    cerr := resp.Body.Close()`)\n\tt.P(`    if err == nil && cerr != nil {`)\n\tt.P(`      err = wrapInternal(cerr, \"failed to close response body\")`)\n\tt.P(`    }`)\n\tt.P(`  }()`)\n\tt.P()\n\tt.P(`  if err = ctx.Err(); err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"aborted because context was done\")`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  if resp.StatusCode != 200 {`)\n\tt.P(`    return ctx, errorFromResponse(resp)`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  d := `, t.pkgs[\"json\"], `.NewDecoder(resp.Body)`)\n\tt.P(`  rawRespBody := `, t.pkgs[\"json\"], `.RawMessage{}`)\n\tt.P(`  if err := d.Decode(&rawRespBody); err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"failed to unmarshal json response\")`)\n\tt.P(`  }`)\n\tt.P(`  unmarshaler := `, t.pkgs[\"protojson\"], `.UnmarshalOptions{DiscardUnknown: true}`)\n\tt.P(`  if err = unmarshaler.Unmarshal(rawRespBody, out); err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"failed to unmarshal json response\")`)\n\tt.P(`  }`)\n\tt.P(`  if err = ctx.Err(); err != nil {`)\n\tt.P(`    return ctx, wrapInternal(err, \"aborted because context was done\")`)\n\tt.P(`  }`)\n\tt.P(`  return ctx, nil`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// Call twirp.ServerHooks.RequestReceived if the hook is available`)\n\tt.P(`func callRequestReceived(ctx `, t.pkgs[\"context\"], `.Context, h *`, t.pkgs[\"twirp\"], `.ServerHooks) (`, t.pkgs[\"context\"], `.Context, error) {`)\n\tt.P(`  if h == nil || h.RequestReceived == nil {`)\n\tt.P(`    return ctx, nil`)\n\tt.P(`  }`)\n\tt.P(`  return h.RequestReceived(ctx)`)\n\tt.P(`}`)\n\tt.P()\n\tt.P(`// Call twirp.ServerHooks.RequestRouted if the hook is available`)\n\tt.P(`func callRequestRouted(ctx `, t.pkgs[\"context\"], `.Context, h *`, t.pkgs[\"twirp\"], `.ServerHooks) (`, t.pkgs[\"context\"], `.Context, error) {`)\n\tt.P(`  if h == nil || h.RequestRouted == nil {`)\n\tt.P(`    return ctx, nil`)\n\tt.P(`  }`)\n\tt.P(`  return h.RequestRouted(ctx)`)\n\tt.P(`}`)\n\tt.P()\n\tt.P(`// Call twirp.ServerHooks.ResponsePrepared if the hook is available`)\n\tt.P(`func callResponsePrepared(ctx `, t.pkgs[\"context\"], `.Context, h *`, t.pkgs[\"twirp\"], `.ServerHooks) `, t.pkgs[\"context\"], `.Context {`)\n\tt.P(`  if h == nil || h.ResponsePrepared == nil {`)\n\tt.P(`    return ctx`)\n\tt.P(`  }`)\n\tt.P(`  return h.ResponsePrepared(ctx)`)\n\tt.P(`}`)\n\tt.P()\n\tt.P(`// Call twirp.ServerHooks.ResponseSent if the hook is available`)\n\tt.P(`func callResponseSent(ctx `, t.pkgs[\"context\"], `.Context, h *`, t.pkgs[\"twirp\"], `.ServerHooks) {`)\n\tt.P(`  if h == nil || h.ResponseSent == nil {`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P(`  h.ResponseSent(ctx)`)\n\tt.P(`}`)\n\tt.P()\n\tt.P(`// Call twirp.ServerHooks.Error if the hook is available`)\n\tt.P(`func callError(ctx `, t.pkgs[\"context\"], `.Context, h *`, t.pkgs[\"twirp\"], `.ServerHooks, err `, t.pkgs[\"twirp\"], `.Error) `, t.pkgs[\"context\"], `.Context {`)\n\tt.P(`  if h == nil || h.Error == nil {`)\n\tt.P(`    return ctx`)\n\tt.P(`  }`)\n\tt.P(`  return h.Error(ctx, err)`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.generateClientHooks()\n}\n\n// P forwards to g.gen.P, which prints output.\nfunc (t *twirp) P(args ...string) {\n\tfor _, v := range args {\n\t\tt.output.WriteString(v)\n\t}\n\tt.output.WriteByte('\\n')\n}\n\n// Big header comments to makes it easier to visually parse a generated file.\nfunc (t *twirp) sectionComment(sectionTitle string) {\n\tt.P()\n\tt.P(`// `, strings.Repeat(\"=\", len(sectionTitle)))\n\tt.P(`// `, sectionTitle)\n\tt.P(`// `, strings.Repeat(\"=\", len(sectionTitle)))\n\tt.P()\n}\n\nfunc (t *twirp) generateService(file *descriptor.FileDescriptorProto, service *descriptor.ServiceDescriptorProto, index int) {\n\tservName := serviceNameCamelCased(service)\n\n\tt.sectionComment(servName + ` Interface`)\n\tt.generateTwirpInterface(file, service)\n\n\tt.sectionComment(servName + ` Protobuf Client`)\n\tt.generateClient(\"Protobuf\", file, service)\n\n\tt.sectionComment(servName + ` JSON Client`)\n\tt.generateClient(\"JSON\", file, service)\n\n\t// Server\n\tt.sectionComment(servName + ` Server Handler`)\n\tt.generateServer(file, service)\n}\n\nfunc (t *twirp) generateTwirpInterface(file *descriptor.FileDescriptorProto, service *descriptor.ServiceDescriptorProto) {\n\tservName := serviceNameCamelCased(service)\n\n\tcomments, err := t.reg.ServiceComments(file, service)\n\tif err == nil {\n\t\tt.printComments(comments)\n\t}\n\tt.P(`type `, servName, ` interface {`)\n\tfor _, method := range service.Method {\n\t\tcomments, err = t.reg.MethodComments(file, service, method)\n\t\tif err == nil {\n\t\t\tt.printComments(comments)\n\t\t}\n\t\tt.P(t.generateSignature(method))\n\t\tt.P()\n\t}\n\tt.P(`}`)\n}\n\nfunc (t *twirp) generateSignature(method *descriptor.MethodDescriptorProto) string {\n\tmethName := methodNameCamelCased(method)\n\tinputType := t.goTypeName(method.GetInputType())\n\toutputType := t.goTypeName(method.GetOutputType())\n\treturn fmt.Sprintf(`\t%s(%s.Context, *%s) (*%s, error)`, methName, t.pkgs[\"context\"], inputType, outputType)\n}\n\n// valid names: 'JSON', 'Protobuf'\nfunc (t *twirp) generateClient(name string, file *descriptor.FileDescriptorProto, service *descriptor.ServiceDescriptorProto) {\n\tservPkg := pkgName(file)\n\tservName := serviceNameCamelCased(service)\n\tstructName := unexported(servName) + name + \"Client\"\n\tnewClientFunc := \"New\" + servName + name + \"Client\"\n\tservNameLit := serviceNameLiteral(service)\n\tservNameCc := servName\n\n\tmethCnt := strconv.Itoa(len(service.Method))\n\tt.P(`type `, structName, ` struct {`)\n\tt.P(`  client HTTPClient`)\n\tt.P(`  urls  [`, methCnt, `]string`)\n\tt.P(`  interceptor `, t.pkgs[\"twirp\"], `.Interceptor`)\n\tt.P(`  opts `, t.pkgs[\"twirp\"], `.ClientOptions`)\n\tt.P(`}`)\n\tt.P()\n\n\tt.P(`// `, newClientFunc, ` creates a `, name, ` client that implements the `, servName, ` interface.`)\n\tt.P(`// It communicates using `, name, ` and can be configured with a custom HTTPClient.`)\n\tt.P(`func `, newClientFunc, `(baseURL string, client HTTPClient, opts ...`, t.pkgs[\"twirp\"], `.ClientOption) `, servName, ` {`)\n\tt.P(`  if c, ok := client.(*`, t.pkgs[\"http\"], `.Client); ok {`)\n\tt.P(`    client = withoutRedirects(c)`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  clientOpts := `, t.pkgs[\"twirp\"], `.ClientOptions{}`)\n\tt.P(`  for _, o := range opts {`)\n\tt.P(`    o(&clientOpts)`)\n\tt.P(`  }`)\n\tt.P()\n\n\tt.P(`  // Using ReadOpt allows backwards and forwards compatibility with new options in the future`)\n\tt.P(`  literalURLs := false`)\n\tt.P(`  _ = clientOpts.ReadOpt(\"literalURLs\", &literalURLs)`)\n\tt.P(`  var pathPrefix string`)\n\tt.P(`  if ok := clientOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {`)\n\tt.P(`    pathPrefix = \"/twirp\" // default prefix`)\n\tt.P(`  }`)\n\n\tt.P()\n\tif len(service.Method) > 0 {\n\t\tt.P(`  // Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>`)\n\t\tt.P(`  serviceURL := sanitizeBaseURL(baseURL)`)\n\t\tif servNameLit == servNameCc {\n\t\t\tt.P(`  serviceURL += baseServicePath(pathPrefix, \"`, servPkg, `\", \"`, servNameCc, `\")`)\n\t\t} else { // proto service name is not CamelCased, then it needs to check client option to decide if needs to change case\n\t\t\tt.P(`  if literalURLs {`)\n\t\t\tt.P(`    serviceURL += baseServicePath(pathPrefix, \"`, servPkg, `\", \"`, servNameLit, `\")`)\n\t\t\tt.P(`  } else {`)\n\t\t\tt.P(`    serviceURL += baseServicePath(pathPrefix, \"`, servPkg, `\", \"`, servNameCc, `\")`)\n\t\t\tt.P(`  }`)\n\t\t}\n\t}\n\tt.P(`  urls := [`, methCnt, `]string{`)\n\tfor _, method := range service.Method {\n\t\tt.P(`    serviceURL + \"`, methodNameCamelCased(method), `\",`)\n\t}\n\tt.P(`  }`)\n\n\tallMethodsCamelCased := true\n\tfor _, method := range service.Method {\n\t\tmethNameLit := methodNameLiteral(method)\n\t\tmethNameCc := methodNameCamelCased(method)\n\t\tif methNameCc != methNameLit {\n\t\t\tallMethodsCamelCased = false\n\t\t\tbreak\n\t\t}\n\t}\n\tif !allMethodsCamelCased {\n\t\tt.P(`  if literalURLs {`)\n\t\tt.P(`    urls = [`, methCnt, `]string{`)\n\t\tfor _, method := range service.Method {\n\t\t\tt.P(`    serviceURL + \"`, methodNameLiteral(method), `\",`)\n\t\t}\n\t\tt.P(`    }`)\n\t\tt.P(`  }`)\n\t}\n\n\tt.P()\n\tt.P(`  return &`, structName, `{`)\n\tt.P(`    client: client,`)\n\tt.P(`    urls:   urls,`)\n\tt.P(`    interceptor: `, t.pkgs[\"twirp\"], `.ChainInterceptors(clientOpts.Interceptors...),`)\n\tt.P(`    opts: clientOpts,`)\n\tt.P(`  }`)\n\tt.P(`}`)\n\tt.P()\n\n\tfor i, method := range service.Method {\n\t\tmethName := methodNameCamelCased(method)\n\t\tpkgName := pkgName(file)\n\t\tinputType := t.goTypeName(method.GetInputType())\n\t\toutputType := t.goTypeName(method.GetOutputType())\n\t\tt.P(`func (c *`, structName, `) `, methName, `(ctx `, t.pkgs[\"context\"], `.Context, in *`, inputType, `) (*`, outputType, `, error) {`)\n\t\tt.P(`  ctx = `, t.pkgs[\"ctxsetters\"], `.WithPackageName(ctx, \"`, pkgName, `\")`)\n\t\tt.P(`  ctx = `, t.pkgs[\"ctxsetters\"], `.WithServiceName(ctx, \"`, servName, `\")`)\n\t\tt.P(`  ctx = `, t.pkgs[\"ctxsetters\"], `.WithMethodName(ctx, \"`, methName, `\")`)\n\t\tt.P(`  caller := c.call`, methName)\n\t\tt.P(`  if c.interceptor != nil {`)\n\t\tt.generateClientInterceptorCaller(method)\n\t\tt.P(`  }`)\n\t\tt.P(`  return caller(ctx, in)`)\n\t\tt.P(`}`)\n\t\tt.P()\n\t\tt.P(`func (c *`, structName, `) call`, methName, `(ctx `, t.pkgs[\"context\"], `.Context, in *`, inputType, `) (*`, outputType, `, error) {`)\n\t\tt.P(`  out := new(`, outputType, `)`)\n\t\tt.P(`  ctx, err := do`, name, `Request(ctx, c.client, c.opts.Hooks, c.urls[`, strconv.Itoa(i), `], in, out)`)\n\t\tt.P(`  if err != nil {`)\n\t\tt.P(`    twerr, ok := err.(`, t.pkgs[\"twirp\"], `.Error)`)\n\t\tt.P(`    if !ok {`)\n\t\tt.P(`      twerr = `, t.pkgs[\"twirp\"], `.InternalErrorWith(err)`)\n\t\tt.P(`    }`)\n\t\tt.P(`    callClientError(ctx, c.opts.Hooks, twerr)`)\n\t\tt.P(`    return nil, err`)\n\t\tt.P(`  }`)\n\t\tt.P()\n\t\tt.P(`  callClientResponseReceived(ctx, c.opts.Hooks)`)\n\t\tt.P()\n\t\tt.P(`  return out, nil`)\n\t\tt.P(`}`)\n\t\tt.P()\n\t}\n}\n\nfunc (t *twirp) generateClientHooks() {\n\tt.P(`func callClientResponseReceived(ctx `, t.pkgs[\"context\"], `.Context, h *`, t.pkgs[\"twirp\"], `.ClientHooks) {`)\n\tt.P(`  if h == nil || h.ResponseReceived == nil {`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P(`  h.ResponseReceived(ctx)`)\n\tt.P(`}`)\n\tt.P()\n\tt.P(`func callClientRequestPrepared(ctx `, t.pkgs[\"context\"], `.Context, h *`, t.pkgs[\"twirp\"], `.ClientHooks, req *`, t.pkgs[\"http\"], `.Request) (`, t.pkgs[\"context\"], `.Context, error) {`)\n\tt.P(`  if h == nil || h.RequestPrepared == nil {`)\n\tt.P(`    return ctx, nil`)\n\tt.P(`  }`)\n\tt.P(`  return h.RequestPrepared(ctx, req)`)\n\tt.P(`}`)\n\tt.P()\n\tt.P(`func callClientError(ctx `, t.pkgs[\"context\"], `.Context, h *`, t.pkgs[\"twirp\"], `.ClientHooks, err `, t.pkgs[\"twirp\"], `.Error) {`)\n\tt.P(`  if h == nil || h.Error == nil {`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P(`  h.Error(ctx, err)`)\n\tt.P(`}`)\n}\n\nfunc (t *twirp) generateServer(file *descriptor.FileDescriptorProto, service *descriptor.ServiceDescriptorProto) {\n\tservName := serviceNameCamelCased(service)\n\n\t// Server implementation.\n\tservStruct := serviceStruct(service)\n\tt.P(`type `, servStruct, ` struct {`)\n\tt.P(`  `, servName)\n\tt.P(`  interceptor `, t.pkgs[\"twirp\"], `.Interceptor`)\n\tt.P(`  hooks     *`, t.pkgs[\"twirp\"], `.ServerHooks`)\n\tt.P(`  pathPrefix string // prefix for routing`)\n\tt.P(`  jsonSkipDefaults bool // do not include unpopulated fields (default values) in the response`)\n\tt.P(`  jsonCamelCase bool // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names`)\n\tt.P(`}`)\n\tt.P()\n\n\t// Constructor for server implementation\n\tt.P(`// New`, servName, `Server builds a TwirpServer that can be used as an http.Handler to handle`)\n\tt.P(`// HTTP requests that are routed to the right method in the provided svc implementation.`)\n\tt.P(`// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).`)\n\tt.P(`func New`, servName, `Server(svc `, servName, `, opts ...interface{}) TwirpServer {`)\n\tt.P(`  serverOpts := newServerOpts(opts)`)\n\tt.P()\n\tt.P(`  // Using ReadOpt allows backwards and forwards compatibility with new options in the future`)\n\tt.P(`  jsonSkipDefaults := false`)\n\tt.P(`  _ = serverOpts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)`)\n\tt.P(`  jsonCamelCase := false`)\n\tt.P(`  _ = serverOpts.ReadOpt(\"jsonCamelCase\", &jsonCamelCase)`)\n\tt.P(`  var pathPrefix string`)\n\tt.P(`  if ok := serverOpts.ReadOpt(\"pathPrefix\", &pathPrefix); !ok {`)\n\tt.P(`    pathPrefix = \"/twirp\" // default prefix`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  return &`, servStruct, `{`)\n\tt.P(`    `, servName, `: svc,`)\n\tt.P(`    hooks: serverOpts.Hooks,`)\n\tt.P(`    interceptor: `, t.pkgs[\"twirp\"], `.ChainInterceptors(serverOpts.Interceptors...),`)\n\tt.P(`    pathPrefix: pathPrefix,`)\n\tt.P(`    jsonSkipDefaults: jsonSkipDefaults,`)\n\tt.P(`    jsonCamelCase: jsonCamelCase,`)\n\tt.P(`  }`)\n\tt.P(`}`)\n\tt.P()\n\n\t// Write Errors\n\tt.P(`// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.`)\n\tt.P(`// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)`)\n\tt.P(`func (s *`, servStruct, `) writeError(ctx `, t.pkgs[\"context\"], `.Context, resp `, t.pkgs[\"http\"], `.ResponseWriter, err error) {`)\n\tt.P(`  writeError(ctx, resp, err, s.hooks)`)\n\tt.P(`}`)\n\tt.P()\n\n\t// Write request body read issue\n\tt.P(`// handleRequestBodyError is used to handle error when the twirp server cannot read request`)\n\tt.P(`func (s *`, servStruct, `) handleRequestBodyError(ctx `, t.pkgs[\"context\"], `.Context, resp `, t.pkgs[\"http\"], `.ResponseWriter, msg string, err error) {`)\n\tt.P(`  if `, t.pkgs[\"context\"], `.Canceled == ctx.Err() {`)\n\tt.P(`    s.writeError(ctx, resp, `, t.pkgs[\"twirp\"], `.NewError(`, t.pkgs[\"twirp\"], `.Canceled, \"failed to read request: context canceled\"))`)\n\tt.P(`    return`)\n\tt.P(`  } `)\n\tt.P(`  if `, t.pkgs[\"context\"], `.DeadlineExceeded == ctx.Err() {`)\n\tt.P(`    s.writeError(ctx, resp, `, t.pkgs[\"twirp\"], `.NewError(`, t.pkgs[\"twirp\"], `.DeadlineExceeded, \"failed to read request: deadline exceeded\"))`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P(`  s.writeError(ctx, resp, `, t.pkgs[\"twirp\"], `.WrapError(malformedRequestError(msg), err))`)\n\tt.P(`}`)\n\tt.P()\n\n\t// Routing.\n\tt.generateServerRouting(servStruct, file, service)\n\n\t// Methods.\n\tfor _, method := range service.Method {\n\t\tt.generateServerMethod(service, method)\n\t}\n\n\tt.generateServiceMetadataAccessors(file, service)\n}\n\nfunc (t *twirp) generateServerRouting(servStruct string, file *descriptor.FileDescriptorProto, service *descriptor.ServiceDescriptorProto) {\n\tpkgName := pkgName(file)\n\tservName := serviceNameCamelCased(service)\n\tpkgServNameLit := pkgServiceNameLiteral(file, service)\n\tpkgServNameCc := pkgServiceNameCamelCased(file, service)\n\n\tt.P(`// `, servName, `PathPrefix is a convenience constant that may identify URL paths.`)\n\tt.P(`// Should be used with caution, it only matches routes generated by Twirp Go clients,`)\n\tt.P(`// with the default \"/twirp\" prefix and default CamelCase service and method names.`)\n\tt.P(`// More info: https://twitchtv.github.io/twirp/docs/routing.html`)\n\tt.P(`const `, servName, `PathPrefix = \"/twirp/`, pkgServNameCc, `/\"`)\n\tt.P()\n\n\tt.P(`func (s *`, servStruct, `) ServeHTTP(resp `, t.pkgs[\"http\"], `.ResponseWriter, req *`, t.pkgs[\"http\"], `.Request) {`)\n\tt.P(`  ctx := req.Context()`)\n\tt.P(`  ctx = `, t.pkgs[\"ctxsetters\"], `.WithPackageName(ctx, \"`, pkgName, `\")`)\n\tt.P(`  ctx = `, t.pkgs[\"ctxsetters\"], `.WithServiceName(ctx, \"`, servName, `\")`)\n\tt.P(`  ctx = `, t.pkgs[\"ctxsetters\"], `.WithResponseWriter(ctx, resp)`)\n\tt.P()\n\tt.P(`  var err error`)\n\tt.P(`  ctx, err = callRequestReceived(ctx, s.hooks)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    s.writeError(ctx, resp, err)`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  if req.Method != \"POST\" {`)\n\tt.P(`    msg := `, t.pkgs[\"fmt\"], `.Sprintf(\"unsupported method %q (only POST is allowed)\", req.Method)`)\n\tt.P(`    s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  // Verify path format: [<prefix>]/<package>.<Service>/<Method>`)\n\tt.P(`  prefix, pkgService, method := parseTwirpPath(req.URL.Path)`)\n\tif pkgServNameLit == pkgServNameCc {\n\t\tt.P(`  if pkgService != `, strconv.Quote(pkgServNameLit), ` {`)\n\t} else { // proto service name is not CamelCased, but need to support CamelCased routes for Go clients (https://github.com/twitchtv/twirp/pull/257)\n\t\tt.P(`  if pkgService != `, strconv.Quote(pkgServNameLit), ` && pkgService != `, strconv.Quote(pkgServNameCc), ` {`)\n\t}\n\tt.P(`    msg := `, t.pkgs[\"fmt\"], `.Sprintf(\"no handler for path %q\", req.URL.Path)`)\n\tt.P(`    s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P(`  if prefix != s.pathPrefix {`)\n\tt.P(`    msg := `, t.pkgs[\"fmt\"], `.Sprintf(\"invalid path prefix %q, expected %q, on path %q\", prefix, s.pathPrefix, req.URL.Path)`)\n\tt.P(`    s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  switch method {`)\n\tfor _, method := range service.Method {\n\t\tmethNameLit := methodNameLiteral(method)\n\t\tmethNameCc := methodNameCamelCased(method)\n\n\t\tif methNameCc == methNameLit {\n\t\t\tt.P(`  case `, strconv.Quote(methNameLit), `:`)\n\t\t} else { // proto method name is not CamelCased, but need to support CamelCased routes for Go clients (https://github.com/twitchtv/twirp/pull/257)\n\t\t\tt.P(`  case `, strconv.Quote(methNameLit), `, `, strconv.Quote(methNameCc), `:`)\n\t\t}\n\t\tt.P(`    s.serve`, methNameCc, `(ctx, resp, req)`)\n\t\tt.P(`    return`)\n\t}\n\tt.P(`  default:`)\n\tt.P(`    msg := `, t.pkgs[\"fmt\"], `.Sprintf(\"no handler for path %q\", req.URL.Path)`)\n\tt.P(`    s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P(`}`)\n\tt.P()\n}\n\nfunc (t *twirp) generateServerMethod(service *descriptor.ServiceDescriptorProto, method *descriptor.MethodDescriptorProto) {\n\tmethName := methodNameCamelCased(method)\n\tservStruct := serviceStruct(service)\n\tt.P(`func (s *`, servStruct, `) serve`, methName, `(ctx `, t.pkgs[\"context\"], `.Context, resp `, t.pkgs[\"http\"], `.ResponseWriter, req *`, t.pkgs[\"http\"], `.Request) {`)\n\tt.P(`  header := req.Header.Get(\"Content-Type\")`)\n\tt.P(`  i := `, t.pkgs[\"strings\"], `.Index(header, \";\")`)\n\tt.P(`  if i == -1 {`)\n\tt.P(`    i = len(header)`)\n\tt.P(`  }`)\n\tt.P(`  switch `, t.pkgs[\"strings\"], `.TrimSpace(`, t.pkgs[\"strings\"], `.ToLower(header[:i])) {`)\n\tt.P(`  case \"application/json\":`)\n\tt.P(`    s.serve`, methName, `JSON(ctx, resp, req)`)\n\tt.P(`  case \"application/protobuf\":`)\n\tt.P(`    s.serve`, methName, `Protobuf(ctx, resp, req)`)\n\tt.P(`  default:`)\n\tt.P(`    msg := `, t.pkgs[\"fmt\"], `.Sprintf(\"unexpected Content-Type: %q\", req.Header.Get(\"Content-Type\"))`)\n\tt.P(`    twerr := badRouteError(msg, req.Method, req.URL.Path)`)\n\tt.P(`    s.writeError(ctx, resp, twerr)`)\n\tt.P(`  }`)\n\tt.P(`}`)\n\tt.P()\n\tt.generateServerJSONMethod(service, method)\n\tt.generateServerProtobufMethod(service, method)\n}\n\nfunc (t *twirp) generateServerJSONMethod(service *descriptor.ServiceDescriptorProto, method *descriptor.MethodDescriptorProto) {\n\tservStruct := serviceStruct(service)\n\tmethName := methodNameCamelCased(method)\n\tservName := serviceNameCamelCased(service)\n\tt.P(`func (s *`, servStruct, `) serve`, methName, `JSON(ctx `, t.pkgs[\"context\"], `.Context, resp `, t.pkgs[\"http\"], `.ResponseWriter, req *`, t.pkgs[\"http\"], `.Request) {`)\n\tt.P(`  var err error`)\n\tt.P(`  ctx = `, t.pkgs[\"ctxsetters\"], `.WithMethodName(ctx, \"`, methName, `\")`)\n\tt.P(`  ctx, err = callRequestRouted(ctx, s.hooks)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    s.writeError(ctx, resp, err)`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  d := `, t.pkgs[\"json\"], `.NewDecoder(req.Body)`)\n\tt.P(`  rawReqBody := `, t.pkgs[\"json\"], `.RawMessage{}`)\n\tt.P(`  if err := d.Decode(&rawReqBody); err != nil {`)\n\tt.P(`    s.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P(`  reqContent := new(`, t.goTypeName(method.GetInputType()), `)`)\n\tt.P(`  unmarshaler := `, t.pkgs[\"protojson\"], `.UnmarshalOptions{DiscardUnknown: true}`)\n\tt.P(`  if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {`)\n\tt.P(`    s.handleRequestBodyError(ctx, resp, \"the json request could not be decoded\", err)`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  handler := s.`, servName, `.`, methName)\n\tt.P(`  if s.interceptor != nil {`)\n\tt.generateServerInterceptorHandler(service, method)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  // Call service method`)\n\tt.P(`  var respContent *`, t.goTypeName(method.GetOutputType()))\n\tt.P(`  func() {`)\n\tt.P(`    defer ensurePanicResponses(ctx, resp, s.hooks)`)\n\tt.P(`    respContent, err = handler(ctx, reqContent)`)\n\tt.P(`  }()`)\n\tt.P()\n\tt.P(`  if err != nil {`)\n\tt.P(`    s.writeError(ctx, resp, err)`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P(`  if respContent == nil {`)\n\tt.P(`    s.writeError(ctx, resp, `, t.pkgs[\"twirp\"], `.InternalError(\"received a nil *`, t.goTypeName(method.GetOutputType()), ` and nil error while calling `, methName, `. nil responses are not supported\"))`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  ctx = callResponsePrepared(ctx, s.hooks)`)\n\tt.P()\n\tt.P(`  marshaler := &`, t.pkgs[\"protojson\"], `.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}`)\n\tt.P(`  respBytes, err := marshaler.Marshal(respContent)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    s.writeError(ctx, resp, wrapInternal(err, \"failed to marshal json response\"))`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  ctx = `, t.pkgs[\"ctxsetters\"], `.WithStatusCode(ctx, `, t.pkgs[\"http\"], `.StatusOK)`)\n\tt.P(`  resp.Header().Set(\"Content-Type\", \"application/json\")`)\n\tt.P(`  resp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))`)\n\tt.P(`  resp.WriteHeader(`, t.pkgs[\"http\"], `.StatusOK)`)\n\tt.P()\n\tt.P(`  if n, err := resp.Write(respBytes); err != nil {`)\n\tt.P(`    msg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())`)\n\tt.P(`    twerr := `, t.pkgs[\"twirp\"], `.NewError(`, t.pkgs[\"twirp\"], `.Unknown, msg)`)\n\tt.P(`    ctx = callError(ctx, s.hooks, twerr)`)\n\tt.P(`  }`)\n\tt.P(`  callResponseSent(ctx, s.hooks)`)\n\tt.P(`}`)\n\tt.P()\n}\n\nfunc (t *twirp) generateServerProtobufMethod(service *descriptor.ServiceDescriptorProto, method *descriptor.MethodDescriptorProto) {\n\tservStruct := serviceStruct(service)\n\tmethName := methodNameCamelCased(method)\n\tservName := serviceNameCamelCased(service)\n\tt.P(`func (s *`, servStruct, `) serve`, methName, `Protobuf(ctx `, t.pkgs[\"context\"], `.Context, resp `, t.pkgs[\"http\"], `.ResponseWriter, req *`, t.pkgs[\"http\"], `.Request) {`)\n\tt.P(`  var err error`)\n\tt.P(`  ctx = `, t.pkgs[\"ctxsetters\"], `.WithMethodName(ctx, \"`, methName, `\")`)\n\tt.P(`  ctx, err = callRequestRouted(ctx, s.hooks)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    s.writeError(ctx, resp, err)`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  buf, err := `, t.pkgs[\"io\"], `.ReadAll(req.Body)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    s.handleRequestBodyError(ctx, resp, \"failed to read request body\", err)`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P(`  reqContent := new(`, t.goTypeName(method.GetInputType()), `)`)\n\tt.P(`  if err = `, t.pkgs[\"proto\"], `.Unmarshal(buf, reqContent); err != nil {`)\n\tt.P(`    s.writeError(ctx, resp, malformedRequestError(\"the protobuf request could not be decoded\"))`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  handler := s.`, servName, `.`, methName)\n\tt.P(`  if s.interceptor != nil {`)\n\tt.generateServerInterceptorHandler(service, method)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  // Call service method`)\n\tt.P(`  var respContent *`, t.goTypeName(method.GetOutputType()))\n\tt.P(`  func() {`)\n\tt.P(`    defer ensurePanicResponses(ctx, resp, s.hooks)`)\n\tt.P(`    respContent, err = handler(ctx, reqContent)`)\n\tt.P(`  }()`)\n\tt.P()\n\tt.P(`  if err != nil {`)\n\tt.P(`    s.writeError(ctx, resp, err)`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P(`  if respContent == nil {`)\n\tt.P(`    s.writeError(ctx, resp, `, t.pkgs[\"twirp\"], `.InternalError(\"received a nil *`, t.goTypeName(method.GetOutputType()), ` and nil error while calling `, methName, `. nil responses are not supported\"))`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  ctx = callResponsePrepared(ctx, s.hooks)`)\n\tt.P()\n\tt.P(`  respBytes, err := `, t.pkgs[\"proto\"], `.Marshal(respContent)`)\n\tt.P(`  if err != nil {`)\n\tt.P(`    s.writeError(ctx, resp, wrapInternal(err, \"failed to marshal proto response\"))`)\n\tt.P(`    return`)\n\tt.P(`  }`)\n\tt.P()\n\tt.P(`  ctx = `, t.pkgs[\"ctxsetters\"], `.WithStatusCode(ctx, `, t.pkgs[\"http\"], `.StatusOK)`)\n\tt.P(`  resp.Header().Set(\"Content-Type\", \"application/protobuf\")`)\n\tt.P(`  resp.Header().Set(\"Content-Length\", strconv.Itoa(len(respBytes)))`)\n\tt.P(`  resp.WriteHeader(`, t.pkgs[\"http\"], `.StatusOK)`)\n\tt.P(`  if n, err := resp.Write(respBytes); err != nil {`)\n\tt.P(`    msg := fmt.Sprintf(\"failed to write response, %d of %d bytes written: %s\", n, len(respBytes), err.Error())`)\n\tt.P(`    twerr := `, t.pkgs[\"twirp\"], `.NewError(`, t.pkgs[\"twirp\"], `.Unknown, msg)`)\n\tt.P(`    ctx = callError(ctx, s.hooks, twerr)`)\n\tt.P(`  }`)\n\tt.P(`  callResponseSent(ctx, s.hooks)`)\n\tt.P(`}`)\n\tt.P()\n}\n\nfunc (t *twirp) generateClientInterceptorCaller(method *descriptor.MethodDescriptorProto) {\n\tmethName := methodNameCamelCased(method)\n\tt.generateInterceptorFunc(\"c\", \"caller\", \"c.call\"+methName, method)\n}\n\nfunc (t *twirp) generateServerInterceptorHandler(service *descriptor.ServiceDescriptorProto, method *descriptor.MethodDescriptorProto) {\n\tmethName := methodNameCamelCased(method)\n\tservName := serviceNameCamelCased(service)\n\tt.generateInterceptorFunc(\"s\", \"handler\", \"s.\"+servName+\".\"+methName, method)\n}\n\nfunc (t *twirp) generateInterceptorFunc(\n\treceiverName string,\n\tvarName string,\n\tdelegateFuncName string,\n\tmethod *descriptor.MethodDescriptorProto,\n) {\n\tinputType := t.goTypeName(method.GetInputType())\n\toutputType := t.goTypeName(method.GetOutputType())\n\tt.P(`    `, varName, ` = func(ctx `, t.pkgs[\"context\"], `.Context, req *`, inputType, `) (*`, outputType, `, error) {`)\n\tt.P(`      resp, err := `, receiverName, `.interceptor(`)\n\tt.P(`        func(ctx `, t.pkgs[\"context\"], ` .Context, req interface{}) (interface{}, error) {`)\n\tt.P(`          typedReq, ok := req.(*`, inputType, `)`)\n\tt.P(`          if !ok {`)\n\tt.P(`            return nil, `, t.pkgs[\"twirp\"], `.InternalError(\"failed type assertion req.(*`, inputType, `) when calling interceptor\")`)\n\tt.P(`          }`)\n\tt.P(`          return `, delegateFuncName, `(ctx, typedReq)`)\n\tt.P(`        },`)\n\tt.P(`      )(ctx, req)`)\n\tt.P(`      if resp != nil {`)\n\tt.P(`        typedResp, ok := resp.(*`, outputType, `)`)\n\tt.P(`        if !ok {`)\n\tt.P(`          return nil, `, t.pkgs[\"twirp\"], `.InternalError(\"failed type assertion resp.(*`, outputType, `) when calling interceptor\")`)\n\tt.P(`        }`)\n\tt.P(`        return typedResp, err`)\n\tt.P(`      }`)\n\tt.P(`      return nil, err`)\n\tt.P(`    }`)\n}\n\n// serviceMetadataVarName is the variable name used in generated code to refer\n// to the compressed bytes of this descriptor. It is not exported, so it is only\n// valid inside the generated package.\n//\n// protoc-gen-go writes its own version of this file, but so does\n// protoc-gen-gogo - with a different name! Twirp aims to be compatible with\n// both; the simplest way forward is to write the file descriptor again as\n// another variable that we control.\nfunc (t *twirp) serviceMetadataVarName() string {\n\treturn fmt.Sprintf(\"twirpFileDescriptor%d\", t.filesHandled)\n}\n\nfunc (t *twirp) generateServiceMetadataAccessors(file *descriptor.FileDescriptorProto, service *descriptor.ServiceDescriptorProto) {\n\tservStruct := serviceStruct(service)\n\tservPkg := pkgName(file)\n\n\tindex := 0\n\tfor i, s := range file.Service {\n\t\tif s.GetName() == service.GetName() {\n\t\t\tindex = i\n\t\t}\n\t}\n\tt.P(`func (s *`, servStruct, `) ServiceDescriptor() ([]byte, int) {`)\n\tt.P(`  return `, t.serviceMetadataVarName(), `, `, strconv.Itoa(index))\n\tt.P(`}`)\n\tt.P()\n\tt.P(`func (s *`, servStruct, `) ProtocGenTwirpVersion() (string) {`)\n\tt.P(`  return `, strconv.Quote(gen.Version))\n\tt.P(`}`)\n\tt.P()\n\tt.P(`// PathPrefix returns the base service path, in the form: \"/<prefix>/<package>.<Service>/\"`)\n\tt.P(`// that is everything in a Twirp route except for the <Method>. This can be used for routing,`)\n\tt.P(`// for example to identify the requests that are targeted to this service in a mux.`)\n\tt.P(`func (s *`, servStruct, `) PathPrefix() (string) {`)\n\tservName := serviceNameCamelCased(service) // it should be serviceNameLiteral(service), but needs to use CamelCase routes for backwards compatibility\n\tt.P(`  return baseServicePath(s.pathPrefix, \"`, servPkg, `\", \"`, servName, `\") `)\n\tt.P(`}`)\n}\n\nfunc (t *twirp) generateFileDescriptor(file *descriptor.FileDescriptorProto) {\n\t// Copied straight of of protoc-gen-go, which trims out comments.\n\tpb := proto.Clone(file).(*descriptor.FileDescriptorProto)\n\tpb.SourceCodeInfo = nil\n\n\tb, err := proto.Marshal(pb)\n\tif err != nil {\n\t\tgen.Fail(err.Error())\n\t}\n\n\tvar buf bytes.Buffer\n\tw, _ := gzip.NewWriterLevel(&buf, gzip.BestCompression)\n\t_, _ = w.Write(b)\n\tw.Close()\n\tb = buf.Bytes()\n\n\tv := t.serviceMetadataVarName()\n\tt.P()\n\tt.P(\"var \", v, \" = []byte{\")\n\tt.P(\"\t// \", fmt.Sprintf(\"%d\", 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\tt.P(`\t`, s)\n\n\t\tb = b[n:]\n\t}\n\tt.P(\"}\")\n}\n\nfunc (t *twirp) printComments(comments typemap.DefinitionComments) bool {\n\ttext := strings.TrimSuffix(comments.Leading, \"\\n\")\n\tif len(strings.TrimSpace(text)) == 0 {\n\t\treturn false\n\t}\n\tsplit := strings.Split(text, \"\\n\")\n\tfor _, line := range split {\n\t\tt.P(\"// \", strings.TrimPrefix(line, \" \"))\n\t}\n\treturn len(split) > 0\n}\n\n// Given a protobuf name for a Message, return the Go name we will use for that\n// type, including its package prefix.\nfunc (t *twirp) goTypeName(protoName string) string {\n\tdef := t.reg.MessageDefinition(protoName)\n\tif def == nil {\n\t\tgen.Fail(\"could not find message for\", protoName)\n\t}\n\n\tvar prefix string\n\tif pkg := t.goPackageName(def.File); pkg != t.genPkgName {\n\t\tprefix = pkg + \".\"\n\t}\n\n\tvar name string\n\tfor _, parent := range def.Lineage() {\n\t\tname += stringutils.CamelCase(parent.Descriptor.GetName()) + \"_\"\n\t}\n\tname += stringutils.CamelCase(def.Descriptor.GetName())\n\treturn prefix + name\n}\n\nfunc (t *twirp) goPackageName(file *descriptor.FileDescriptorProto) string {\n\treturn t.fileToGoPackageName[file]\n}\n\nfunc (t *twirp) formattedOutput() string {\n\t// Reformat generated code.\n\tfset := token.NewFileSet()\n\traw := t.output.Bytes()\n\tast, err := parser.ParseFile(fset, \"\", raw, 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(raw))\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\tgen.Fail(\"bad Go source code was generated:\", err.Error(), \"\\n\"+src.String())\n\t}\n\n\tout := bytes.NewBuffer(nil)\n\terr = (&printer.Config{Mode: printer.TabIndent | printer.UseSpaces, Tabwidth: 8}).Fprint(out, fset, ast)\n\tif err != nil {\n\t\tgen.Fail(\"generated Go source code could not be reformatted:\", err.Error())\n\t}\n\n\treturn out.String()\n}\n\nfunc unexported(s string) string { return strings.ToLower(s[:1]) + s[1:] }\n\nfunc pkgName(file *descriptor.FileDescriptorProto) string {\n\treturn file.GetPackage()\n}\n\nfunc serviceNameCamelCased(service *descriptor.ServiceDescriptorProto) string {\n\treturn stringutils.CamelCase(service.GetName())\n}\n\nfunc serviceNameLiteral(service *descriptor.ServiceDescriptorProto) string {\n\treturn service.GetName()\n}\n\nfunc pkgServiceNameCamelCased(file *descriptor.FileDescriptorProto, service *descriptor.ServiceDescriptorProto) string {\n\tname := serviceNameCamelCased(service)\n\tif pkg := pkgName(file); pkg != \"\" {\n\t\tname = pkg + \".\" + name\n\t}\n\treturn name\n}\n\nfunc pkgServiceNameLiteral(file *descriptor.FileDescriptorProto, service *descriptor.ServiceDescriptorProto) string {\n\tname := serviceNameLiteral(service)\n\tif pkg := pkgName(file); pkg != \"\" {\n\t\tname = pkg + \".\" + name\n\t}\n\treturn name\n}\n\nfunc serviceStruct(service *descriptor.ServiceDescriptorProto) string {\n\treturn unexported(serviceNameCamelCased(service)) + \"Server\"\n}\n\nfunc methodNameCamelCased(method *descriptor.MethodDescriptorProto) string {\n\treturn stringutils.CamelCase(method.GetName())\n}\n\nfunc methodNameLiteral(method *descriptor.MethodDescriptorProto) string {\n\treturn method.GetName()\n}\n\nfunc fileDescSliceContains(slice []*descriptor.FileDescriptorProto, f *descriptor.FileDescriptorProto) bool {\n\tfor _, sf := range slice {\n\t\tif f == sf {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n"
  },
  {
    "path": "protoc-gen-twirp/generator_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\nimport (\n\t\"os\"\n\t\"os/exec\"\n\t\"testing\"\n\n\t\"google.golang.org/protobuf/proto\"\n\tplugin \"google.golang.org/protobuf/types/pluginpb\"\n)\n\nfunc TestGenerateParseCommandLineParamsError(t *testing.T) {\n\tif os.Getenv(\"BE_CRASHER\") == \"1\" {\n\t\tg := &twirp{}\n\t\tg.Generate(&plugin.CodeGeneratorRequest{\n\t\t\tParameter: proto.String(\"invalid\"),\n\t\t})\n\t\treturn\n\t}\n\tcmd := exec.Command(os.Args[0], \"-test.run=TestGenerateParseCommandLineParamsError\")\n\tcmd.Env = append(os.Environ(), \"BE_CRASHER=1\")\n\terr := cmd.Run()\n\tif e, ok := err.(*exec.ExitError); ok && !e.Success() {\n\t\treturn\n\t}\n\tt.Fatalf(\"process ran with err %v, want exit status 1\", err)\n}\n"
  },
  {
    "path": "protoc-gen-twirp/go_naming.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\nimport (\n\t\"path\"\n\t\"strings\"\n\n\tdescriptor \"google.golang.org/protobuf/types/descriptorpb\"\n\n\t\"github.com/twitchtv/twirp/internal/gen/stringutils\"\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 goPackageOption(f *descriptor.FileDescriptorProto) (impPath, pkg string, ok bool) {\n\tpkg = f.GetOptions().GetGoPackage()\n\tif pkg == \"\" {\n\t\treturn \"\", \"\", false\n\t}\n\tif bits := strings.Split(pkg, \";\"); len(bits) == 2 {\n\t\treturn bits[0], bits[1], true\n\t}\n\t// The presence of a slash implies there's an import path.\n\tslash := strings.LastIndex(pkg, \"/\")\n\tif slash < 0 {\n\t\treturn \"\", pkg, true\n\t}\n\timpPath, pkg = pkg, pkg[slash+1:]\n\t// A semicolon-delimited suffix overrides the package name.\n\tsc := strings.IndexByte(impPath, ';')\n\tif sc < 0 {\n\t\treturn impPath, pkg, true\n\t}\n\timpPath, pkg = impPath[:sc], impPath[sc+1:]\n\treturn impPath, pkg, true\n}\n\n// goPackageName returns the Go package name to use in the generated Go file.\n// The result explicitly reports whether the name came from an option go_package\n// statement. If explicit is false, the name was derived from the protocol\n// buffer's package statement or the input file name.\nfunc goPackageName(f *descriptor.FileDescriptorProto) (name string, explicit bool) {\n\t// Does the file have a \"go_package\" option?\n\tif _, pkg, ok := goPackageOption(f); ok {\n\t\treturn pkg, true\n\t}\n\n\t// Does the file have a package clause?\n\tif pkg := f.GetPackage(); pkg != \"\" {\n\t\treturn pkg, false\n\t}\n\t// Use the file base name.\n\treturn stringutils.BaseName(f.GetName()), false\n}\n\n// goFileName returns the output name for the generated Go file.\nfunc (t *twirp) goFileName(f *descriptor.FileDescriptorProto) string {\n\tname := *f.Name // proto file name\n\tif ext := path.Ext(name); ext == \".proto\" || ext == \".protodevel\" {\n\t\tname = name[:len(name)-len(ext)] // remove extension\n\t}\n\tname += \".twirp.go\" // add twirp extension\n\n\t// with paths=source_relative, the directory is the same as the proto file\n\tif t.sourceRelativePaths {\n\t\treturn name\n\t}\n\t// otherwise, the directory is taken from the option go_package\n\tif impPath, _, ok := goPackageOption(f); ok && impPath != \"\" {\n\t\tif t.modulePrefix != \"\" {\n\t\t\timpPath = strings.TrimPrefix(strings.TrimPrefix(impPath, t.modulePrefix), \"/\")\n\t\t}\n\n\t\t// Replace the existing dirname with the import path from go_package\n\t\t_, name = path.Split(name)\n\t\tname = path.Join(impPath, name)\n\t\treturn name\n\t}\n\n\treturn name\n}\n\nfunc parseGoPackageOption(v string) (importPath, packageName string) {\n\t// Allowed formats:\n\t// option go_package = \"foo\";\n\t// option go_package = \"github.com/example/foo\";\n\t// option go_package = \"github.com/example/foo;bar\";\n\n\tsemicolonPos := strings.Index(v, \";\")\n\tif semicolonPos > -1 {\n\t\timportPath = v[:semicolonPos]\n\t\tpackageName = v[semicolonPos+1:]\n\t\treturn\n\t}\n\n\tif strings.Contains(v, \"/\") {\n\t\timportPath = v\n\t\t_, packageName = path.Split(v)\n\t\treturn\n\t}\n\n\timportPath = \"\"\n\tpackageName = v\n\treturn\n}\n"
  },
  {
    "path": "protoc-gen-twirp/go_naming_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\nimport (\n\t\"testing\"\n\n\tdescriptor \"google.golang.org/protobuf/types/descriptorpb\"\n)\n\nfunc TestParseGoPackageOption(t *testing.T) {\n\ttestcase := func(in, wantImport, wantPkg string) func(*testing.T) {\n\t\treturn func(t *testing.T) {\n\t\t\thaveImport, havePkg := parseGoPackageOption(in)\n\t\t\tif haveImport != wantImport {\n\t\t\t\tt.Errorf(\"wrong importPath, have=%q want=%q\", haveImport, wantImport)\n\t\t\t}\n\t\t\tif havePkg != wantPkg {\n\t\t\t\tt.Errorf(\"wrong packageName, have=%q want=%q\", havePkg, wantPkg)\n\t\t\t}\n\t\t}\n\t}\n\n\tt.Run(\"empty string\", testcase(\"\", \"\", \"\"))\n\tt.Run(\"bare package\", testcase(\"foo\", \"\", \"foo\"))\n\tt.Run(\"full import\", testcase(\"github.com/example/foo\", \"github.com/example/foo\", \"foo\"))\n\tt.Run(\"full import with override\",\n\t\ttestcase(\"github.com/example/foo;bar\", \"github.com/example/foo\", \"bar\"))\n\tt.Run(\"non dotted import with package\", testcase(\"foo;bar\", \"foo\", \"bar\"))\n}\n\nfunc TestGoPackageOption(t *testing.T) {\n\ttestcase := func(in, wantImport, wantPkg string, wantOK bool) func(*testing.T) {\n\t\treturn func(t *testing.T) {\n\t\t\thaveImport, havePkg, haveOK := goPackageOption(&descriptor.FileDescriptorProto{\n\t\t\t\tOptions: &descriptor.FileOptions{\n\t\t\t\t\tGoPackage: &in,\n\t\t\t\t},\n\t\t\t})\n\t\t\tif wantOK != haveOK {\n\t\t\t\tt.Errorf(\"wrong ok, have=%t want=%t\", haveOK, wantOK)\n\t\t\t}\n\t\t\tif haveImport != wantImport {\n\t\t\t\tt.Errorf(\"wrong importPath, have=%q want=%q\", haveImport, wantImport)\n\t\t\t}\n\t\t\tif havePkg != wantPkg {\n\t\t\t\tt.Errorf(\"wrong packageName, have=%q want=%q\", havePkg, wantPkg)\n\t\t\t}\n\t\t}\n\t}\n\n\tt.Run(\"empty string\", testcase(\"\", \"\", \"\", false))\n\tt.Run(\"bare package\", testcase(\"foo\", \"\", \"foo\", true))\n\tt.Run(\"full import\", testcase(\"github.com/example/foo\", \"github.com/example/foo\", \"foo\", true))\n\tt.Run(\"full import with override\",\n\t\ttestcase(\"github.com/example/foo;bar\", \"github.com/example/foo\", \"bar\", true))\n\tt.Run(\"non dotted import with package\", testcase(\"foo;bar\", \"foo\", \"bar\", true))\n}\n\nfunc TestGoFileName(t *testing.T) {\n\ttestcase := func(srcrelpaths bool, modprefix, fname, gopkg, wantName string) func(t2 *testing.T) {\n\t\treturn func(t *testing.T) {\n\t\t\tf := &descriptor.FileDescriptorProto{\n\t\t\t\tName: &fname,\n\t\t\t\tOptions: &descriptor.FileOptions{\n\t\t\t\t\tGoPackage: &gopkg,\n\t\t\t\t},\n\t\t\t}\n\n\t\t\ttw := &twirp{\n\t\t\t\tsourceRelativePaths: srcrelpaths,\n\t\t\t\tmodulePrefix:        modprefix,\n\t\t\t}\n\n\t\t\tif name := tw.goFileName(f); name != wantName {\n\t\t\t\tt.Errorf(\"wrong goFileName, have=%q want=%q\", name, wantName)\n\t\t\t}\n\t\t}\n\t}\n\n\tt.Run(\"paths=source_relative\",\n\t\ttestcase(true, \"\",\n\t\t\t\"rpc/v1/service.proto\", \"example.com/module/package/rpc/v1\",\n\t\t\t\"rpc/v1/service.twirp.go\"))\n\n\tt.Run(\"paths=import,module=example.com/module/package\",\n\t\ttestcase(false, \"example.com/module/package\",\n\t\t\t\"rpc/v1/service.proto\", \"example.com/module/package/rpc/v1\",\n\t\t\t\"rpc/v1/service.twirp.go\"))\n\n\tt.Run(\"paths=import,module=example.com/module/package/\",\n\t\ttestcase(false, \"example.com/module/package/\",\n\t\t\t\"rpc/v1/service.proto\", \"example.com/module/package/rpc/v1\",\n\t\t\t\"rpc/v1/service.twirp.go\"))\n}\n"
  },
  {
    "path": "protoc-gen-twirp/main.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage main\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/twitchtv/twirp/internal/gen\"\n)\n\nfunc main() {\n\tversionFlag := flag.Bool(\"version\", false, \"print version and exit\")\n\tflag.Parse()\n\tif *versionFlag {\n\t\tfmt.Println(gen.Version)\n\t\tos.Exit(0)\n\t}\n\n\tg := newGenerator()\n\tgen.Main(g)\n}\n"
  },
  {
    "path": "server_options.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\npackage twirp\n\nimport (\n\t\"context\"\n\t\"reflect\"\n)\n\n// ServerOption is a functional option for extending a Twirp service.\ntype ServerOption func(*ServerOptions)\n\n// WithServerHooks defines the hooks for a Twirp server.\nfunc WithServerHooks(hooks *ServerHooks) ServerOption {\n\treturn func(opts *ServerOptions) {\n\t\topts.Hooks = hooks\n\t}\n}\n\n// WithServerInterceptors defines the interceptors for a Twirp server.\nfunc WithServerInterceptors(interceptors ...Interceptor) ServerOption {\n\treturn func(opts *ServerOptions) {\n\t\topts.Interceptors = append(opts.Interceptors, interceptors...)\n\t}\n}\n\n// WithServerPathPrefix specifies a different prefix for routing.\n// If not specified, the \"/twirp\" prefix is used by default.\n// An empty value \"\" can be specified to use no prefix.\n// The clients must be configured to send requests using the same prefix.\n// URL format: \"<baseURL>[<prefix>]/<package>.<Service>/<Method>\"\n// More info on Twirp docs: https://twitchtv.github.io/twirp/docs/routing.html\nfunc WithServerPathPrefix(prefix string) ServerOption {\n\treturn func(opts *ServerOptions) {\n\t\topts.setOpt(\"pathPrefix\", prefix)\n\t\topts.pathPrefix = &prefix // for code generated before v8.1.0\n\t}\n}\n\n// WithServerJSONSkipDefaults configures JSON serialization to skip\n// unpopulated or default values in JSON responses, which results in\n// smaller response sizes. This was the default before v7 and can be\n// enabled for full backwards compatibility if required.\n// This is now disabled by default, because JSON serialization is\n// commonly used for manual debugging, in which case it is useful\n// to see the full shape of the response.\n// See: https://pkg.go.dev/google.golang.org/protobuf/encoding/protojson\n// See: https://developers.google.com/protocol-buffers/docs/proto3#json\nfunc WithServerJSONSkipDefaults(skipDefaults bool) ServerOption {\n\treturn func(opts *ServerOptions) {\n\t\topts.setOpt(\"jsonSkipDefaults\", skipDefaults)\n\t\topts.JSONSkipDefaults = skipDefaults // for code generated before v8.1.0\n\t}\n}\n\n// WithServerJSONCamelCaseNames configures JSON serialization to use the\n// default proto3 JSON encoding (lowerCamelCase) rather than the original\n// proto field names. Twirp uses the original proto field names by default,\n// because JSON encoding is often used for manual debugging of the API,\n// but this option allows better compatibility with other proto-json parsers.\n// See: https://pkg.go.dev/google.golang.org/protobuf/encoding/protojson\n// See: https://developers.google.com/protocol-buffers/docs/proto3#json\nfunc WithServerJSONCamelCaseNames(jsonCamelCase bool) ServerOption {\n\treturn func(opts *ServerOptions) {\n\t\topts.setOpt(\"jsonCamelCase\", jsonCamelCase)\n\t}\n}\n\n// ServerHooks is a container for callbacks that can instrument a\n// Twirp-generated server. These callbacks all accept a context and return a\n// context. They can use this to add to the request context as it threads\n// through the system, appending values or deadlines to it.\n//\n// The RequestReceived and RequestRouted hooks are special: they can return\n// errors. If they return a non-nil error, handling for that request will be\n// stopped at that point. The Error hook will be triggered, and the error will\n// be sent to the client. This can be used for stuff like auth checks before\n// deserializing a request.\n//\n// The RequestReceived hook is always called first, and it is called for every\n// request that the Twirp server handles. The last hook to be called in a\n// request's lifecycle is always ResponseSent, even in the case of an error.\n//\n// Details on the timing of each hook are documented as comments on the fields\n// of the ServerHooks type.\ntype ServerHooks struct {\n\t// RequestReceived is called as soon as a request enters the Twirp\n\t// server at the earliest available moment.\n\tRequestReceived func(context.Context) (context.Context, error)\n\n\t// RequestRouted is called when a request has been routed to a\n\t// particular method of the Twirp server.\n\tRequestRouted func(context.Context) (context.Context, error)\n\n\t// ResponsePrepared is called when a request has been handled and a\n\t// response is ready to be sent to the client.\n\tResponsePrepared func(context.Context) context.Context\n\n\t// ResponseSent is called when all bytes of a response (including an error\n\t// response) have been written. Because the ResponseSent hook is terminal, it\n\t// does not return a context.\n\tResponseSent func(context.Context)\n\n\t// Error hook is called when an error occurs while handling a request. The\n\t// Error is passed as argument to the hook.\n\tError func(context.Context, Error) context.Context\n}\n\n// ChainHooks creates a new *ServerHooks which chains the callbacks in\n// each of the constituent hooks passed in. Each hook function will be\n// called in the order of the ServerHooks values passed in.\n//\n// For the erroring hooks, RequestReceived and RequestRouted, any returned\n// errors prevent processing by later hooks.\nfunc ChainHooks(hooks ...*ServerHooks) *ServerHooks {\n\tif len(hooks) == 0 {\n\t\treturn nil\n\t}\n\tif len(hooks) == 1 {\n\t\treturn hooks[0]\n\t}\n\treturn &ServerHooks{\n\t\tRequestReceived: func(ctx context.Context) (context.Context, error) {\n\t\t\tvar err error\n\t\t\tfor _, h := range hooks {\n\t\t\t\tif h != nil && h.RequestReceived != nil {\n\t\t\t\t\tctx, err = h.RequestReceived(ctx)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn ctx, err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ctx, nil\n\t\t},\n\t\tRequestRouted: func(ctx context.Context) (context.Context, error) {\n\t\t\tvar err error\n\t\t\tfor _, h := range hooks {\n\t\t\t\tif h != nil && h.RequestRouted != nil {\n\t\t\t\t\tctx, err = h.RequestRouted(ctx)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn ctx, err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ctx, nil\n\t\t},\n\t\tResponsePrepared: func(ctx context.Context) context.Context {\n\t\t\tfor _, h := range hooks {\n\t\t\t\tif h != nil && h.ResponsePrepared != nil {\n\t\t\t\t\tctx = h.ResponsePrepared(ctx)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ctx\n\t\t},\n\t\tResponseSent: func(ctx context.Context) {\n\t\t\tfor _, h := range hooks {\n\t\t\t\tif h != nil && h.ResponseSent != nil {\n\t\t\t\t\th.ResponseSent(ctx)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tError: func(ctx context.Context, twerr Error) context.Context {\n\t\t\tfor _, h := range hooks {\n\t\t\t\tif h != nil && h.Error != nil {\n\t\t\t\t\tctx = h.Error(ctx, twerr)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn ctx\n\t\t},\n\t}\n}\n\n// ServerOptions encapsulate the configurable parameters on a Twirp server.\n// This type is meant to be used only by generated code.\ntype ServerOptions struct {\n\t// Untyped options map. The methods setOpt and ReadOpt are used to set\n\t// and read options. The options are untyped so when a new option is added,\n\t// newly generated code can still work with older versions of the runtime.\n\tm map[string]interface{}\n\n\tHooks        *ServerHooks\n\tInterceptors []Interceptor\n\n\t// Properties below are only used by code that was\n\t// generated by older versions of Twirp (before v8.1.0).\n\t// New options with standard types added in the future\n\t// don't need new properties, they should use ReadOpt.\n\tJSONSkipDefaults bool\n\tpathPrefix       *string\n}\n\n// ReadOpt extracts an option to a pointer value,\n// returns true if the option exists and was extracted.\n// This method is meant to be used by generated code,\n// keeping the type dependency outside of the runtime.\n//\n// Usage example:\n//\n//     opts.setOpt(\"fooOpt\", 123)\n//     var foo int\n//     ok := opts.ReadOpt(\"fooOpt\", &int)\n//\nfunc (opts *ServerOptions) ReadOpt(key string, out interface{}) bool {\n\tval, ok := opts.m[key]\n\tif !ok {\n\t\treturn false\n\t}\n\n\trout := reflect.ValueOf(out)\n\tif rout.Kind() != reflect.Ptr {\n\t\tpanic(\"ReadOpt(key, out); out must be a pointer but it was not\")\n\t}\n\trout.Elem().Set(reflect.ValueOf(val))\n\treturn true\n}\n\n// setOpt adds an option key/value. It is used by ServerOption helpers.\n// The value can be extracted with ReadOpt by passing a pointer to the same type.\nfunc (opts *ServerOptions) setOpt(key string, val interface{}) {\n\tif opts.m == nil {\n\t\topts.m = make(map[string]interface{})\n\t}\n\topts.m[key] = val\n}\n\n// PathPrefix() is used only by clients generated before v8.1.0\nfunc (opts *ServerOptions) PathPrefix() string {\n\tif opts.pathPrefix == nil {\n\t\treturn \"/twirp\" // default prefix\n\t}\n\treturn *opts.pathPrefix\n}\n"
  },
  {
    "path": "server_options_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage twirp\n\nimport (\n\t\"context\"\n\t\"reflect\"\n\t\"testing\"\n)\n\nfunc TestServerOptionsReadOpt(t *testing.T) {\n\topts := &ServerOptions{}\n\tok := false\n\n\tvar fooNum int\n\tok = opts.ReadOpt(\"fooNum\", &fooNum)\n\tif ok {\n\t\tt.Errorf(\"option 'fooNum' does not exist, opts.ReadOpt should have returned false\")\n\t}\n\n\topts.setOpt(\"fooNum\", 455)\n\tok = opts.ReadOpt(\"fooNum\", &fooNum)\n\tif !ok || fooNum != 455 {\n\t\tt.Errorf(\"option 'fooNum' expected to be 455\")\n\t}\n\n\tvar jsonSkipDefaults bool\n\tok = opts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tif ok {\n\t\tt.Errorf(\"option 'jsonSkipDefaults' does not exist, opts.ReadOpt should have returned false\")\n\t}\n\n\tWithServerJSONSkipDefaults(true)(opts)\n\tok = opts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tif !ok || !jsonSkipDefaults {\n\t\tt.Errorf(\"option 'jsonSkipDefaults' expected to be true, ok: %v, val: %v\", ok, jsonSkipDefaults)\n\t}\n\n\tWithServerJSONSkipDefaults(false)(opts)\n\tok = opts.ReadOpt(\"jsonSkipDefaults\", &jsonSkipDefaults)\n\tif !ok || jsonSkipDefaults {\n\t\tt.Errorf(\"option 'jsonSkipDefaults' expected to be false, ok: %v, val: %v\", ok, jsonSkipDefaults)\n\t}\n}\n\nfunc TestChainHooks(t *testing.T) {\n\tvar (\n\t\thook1 = new(ServerHooks)\n\t\thook2 = new(ServerHooks)\n\t\thook3 = new(ServerHooks)\n\t)\n\n\tconst key = \"key\"\n\n\thook1.RequestReceived = func(ctx context.Context) (context.Context, error) {\n\t\treturn context.WithValue(ctx, key, []string{\"hook1\"}), nil\n\t}\n\thook2.RequestReceived = func(ctx context.Context) (context.Context, error) {\n\t\tv := ctx.Value(key).([]string)\n\t\treturn context.WithValue(ctx, key, append(v, \"hook2\")), nil\n\t}\n\thook3.RequestReceived = func(ctx context.Context) (context.Context, error) {\n\t\tv := ctx.Value(key).([]string)\n\t\treturn context.WithValue(ctx, key, append(v, \"hook3\")), nil\n\t}\n\n\thook1.RequestRouted = func(ctx context.Context) (context.Context, error) {\n\t\treturn context.WithValue(ctx, key, []string{\"hook1\"}), nil\n\t}\n\n\thook2.ResponsePrepared = func(ctx context.Context) context.Context {\n\t\treturn context.WithValue(ctx, key, []string{\"hook2\"})\n\t}\n\n\tchain := ChainHooks(hook1, hook2, hook3)\n\n\tctx := context.Background()\n\n\t// When all three chained hooks have a handler, all should be called in order.\n\twant := []string{\"hook1\", \"hook2\", \"hook3\"}\n\thaveCtx, err := chain.RequestReceived(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"RequestReceived chain has unexpected err %v\", err)\n\t}\n\thave := haveCtx.Value(key)\n\tif !reflect.DeepEqual(want, have) {\n\t\tt.Errorf(\"RequestReceived chain has unexpected ctx, have=%v, want=%v\", have, want)\n\t}\n\n\t// When only the first chained hook has a handler, it should be called, and\n\t// there should be no panic.\n\twant = []string{\"hook1\"}\n\thaveCtx, err = chain.RequestRouted(ctx)\n\tif err != nil {\n\t\tt.Fatalf(\"RequestRouted chain has unexpected err %v\", err)\n\t}\n\thave = haveCtx.Value(key)\n\tif !reflect.DeepEqual(want, have) {\n\t\tt.Errorf(\"RequestRouted chain has unexpected ctx, have=%v, want=%v\", have, want)\n\t}\n\n\t// When only the second chained hook has a handler, it should be called, and\n\t// there should be no panic.\n\twant = []string{\"hook2\"}\n\thave = chain.ResponsePrepared(ctx).Value(key)\n\tif !reflect.DeepEqual(want, have) {\n\t\tt.Errorf(\"RequestRouted chain has unexpected ctx, have=%v, want=%v\", have, want)\n\t}\n\n\t// When none of the chained hooks has a handler there should be no panic.\n\tchain.ResponseSent(ctx)\n}\n\nfunc TestWithServerPathPrefix(t *testing.T) {\n\topts := &ServerOptions{}\n\n\t// Default value\n\tif have, want := opts.PathPrefix(), \"/twirp\"; have != want {\n\t\tt.Errorf(\"unexpected default PathPrefix() on ServerOptions, have: %q, want: %q\", have, want)\n\t}\n\n\t// Set a different prefix\n\tWithServerPathPrefix(\"/newprfx/foobar\")(opts)\n\tif have, want := opts.PathPrefix(), \"/newprfx/foobar\"; have != want {\n\t\tt.Errorf(\"unexpected value after WithServerPathPrefix, have: %q, want: %q\", have, want)\n\t}\n\n\t// Use empty value for no-prefix\n\tWithServerPathPrefix(\"\")(opts)\n\tif have, want := opts.PathPrefix(), \"\"; have != want {\n\t\tt.Errorf(\"unexpected value after WithServerPathPrefix, have: %q, want: %q\", have, want)\n\t}\n}\n\nfunc TestWithJSONSkipDefaults(t *testing.T) {\n\topts := &ServerOptions{}\n\n\tWithServerJSONSkipDefaults(true)(opts)\n\tif !opts.JSONSkipDefaults {\n\t\tt.Errorf(\"opts.JSONSkipDefaults expected to be true, but it is false\")\n\t}\n\n\tWithServerJSONSkipDefaults(false)(opts)\n\tif opts.JSONSkipDefaults {\n\t\tt.Errorf(\"opts.JSONSkipDefaults expected to be false, but it is true\")\n\t}\n}\n"
  },
  {
    "path": "tools.json",
    "content": "{\n  \"Tools\": [\n    {\n      \"Repository\": \"github.com/kisielk/errcheck\",\n      \"Commit\": \"db0ca22445717d1b2c51ac1034440e0a2a2de645\"\n    },\n    {\n      \"Repository\": \"github.com/twitchtv/retool\",\n      \"Commit\": \"6f6d4930d88c40e23d2b54d12e64f0444e1fb4ef\"\n    },\n    {\n      \"Repository\": \"google.golang.org/protobuf/cmd/protoc-gen-go\",\n      \"Commit\": \"fc9592f7ac4bade8f83e636263f8f07715c698d1\"\n    }\n  ],\n  \"RetoolVersion\": \"1.3.5\"\n}"
  },
  {
    "path": "vendor/github.com/davecgh/go-spew/LICENSE",
    "content": "ISC License\n\nCopyright (c) 2012-2016 Dave Collins <dave@davec.name>\n\nPermission to use, copy, modify, and distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n"
  },
  {
    "path": "vendor/github.com/davecgh/go-spew/spew/bypass.go",
    "content": "// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n// NOTE: Due to the following build constraints, this file will only be compiled\n// when the code is not running on Google App Engine, compiled by GopherJS, and\n// \"-tags safe\" is not added to the go build command line.  The \"disableunsafe\"\n// tag is deprecated and thus should not be used.\n// +build !js,!appengine,!safe,!disableunsafe\n\npackage spew\n\nimport (\n\t\"reflect\"\n\t\"unsafe\"\n)\n\nconst (\n\t// UnsafeDisabled is a build-time constant which specifies whether or\n\t// not access to the unsafe package is available.\n\tUnsafeDisabled = false\n\n\t// ptrSize is the size of a pointer on the current arch.\n\tptrSize = unsafe.Sizeof((*byte)(nil))\n)\n\nvar (\n\t// offsetPtr, offsetScalar, and offsetFlag are the offsets for the\n\t// internal reflect.Value fields.  These values are valid before golang\n\t// commit ecccf07e7f9d which changed the format.  The are also valid\n\t// after commit 82f48826c6c7 which changed the format again to mirror\n\t// the original format.  Code in the init function updates these offsets\n\t// as necessary.\n\toffsetPtr    = uintptr(ptrSize)\n\toffsetScalar = uintptr(0)\n\toffsetFlag   = uintptr(ptrSize * 2)\n\n\t// flagKindWidth and flagKindShift indicate various bits that the\n\t// reflect package uses internally to track kind information.\n\t//\n\t// flagRO indicates whether or not the value field of a reflect.Value is\n\t// read-only.\n\t//\n\t// flagIndir indicates whether the value field of a reflect.Value is\n\t// the actual data or a pointer to the data.\n\t//\n\t// These values are valid before golang commit 90a7c3c86944 which\n\t// changed their positions.  Code in the init function updates these\n\t// flags as necessary.\n\tflagKindWidth = uintptr(5)\n\tflagKindShift = uintptr(flagKindWidth - 1)\n\tflagRO        = uintptr(1 << 0)\n\tflagIndir     = uintptr(1 << 1)\n)\n\nfunc init() {\n\t// Older versions of reflect.Value stored small integers directly in the\n\t// ptr field (which is named val in the older versions).  Versions\n\t// between commits ecccf07e7f9d and 82f48826c6c7 added a new field named\n\t// scalar for this purpose which unfortunately came before the flag\n\t// field, so the offset of the flag field is different for those\n\t// versions.\n\t//\n\t// This code constructs a new reflect.Value from a known small integer\n\t// and checks if the size of the reflect.Value struct indicates it has\n\t// the scalar field. When it does, the offsets are updated accordingly.\n\tvv := reflect.ValueOf(0xf00)\n\tif unsafe.Sizeof(vv) == (ptrSize * 4) {\n\t\toffsetScalar = ptrSize * 2\n\t\toffsetFlag = ptrSize * 3\n\t}\n\n\t// Commit 90a7c3c86944 changed the flag positions such that the low\n\t// order bits are the kind.  This code extracts the kind from the flags\n\t// field and ensures it's the correct type.  When it's not, the flag\n\t// order has been changed to the newer format, so the flags are updated\n\t// accordingly.\n\tupf := unsafe.Pointer(uintptr(unsafe.Pointer(&vv)) + offsetFlag)\n\tupfv := *(*uintptr)(upf)\n\tflagKindMask := uintptr((1<<flagKindWidth - 1) << flagKindShift)\n\tif (upfv&flagKindMask)>>flagKindShift != uintptr(reflect.Int) {\n\t\tflagKindShift = 0\n\t\tflagRO = 1 << 5\n\t\tflagIndir = 1 << 6\n\n\t\t// Commit adf9b30e5594 modified the flags to separate the\n\t\t// flagRO flag into two bits which specifies whether or not the\n\t\t// field is embedded.  This causes flagIndir to move over a bit\n\t\t// and means that flagRO is the combination of either of the\n\t\t// original flagRO bit and the new bit.\n\t\t//\n\t\t// This code detects the change by extracting what used to be\n\t\t// the indirect bit to ensure it's set.  When it's not, the flag\n\t\t// order has been changed to the newer format, so the flags are\n\t\t// updated accordingly.\n\t\tif upfv&flagIndir == 0 {\n\t\t\tflagRO = 3 << 5\n\t\t\tflagIndir = 1 << 7\n\t\t}\n\t}\n}\n\n// unsafeReflectValue converts the passed reflect.Value into a one that bypasses\n// the typical safety restrictions preventing access to unaddressable and\n// unexported data.  It works by digging the raw pointer to the underlying\n// value out of the protected value and generating a new unprotected (unsafe)\n// reflect.Value to it.\n//\n// This allows us to check for implementations of the Stringer and error\n// interfaces to be used for pretty printing ordinarily unaddressable and\n// inaccessible values such as unexported struct fields.\nfunc unsafeReflectValue(v reflect.Value) (rv reflect.Value) {\n\tindirects := 1\n\tvt := v.Type()\n\tupv := unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetPtr)\n\trvf := *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetFlag))\n\tif rvf&flagIndir != 0 {\n\t\tvt = reflect.PtrTo(v.Type())\n\t\tindirects++\n\t} else if offsetScalar != 0 {\n\t\t// The value is in the scalar field when it's not one of the\n\t\t// reference types.\n\t\tswitch vt.Kind() {\n\t\tcase reflect.Uintptr:\n\t\tcase reflect.Chan:\n\t\tcase reflect.Func:\n\t\tcase reflect.Map:\n\t\tcase reflect.Ptr:\n\t\tcase reflect.UnsafePointer:\n\t\tdefault:\n\t\t\tupv = unsafe.Pointer(uintptr(unsafe.Pointer(&v)) +\n\t\t\t\toffsetScalar)\n\t\t}\n\t}\n\n\tpv := reflect.NewAt(vt, upv)\n\trv = pv\n\tfor i := 0; i < indirects; i++ {\n\t\trv = rv.Elem()\n\t}\n\treturn rv\n}\n"
  },
  {
    "path": "vendor/github.com/davecgh/go-spew/spew/bypasssafe.go",
    "content": "// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>\n//\n// Permission to use, copy, modify, and distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n// NOTE: Due to the following build constraints, this file will only be compiled\n// when the code is running on Google App Engine, compiled by GopherJS, or\n// \"-tags safe\" is added to the go build command line.  The \"disableunsafe\"\n// tag is deprecated and thus should not be used.\n// +build js appengine safe disableunsafe\n\npackage spew\n\nimport \"reflect\"\n\nconst (\n\t// UnsafeDisabled is a build-time constant which specifies whether or\n\t// not access to the unsafe package is available.\n\tUnsafeDisabled = true\n)\n\n// unsafeReflectValue typically converts the passed reflect.Value into a one\n// that bypasses the typical safety restrictions preventing access to\n// unaddressable and unexported data.  However, doing this relies on access to\n// the unsafe package.  This is a stub version which simply returns the passed\n// reflect.Value when the unsafe package is not available.\nfunc unsafeReflectValue(v reflect.Value) reflect.Value {\n\treturn v\n}\n"
  },
  {
    "path": "vendor/github.com/davecgh/go-spew/spew/common.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"reflect\"\n\t\"sort\"\n\t\"strconv\"\n)\n\n// Some constants in the form of bytes to avoid string overhead.  This mirrors\n// the technique used in the fmt package.\nvar (\n\tpanicBytes            = []byte(\"(PANIC=\")\n\tplusBytes             = []byte(\"+\")\n\tiBytes                = []byte(\"i\")\n\ttrueBytes             = []byte(\"true\")\n\tfalseBytes            = []byte(\"false\")\n\tinterfaceBytes        = []byte(\"(interface {})\")\n\tcommaNewlineBytes     = []byte(\",\\n\")\n\tnewlineBytes          = []byte(\"\\n\")\n\topenBraceBytes        = []byte(\"{\")\n\topenBraceNewlineBytes = []byte(\"{\\n\")\n\tcloseBraceBytes       = []byte(\"}\")\n\tasteriskBytes         = []byte(\"*\")\n\tcolonBytes            = []byte(\":\")\n\tcolonSpaceBytes       = []byte(\": \")\n\topenParenBytes        = []byte(\"(\")\n\tcloseParenBytes       = []byte(\")\")\n\tspaceBytes            = []byte(\" \")\n\tpointerChainBytes     = []byte(\"->\")\n\tnilAngleBytes         = []byte(\"<nil>\")\n\tmaxNewlineBytes       = []byte(\"<max depth reached>\\n\")\n\tmaxShortBytes         = []byte(\"<max>\")\n\tcircularBytes         = []byte(\"<already shown>\")\n\tcircularShortBytes    = []byte(\"<shown>\")\n\tinvalidAngleBytes     = []byte(\"<invalid>\")\n\topenBracketBytes      = []byte(\"[\")\n\tcloseBracketBytes     = []byte(\"]\")\n\tpercentBytes          = []byte(\"%\")\n\tprecisionBytes        = []byte(\".\")\n\topenAngleBytes        = []byte(\"<\")\n\tcloseAngleBytes       = []byte(\">\")\n\topenMapBytes          = []byte(\"map[\")\n\tcloseMapBytes         = []byte(\"]\")\n\tlenEqualsBytes        = []byte(\"len=\")\n\tcapEqualsBytes        = []byte(\"cap=\")\n)\n\n// hexDigits is used to map a decimal value to a hex digit.\nvar hexDigits = \"0123456789abcdef\"\n\n// catchPanic handles any panics that might occur during the handleMethods\n// calls.\nfunc catchPanic(w io.Writer, v reflect.Value) {\n\tif err := recover(); err != nil {\n\t\tw.Write(panicBytes)\n\t\tfmt.Fprintf(w, \"%v\", err)\n\t\tw.Write(closeParenBytes)\n\t}\n}\n\n// handleMethods attempts to call the Error and String methods on the underlying\n// type the passed reflect.Value represents and outputes the result to Writer w.\n//\n// It handles panics in any called methods by catching and displaying the error\n// as the formatted value.\nfunc handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) {\n\t// We need an interface to check if the type implements the error or\n\t// Stringer interface.  However, the reflect package won't give us an\n\t// interface on certain things like unexported struct fields in order\n\t// to enforce visibility rules.  We use unsafe, when it's available,\n\t// to bypass these restrictions since this package does not mutate the\n\t// values.\n\tif !v.CanInterface() {\n\t\tif UnsafeDisabled {\n\t\t\treturn false\n\t\t}\n\n\t\tv = unsafeReflectValue(v)\n\t}\n\n\t// Choose whether or not to do error and Stringer interface lookups against\n\t// the base type or a pointer to the base type depending on settings.\n\t// Technically calling one of these methods with a pointer receiver can\n\t// mutate the value, however, types which choose to satisify an error or\n\t// Stringer interface with a pointer receiver should not be mutating their\n\t// state inside these interface methods.\n\tif !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() {\n\t\tv = unsafeReflectValue(v)\n\t}\n\tif v.CanAddr() {\n\t\tv = v.Addr()\n\t}\n\n\t// Is it an error or Stringer?\n\tswitch iface := v.Interface().(type) {\n\tcase error:\n\t\tdefer catchPanic(w, v)\n\t\tif cs.ContinueOnMethod {\n\t\t\tw.Write(openParenBytes)\n\t\t\tw.Write([]byte(iface.Error()))\n\t\t\tw.Write(closeParenBytes)\n\t\t\tw.Write(spaceBytes)\n\t\t\treturn false\n\t\t}\n\n\t\tw.Write([]byte(iface.Error()))\n\t\treturn true\n\n\tcase fmt.Stringer:\n\t\tdefer catchPanic(w, v)\n\t\tif cs.ContinueOnMethod {\n\t\t\tw.Write(openParenBytes)\n\t\t\tw.Write([]byte(iface.String()))\n\t\t\tw.Write(closeParenBytes)\n\t\t\tw.Write(spaceBytes)\n\t\t\treturn false\n\t\t}\n\t\tw.Write([]byte(iface.String()))\n\t\treturn true\n\t}\n\treturn false\n}\n\n// printBool outputs a boolean value as true or false to Writer w.\nfunc printBool(w io.Writer, val bool) {\n\tif val {\n\t\tw.Write(trueBytes)\n\t} else {\n\t\tw.Write(falseBytes)\n\t}\n}\n\n// printInt outputs a signed integer value to Writer w.\nfunc printInt(w io.Writer, val int64, base int) {\n\tw.Write([]byte(strconv.FormatInt(val, base)))\n}\n\n// printUint outputs an unsigned integer value to Writer w.\nfunc printUint(w io.Writer, val uint64, base int) {\n\tw.Write([]byte(strconv.FormatUint(val, base)))\n}\n\n// printFloat outputs a floating point value using the specified precision,\n// which is expected to be 32 or 64bit, to Writer w.\nfunc printFloat(w io.Writer, val float64, precision int) {\n\tw.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision)))\n}\n\n// printComplex outputs a complex value using the specified float precision\n// for the real and imaginary parts to Writer w.\nfunc printComplex(w io.Writer, c complex128, floatPrecision int) {\n\tr := real(c)\n\tw.Write(openParenBytes)\n\tw.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision)))\n\ti := imag(c)\n\tif i >= 0 {\n\t\tw.Write(plusBytes)\n\t}\n\tw.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision)))\n\tw.Write(iBytes)\n\tw.Write(closeParenBytes)\n}\n\n// printHexPtr outputs a uintptr formatted as hexidecimal with a leading '0x'\n// prefix to Writer w.\nfunc printHexPtr(w io.Writer, p uintptr) {\n\t// Null pointer.\n\tnum := uint64(p)\n\tif num == 0 {\n\t\tw.Write(nilAngleBytes)\n\t\treturn\n\t}\n\n\t// Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix\n\tbuf := make([]byte, 18)\n\n\t// It's simpler to construct the hex string right to left.\n\tbase := uint64(16)\n\ti := len(buf) - 1\n\tfor num >= base {\n\t\tbuf[i] = hexDigits[num%base]\n\t\tnum /= base\n\t\ti--\n\t}\n\tbuf[i] = hexDigits[num]\n\n\t// Add '0x' prefix.\n\ti--\n\tbuf[i] = 'x'\n\ti--\n\tbuf[i] = '0'\n\n\t// Strip unused leading bytes.\n\tbuf = buf[i:]\n\tw.Write(buf)\n}\n\n// valuesSorter implements sort.Interface to allow a slice of reflect.Value\n// elements to be sorted.\ntype valuesSorter struct {\n\tvalues  []reflect.Value\n\tstrings []string // either nil or same len and values\n\tcs      *ConfigState\n}\n\n// newValuesSorter initializes a valuesSorter instance, which holds a set of\n// surrogate keys on which the data should be sorted.  It uses flags in\n// ConfigState to decide if and how to populate those surrogate keys.\nfunc newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface {\n\tvs := &valuesSorter{values: values, cs: cs}\n\tif canSortSimply(vs.values[0].Kind()) {\n\t\treturn vs\n\t}\n\tif !cs.DisableMethods {\n\t\tvs.strings = make([]string, len(values))\n\t\tfor i := range vs.values {\n\t\t\tb := bytes.Buffer{}\n\t\t\tif !handleMethods(cs, &b, vs.values[i]) {\n\t\t\t\tvs.strings = nil\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tvs.strings[i] = b.String()\n\t\t}\n\t}\n\tif vs.strings == nil && cs.SpewKeys {\n\t\tvs.strings = make([]string, len(values))\n\t\tfor i := range vs.values {\n\t\t\tvs.strings[i] = Sprintf(\"%#v\", vs.values[i].Interface())\n\t\t}\n\t}\n\treturn vs\n}\n\n// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted\n// directly, or whether it should be considered for sorting by surrogate keys\n// (if the ConfigState allows it).\nfunc canSortSimply(kind reflect.Kind) bool {\n\t// This switch parallels valueSortLess, except for the default case.\n\tswitch kind {\n\tcase reflect.Bool:\n\t\treturn true\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\treturn true\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\treturn true\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn true\n\tcase reflect.String:\n\t\treturn true\n\tcase reflect.Uintptr:\n\t\treturn true\n\tcase reflect.Array:\n\t\treturn true\n\t}\n\treturn false\n}\n\n// Len returns the number of values in the slice.  It is part of the\n// sort.Interface implementation.\nfunc (s *valuesSorter) Len() int {\n\treturn len(s.values)\n}\n\n// Swap swaps the values at the passed indices.  It is part of the\n// sort.Interface implementation.\nfunc (s *valuesSorter) Swap(i, j int) {\n\ts.values[i], s.values[j] = s.values[j], s.values[i]\n\tif s.strings != nil {\n\t\ts.strings[i], s.strings[j] = s.strings[j], s.strings[i]\n\t}\n}\n\n// valueSortLess returns whether the first value should sort before the second\n// value.  It is used by valueSorter.Less as part of the sort.Interface\n// implementation.\nfunc valueSortLess(a, b reflect.Value) bool {\n\tswitch a.Kind() {\n\tcase reflect.Bool:\n\t\treturn !a.Bool() && b.Bool()\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\treturn a.Int() < b.Int()\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\treturn a.Uint() < b.Uint()\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn a.Float() < b.Float()\n\tcase reflect.String:\n\t\treturn a.String() < b.String()\n\tcase reflect.Uintptr:\n\t\treturn a.Uint() < b.Uint()\n\tcase reflect.Array:\n\t\t// Compare the contents of both arrays.\n\t\tl := a.Len()\n\t\tfor i := 0; i < l; i++ {\n\t\t\tav := a.Index(i)\n\t\t\tbv := b.Index(i)\n\t\t\tif av.Interface() == bv.Interface() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn valueSortLess(av, bv)\n\t\t}\n\t}\n\treturn a.String() < b.String()\n}\n\n// Less returns whether the value at index i should sort before the\n// value at index j.  It is part of the sort.Interface implementation.\nfunc (s *valuesSorter) Less(i, j int) bool {\n\tif s.strings == nil {\n\t\treturn valueSortLess(s.values[i], s.values[j])\n\t}\n\treturn s.strings[i] < s.strings[j]\n}\n\n// sortValues is a sort function that handles both native types and any type that\n// can be converted to error or Stringer.  Other inputs are sorted according to\n// their Value.String() value to ensure display stability.\nfunc sortValues(values []reflect.Value, cs *ConfigState) {\n\tif len(values) == 0 {\n\t\treturn\n\t}\n\tsort.Sort(newValuesSorter(values, cs))\n}\n"
  },
  {
    "path": "vendor/github.com/davecgh/go-spew/spew/config.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n)\n\n// ConfigState houses the configuration options used by spew to format and\n// display values.  There is a global instance, Config, that is used to control\n// all top-level Formatter and Dump functionality.  Each ConfigState instance\n// provides methods equivalent to the top-level functions.\n//\n// The zero value for ConfigState provides no indentation.  You would typically\n// want to set it to a space or a tab.\n//\n// Alternatively, you can use NewDefaultConfig to get a ConfigState instance\n// with default settings.  See the documentation of NewDefaultConfig for default\n// values.\ntype ConfigState struct {\n\t// Indent specifies the string to use for each indentation level.  The\n\t// global config instance that all top-level functions use set this to a\n\t// single space by default.  If you would like more indentation, you might\n\t// set this to a tab with \"\\t\" or perhaps two spaces with \"  \".\n\tIndent string\n\n\t// MaxDepth controls the maximum number of levels to descend into nested\n\t// data structures.  The default, 0, means there is no limit.\n\t//\n\t// NOTE: Circular data structures are properly detected, so it is not\n\t// necessary to set this value unless you specifically want to limit deeply\n\t// nested data structures.\n\tMaxDepth int\n\n\t// DisableMethods specifies whether or not error and Stringer interfaces are\n\t// invoked for types that implement them.\n\tDisableMethods bool\n\n\t// DisablePointerMethods specifies whether or not to check for and invoke\n\t// error and Stringer interfaces on types which only accept a pointer\n\t// receiver when the current type is not a pointer.\n\t//\n\t// NOTE: This might be an unsafe action since calling one of these methods\n\t// with a pointer receiver could technically mutate the value, however,\n\t// in practice, types which choose to satisify an error or Stringer\n\t// interface with a pointer receiver should not be mutating their state\n\t// inside these interface methods.  As a result, this option relies on\n\t// access to the unsafe package, so it will not have any effect when\n\t// running in environments without access to the unsafe package such as\n\t// Google App Engine or with the \"safe\" build tag specified.\n\tDisablePointerMethods bool\n\n\t// DisablePointerAddresses specifies whether to disable the printing of\n\t// pointer addresses. This is useful when diffing data structures in tests.\n\tDisablePointerAddresses bool\n\n\t// DisableCapacities specifies whether to disable the printing of capacities\n\t// for arrays, slices, maps and channels. This is useful when diffing\n\t// data structures in tests.\n\tDisableCapacities bool\n\n\t// ContinueOnMethod specifies whether or not recursion should continue once\n\t// a custom error or Stringer interface is invoked.  The default, false,\n\t// means it will print the results of invoking the custom error or Stringer\n\t// interface and return immediately instead of continuing to recurse into\n\t// the internals of the data type.\n\t//\n\t// NOTE: This flag does not have any effect if method invocation is disabled\n\t// via the DisableMethods or DisablePointerMethods options.\n\tContinueOnMethod bool\n\n\t// SortKeys specifies map keys should be sorted before being printed. Use\n\t// this to have a more deterministic, diffable output.  Note that only\n\t// native types (bool, int, uint, floats, uintptr and string) and types\n\t// that support the error or Stringer interfaces (if methods are\n\t// enabled) are supported, with other types sorted according to the\n\t// reflect.Value.String() output which guarantees display stability.\n\tSortKeys bool\n\n\t// SpewKeys specifies that, as a last resort attempt, map keys should\n\t// be spewed to strings and sorted by those strings.  This is only\n\t// considered if SortKeys is true.\n\tSpewKeys bool\n}\n\n// Config is the active configuration of the top-level functions.\n// The configuration can be changed by modifying the contents of spew.Config.\nvar Config = ConfigState{Indent: \" \"}\n\n// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the formatted string as a value that satisfies error.  See NewFormatter\n// for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Errorf(format string, a ...interface{}) (err error) {\n\treturn fmt.Errorf(format, c.convertArgs(a)...)\n}\n\n// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprint(w, c.convertArgs(a)...)\n}\n\n// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintf(w, format, c.convertArgs(a)...)\n}\n\n// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it\n// passed with a Formatter interface returned by c.NewFormatter.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintln(w, c.convertArgs(a)...)\n}\n\n// Print is a wrapper for fmt.Print that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Print(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Print(a ...interface{}) (n int, err error) {\n\treturn fmt.Print(c.convertArgs(a)...)\n}\n\n// Printf is a wrapper for fmt.Printf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Printf(format, c.convertArgs(a)...)\n}\n\n// Println is a wrapper for fmt.Println that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Println(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Println(a ...interface{}) (n int, err error) {\n\treturn fmt.Println(c.convertArgs(a)...)\n}\n\n// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprint(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Sprint(a ...interface{}) string {\n\treturn fmt.Sprint(c.convertArgs(a)...)\n}\n\n// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were\n// passed with a Formatter interface returned by c.NewFormatter.  It returns\n// the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Sprintf(format string, a ...interface{}) string {\n\treturn fmt.Sprintf(format, c.convertArgs(a)...)\n}\n\n// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it\n// were passed with a Formatter interface returned by c.NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b))\nfunc (c *ConfigState) Sprintln(a ...interface{}) string {\n\treturn fmt.Sprintln(c.convertArgs(a)...)\n}\n\n/*\nNewFormatter returns a custom formatter that satisfies the fmt.Formatter\ninterface.  As a result, it integrates cleanly with standard fmt package\nprinting functions.  The formatter is useful for inline printing of smaller data\ntypes similar to the standard %v format specifier.\n\nThe custom formatter only responds to the %v (most compact), %+v (adds pointer\naddresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb\ncombinations.  Any other verbs such as %x and %q will be sent to the the\nstandard fmt package for formatting.  In addition, the custom formatter ignores\nthe width and precision arguments (however they will still work on the format\nspecifiers not handled by the custom formatter).\n\nTypically this function shouldn't be called directly.  It is much easier to make\nuse of the custom formatter by calling one of the convenience functions such as\nc.Printf, c.Println, or c.Printf.\n*/\nfunc (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter {\n\treturn newFormatter(c, v)\n}\n\n// Fdump formats and displays the passed arguments to io.Writer w.  It formats\n// exactly the same as Dump.\nfunc (c *ConfigState) Fdump(w io.Writer, a ...interface{}) {\n\tfdump(c, w, a...)\n}\n\n/*\nDump displays the passed parameters to standard out with newlines, customizable\nindentation, and additional debug information such as complete types and all\npointer addresses used to indirect to the final value.  It provides the\nfollowing features over the built-in printing facilities provided by the fmt\npackage:\n\n\t* Pointers are dereferenced and followed\n\t* Circular data structures are detected and handled properly\n\t* Custom Stringer/error interfaces are optionally invoked, including\n\t  on unexported types\n\t* Custom types which only implement the Stringer/error interfaces via\n\t  a pointer receiver are optionally invoked when passing non-pointer\n\t  variables\n\t* Byte arrays and slices are dumped like the hexdump -C command which\n\t  includes offsets, byte values in hex, and ASCII output\n\nThe configuration options are controlled by modifying the public members\nof c.  See ConfigState for options documentation.\n\nSee Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to\nget the formatted result as a string.\n*/\nfunc (c *ConfigState) Dump(a ...interface{}) {\n\tfdump(c, os.Stdout, a...)\n}\n\n// Sdump returns a string with the passed arguments formatted exactly the same\n// as Dump.\nfunc (c *ConfigState) Sdump(a ...interface{}) string {\n\tvar buf bytes.Buffer\n\tfdump(c, &buf, a...)\n\treturn buf.String()\n}\n\n// convertArgs accepts a slice of arguments and returns a slice of the same\n// length with each argument converted to a spew Formatter interface using\n// the ConfigState associated with s.\nfunc (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) {\n\tformatters = make([]interface{}, len(args))\n\tfor index, arg := range args {\n\t\tformatters[index] = newFormatter(c, arg)\n\t}\n\treturn formatters\n}\n\n// NewDefaultConfig returns a ConfigState with the following default settings.\n//\n// \tIndent: \" \"\n// \tMaxDepth: 0\n// \tDisableMethods: false\n// \tDisablePointerMethods: false\n// \tContinueOnMethod: false\n// \tSortKeys: false\nfunc NewDefaultConfig() *ConfigState {\n\treturn &ConfigState{Indent: \" \"}\n}\n"
  },
  {
    "path": "vendor/github.com/davecgh/go-spew/spew/doc.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\n/*\nPackage spew implements a deep pretty printer for Go data structures to aid in\ndebugging.\n\nA quick overview of the additional features spew provides over the built-in\nprinting facilities for Go data types are as follows:\n\n\t* Pointers are dereferenced and followed\n\t* Circular data structures are detected and handled properly\n\t* Custom Stringer/error interfaces are optionally invoked, including\n\t  on unexported types\n\t* Custom types which only implement the Stringer/error interfaces via\n\t  a pointer receiver are optionally invoked when passing non-pointer\n\t  variables\n\t* Byte arrays and slices are dumped like the hexdump -C command which\n\t  includes offsets, byte values in hex, and ASCII output (only when using\n\t  Dump style)\n\nThere are two different approaches spew allows for dumping Go data structures:\n\n\t* Dump style which prints with newlines, customizable indentation,\n\t  and additional debug information such as types and all pointer addresses\n\t  used to indirect to the final value\n\t* A custom Formatter interface that integrates cleanly with the standard fmt\n\t  package and replaces %v, %+v, %#v, and %#+v to provide inline printing\n\t  similar to the default %v while providing the additional functionality\n\t  outlined above and passing unsupported format verbs such as %x and %q\n\t  along to fmt\n\nQuick Start\n\nThis section demonstrates how to quickly get started with spew.  See the\nsections below for further details on formatting and configuration options.\n\nTo dump a variable with full newlines, indentation, type, and pointer\ninformation use Dump, Fdump, or Sdump:\n\tspew.Dump(myVar1, myVar2, ...)\n\tspew.Fdump(someWriter, myVar1, myVar2, ...)\n\tstr := spew.Sdump(myVar1, myVar2, ...)\n\nAlternatively, if you would prefer to use format strings with a compacted inline\nprinting style, use the convenience wrappers Printf, Fprintf, etc with\n%v (most compact), %+v (adds pointer addresses), %#v (adds types), or\n%#+v (adds types and pointer addresses):\n\tspew.Printf(\"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Printf(\"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\tspew.Fprintf(someWriter, \"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Fprintf(someWriter, \"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\nConfiguration Options\n\nConfiguration of spew is handled by fields in the ConfigState type.  For\nconvenience, all of the top-level functions use a global state available\nvia the spew.Config global.\n\nIt is also possible to create a ConfigState instance that provides methods\nequivalent to the top-level functions.  This allows concurrent configuration\noptions.  See the ConfigState documentation for more details.\n\nThe following configuration options are available:\n\t* Indent\n\t\tString to use for each indentation level for Dump functions.\n\t\tIt is a single space by default.  A popular alternative is \"\\t\".\n\n\t* MaxDepth\n\t\tMaximum number of levels to descend into nested data structures.\n\t\tThere is no limit by default.\n\n\t* DisableMethods\n\t\tDisables invocation of error and Stringer interface methods.\n\t\tMethod invocation is enabled by default.\n\n\t* DisablePointerMethods\n\t\tDisables invocation of error and Stringer interface methods on types\n\t\twhich only accept pointer receivers from non-pointer variables.\n\t\tPointer method invocation is enabled by default.\n\n\t* DisablePointerAddresses\n\t\tDisablePointerAddresses specifies whether to disable the printing of\n\t\tpointer addresses. This is useful when diffing data structures in tests.\n\n\t* DisableCapacities\n\t\tDisableCapacities specifies whether to disable the printing of\n\t\tcapacities for arrays, slices, maps and channels. This is useful when\n\t\tdiffing data structures in tests.\n\n\t* ContinueOnMethod\n\t\tEnables recursion into types after invoking error and Stringer interface\n\t\tmethods. Recursion after method invocation is disabled by default.\n\n\t* SortKeys\n\t\tSpecifies map keys should be sorted before being printed. Use\n\t\tthis to have a more deterministic, diffable output.  Note that\n\t\tonly native types (bool, int, uint, floats, uintptr and string)\n\t\tand types which implement error or Stringer interfaces are\n\t\tsupported with other types sorted according to the\n\t\treflect.Value.String() output which guarantees display\n\t\tstability.  Natural map order is used by default.\n\n\t* SpewKeys\n\t\tSpecifies that, as a last resort attempt, map keys should be\n\t\tspewed to strings and sorted by those strings.  This is only\n\t\tconsidered if SortKeys is true.\n\nDump Usage\n\nSimply call spew.Dump with a list of variables you want to dump:\n\n\tspew.Dump(myVar1, myVar2, ...)\n\nYou may also call spew.Fdump if you would prefer to output to an arbitrary\nio.Writer.  For example, to dump to standard error:\n\n\tspew.Fdump(os.Stderr, myVar1, myVar2, ...)\n\nA third option is to call spew.Sdump to get the formatted output as a string:\n\n\tstr := spew.Sdump(myVar1, myVar2, ...)\n\nSample Dump Output\n\nSee the Dump example for details on the setup of the types and variables being\nshown here.\n\n\t(main.Foo) {\n\t unexportedField: (*main.Bar)(0xf84002e210)({\n\t  flag: (main.Flag) flagTwo,\n\t  data: (uintptr) <nil>\n\t }),\n\t ExportedField: (map[interface {}]interface {}) (len=1) {\n\t  (string) (len=3) \"one\": (bool) true\n\t }\n\t}\n\nByte (and uint8) arrays and slices are displayed uniquely like the hexdump -C\ncommand as shown.\n\t([]uint8) (len=32 cap=32) {\n\t 00000000  11 12 13 14 15 16 17 18  19 1a 1b 1c 1d 1e 1f 20  |............... |\n\t 00000010  21 22 23 24 25 26 27 28  29 2a 2b 2c 2d 2e 2f 30  |!\"#$%&'()*+,-./0|\n\t 00000020  31 32                                             |12|\n\t}\n\nCustom Formatter\n\nSpew provides a custom formatter that implements the fmt.Formatter interface\nso that it integrates cleanly with standard fmt package printing functions. The\nformatter is useful for inline printing of smaller data types similar to the\nstandard %v format specifier.\n\nThe custom formatter only responds to the %v (most compact), %+v (adds pointer\naddresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb\ncombinations.  Any other verbs such as %x and %q will be sent to the the\nstandard fmt package for formatting.  In addition, the custom formatter ignores\nthe width and precision arguments (however they will still work on the format\nspecifiers not handled by the custom formatter).\n\nCustom Formatter Usage\n\nThe simplest way to make use of the spew custom formatter is to call one of the\nconvenience functions such as spew.Printf, spew.Println, or spew.Printf.  The\nfunctions have syntax you are most likely already familiar with:\n\n\tspew.Printf(\"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Printf(\"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\tspew.Println(myVar, myVar2)\n\tspew.Fprintf(os.Stderr, \"myVar1: %v -- myVar2: %+v\", myVar1, myVar2)\n\tspew.Fprintf(os.Stderr, \"myVar3: %#v -- myVar4: %#+v\", myVar3, myVar4)\n\nSee the Index for the full list convenience functions.\n\nSample Formatter Output\n\nDouble pointer to a uint8:\n\t  %v: <**>5\n\t %+v: <**>(0xf8400420d0->0xf8400420c8)5\n\t %#v: (**uint8)5\n\t%#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5\n\nPointer to circular struct with a uint8 field and a pointer to itself:\n\t  %v: <*>{1 <*><shown>}\n\t %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)<shown>}\n\t %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)<shown>}\n\t%#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)<shown>}\n\nSee the Printf example for details on the setup of variables being shown\nhere.\n\nErrors\n\nSince it is possible for custom Stringer/error interfaces to panic, spew\ndetects them and handles them internally by printing the panic information\ninline with the output.  Since spew is intended to provide deep pretty printing\ncapabilities on structures, it intentionally does not return any errors.\n*/\npackage spew\n"
  },
  {
    "path": "vendor/github.com/davecgh/go-spew/spew/dump.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"strings\"\n)\n\nvar (\n\t// uint8Type is a reflect.Type representing a uint8.  It is used to\n\t// convert cgo types to uint8 slices for hexdumping.\n\tuint8Type = reflect.TypeOf(uint8(0))\n\n\t// cCharRE is a regular expression that matches a cgo char.\n\t// It is used to detect character arrays to hexdump them.\n\tcCharRE = regexp.MustCompile(\"^.*\\\\._Ctype_char$\")\n\n\t// cUnsignedCharRE is a regular expression that matches a cgo unsigned\n\t// char.  It is used to detect unsigned character arrays to hexdump\n\t// them.\n\tcUnsignedCharRE = regexp.MustCompile(\"^.*\\\\._Ctype_unsignedchar$\")\n\n\t// cUint8tCharRE is a regular expression that matches a cgo uint8_t.\n\t// It is used to detect uint8_t arrays to hexdump them.\n\tcUint8tCharRE = regexp.MustCompile(\"^.*\\\\._Ctype_uint8_t$\")\n)\n\n// dumpState contains information about the state of a dump operation.\ntype dumpState struct {\n\tw                io.Writer\n\tdepth            int\n\tpointers         map[uintptr]int\n\tignoreNextType   bool\n\tignoreNextIndent bool\n\tcs               *ConfigState\n}\n\n// indent performs indentation according to the depth level and cs.Indent\n// option.\nfunc (d *dumpState) indent() {\n\tif d.ignoreNextIndent {\n\t\td.ignoreNextIndent = false\n\t\treturn\n\t}\n\td.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth))\n}\n\n// unpackValue returns values inside of non-nil interfaces when possible.\n// This is useful for data types like structs, arrays, slices, and maps which\n// can contain varying types packed inside an interface.\nfunc (d *dumpState) unpackValue(v reflect.Value) reflect.Value {\n\tif v.Kind() == reflect.Interface && !v.IsNil() {\n\t\tv = v.Elem()\n\t}\n\treturn v\n}\n\n// dumpPtr handles formatting of pointers by indirecting them as necessary.\nfunc (d *dumpState) dumpPtr(v reflect.Value) {\n\t// Remove pointers at or below the current depth from map used to detect\n\t// circular refs.\n\tfor k, depth := range d.pointers {\n\t\tif depth >= d.depth {\n\t\t\tdelete(d.pointers, k)\n\t\t}\n\t}\n\n\t// Keep list of all dereferenced pointers to show later.\n\tpointerChain := make([]uintptr, 0)\n\n\t// Figure out how many levels of indirection there are by dereferencing\n\t// pointers and unpacking interfaces down the chain while detecting circular\n\t// references.\n\tnilFound := false\n\tcycleFound := false\n\tindirects := 0\n\tve := v\n\tfor ve.Kind() == reflect.Ptr {\n\t\tif ve.IsNil() {\n\t\t\tnilFound = true\n\t\t\tbreak\n\t\t}\n\t\tindirects++\n\t\taddr := ve.Pointer()\n\t\tpointerChain = append(pointerChain, addr)\n\t\tif pd, ok := d.pointers[addr]; ok && pd < d.depth {\n\t\t\tcycleFound = true\n\t\t\tindirects--\n\t\t\tbreak\n\t\t}\n\t\td.pointers[addr] = d.depth\n\n\t\tve = ve.Elem()\n\t\tif ve.Kind() == reflect.Interface {\n\t\t\tif ve.IsNil() {\n\t\t\t\tnilFound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tve = ve.Elem()\n\t\t}\n\t}\n\n\t// Display type information.\n\td.w.Write(openParenBytes)\n\td.w.Write(bytes.Repeat(asteriskBytes, indirects))\n\td.w.Write([]byte(ve.Type().String()))\n\td.w.Write(closeParenBytes)\n\n\t// Display pointer information.\n\tif !d.cs.DisablePointerAddresses && len(pointerChain) > 0 {\n\t\td.w.Write(openParenBytes)\n\t\tfor i, addr := range pointerChain {\n\t\t\tif i > 0 {\n\t\t\t\td.w.Write(pointerChainBytes)\n\t\t\t}\n\t\t\tprintHexPtr(d.w, addr)\n\t\t}\n\t\td.w.Write(closeParenBytes)\n\t}\n\n\t// Display dereferenced value.\n\td.w.Write(openParenBytes)\n\tswitch {\n\tcase nilFound == true:\n\t\td.w.Write(nilAngleBytes)\n\n\tcase cycleFound == true:\n\t\td.w.Write(circularBytes)\n\n\tdefault:\n\t\td.ignoreNextType = true\n\t\td.dump(ve)\n\t}\n\td.w.Write(closeParenBytes)\n}\n\n// dumpSlice handles formatting of arrays and slices.  Byte (uint8 under\n// reflection) arrays and slices are dumped in hexdump -C fashion.\nfunc (d *dumpState) dumpSlice(v reflect.Value) {\n\t// Determine whether this type should be hex dumped or not.  Also,\n\t// for types which should be hexdumped, try to use the underlying data\n\t// first, then fall back to trying to convert them to a uint8 slice.\n\tvar buf []uint8\n\tdoConvert := false\n\tdoHexDump := false\n\tnumEntries := v.Len()\n\tif numEntries > 0 {\n\t\tvt := v.Index(0).Type()\n\t\tvts := vt.String()\n\t\tswitch {\n\t\t// C types that need to be converted.\n\t\tcase cCharRE.MatchString(vts):\n\t\t\tfallthrough\n\t\tcase cUnsignedCharRE.MatchString(vts):\n\t\t\tfallthrough\n\t\tcase cUint8tCharRE.MatchString(vts):\n\t\t\tdoConvert = true\n\n\t\t// Try to use existing uint8 slices and fall back to converting\n\t\t// and copying if that fails.\n\t\tcase vt.Kind() == reflect.Uint8:\n\t\t\t// We need an addressable interface to convert the type\n\t\t\t// to a byte slice.  However, the reflect package won't\n\t\t\t// give us an interface on certain things like\n\t\t\t// unexported struct fields in order to enforce\n\t\t\t// visibility rules.  We use unsafe, when available, to\n\t\t\t// bypass these restrictions since this package does not\n\t\t\t// mutate the values.\n\t\t\tvs := v\n\t\t\tif !vs.CanInterface() || !vs.CanAddr() {\n\t\t\t\tvs = unsafeReflectValue(vs)\n\t\t\t}\n\t\t\tif !UnsafeDisabled {\n\t\t\t\tvs = vs.Slice(0, numEntries)\n\n\t\t\t\t// Use the existing uint8 slice if it can be\n\t\t\t\t// type asserted.\n\t\t\t\tiface := vs.Interface()\n\t\t\t\tif slice, ok := iface.([]uint8); ok {\n\t\t\t\t\tbuf = slice\n\t\t\t\t\tdoHexDump = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// The underlying data needs to be converted if it can't\n\t\t\t// be type asserted to a uint8 slice.\n\t\t\tdoConvert = true\n\t\t}\n\n\t\t// Copy and convert the underlying type if needed.\n\t\tif doConvert && vt.ConvertibleTo(uint8Type) {\n\t\t\t// Convert and copy each element into a uint8 byte\n\t\t\t// slice.\n\t\t\tbuf = make([]uint8, numEntries)\n\t\t\tfor i := 0; i < numEntries; i++ {\n\t\t\t\tvv := v.Index(i)\n\t\t\t\tbuf[i] = uint8(vv.Convert(uint8Type).Uint())\n\t\t\t}\n\t\t\tdoHexDump = true\n\t\t}\n\t}\n\n\t// Hexdump the entire slice as needed.\n\tif doHexDump {\n\t\tindent := strings.Repeat(d.cs.Indent, d.depth)\n\t\tstr := indent + hex.Dump(buf)\n\t\tstr = strings.Replace(str, \"\\n\", \"\\n\"+indent, -1)\n\t\tstr = strings.TrimRight(str, d.cs.Indent)\n\t\td.w.Write([]byte(str))\n\t\treturn\n\t}\n\n\t// Recursively call dump for each item.\n\tfor i := 0; i < numEntries; i++ {\n\t\td.dump(d.unpackValue(v.Index(i)))\n\t\tif i < (numEntries - 1) {\n\t\t\td.w.Write(commaNewlineBytes)\n\t\t} else {\n\t\t\td.w.Write(newlineBytes)\n\t\t}\n\t}\n}\n\n// dump is the main workhorse for dumping a value.  It uses the passed reflect\n// value to figure out what kind of object we are dealing with and formats it\n// appropriately.  It is a recursive function, however circular data structures\n// are detected and handled properly.\nfunc (d *dumpState) dump(v reflect.Value) {\n\t// Handle invalid reflect values immediately.\n\tkind := v.Kind()\n\tif kind == reflect.Invalid {\n\t\td.w.Write(invalidAngleBytes)\n\t\treturn\n\t}\n\n\t// Handle pointers specially.\n\tif kind == reflect.Ptr {\n\t\td.indent()\n\t\td.dumpPtr(v)\n\t\treturn\n\t}\n\n\t// Print type information unless already handled elsewhere.\n\tif !d.ignoreNextType {\n\t\td.indent()\n\t\td.w.Write(openParenBytes)\n\t\td.w.Write([]byte(v.Type().String()))\n\t\td.w.Write(closeParenBytes)\n\t\td.w.Write(spaceBytes)\n\t}\n\td.ignoreNextType = false\n\n\t// Display length and capacity if the built-in len and cap functions\n\t// work with the value's kind and the len/cap itself is non-zero.\n\tvalueLen, valueCap := 0, 0\n\tswitch v.Kind() {\n\tcase reflect.Array, reflect.Slice, reflect.Chan:\n\t\tvalueLen, valueCap = v.Len(), v.Cap()\n\tcase reflect.Map, reflect.String:\n\t\tvalueLen = v.Len()\n\t}\n\tif valueLen != 0 || !d.cs.DisableCapacities && valueCap != 0 {\n\t\td.w.Write(openParenBytes)\n\t\tif valueLen != 0 {\n\t\t\td.w.Write(lenEqualsBytes)\n\t\t\tprintInt(d.w, int64(valueLen), 10)\n\t\t}\n\t\tif !d.cs.DisableCapacities && valueCap != 0 {\n\t\t\tif valueLen != 0 {\n\t\t\t\td.w.Write(spaceBytes)\n\t\t\t}\n\t\t\td.w.Write(capEqualsBytes)\n\t\t\tprintInt(d.w, int64(valueCap), 10)\n\t\t}\n\t\td.w.Write(closeParenBytes)\n\t\td.w.Write(spaceBytes)\n\t}\n\n\t// Call Stringer/error interfaces if they exist and the handle methods flag\n\t// is enabled\n\tif !d.cs.DisableMethods {\n\t\tif (kind != reflect.Invalid) && (kind != reflect.Interface) {\n\t\t\tif handled := handleMethods(d.cs, d.w, v); handled {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch kind {\n\tcase reflect.Invalid:\n\t\t// Do nothing.  We should never get here since invalid has already\n\t\t// been handled above.\n\n\tcase reflect.Bool:\n\t\tprintBool(d.w, v.Bool())\n\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\tprintInt(d.w, v.Int(), 10)\n\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\tprintUint(d.w, v.Uint(), 10)\n\n\tcase reflect.Float32:\n\t\tprintFloat(d.w, v.Float(), 32)\n\n\tcase reflect.Float64:\n\t\tprintFloat(d.w, v.Float(), 64)\n\n\tcase reflect.Complex64:\n\t\tprintComplex(d.w, v.Complex(), 32)\n\n\tcase reflect.Complex128:\n\t\tprintComplex(d.w, v.Complex(), 64)\n\n\tcase reflect.Slice:\n\t\tif v.IsNil() {\n\t\t\td.w.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\t\tfallthrough\n\n\tcase reflect.Array:\n\t\td.w.Write(openBraceNewlineBytes)\n\t\td.depth++\n\t\tif (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {\n\t\t\td.indent()\n\t\t\td.w.Write(maxNewlineBytes)\n\t\t} else {\n\t\t\td.dumpSlice(v)\n\t\t}\n\t\td.depth--\n\t\td.indent()\n\t\td.w.Write(closeBraceBytes)\n\n\tcase reflect.String:\n\t\td.w.Write([]byte(strconv.Quote(v.String())))\n\n\tcase reflect.Interface:\n\t\t// The only time we should get here is for nil interfaces due to\n\t\t// unpackValue calls.\n\t\tif v.IsNil() {\n\t\t\td.w.Write(nilAngleBytes)\n\t\t}\n\n\tcase reflect.Ptr:\n\t\t// Do nothing.  We should never get here since pointers have already\n\t\t// been handled above.\n\n\tcase reflect.Map:\n\t\t// nil maps should be indicated as different than empty maps\n\t\tif v.IsNil() {\n\t\t\td.w.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\n\t\td.w.Write(openBraceNewlineBytes)\n\t\td.depth++\n\t\tif (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {\n\t\t\td.indent()\n\t\t\td.w.Write(maxNewlineBytes)\n\t\t} else {\n\t\t\tnumEntries := v.Len()\n\t\t\tkeys := v.MapKeys()\n\t\t\tif d.cs.SortKeys {\n\t\t\t\tsortValues(keys, d.cs)\n\t\t\t}\n\t\t\tfor i, key := range keys {\n\t\t\t\td.dump(d.unpackValue(key))\n\t\t\t\td.w.Write(colonSpaceBytes)\n\t\t\t\td.ignoreNextIndent = true\n\t\t\t\td.dump(d.unpackValue(v.MapIndex(key)))\n\t\t\t\tif i < (numEntries - 1) {\n\t\t\t\t\td.w.Write(commaNewlineBytes)\n\t\t\t\t} else {\n\t\t\t\t\td.w.Write(newlineBytes)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\td.depth--\n\t\td.indent()\n\t\td.w.Write(closeBraceBytes)\n\n\tcase reflect.Struct:\n\t\td.w.Write(openBraceNewlineBytes)\n\t\td.depth++\n\t\tif (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {\n\t\t\td.indent()\n\t\t\td.w.Write(maxNewlineBytes)\n\t\t} else {\n\t\t\tvt := v.Type()\n\t\t\tnumFields := v.NumField()\n\t\t\tfor i := 0; i < numFields; i++ {\n\t\t\t\td.indent()\n\t\t\t\tvtf := vt.Field(i)\n\t\t\t\td.w.Write([]byte(vtf.Name))\n\t\t\t\td.w.Write(colonSpaceBytes)\n\t\t\t\td.ignoreNextIndent = true\n\t\t\t\td.dump(d.unpackValue(v.Field(i)))\n\t\t\t\tif i < (numFields - 1) {\n\t\t\t\t\td.w.Write(commaNewlineBytes)\n\t\t\t\t} else {\n\t\t\t\t\td.w.Write(newlineBytes)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\td.depth--\n\t\td.indent()\n\t\td.w.Write(closeBraceBytes)\n\n\tcase reflect.Uintptr:\n\t\tprintHexPtr(d.w, uintptr(v.Uint()))\n\n\tcase reflect.UnsafePointer, reflect.Chan, reflect.Func:\n\t\tprintHexPtr(d.w, v.Pointer())\n\n\t// There were not any other types at the time this code was written, but\n\t// fall back to letting the default fmt package handle it in case any new\n\t// types are added.\n\tdefault:\n\t\tif v.CanInterface() {\n\t\t\tfmt.Fprintf(d.w, \"%v\", v.Interface())\n\t\t} else {\n\t\t\tfmt.Fprintf(d.w, \"%v\", v.String())\n\t\t}\n\t}\n}\n\n// fdump is a helper function to consolidate the logic from the various public\n// methods which take varying writers and config states.\nfunc fdump(cs *ConfigState, w io.Writer, a ...interface{}) {\n\tfor _, arg := range a {\n\t\tif arg == nil {\n\t\t\tw.Write(interfaceBytes)\n\t\t\tw.Write(spaceBytes)\n\t\t\tw.Write(nilAngleBytes)\n\t\t\tw.Write(newlineBytes)\n\t\t\tcontinue\n\t\t}\n\n\t\td := dumpState{w: w, cs: cs}\n\t\td.pointers = make(map[uintptr]int)\n\t\td.dump(reflect.ValueOf(arg))\n\t\td.w.Write(newlineBytes)\n\t}\n}\n\n// Fdump formats and displays the passed arguments to io.Writer w.  It formats\n// exactly the same as Dump.\nfunc Fdump(w io.Writer, a ...interface{}) {\n\tfdump(&Config, w, a...)\n}\n\n// Sdump returns a string with the passed arguments formatted exactly the same\n// as Dump.\nfunc Sdump(a ...interface{}) string {\n\tvar buf bytes.Buffer\n\tfdump(&Config, &buf, a...)\n\treturn buf.String()\n}\n\n/*\nDump displays the passed parameters to standard out with newlines, customizable\nindentation, and additional debug information such as complete types and all\npointer addresses used to indirect to the final value.  It provides the\nfollowing features over the built-in printing facilities provided by the fmt\npackage:\n\n\t* Pointers are dereferenced and followed\n\t* Circular data structures are detected and handled properly\n\t* Custom Stringer/error interfaces are optionally invoked, including\n\t  on unexported types\n\t* Custom types which only implement the Stringer/error interfaces via\n\t  a pointer receiver are optionally invoked when passing non-pointer\n\t  variables\n\t* Byte arrays and slices are dumped like the hexdump -C command which\n\t  includes offsets, byte values in hex, and ASCII output\n\nThe configuration options are controlled by an exported package global,\nspew.Config.  See ConfigState for options documentation.\n\nSee Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to\nget the formatted result as a string.\n*/\nfunc Dump(a ...interface{}) {\n\tfdump(&Config, os.Stdout, a...)\n}\n"
  },
  {
    "path": "vendor/github.com/davecgh/go-spew/spew/format.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// supportedFlags is a list of all the character flags supported by fmt package.\nconst supportedFlags = \"0-+# \"\n\n// formatState implements the fmt.Formatter interface and contains information\n// about the state of a formatting operation.  The NewFormatter function can\n// be used to get a new Formatter which can be used directly as arguments\n// in standard fmt package printing calls.\ntype formatState struct {\n\tvalue          interface{}\n\tfs             fmt.State\n\tdepth          int\n\tpointers       map[uintptr]int\n\tignoreNextType bool\n\tcs             *ConfigState\n}\n\n// buildDefaultFormat recreates the original format string without precision\n// and width information to pass in to fmt.Sprintf in the case of an\n// unrecognized type.  Unless new types are added to the language, this\n// function won't ever be called.\nfunc (f *formatState) buildDefaultFormat() (format string) {\n\tbuf := bytes.NewBuffer(percentBytes)\n\n\tfor _, flag := range supportedFlags {\n\t\tif f.fs.Flag(int(flag)) {\n\t\t\tbuf.WriteRune(flag)\n\t\t}\n\t}\n\n\tbuf.WriteRune('v')\n\n\tformat = buf.String()\n\treturn format\n}\n\n// constructOrigFormat recreates the original format string including precision\n// and width information to pass along to the standard fmt package.  This allows\n// automatic deferral of all format strings this package doesn't support.\nfunc (f *formatState) constructOrigFormat(verb rune) (format string) {\n\tbuf := bytes.NewBuffer(percentBytes)\n\n\tfor _, flag := range supportedFlags {\n\t\tif f.fs.Flag(int(flag)) {\n\t\t\tbuf.WriteRune(flag)\n\t\t}\n\t}\n\n\tif width, ok := f.fs.Width(); ok {\n\t\tbuf.WriteString(strconv.Itoa(width))\n\t}\n\n\tif precision, ok := f.fs.Precision(); ok {\n\t\tbuf.Write(precisionBytes)\n\t\tbuf.WriteString(strconv.Itoa(precision))\n\t}\n\n\tbuf.WriteRune(verb)\n\n\tformat = buf.String()\n\treturn format\n}\n\n// unpackValue returns values inside of non-nil interfaces when possible and\n// ensures that types for values which have been unpacked from an interface\n// are displayed when the show types flag is also set.\n// This is useful for data types like structs, arrays, slices, and maps which\n// can contain varying types packed inside an interface.\nfunc (f *formatState) unpackValue(v reflect.Value) reflect.Value {\n\tif v.Kind() == reflect.Interface {\n\t\tf.ignoreNextType = false\n\t\tif !v.IsNil() {\n\t\t\tv = v.Elem()\n\t\t}\n\t}\n\treturn v\n}\n\n// formatPtr handles formatting of pointers by indirecting them as necessary.\nfunc (f *formatState) formatPtr(v reflect.Value) {\n\t// Display nil if top level pointer is nil.\n\tshowTypes := f.fs.Flag('#')\n\tif v.IsNil() && (!showTypes || f.ignoreNextType) {\n\t\tf.fs.Write(nilAngleBytes)\n\t\treturn\n\t}\n\n\t// Remove pointers at or below the current depth from map used to detect\n\t// circular refs.\n\tfor k, depth := range f.pointers {\n\t\tif depth >= f.depth {\n\t\t\tdelete(f.pointers, k)\n\t\t}\n\t}\n\n\t// Keep list of all dereferenced pointers to possibly show later.\n\tpointerChain := make([]uintptr, 0)\n\n\t// Figure out how many levels of indirection there are by derferencing\n\t// pointers and unpacking interfaces down the chain while detecting circular\n\t// references.\n\tnilFound := false\n\tcycleFound := false\n\tindirects := 0\n\tve := v\n\tfor ve.Kind() == reflect.Ptr {\n\t\tif ve.IsNil() {\n\t\t\tnilFound = true\n\t\t\tbreak\n\t\t}\n\t\tindirects++\n\t\taddr := ve.Pointer()\n\t\tpointerChain = append(pointerChain, addr)\n\t\tif pd, ok := f.pointers[addr]; ok && pd < f.depth {\n\t\t\tcycleFound = true\n\t\t\tindirects--\n\t\t\tbreak\n\t\t}\n\t\tf.pointers[addr] = f.depth\n\n\t\tve = ve.Elem()\n\t\tif ve.Kind() == reflect.Interface {\n\t\t\tif ve.IsNil() {\n\t\t\t\tnilFound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tve = ve.Elem()\n\t\t}\n\t}\n\n\t// Display type or indirection level depending on flags.\n\tif showTypes && !f.ignoreNextType {\n\t\tf.fs.Write(openParenBytes)\n\t\tf.fs.Write(bytes.Repeat(asteriskBytes, indirects))\n\t\tf.fs.Write([]byte(ve.Type().String()))\n\t\tf.fs.Write(closeParenBytes)\n\t} else {\n\t\tif nilFound || cycleFound {\n\t\t\tindirects += strings.Count(ve.Type().String(), \"*\")\n\t\t}\n\t\tf.fs.Write(openAngleBytes)\n\t\tf.fs.Write([]byte(strings.Repeat(\"*\", indirects)))\n\t\tf.fs.Write(closeAngleBytes)\n\t}\n\n\t// Display pointer information depending on flags.\n\tif f.fs.Flag('+') && (len(pointerChain) > 0) {\n\t\tf.fs.Write(openParenBytes)\n\t\tfor i, addr := range pointerChain {\n\t\t\tif i > 0 {\n\t\t\t\tf.fs.Write(pointerChainBytes)\n\t\t\t}\n\t\t\tprintHexPtr(f.fs, addr)\n\t\t}\n\t\tf.fs.Write(closeParenBytes)\n\t}\n\n\t// Display dereferenced value.\n\tswitch {\n\tcase nilFound == true:\n\t\tf.fs.Write(nilAngleBytes)\n\n\tcase cycleFound == true:\n\t\tf.fs.Write(circularShortBytes)\n\n\tdefault:\n\t\tf.ignoreNextType = true\n\t\tf.format(ve)\n\t}\n}\n\n// format is the main workhorse for providing the Formatter interface.  It\n// uses the passed reflect value to figure out what kind of object we are\n// dealing with and formats it appropriately.  It is a recursive function,\n// however circular data structures are detected and handled properly.\nfunc (f *formatState) format(v reflect.Value) {\n\t// Handle invalid reflect values immediately.\n\tkind := v.Kind()\n\tif kind == reflect.Invalid {\n\t\tf.fs.Write(invalidAngleBytes)\n\t\treturn\n\t}\n\n\t// Handle pointers specially.\n\tif kind == reflect.Ptr {\n\t\tf.formatPtr(v)\n\t\treturn\n\t}\n\n\t// Print type information unless already handled elsewhere.\n\tif !f.ignoreNextType && f.fs.Flag('#') {\n\t\tf.fs.Write(openParenBytes)\n\t\tf.fs.Write([]byte(v.Type().String()))\n\t\tf.fs.Write(closeParenBytes)\n\t}\n\tf.ignoreNextType = false\n\n\t// Call Stringer/error interfaces if they exist and the handle methods\n\t// flag is enabled.\n\tif !f.cs.DisableMethods {\n\t\tif (kind != reflect.Invalid) && (kind != reflect.Interface) {\n\t\t\tif handled := handleMethods(f.cs, f.fs, v); handled {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch kind {\n\tcase reflect.Invalid:\n\t\t// Do nothing.  We should never get here since invalid has already\n\t\t// been handled above.\n\n\tcase reflect.Bool:\n\t\tprintBool(f.fs, v.Bool())\n\n\tcase reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:\n\t\tprintInt(f.fs, v.Int(), 10)\n\n\tcase reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:\n\t\tprintUint(f.fs, v.Uint(), 10)\n\n\tcase reflect.Float32:\n\t\tprintFloat(f.fs, v.Float(), 32)\n\n\tcase reflect.Float64:\n\t\tprintFloat(f.fs, v.Float(), 64)\n\n\tcase reflect.Complex64:\n\t\tprintComplex(f.fs, v.Complex(), 32)\n\n\tcase reflect.Complex128:\n\t\tprintComplex(f.fs, v.Complex(), 64)\n\n\tcase reflect.Slice:\n\t\tif v.IsNil() {\n\t\t\tf.fs.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\t\tfallthrough\n\n\tcase reflect.Array:\n\t\tf.fs.Write(openBracketBytes)\n\t\tf.depth++\n\t\tif (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {\n\t\t\tf.fs.Write(maxShortBytes)\n\t\t} else {\n\t\t\tnumEntries := v.Len()\n\t\t\tfor i := 0; i < numEntries; i++ {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tf.fs.Write(spaceBytes)\n\t\t\t\t}\n\t\t\t\tf.ignoreNextType = true\n\t\t\t\tf.format(f.unpackValue(v.Index(i)))\n\t\t\t}\n\t\t}\n\t\tf.depth--\n\t\tf.fs.Write(closeBracketBytes)\n\n\tcase reflect.String:\n\t\tf.fs.Write([]byte(v.String()))\n\n\tcase reflect.Interface:\n\t\t// The only time we should get here is for nil interfaces due to\n\t\t// unpackValue calls.\n\t\tif v.IsNil() {\n\t\t\tf.fs.Write(nilAngleBytes)\n\t\t}\n\n\tcase reflect.Ptr:\n\t\t// Do nothing.  We should never get here since pointers have already\n\t\t// been handled above.\n\n\tcase reflect.Map:\n\t\t// nil maps should be indicated as different than empty maps\n\t\tif v.IsNil() {\n\t\t\tf.fs.Write(nilAngleBytes)\n\t\t\tbreak\n\t\t}\n\n\t\tf.fs.Write(openMapBytes)\n\t\tf.depth++\n\t\tif (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {\n\t\t\tf.fs.Write(maxShortBytes)\n\t\t} else {\n\t\t\tkeys := v.MapKeys()\n\t\t\tif f.cs.SortKeys {\n\t\t\t\tsortValues(keys, f.cs)\n\t\t\t}\n\t\t\tfor i, key := range keys {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tf.fs.Write(spaceBytes)\n\t\t\t\t}\n\t\t\t\tf.ignoreNextType = true\n\t\t\t\tf.format(f.unpackValue(key))\n\t\t\t\tf.fs.Write(colonBytes)\n\t\t\t\tf.ignoreNextType = true\n\t\t\t\tf.format(f.unpackValue(v.MapIndex(key)))\n\t\t\t}\n\t\t}\n\t\tf.depth--\n\t\tf.fs.Write(closeMapBytes)\n\n\tcase reflect.Struct:\n\t\tnumFields := v.NumField()\n\t\tf.fs.Write(openBraceBytes)\n\t\tf.depth++\n\t\tif (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {\n\t\t\tf.fs.Write(maxShortBytes)\n\t\t} else {\n\t\t\tvt := v.Type()\n\t\t\tfor i := 0; i < numFields; i++ {\n\t\t\t\tif i > 0 {\n\t\t\t\t\tf.fs.Write(spaceBytes)\n\t\t\t\t}\n\t\t\t\tvtf := vt.Field(i)\n\t\t\t\tif f.fs.Flag('+') || f.fs.Flag('#') {\n\t\t\t\t\tf.fs.Write([]byte(vtf.Name))\n\t\t\t\t\tf.fs.Write(colonBytes)\n\t\t\t\t}\n\t\t\t\tf.format(f.unpackValue(v.Field(i)))\n\t\t\t}\n\t\t}\n\t\tf.depth--\n\t\tf.fs.Write(closeBraceBytes)\n\n\tcase reflect.Uintptr:\n\t\tprintHexPtr(f.fs, uintptr(v.Uint()))\n\n\tcase reflect.UnsafePointer, reflect.Chan, reflect.Func:\n\t\tprintHexPtr(f.fs, v.Pointer())\n\n\t// There were not any other types at the time this code was written, but\n\t// fall back to letting the default fmt package handle it if any get added.\n\tdefault:\n\t\tformat := f.buildDefaultFormat()\n\t\tif v.CanInterface() {\n\t\t\tfmt.Fprintf(f.fs, format, v.Interface())\n\t\t} else {\n\t\t\tfmt.Fprintf(f.fs, format, v.String())\n\t\t}\n\t}\n}\n\n// Format satisfies the fmt.Formatter interface. See NewFormatter for usage\n// details.\nfunc (f *formatState) Format(fs fmt.State, verb rune) {\n\tf.fs = fs\n\n\t// Use standard formatting for verbs that are not v.\n\tif verb != 'v' {\n\t\tformat := f.constructOrigFormat(verb)\n\t\tfmt.Fprintf(fs, format, f.value)\n\t\treturn\n\t}\n\n\tif f.value == nil {\n\t\tif fs.Flag('#') {\n\t\t\tfs.Write(interfaceBytes)\n\t\t}\n\t\tfs.Write(nilAngleBytes)\n\t\treturn\n\t}\n\n\tf.format(reflect.ValueOf(f.value))\n}\n\n// newFormatter is a helper function to consolidate the logic from the various\n// public methods which take varying config states.\nfunc newFormatter(cs *ConfigState, v interface{}) fmt.Formatter {\n\tfs := &formatState{value: v, cs: cs}\n\tfs.pointers = make(map[uintptr]int)\n\treturn fs\n}\n\n/*\nNewFormatter returns a custom formatter that satisfies the fmt.Formatter\ninterface.  As a result, it integrates cleanly with standard fmt package\nprinting functions.  The formatter is useful for inline printing of smaller data\ntypes similar to the standard %v format specifier.\n\nThe custom formatter only responds to the %v (most compact), %+v (adds pointer\naddresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb\ncombinations.  Any other verbs such as %x and %q will be sent to the the\nstandard fmt package for formatting.  In addition, the custom formatter ignores\nthe width and precision arguments (however they will still work on the format\nspecifiers not handled by the custom formatter).\n\nTypically this function shouldn't be called directly.  It is much easier to make\nuse of the custom formatter by calling one of the convenience functions such as\nPrintf, Println, or Fprintf.\n*/\nfunc NewFormatter(v interface{}) fmt.Formatter {\n\treturn newFormatter(&Config, v)\n}\n"
  },
  {
    "path": "vendor/github.com/davecgh/go-spew/spew/spew.go",
    "content": "/*\n * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\npackage spew\n\nimport (\n\t\"fmt\"\n\t\"io\"\n)\n\n// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the formatted string as a value that satisfies error.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Errorf(format string, a ...interface{}) (err error) {\n\treturn fmt.Errorf(format, convertArgs(a)...)\n}\n\n// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Fprint(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprint(w, convertArgs(a)...)\n}\n\n// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintf(w, format, convertArgs(a)...)\n}\n\n// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it\n// passed with a default Formatter interface returned by NewFormatter.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Fprintln(w io.Writer, a ...interface{}) (n int, err error) {\n\treturn fmt.Fprintln(w, convertArgs(a)...)\n}\n\n// Print is a wrapper for fmt.Print that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Print(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Print(a ...interface{}) (n int, err error) {\n\treturn fmt.Print(convertArgs(a)...)\n}\n\n// Printf is a wrapper for fmt.Printf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Printf(format string, a ...interface{}) (n int, err error) {\n\treturn fmt.Printf(format, convertArgs(a)...)\n}\n\n// Println is a wrapper for fmt.Println that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the number of bytes written and any write error encountered.  See\n// NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Println(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Println(a ...interface{}) (n int, err error) {\n\treturn fmt.Println(convertArgs(a)...)\n}\n\n// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Sprint(a ...interface{}) string {\n\treturn fmt.Sprint(convertArgs(a)...)\n}\n\n// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were\n// passed with a default Formatter interface returned by NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Sprintf(format string, a ...interface{}) string {\n\treturn fmt.Sprintf(format, convertArgs(a)...)\n}\n\n// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it\n// were passed with a default Formatter interface returned by NewFormatter.  It\n// returns the resulting string.  See NewFormatter for formatting details.\n//\n// This function is shorthand for the following syntax:\n//\n//\tfmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b))\nfunc Sprintln(a ...interface{}) string {\n\treturn fmt.Sprintln(convertArgs(a)...)\n}\n\n// convertArgs accepts a slice of arguments and returns a slice of the same\n// length with each argument converted to a default spew Formatter interface.\nfunc convertArgs(args []interface{}) (formatters []interface{}) {\n\tformatters = make([]interface{}, len(args))\n\tfor index, arg := range args {\n\t\tformatters[index] = NewFormatter(arg)\n\t}\n\treturn formatters\n}\n"
  },
  {
    "path": "vendor/github.com/pkg/errors/LICENSE",
    "content": "Copyright (c) 2015, Dave Cheney <dave@cheney.net>\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (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"
  },
  {
    "path": "vendor/github.com/pkg/errors/errors.go",
    "content": "// Package errors provides simple error handling primitives.\n//\n// The traditional error handling idiom in Go is roughly akin to\n//\n//     if err != nil {\n//             return err\n//     }\n//\n// which applied recursively up the call stack results in error reports\n// without context or debugging information. The errors package allows\n// programmers to add context to the failure path in their code in a way\n// that does not destroy the original value of the error.\n//\n// Adding context to an error\n//\n// The errors.Wrap function returns a new error that adds context to the\n// original error by recording a stack trace at the point Wrap is called,\n// and the supplied message. For example\n//\n//     _, err := ioutil.ReadAll(r)\n//     if err != nil {\n//             return errors.Wrap(err, \"read failed\")\n//     }\n//\n// If additional control is required the errors.WithStack and errors.WithMessage\n// functions destructure errors.Wrap into its component operations of annotating\n// an error with a stack trace and an a message, respectively.\n//\n// Retrieving the cause of an error\n//\n// Using errors.Wrap constructs a stack of errors, adding context to the\n// preceding error. Depending on the nature of the error it may be necessary\n// to reverse the operation of errors.Wrap to retrieve the original error\n// for inspection. Any error value which implements this interface\n//\n//     type causer interface {\n//             Cause() error\n//     }\n//\n// can be inspected by errors.Cause. errors.Cause will recursively retrieve\n// the topmost error which does not implement causer, which is assumed to be\n// the original cause. For example:\n//\n//     switch err := errors.Cause(err).(type) {\n//     case *MyError:\n//             // handle specifically\n//     default:\n//             // unknown error\n//     }\n//\n// causer interface is not exported by this package, but is considered a part\n// of stable public API.\n//\n// Formatted printing of errors\n//\n// All error values returned from this package implement fmt.Formatter and can\n// be formatted by the fmt package. The following verbs are supported\n//\n//     %s    print the error. If the error has a Cause it will be\n//           printed recursively\n//     %v    see %s\n//     %+v   extended format. Each Frame of the error's StackTrace will\n//           be printed in detail.\n//\n// Retrieving the stack trace of an error or wrapper\n//\n// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are\n// invoked. This information can be retrieved with the following interface.\n//\n//     type stackTracer interface {\n//             StackTrace() errors.StackTrace\n//     }\n//\n// Where errors.StackTrace is defined as\n//\n//     type StackTrace []Frame\n//\n// The Frame type represents a call site in the stack trace. Frame supports\n// the fmt.Formatter interface that can be used for printing information about\n// the stack trace of this error. For example:\n//\n//     if err, ok := err.(stackTracer); ok {\n//             for _, f := range err.StackTrace() {\n//                     fmt.Printf(\"%+s:%d\", f)\n//             }\n//     }\n//\n// stackTracer interface is not exported by this package, but is considered a part\n// of stable public API.\n//\n// See the documentation for Frame.Format for more details.\npackage errors\n\nimport (\n\t\"fmt\"\n\t\"io\"\n)\n\n// New returns an error with the supplied message.\n// New also records the stack trace at the point it was called.\nfunc New(message string) error {\n\treturn &fundamental{\n\t\tmsg:   message,\n\t\tstack: callers(),\n\t}\n}\n\n// Errorf formats according to a format specifier and returns the string\n// as a value that satisfies error.\n// Errorf also records the stack trace at the point it was called.\nfunc Errorf(format string, args ...interface{}) error {\n\treturn &fundamental{\n\t\tmsg:   fmt.Sprintf(format, args...),\n\t\tstack: callers(),\n\t}\n}\n\n// fundamental is an error that has a message and a stack, but no caller.\ntype fundamental struct {\n\tmsg string\n\t*stack\n}\n\nfunc (f *fundamental) Error() string { return f.msg }\n\nfunc (f *fundamental) Format(s fmt.State, verb rune) {\n\tswitch verb {\n\tcase 'v':\n\t\tif s.Flag('+') {\n\t\t\tio.WriteString(s, f.msg)\n\t\t\tf.stack.Format(s, verb)\n\t\t\treturn\n\t\t}\n\t\tfallthrough\n\tcase 's':\n\t\tio.WriteString(s, f.msg)\n\tcase 'q':\n\t\tfmt.Fprintf(s, \"%q\", f.msg)\n\t}\n}\n\n// WithStack annotates err with a stack trace at the point WithStack was called.\n// If err is nil, WithStack returns nil.\nfunc WithStack(err error) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\treturn &withStack{\n\t\terr,\n\t\tcallers(),\n\t}\n}\n\ntype withStack struct {\n\terror\n\t*stack\n}\n\nfunc (w *withStack) Cause() error { return w.error }\n\nfunc (w *withStack) Format(s fmt.State, verb rune) {\n\tswitch verb {\n\tcase 'v':\n\t\tif s.Flag('+') {\n\t\t\tfmt.Fprintf(s, \"%+v\", w.Cause())\n\t\t\tw.stack.Format(s, verb)\n\t\t\treturn\n\t\t}\n\t\tfallthrough\n\tcase 's':\n\t\tio.WriteString(s, w.Error())\n\tcase 'q':\n\t\tfmt.Fprintf(s, \"%q\", w.Error())\n\t}\n}\n\n// Wrap returns an error annotating err with a stack trace\n// at the point Wrap is called, and the supplied message.\n// If err is nil, Wrap returns nil.\nfunc Wrap(err error, message string) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\terr = &withMessage{\n\t\tcause: err,\n\t\tmsg:   message,\n\t}\n\treturn &withStack{\n\t\terr,\n\t\tcallers(),\n\t}\n}\n\n// Wrapf returns an error annotating err with a stack trace\n// at the point Wrapf is call, and the format specifier.\n// If err is nil, Wrapf returns nil.\nfunc Wrapf(err error, format string, args ...interface{}) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\terr = &withMessage{\n\t\tcause: err,\n\t\tmsg:   fmt.Sprintf(format, args...),\n\t}\n\treturn &withStack{\n\t\terr,\n\t\tcallers(),\n\t}\n}\n\n// WithMessage annotates err with a new message.\n// If err is nil, WithMessage returns nil.\nfunc WithMessage(err error, message string) error {\n\tif err == nil {\n\t\treturn nil\n\t}\n\treturn &withMessage{\n\t\tcause: err,\n\t\tmsg:   message,\n\t}\n}\n\ntype withMessage struct {\n\tcause error\n\tmsg   string\n}\n\nfunc (w *withMessage) Error() string { return w.msg + \": \" + w.cause.Error() }\nfunc (w *withMessage) Cause() error  { return w.cause }\n\nfunc (w *withMessage) Format(s fmt.State, verb rune) {\n\tswitch verb {\n\tcase 'v':\n\t\tif s.Flag('+') {\n\t\t\tfmt.Fprintf(s, \"%+v\\n\", w.Cause())\n\t\t\tio.WriteString(s, w.msg)\n\t\t\treturn\n\t\t}\n\t\tfallthrough\n\tcase 's', 'q':\n\t\tio.WriteString(s, w.Error())\n\t}\n}\n\n// Cause returns the underlying cause of the error, if possible.\n// An error value has a cause if it implements the following\n// interface:\n//\n//     type causer interface {\n//            Cause() error\n//     }\n//\n// If the error does not implement Cause, the original error will\n// be returned. If the error is nil, nil will be returned without further\n// investigation.\nfunc Cause(err error) error {\n\ttype causer interface {\n\t\tCause() error\n\t}\n\n\tfor err != nil {\n\t\tcause, ok := err.(causer)\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\terr = cause.Cause()\n\t}\n\treturn err\n}\n"
  },
  {
    "path": "vendor/github.com/pkg/errors/stack.go",
    "content": "package errors\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"path\"\n\t\"runtime\"\n\t\"strings\"\n)\n\n// Frame represents a program counter inside a stack frame.\ntype Frame uintptr\n\n// pc returns the program counter for this frame;\n// multiple frames may have the same PC value.\nfunc (f Frame) pc() uintptr { return uintptr(f) - 1 }\n\n// file returns the full path to the file that contains the\n// function for this Frame's pc.\nfunc (f Frame) file() string {\n\tfn := runtime.FuncForPC(f.pc())\n\tif fn == nil {\n\t\treturn \"unknown\"\n\t}\n\tfile, _ := fn.FileLine(f.pc())\n\treturn file\n}\n\n// line returns the line number of source code of the\n// function for this Frame's pc.\nfunc (f Frame) line() int {\n\tfn := runtime.FuncForPC(f.pc())\n\tif fn == nil {\n\t\treturn 0\n\t}\n\t_, line := fn.FileLine(f.pc())\n\treturn line\n}\n\n// Format formats the frame according to the fmt.Formatter interface.\n//\n//    %s    source file\n//    %d    source line\n//    %n    function name\n//    %v    equivalent to %s:%d\n//\n// Format accepts flags that alter the printing of some verbs, as follows:\n//\n//    %+s   path of source file relative to the compile time GOPATH\n//    %+v   equivalent to %+s:%d\nfunc (f Frame) Format(s fmt.State, verb rune) {\n\tswitch verb {\n\tcase 's':\n\t\tswitch {\n\t\tcase s.Flag('+'):\n\t\t\tpc := f.pc()\n\t\t\tfn := runtime.FuncForPC(pc)\n\t\t\tif fn == nil {\n\t\t\t\tio.WriteString(s, \"unknown\")\n\t\t\t} else {\n\t\t\t\tfile, _ := fn.FileLine(pc)\n\t\t\t\tfmt.Fprintf(s, \"%s\\n\\t%s\", fn.Name(), file)\n\t\t\t}\n\t\tdefault:\n\t\t\tio.WriteString(s, path.Base(f.file()))\n\t\t}\n\tcase 'd':\n\t\tfmt.Fprintf(s, \"%d\", f.line())\n\tcase 'n':\n\t\tname := runtime.FuncForPC(f.pc()).Name()\n\t\tio.WriteString(s, funcname(name))\n\tcase 'v':\n\t\tf.Format(s, 's')\n\t\tio.WriteString(s, \":\")\n\t\tf.Format(s, 'd')\n\t}\n}\n\n// StackTrace is stack of Frames from innermost (newest) to outermost (oldest).\ntype StackTrace []Frame\n\nfunc (st StackTrace) Format(s fmt.State, verb rune) {\n\tswitch verb {\n\tcase 'v':\n\t\tswitch {\n\t\tcase s.Flag('+'):\n\t\t\tfor _, f := range st {\n\t\t\t\tfmt.Fprintf(s, \"\\n%+v\", f)\n\t\t\t}\n\t\tcase s.Flag('#'):\n\t\t\tfmt.Fprintf(s, \"%#v\", []Frame(st))\n\t\tdefault:\n\t\t\tfmt.Fprintf(s, \"%v\", []Frame(st))\n\t\t}\n\tcase 's':\n\t\tfmt.Fprintf(s, \"%s\", []Frame(st))\n\t}\n}\n\n// stack represents a stack of program counters.\ntype stack []uintptr\n\nfunc (s *stack) Format(st fmt.State, verb rune) {\n\tswitch verb {\n\tcase 'v':\n\t\tswitch {\n\t\tcase st.Flag('+'):\n\t\t\tfor _, pc := range *s {\n\t\t\t\tf := Frame(pc)\n\t\t\t\tfmt.Fprintf(st, \"\\n%+v\", f)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc (s *stack) StackTrace() StackTrace {\n\tf := make([]Frame, len(*s))\n\tfor i := 0; i < len(f); i++ {\n\t\tf[i] = Frame((*s)[i])\n\t}\n\treturn f\n}\n\nfunc callers() *stack {\n\tconst depth = 32\n\tvar pcs [depth]uintptr\n\tn := runtime.Callers(3, pcs[:])\n\tvar st stack = pcs[0:n]\n\treturn &st\n}\n\n// funcname removes the path prefix component of a function's name reported by func.Name().\nfunc funcname(name string) string {\n\ti := strings.LastIndex(name, \"/\")\n\tname = name[i+1:]\n\ti = strings.Index(name, \".\")\n\treturn name[i+1:]\n}\n\nfunc trimGOPATH(name, file string) string {\n\t// Here we want to get the source file path relative to the compile time\n\t// GOPATH. As of Go 1.6.x there is no direct way to know the compiled\n\t// GOPATH at runtime, but we can infer the number of path segments in the\n\t// GOPATH. We note that fn.Name() returns the function name qualified by\n\t// the import path, which does not include the GOPATH. Thus we can trim\n\t// segments from the beginning of the file path until the number of path\n\t// separators remaining is one more than the number of path separators in\n\t// the function name. For example, given:\n\t//\n\t//    GOPATH     /home/user\n\t//    file       /home/user/src/pkg/sub/file.go\n\t//    fn.Name()  pkg/sub.Type.Method\n\t//\n\t// We want to produce:\n\t//\n\t//    pkg/sub/file.go\n\t//\n\t// From this we can easily see that fn.Name() has one less path separator\n\t// than our desired output. We count separators from the end of the file\n\t// path until it finds two more than in the function name and then move\n\t// one character forward to preserve the initial path segment without a\n\t// leading separator.\n\tconst sep = \"/\"\n\tgoal := strings.Count(name, sep) + 2\n\ti := len(file)\n\tfor n := 0; n < goal; n++ {\n\t\ti = strings.LastIndex(file[:i], sep)\n\t\tif i == -1 {\n\t\t\t// not enough separators found, set i so that the slice expression\n\t\t\t// below leaves file unmodified\n\t\t\ti = -len(sep)\n\t\t\tbreak\n\t\t}\n\t}\n\t// get back to 0 or trim the leading separator\n\tfile = file[i+len(sep):]\n\treturn file\n}\n"
  },
  {
    "path": "vendor/github.com/pmezard/go-difflib/LICENSE",
    "content": "Copyright (c) 2013, Patrick Mezard\nAll 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 copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n    The names of its contributors may not be used to endorse or promote\nproducts derived from this software without specific prior written\npermission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\nIS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\nTO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\nPARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "vendor/github.com/pmezard/go-difflib/difflib/difflib.go",
    "content": "// Package difflib is a partial port of Python difflib module.\n//\n// It provides tools to compare sequences of strings and generate textual diffs.\n//\n// The following class and functions have been ported:\n//\n// - SequenceMatcher\n//\n// - unified_diff\n//\n// - context_diff\n//\n// Getting unified diffs was the main goal of the port. Keep in mind this code\n// is mostly suitable to output text differences in a human friendly way, there\n// are no guarantees generated diffs are consumable by patch(1).\npackage difflib\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"strings\"\n)\n\nfunc min(a, b int) int {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}\n\nfunc max(a, b int) int {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}\n\nfunc calculateRatio(matches, length int) float64 {\n\tif length > 0 {\n\t\treturn 2.0 * float64(matches) / float64(length)\n\t}\n\treturn 1.0\n}\n\ntype Match struct {\n\tA    int\n\tB    int\n\tSize int\n}\n\ntype OpCode struct {\n\tTag byte\n\tI1  int\n\tI2  int\n\tJ1  int\n\tJ2  int\n}\n\n// SequenceMatcher compares sequence of strings. The basic\n// algorithm predates, and is a little fancier than, an algorithm\n// published in the late 1980's by Ratcliff and Obershelp under the\n// hyperbolic name \"gestalt pattern matching\".  The basic idea is to find\n// the longest contiguous matching subsequence that contains no \"junk\"\n// elements (R-O doesn't address junk).  The same idea is then applied\n// recursively to the pieces of the sequences to the left and to the right\n// of the matching subsequence.  This does not yield minimal edit\n// sequences, but does tend to yield matches that \"look right\" to people.\n//\n// SequenceMatcher tries to compute a \"human-friendly diff\" between two\n// sequences.  Unlike e.g. UNIX(tm) diff, the fundamental notion is the\n// longest *contiguous* & junk-free matching subsequence.  That's what\n// catches peoples' eyes.  The Windows(tm) windiff has another interesting\n// notion, pairing up elements that appear uniquely in each sequence.\n// That, and the method here, appear to yield more intuitive difference\n// reports than does diff.  This method appears to be the least vulnerable\n// to synching up on blocks of \"junk lines\", though (like blank lines in\n// ordinary text files, or maybe \"<P>\" lines in HTML files).  That may be\n// because this is the only method of the 3 that has a *concept* of\n// \"junk\" <wink>.\n//\n// Timing:  Basic R-O is cubic time worst case and quadratic time expected\n// case.  SequenceMatcher is quadratic time for the worst case and has\n// expected-case behavior dependent in a complicated way on how many\n// elements the sequences have in common; best case time is linear.\ntype SequenceMatcher struct {\n\ta              []string\n\tb              []string\n\tb2j            map[string][]int\n\tIsJunk         func(string) bool\n\tautoJunk       bool\n\tbJunk          map[string]struct{}\n\tmatchingBlocks []Match\n\tfullBCount     map[string]int\n\tbPopular       map[string]struct{}\n\topCodes        []OpCode\n}\n\nfunc NewMatcher(a, b []string) *SequenceMatcher {\n\tm := SequenceMatcher{autoJunk: true}\n\tm.SetSeqs(a, b)\n\treturn &m\n}\n\nfunc NewMatcherWithJunk(a, b []string, autoJunk bool,\n\tisJunk func(string) bool) *SequenceMatcher {\n\n\tm := SequenceMatcher{IsJunk: isJunk, autoJunk: autoJunk}\n\tm.SetSeqs(a, b)\n\treturn &m\n}\n\n// Set two sequences to be compared.\nfunc (m *SequenceMatcher) SetSeqs(a, b []string) {\n\tm.SetSeq1(a)\n\tm.SetSeq2(b)\n}\n\n// Set the first sequence to be compared. The second sequence to be compared is\n// not changed.\n//\n// SequenceMatcher computes and caches detailed information about the second\n// sequence, so if you want to compare one sequence S against many sequences,\n// use .SetSeq2(s) once and call .SetSeq1(x) repeatedly for each of the other\n// sequences.\n//\n// See also SetSeqs() and SetSeq2().\nfunc (m *SequenceMatcher) SetSeq1(a []string) {\n\tif &a == &m.a {\n\t\treturn\n\t}\n\tm.a = a\n\tm.matchingBlocks = nil\n\tm.opCodes = nil\n}\n\n// Set the second sequence to be compared. The first sequence to be compared is\n// not changed.\nfunc (m *SequenceMatcher) SetSeq2(b []string) {\n\tif &b == &m.b {\n\t\treturn\n\t}\n\tm.b = b\n\tm.matchingBlocks = nil\n\tm.opCodes = nil\n\tm.fullBCount = nil\n\tm.chainB()\n}\n\nfunc (m *SequenceMatcher) chainB() {\n\t// Populate line -> index mapping\n\tb2j := map[string][]int{}\n\tfor i, s := range m.b {\n\t\tindices := b2j[s]\n\t\tindices = append(indices, i)\n\t\tb2j[s] = indices\n\t}\n\n\t// Purge junk elements\n\tm.bJunk = map[string]struct{}{}\n\tif m.IsJunk != nil {\n\t\tjunk := m.bJunk\n\t\tfor s, _ := range b2j {\n\t\t\tif m.IsJunk(s) {\n\t\t\t\tjunk[s] = struct{}{}\n\t\t\t}\n\t\t}\n\t\tfor s, _ := range junk {\n\t\t\tdelete(b2j, s)\n\t\t}\n\t}\n\n\t// Purge remaining popular elements\n\tpopular := map[string]struct{}{}\n\tn := len(m.b)\n\tif m.autoJunk && n >= 200 {\n\t\tntest := n/100 + 1\n\t\tfor s, indices := range b2j {\n\t\t\tif len(indices) > ntest {\n\t\t\t\tpopular[s] = struct{}{}\n\t\t\t}\n\t\t}\n\t\tfor s, _ := range popular {\n\t\t\tdelete(b2j, s)\n\t\t}\n\t}\n\tm.bPopular = popular\n\tm.b2j = b2j\n}\n\nfunc (m *SequenceMatcher) isBJunk(s string) bool {\n\t_, ok := m.bJunk[s]\n\treturn ok\n}\n\n// Find longest matching block in a[alo:ahi] and b[blo:bhi].\n//\n// If IsJunk is not defined:\n//\n// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where\n//     alo <= i <= i+k <= ahi\n//     blo <= j <= j+k <= bhi\n// and for all (i',j',k') meeting those conditions,\n//     k >= k'\n//     i <= i'\n//     and if i == i', j <= j'\n//\n// In other words, of all maximal matching blocks, return one that\n// starts earliest in a, and of all those maximal matching blocks that\n// start earliest in a, return the one that starts earliest in b.\n//\n// If IsJunk is defined, first the longest matching block is\n// determined as above, but with the additional restriction that no\n// junk element appears in the block.  Then that block is extended as\n// far as possible by matching (only) junk elements on both sides.  So\n// the resulting block never matches on junk except as identical junk\n// happens to be adjacent to an \"interesting\" match.\n//\n// If no blocks match, return (alo, blo, 0).\nfunc (m *SequenceMatcher) findLongestMatch(alo, ahi, blo, bhi int) Match {\n\t// CAUTION:  stripping common prefix or suffix would be incorrect.\n\t// E.g.,\n\t//    ab\n\t//    acab\n\t// Longest matching block is \"ab\", but if common prefix is\n\t// stripped, it's \"a\" (tied with \"b\").  UNIX(tm) diff does so\n\t// strip, so ends up claiming that ab is changed to acab by\n\t// inserting \"ca\" in the middle.  That's minimal but unintuitive:\n\t// \"it's obvious\" that someone inserted \"ac\" at the front.\n\t// Windiff ends up at the same place as diff, but by pairing up\n\t// the unique 'b's and then matching the first two 'a's.\n\tbesti, bestj, bestsize := alo, blo, 0\n\n\t// find longest junk-free match\n\t// during an iteration of the loop, j2len[j] = length of longest\n\t// junk-free match ending with a[i-1] and b[j]\n\tj2len := map[int]int{}\n\tfor i := alo; i != ahi; i++ {\n\t\t// look at all instances of a[i] in b; note that because\n\t\t// b2j has no junk keys, the loop is skipped if a[i] is junk\n\t\tnewj2len := map[int]int{}\n\t\tfor _, j := range m.b2j[m.a[i]] {\n\t\t\t// a[i] matches b[j]\n\t\t\tif j < blo {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif j >= bhi {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tk := j2len[j-1] + 1\n\t\t\tnewj2len[j] = k\n\t\t\tif k > bestsize {\n\t\t\t\tbesti, bestj, bestsize = i-k+1, j-k+1, k\n\t\t\t}\n\t\t}\n\t\tj2len = newj2len\n\t}\n\n\t// Extend the best by non-junk elements on each end.  In particular,\n\t// \"popular\" non-junk elements aren't in b2j, which greatly speeds\n\t// the inner loop above, but also means \"the best\" match so far\n\t// doesn't contain any junk *or* popular non-junk elements.\n\tfor besti > alo && bestj > blo && !m.isBJunk(m.b[bestj-1]) &&\n\t\tm.a[besti-1] == m.b[bestj-1] {\n\t\tbesti, bestj, bestsize = besti-1, bestj-1, bestsize+1\n\t}\n\tfor besti+bestsize < ahi && bestj+bestsize < bhi &&\n\t\t!m.isBJunk(m.b[bestj+bestsize]) &&\n\t\tm.a[besti+bestsize] == m.b[bestj+bestsize] {\n\t\tbestsize += 1\n\t}\n\n\t// Now that we have a wholly interesting match (albeit possibly\n\t// empty!), we may as well suck up the matching junk on each\n\t// side of it too.  Can't think of a good reason not to, and it\n\t// saves post-processing the (possibly considerable) expense of\n\t// figuring out what to do with it.  In the case of an empty\n\t// interesting match, this is clearly the right thing to do,\n\t// because no other kind of match is possible in the regions.\n\tfor besti > alo && bestj > blo && m.isBJunk(m.b[bestj-1]) &&\n\t\tm.a[besti-1] == m.b[bestj-1] {\n\t\tbesti, bestj, bestsize = besti-1, bestj-1, bestsize+1\n\t}\n\tfor besti+bestsize < ahi && bestj+bestsize < bhi &&\n\t\tm.isBJunk(m.b[bestj+bestsize]) &&\n\t\tm.a[besti+bestsize] == m.b[bestj+bestsize] {\n\t\tbestsize += 1\n\t}\n\n\treturn Match{A: besti, B: bestj, Size: bestsize}\n}\n\n// Return list of triples describing matching subsequences.\n//\n// Each triple is of the form (i, j, n), and means that\n// a[i:i+n] == b[j:j+n].  The triples are monotonically increasing in\n// i and in j. It's also guaranteed that if (i, j, n) and (i', j', n') are\n// adjacent triples in the list, and the second is not the last triple in the\n// list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe\n// adjacent equal blocks.\n//\n// The last triple is a dummy, (len(a), len(b), 0), and is the only\n// triple with n==0.\nfunc (m *SequenceMatcher) GetMatchingBlocks() []Match {\n\tif m.matchingBlocks != nil {\n\t\treturn m.matchingBlocks\n\t}\n\n\tvar matchBlocks func(alo, ahi, blo, bhi int, matched []Match) []Match\n\tmatchBlocks = func(alo, ahi, blo, bhi int, matched []Match) []Match {\n\t\tmatch := m.findLongestMatch(alo, ahi, blo, bhi)\n\t\ti, j, k := match.A, match.B, match.Size\n\t\tif match.Size > 0 {\n\t\t\tif alo < i && blo < j {\n\t\t\t\tmatched = matchBlocks(alo, i, blo, j, matched)\n\t\t\t}\n\t\t\tmatched = append(matched, match)\n\t\t\tif i+k < ahi && j+k < bhi {\n\t\t\t\tmatched = matchBlocks(i+k, ahi, j+k, bhi, matched)\n\t\t\t}\n\t\t}\n\t\treturn matched\n\t}\n\tmatched := matchBlocks(0, len(m.a), 0, len(m.b), nil)\n\n\t// It's possible that we have adjacent equal blocks in the\n\t// matching_blocks list now.\n\tnonAdjacent := []Match{}\n\ti1, j1, k1 := 0, 0, 0\n\tfor _, b := range matched {\n\t\t// Is this block adjacent to i1, j1, k1?\n\t\ti2, j2, k2 := b.A, b.B, b.Size\n\t\tif i1+k1 == i2 && j1+k1 == j2 {\n\t\t\t// Yes, so collapse them -- this just increases the length of\n\t\t\t// the first block by the length of the second, and the first\n\t\t\t// block so lengthened remains the block to compare against.\n\t\t\tk1 += k2\n\t\t} else {\n\t\t\t// Not adjacent.  Remember the first block (k1==0 means it's\n\t\t\t// the dummy we started with), and make the second block the\n\t\t\t// new block to compare against.\n\t\t\tif k1 > 0 {\n\t\t\t\tnonAdjacent = append(nonAdjacent, Match{i1, j1, k1})\n\t\t\t}\n\t\t\ti1, j1, k1 = i2, j2, k2\n\t\t}\n\t}\n\tif k1 > 0 {\n\t\tnonAdjacent = append(nonAdjacent, Match{i1, j1, k1})\n\t}\n\n\tnonAdjacent = append(nonAdjacent, Match{len(m.a), len(m.b), 0})\n\tm.matchingBlocks = nonAdjacent\n\treturn m.matchingBlocks\n}\n\n// Return list of 5-tuples describing how to turn a into b.\n//\n// Each tuple is of the form (tag, i1, i2, j1, j2).  The first tuple\n// has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the\n// tuple preceding it, and likewise for j1 == the previous j2.\n//\n// The tags are characters, with these meanings:\n//\n// 'r' (replace):  a[i1:i2] should be replaced by b[j1:j2]\n//\n// 'd' (delete):   a[i1:i2] should be deleted, j1==j2 in this case.\n//\n// 'i' (insert):   b[j1:j2] should be inserted at a[i1:i1], i1==i2 in this case.\n//\n// 'e' (equal):    a[i1:i2] == b[j1:j2]\nfunc (m *SequenceMatcher) GetOpCodes() []OpCode {\n\tif m.opCodes != nil {\n\t\treturn m.opCodes\n\t}\n\ti, j := 0, 0\n\tmatching := m.GetMatchingBlocks()\n\topCodes := make([]OpCode, 0, len(matching))\n\tfor _, m := range matching {\n\t\t//  invariant:  we've pumped out correct diffs to change\n\t\t//  a[:i] into b[:j], and the next matching block is\n\t\t//  a[ai:ai+size] == b[bj:bj+size]. So we need to pump\n\t\t//  out a diff to change a[i:ai] into b[j:bj], pump out\n\t\t//  the matching block, and move (i,j) beyond the match\n\t\tai, bj, size := m.A, m.B, m.Size\n\t\ttag := byte(0)\n\t\tif i < ai && j < bj {\n\t\t\ttag = 'r'\n\t\t} else if i < ai {\n\t\t\ttag = 'd'\n\t\t} else if j < bj {\n\t\t\ttag = 'i'\n\t\t}\n\t\tif tag > 0 {\n\t\t\topCodes = append(opCodes, OpCode{tag, i, ai, j, bj})\n\t\t}\n\t\ti, j = ai+size, bj+size\n\t\t// the list of matching blocks is terminated by a\n\t\t// sentinel with size 0\n\t\tif size > 0 {\n\t\t\topCodes = append(opCodes, OpCode{'e', ai, i, bj, j})\n\t\t}\n\t}\n\tm.opCodes = opCodes\n\treturn m.opCodes\n}\n\n// Isolate change clusters by eliminating ranges with no changes.\n//\n// Return a generator of groups with up to n lines of context.\n// Each group is in the same format as returned by GetOpCodes().\nfunc (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode {\n\tif n < 0 {\n\t\tn = 3\n\t}\n\tcodes := m.GetOpCodes()\n\tif len(codes) == 0 {\n\t\tcodes = []OpCode{OpCode{'e', 0, 1, 0, 1}}\n\t}\n\t// Fixup leading and trailing groups if they show no changes.\n\tif codes[0].Tag == 'e' {\n\t\tc := codes[0]\n\t\ti1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2\n\t\tcodes[0] = OpCode{c.Tag, max(i1, i2-n), i2, max(j1, j2-n), j2}\n\t}\n\tif codes[len(codes)-1].Tag == 'e' {\n\t\tc := codes[len(codes)-1]\n\t\ti1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2\n\t\tcodes[len(codes)-1] = OpCode{c.Tag, i1, min(i2, i1+n), j1, min(j2, j1+n)}\n\t}\n\tnn := n + n\n\tgroups := [][]OpCode{}\n\tgroup := []OpCode{}\n\tfor _, c := range codes {\n\t\ti1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2\n\t\t// End the current group and start a new one whenever\n\t\t// there is a large range with no changes.\n\t\tif c.Tag == 'e' && i2-i1 > nn {\n\t\t\tgroup = append(group, OpCode{c.Tag, i1, min(i2, i1+n),\n\t\t\t\tj1, min(j2, j1+n)})\n\t\t\tgroups = append(groups, group)\n\t\t\tgroup = []OpCode{}\n\t\t\ti1, j1 = max(i1, i2-n), max(j1, j2-n)\n\t\t}\n\t\tgroup = append(group, OpCode{c.Tag, i1, i2, j1, j2})\n\t}\n\tif len(group) > 0 && !(len(group) == 1 && group[0].Tag == 'e') {\n\t\tgroups = append(groups, group)\n\t}\n\treturn groups\n}\n\n// Return a measure of the sequences' similarity (float in [0,1]).\n//\n// Where T is the total number of elements in both sequences, and\n// M is the number of matches, this is 2.0*M / T.\n// Note that this is 1 if the sequences are identical, and 0 if\n// they have nothing in common.\n//\n// .Ratio() is expensive to compute if you haven't already computed\n// .GetMatchingBlocks() or .GetOpCodes(), in which case you may\n// want to try .QuickRatio() or .RealQuickRation() first to get an\n// upper bound.\nfunc (m *SequenceMatcher) Ratio() float64 {\n\tmatches := 0\n\tfor _, m := range m.GetMatchingBlocks() {\n\t\tmatches += m.Size\n\t}\n\treturn calculateRatio(matches, len(m.a)+len(m.b))\n}\n\n// Return an upper bound on ratio() relatively quickly.\n//\n// This isn't defined beyond that it is an upper bound on .Ratio(), and\n// is faster to compute.\nfunc (m *SequenceMatcher) QuickRatio() float64 {\n\t// viewing a and b as multisets, set matches to the cardinality\n\t// of their intersection; this counts the number of matches\n\t// without regard to order, so is clearly an upper bound\n\tif m.fullBCount == nil {\n\t\tm.fullBCount = map[string]int{}\n\t\tfor _, s := range m.b {\n\t\t\tm.fullBCount[s] = m.fullBCount[s] + 1\n\t\t}\n\t}\n\n\t// avail[x] is the number of times x appears in 'b' less the\n\t// number of times we've seen it in 'a' so far ... kinda\n\tavail := map[string]int{}\n\tmatches := 0\n\tfor _, s := range m.a {\n\t\tn, ok := avail[s]\n\t\tif !ok {\n\t\t\tn = m.fullBCount[s]\n\t\t}\n\t\tavail[s] = n - 1\n\t\tif n > 0 {\n\t\t\tmatches += 1\n\t\t}\n\t}\n\treturn calculateRatio(matches, len(m.a)+len(m.b))\n}\n\n// Return an upper bound on ratio() very quickly.\n//\n// This isn't defined beyond that it is an upper bound on .Ratio(), and\n// is faster to compute than either .Ratio() or .QuickRatio().\nfunc (m *SequenceMatcher) RealQuickRatio() float64 {\n\tla, lb := len(m.a), len(m.b)\n\treturn calculateRatio(min(la, lb), la+lb)\n}\n\n// Convert range to the \"ed\" format\nfunc formatRangeUnified(start, stop int) string {\n\t// Per the diff spec at http://www.unix.org/single_unix_specification/\n\tbeginning := start + 1 // lines start numbering with one\n\tlength := stop - start\n\tif length == 1 {\n\t\treturn fmt.Sprintf(\"%d\", beginning)\n\t}\n\tif length == 0 {\n\t\tbeginning -= 1 // empty ranges begin at line just before the range\n\t}\n\treturn fmt.Sprintf(\"%d,%d\", beginning, length)\n}\n\n// Unified diff parameters\ntype UnifiedDiff struct {\n\tA        []string // First sequence lines\n\tFromFile string   // First file name\n\tFromDate string   // First file time\n\tB        []string // Second sequence lines\n\tToFile   string   // Second file name\n\tToDate   string   // Second file time\n\tEol      string   // Headers end of line, defaults to LF\n\tContext  int      // Number of context lines\n}\n\n// Compare two sequences of lines; generate the delta as a unified diff.\n//\n// Unified diffs are a compact way of showing line changes and a few\n// lines of context.  The number of context lines is set by 'n' which\n// defaults to three.\n//\n// By default, the diff control lines (those with ---, +++, or @@) are\n// created with a trailing newline.  This is helpful so that inputs\n// created from file.readlines() result in diffs that are suitable for\n// file.writelines() since both the inputs and outputs have trailing\n// newlines.\n//\n// For inputs that do not have trailing newlines, set the lineterm\n// argument to \"\" so that the output will be uniformly newline free.\n//\n// The unidiff format normally has a header for filenames and modification\n// times.  Any or all of these may be specified using strings for\n// 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.\n// The modification times are normally expressed in the ISO 8601 format.\nfunc WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error {\n\tbuf := bufio.NewWriter(writer)\n\tdefer buf.Flush()\n\twf := func(format string, args ...interface{}) error {\n\t\t_, err := buf.WriteString(fmt.Sprintf(format, args...))\n\t\treturn err\n\t}\n\tws := func(s string) error {\n\t\t_, err := buf.WriteString(s)\n\t\treturn err\n\t}\n\n\tif len(diff.Eol) == 0 {\n\t\tdiff.Eol = \"\\n\"\n\t}\n\n\tstarted := false\n\tm := NewMatcher(diff.A, diff.B)\n\tfor _, g := range m.GetGroupedOpCodes(diff.Context) {\n\t\tif !started {\n\t\t\tstarted = true\n\t\t\tfromDate := \"\"\n\t\t\tif len(diff.FromDate) > 0 {\n\t\t\t\tfromDate = \"\\t\" + diff.FromDate\n\t\t\t}\n\t\t\ttoDate := \"\"\n\t\t\tif len(diff.ToDate) > 0 {\n\t\t\t\ttoDate = \"\\t\" + diff.ToDate\n\t\t\t}\n\t\t\tif diff.FromFile != \"\" || diff.ToFile != \"\" {\n\t\t\t\terr := wf(\"--- %s%s%s\", diff.FromFile, fromDate, diff.Eol)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\terr = wf(\"+++ %s%s%s\", diff.ToFile, toDate, diff.Eol)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfirst, last := g[0], g[len(g)-1]\n\t\trange1 := formatRangeUnified(first.I1, last.I2)\n\t\trange2 := formatRangeUnified(first.J1, last.J2)\n\t\tif err := wf(\"@@ -%s +%s @@%s\", range1, range2, diff.Eol); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, c := range g {\n\t\t\ti1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2\n\t\t\tif c.Tag == 'e' {\n\t\t\t\tfor _, line := range diff.A[i1:i2] {\n\t\t\t\t\tif err := ws(\" \" + line); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif c.Tag == 'r' || c.Tag == 'd' {\n\t\t\t\tfor _, line := range diff.A[i1:i2] {\n\t\t\t\t\tif err := ws(\"-\" + line); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif c.Tag == 'r' || c.Tag == 'i' {\n\t\t\t\tfor _, line := range diff.B[j1:j2] {\n\t\t\t\t\tif err := ws(\"+\" + line); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\n// Like WriteUnifiedDiff but returns the diff a string.\nfunc GetUnifiedDiffString(diff UnifiedDiff) (string, error) {\n\tw := &bytes.Buffer{}\n\terr := WriteUnifiedDiff(w, diff)\n\treturn string(w.Bytes()), err\n}\n\n// Convert range to the \"ed\" format.\nfunc formatRangeContext(start, stop int) string {\n\t// Per the diff spec at http://www.unix.org/single_unix_specification/\n\tbeginning := start + 1 // lines start numbering with one\n\tlength := stop - start\n\tif length == 0 {\n\t\tbeginning -= 1 // empty ranges begin at line just before the range\n\t}\n\tif length <= 1 {\n\t\treturn fmt.Sprintf(\"%d\", beginning)\n\t}\n\treturn fmt.Sprintf(\"%d,%d\", beginning, beginning+length-1)\n}\n\ntype ContextDiff UnifiedDiff\n\n// Compare two sequences of lines; generate the delta as a context diff.\n//\n// Context diffs are a compact way of showing line changes and a few\n// lines of context. The number of context lines is set by diff.Context\n// which defaults to three.\n//\n// By default, the diff control lines (those with *** or ---) are\n// created with a trailing newline.\n//\n// For inputs that do not have trailing newlines, set the diff.Eol\n// argument to \"\" so that the output will be uniformly newline free.\n//\n// The context diff format normally has a header for filenames and\n// modification times.  Any or all of these may be specified using\n// strings for diff.FromFile, diff.ToFile, diff.FromDate, diff.ToDate.\n// The modification times are normally expressed in the ISO 8601 format.\n// If not specified, the strings default to blanks.\nfunc WriteContextDiff(writer io.Writer, diff ContextDiff) error {\n\tbuf := bufio.NewWriter(writer)\n\tdefer buf.Flush()\n\tvar diffErr error\n\twf := func(format string, args ...interface{}) {\n\t\t_, err := buf.WriteString(fmt.Sprintf(format, args...))\n\t\tif diffErr == nil && err != nil {\n\t\t\tdiffErr = err\n\t\t}\n\t}\n\tws := func(s string) {\n\t\t_, err := buf.WriteString(s)\n\t\tif diffErr == nil && err != nil {\n\t\t\tdiffErr = err\n\t\t}\n\t}\n\n\tif len(diff.Eol) == 0 {\n\t\tdiff.Eol = \"\\n\"\n\t}\n\n\tprefix := map[byte]string{\n\t\t'i': \"+ \",\n\t\t'd': \"- \",\n\t\t'r': \"! \",\n\t\t'e': \"  \",\n\t}\n\n\tstarted := false\n\tm := NewMatcher(diff.A, diff.B)\n\tfor _, g := range m.GetGroupedOpCodes(diff.Context) {\n\t\tif !started {\n\t\t\tstarted = true\n\t\t\tfromDate := \"\"\n\t\t\tif len(diff.FromDate) > 0 {\n\t\t\t\tfromDate = \"\\t\" + diff.FromDate\n\t\t\t}\n\t\t\ttoDate := \"\"\n\t\t\tif len(diff.ToDate) > 0 {\n\t\t\t\ttoDate = \"\\t\" + diff.ToDate\n\t\t\t}\n\t\t\tif diff.FromFile != \"\" || diff.ToFile != \"\" {\n\t\t\t\twf(\"*** %s%s%s\", diff.FromFile, fromDate, diff.Eol)\n\t\t\t\twf(\"--- %s%s%s\", diff.ToFile, toDate, diff.Eol)\n\t\t\t}\n\t\t}\n\n\t\tfirst, last := g[0], g[len(g)-1]\n\t\tws(\"***************\" + diff.Eol)\n\n\t\trange1 := formatRangeContext(first.I1, last.I2)\n\t\twf(\"*** %s ****%s\", range1, diff.Eol)\n\t\tfor _, c := range g {\n\t\t\tif c.Tag == 'r' || c.Tag == 'd' {\n\t\t\t\tfor _, cc := range g {\n\t\t\t\t\tif cc.Tag == 'i' {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfor _, line := range diff.A[cc.I1:cc.I2] {\n\t\t\t\t\t\tws(prefix[cc.Tag] + line)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\trange2 := formatRangeContext(first.J1, last.J2)\n\t\twf(\"--- %s ----%s\", range2, diff.Eol)\n\t\tfor _, c := range g {\n\t\t\tif c.Tag == 'r' || c.Tag == 'i' {\n\t\t\t\tfor _, cc := range g {\n\t\t\t\t\tif cc.Tag == 'd' {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfor _, line := range diff.B[cc.J1:cc.J2] {\n\t\t\t\t\t\tws(prefix[cc.Tag] + line)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn diffErr\n}\n\n// Like WriteContextDiff but returns the diff a string.\nfunc GetContextDiffString(diff ContextDiff) (string, error) {\n\tw := &bytes.Buffer{}\n\terr := WriteContextDiff(w, diff)\n\treturn string(w.Bytes()), err\n}\n\n// Split a string on \"\\n\" while preserving them. The output can be used\n// as input for UnifiedDiff and ContextDiff structures.\nfunc SplitLines(s string) []string {\n\tlines := strings.SplitAfter(s, \"\\n\")\n\tlines[len(lines)-1] += \"\\n\"\n\treturn lines\n}\n"
  },
  {
    "path": "vendor/github.com/stretchr/testify/LICENSE",
    "content": "Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell\n\nPlease consider promoting this project if you find it useful.\n\nPermission is hereby granted, free of charge, to any person \nobtaining a copy of this software and associated documentation \nfiles (the \"Software\"), to deal in the Software without restriction, \nincluding without limitation the rights to use, copy, modify, merge, \npublish, distribute, sublicense, and/or sell copies of the Software, \nand to permit persons to whom the Software is furnished to do so, \nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, \nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES \nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. \nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, \nDAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT \nOR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE \nOR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "vendor/github.com/stretchr/testify/assert/assertion_format.go",
    "content": "/*\n* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen\n* THIS FILE MUST NOT BE EDITED BY HAND\n */\n\npackage assert\n\nimport (\n\thttp \"net/http\"\n\turl \"net/url\"\n\ttime \"time\"\n)\n\n// Conditionf uses a Comparison to assert a complex condition.\nfunc Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool {\n\treturn Condition(t, comp, append([]interface{}{msg}, args...)...)\n}\n\n// Containsf asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    assert.Containsf(t, \"Hello World\", \"World\", \"error message %s\", \"formatted\")\n//    assert.Containsf(t, [\"Hello\", \"World\"], \"World\", \"error message %s\", \"formatted\")\n//    assert.Containsf(t, {\"Hello\": \"World\"}, \"Hello\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {\n\treturn Contains(t, s, contains, append([]interface{}{msg}, args...)...)\n}\n\n// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {\n\treturn DirExists(t, path, append([]interface{}{msg}, args...)...)\n}\n\n// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], \"error message %s\", \"formatted\"))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool {\n\treturn ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...)\n}\n\n// Emptyf asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  assert.Emptyf(t, obj, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\treturn Empty(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// Equalf asserts that two objects are equal.\n//\n//    assert.Equalf(t, 123, 123, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\treturn Equal(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// EqualErrorf asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   assert.EqualErrorf(t, err,  expectedErrorString, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool {\n\treturn EqualError(t, theError, errString, append([]interface{}{msg}, args...)...)\n}\n\n// EqualValuesf asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    assert.EqualValuesf(t, uint32(123, \"error message %s\", \"formatted\"), int32(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\treturn EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// Errorf asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.Errorf(t, err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedErrorf, err)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Errorf(t TestingT, err error, msg string, args ...interface{}) bool {\n\treturn Error(t, err, append([]interface{}{msg}, args...)...)\n}\n\n// Exactlyf asserts that two objects are equal in value and type.\n//\n//    assert.Exactlyf(t, int32(123, \"error message %s\", \"formatted\"), int64(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\treturn Exactly(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// Failf reports a failure through\nfunc Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {\n\treturn Fail(t, failureMessage, append([]interface{}{msg}, args...)...)\n}\n\n// FailNowf fails test\nfunc FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {\n\treturn FailNow(t, failureMessage, append([]interface{}{msg}, args...)...)\n}\n\n// Falsef asserts that the specified value is false.\n//\n//    assert.Falsef(t, myBool, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Falsef(t TestingT, value bool, msg string, args ...interface{}) bool {\n\treturn False(t, value, append([]interface{}{msg}, args...)...)\n}\n\n// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {\n\treturn FileExists(t, path, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPBodyContainsf asserts that a specified handler returns a\n// body that contains a string.\n//\n//  assert.HTTPBodyContainsf(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {\n\treturn HTTPBodyContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPBodyNotContainsf asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  assert.HTTPBodyNotContainsf(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {\n\treturn HTTPBodyNotContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPErrorf asserts that a specified handler returns an error status code.\n//\n//  assert.HTTPErrorf(t, myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\treturn HTTPError(t, handler, method, url, values, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPRedirectf asserts that a specified handler returns a redirect status code.\n//\n//  assert.HTTPRedirectf(t, myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\treturn HTTPRedirect(t, handler, method, url, values, append([]interface{}{msg}, args...)...)\n}\n\n// HTTPSuccessf asserts that a specified handler returns a success status code.\n//\n//  assert.HTTPSuccessf(t, myHandler, \"POST\", \"http://www.google.com\", nil, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\treturn HTTPSuccess(t, handler, method, url, values, append([]interface{}{msg}, args...)...)\n}\n\n// Implementsf asserts that an object is implemented by the specified interface.\n//\n//    assert.Implementsf(t, (*MyInterface, \"error message %s\", \"formatted\")(nil), new(MyObject))\nfunc Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {\n\treturn Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...)\n}\n\n// InDeltaf asserts that the two numerals are within delta of each other.\n//\n// \t assert.InDeltaf(t, math.Pi, (22 / 7.0, \"error message %s\", \"formatted\"), 0.01)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\treturn InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...)\n}\n\n// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\treturn InDeltaMapValues(t, expected, actual, delta, append([]interface{}{msg}, args...)...)\n}\n\n// InDeltaSlicef is the same as InDelta, except it compares two slices.\nfunc InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\treturn InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...)\n}\n\n// InEpsilonf asserts that expected and actual have a relative error less than epsilon\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {\n\treturn InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)\n}\n\n// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.\nfunc InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {\n\treturn InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)\n}\n\n// IsTypef asserts that the specified objects are of the same type.\nfunc IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {\n\treturn IsType(t, expectedType, object, append([]interface{}{msg}, args...)...)\n}\n\n// JSONEqf asserts that two JSON strings are equivalent.\n//\n//  assert.JSONEqf(t, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {\n\treturn JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// Lenf asserts that the specified object has specific length.\n// Lenf also fails if the object has a type that len() not accept.\n//\n//    assert.Lenf(t, mySlice, 3, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool {\n\treturn Len(t, object, length, append([]interface{}{msg}, args...)...)\n}\n\n// Nilf asserts that the specified object is nil.\n//\n//    assert.Nilf(t, err, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\treturn Nil(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// NoErrorf asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.NoErrorf(t, err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedObj, actualObj)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool {\n\treturn NoError(t, err, append([]interface{}{msg}, args...)...)\n}\n\n// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    assert.NotContainsf(t, \"Hello World\", \"Earth\", \"error message %s\", \"formatted\")\n//    assert.NotContainsf(t, [\"Hello\", \"World\"], \"Earth\", \"error message %s\", \"formatted\")\n//    assert.NotContainsf(t, {\"Hello\": \"World\"}, \"Earth\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {\n\treturn NotContains(t, s, contains, append([]interface{}{msg}, args...)...)\n}\n\n// NotEmptyf asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if assert.NotEmptyf(t, obj, \"error message %s\", \"formatted\") {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\treturn NotEmpty(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// NotEqualf asserts that the specified values are NOT equal.\n//\n//    assert.NotEqualf(t, obj1, obj2, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\treturn NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...)\n}\n\n// NotNilf asserts that the specified object is not nil.\n//\n//    assert.NotNilf(t, err, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {\n\treturn NotNil(t, object, append([]interface{}{msg}, args...)...)\n}\n\n// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   assert.NotPanicsf(t, func(){ RemainCalm() }, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {\n\treturn NotPanics(t, f, append([]interface{}{msg}, args...)...)\n}\n\n// NotRegexpf asserts that a specified regexp does not match a string.\n//\n//  assert.NotRegexpf(t, regexp.MustCompile(\"starts\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  assert.NotRegexpf(t, \"^start\", \"it's not starting\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {\n\treturn NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...)\n}\n\n// NotSubsetf asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.NotSubsetf(t, [1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {\n\treturn NotSubset(t, list, subset, append([]interface{}{msg}, args...)...)\n}\n\n// NotZerof asserts that i is not the zero value for its type and returns the truth.\nfunc NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {\n\treturn NotZero(t, i, append([]interface{}{msg}, args...)...)\n}\n\n// Panicsf asserts that the code inside the specified PanicTestFunc panics.\n//\n//   assert.Panicsf(t, func(){ GoCrazy() }, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {\n\treturn Panics(t, f, append([]interface{}{msg}, args...)...)\n}\n\n// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   assert.PanicsWithValuef(t, \"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {\n\treturn PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...)\n}\n\n// Regexpf asserts that a specified regexp matches a string.\n//\n//  assert.Regexpf(t, regexp.MustCompile(\"start\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  assert.Regexpf(t, \"start...$\", \"it's not starting\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {\n\treturn Regexp(t, rx, str, append([]interface{}{msg}, args...)...)\n}\n\n// Subsetf asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.Subsetf(t, [1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {\n\treturn Subset(t, list, subset, append([]interface{}{msg}, args...)...)\n}\n\n// Truef asserts that the specified value is true.\n//\n//    assert.Truef(t, myBool, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Truef(t TestingT, value bool, msg string, args ...interface{}) bool {\n\treturn True(t, value, append([]interface{}{msg}, args...)...)\n}\n\n// WithinDurationf asserts that the two times are within duration delta of each other.\n//\n//   assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {\n\treturn WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...)\n}\n\n// Zerof asserts that i is the zero value for its type and returns the truth.\nfunc Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {\n\treturn Zero(t, i, append([]interface{}{msg}, args...)...)\n}\n"
  },
  {
    "path": "vendor/github.com/stretchr/testify/assert/assertion_forward.go",
    "content": "/*\n* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen\n* THIS FILE MUST NOT BE EDITED BY HAND\n */\n\npackage assert\n\nimport (\n\thttp \"net/http\"\n\turl \"net/url\"\n\ttime \"time\"\n)\n\n// Condition uses a Comparison to assert a complex condition.\nfunc (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool {\n\treturn Condition(a.t, comp, msgAndArgs...)\n}\n\n// Conditionf uses a Comparison to assert a complex condition.\nfunc (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool {\n\treturn Conditionf(a.t, comp, msg, args...)\n}\n\n// Contains asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    a.Contains(\"Hello World\", \"World\")\n//    a.Contains([\"Hello\", \"World\"], \"World\")\n//    a.Contains({\"Hello\": \"World\"}, \"Hello\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {\n\treturn Contains(a.t, s, contains, msgAndArgs...)\n}\n\n// Containsf asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    a.Containsf(\"Hello World\", \"World\", \"error message %s\", \"formatted\")\n//    a.Containsf([\"Hello\", \"World\"], \"World\", \"error message %s\", \"formatted\")\n//    a.Containsf({\"Hello\": \"World\"}, \"Hello\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {\n\treturn Containsf(a.t, s, contains, msg, args...)\n}\n\n// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool {\n\treturn DirExists(a.t, path, msgAndArgs...)\n}\n\n// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bool {\n\treturn DirExistsf(a.t, path, msg, args...)\n}\n\n// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2]))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool {\n\treturn ElementsMatch(a.t, listA, listB, msgAndArgs...)\n}\n\n// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], \"error message %s\", \"formatted\"))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool {\n\treturn ElementsMatchf(a.t, listA, listB, msg, args...)\n}\n\n// Empty asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  a.Empty(obj)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool {\n\treturn Empty(a.t, object, msgAndArgs...)\n}\n\n// Emptyf asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  a.Emptyf(obj, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool {\n\treturn Emptyf(a.t, object, msg, args...)\n}\n\n// Equal asserts that two objects are equal.\n//\n//    a.Equal(123, 123)\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\treturn Equal(a.t, expected, actual, msgAndArgs...)\n}\n\n// EqualError asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   a.EqualError(err,  expectedErrorString)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool {\n\treturn EqualError(a.t, theError, errString, msgAndArgs...)\n}\n\n// EqualErrorf asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   a.EqualErrorf(err,  expectedErrorString, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool {\n\treturn EqualErrorf(a.t, theError, errString, msg, args...)\n}\n\n// EqualValues asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    a.EqualValues(uint32(123), int32(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\treturn EqualValues(a.t, expected, actual, msgAndArgs...)\n}\n\n// EqualValuesf asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    a.EqualValuesf(uint32(123, \"error message %s\", \"formatted\"), int32(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\treturn EqualValuesf(a.t, expected, actual, msg, args...)\n}\n\n// Equalf asserts that two objects are equal.\n//\n//    a.Equalf(123, 123, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\treturn Equalf(a.t, expected, actual, msg, args...)\n}\n\n// Error asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.Error(err) {\n// \t   assert.Equal(t, expectedError, err)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool {\n\treturn Error(a.t, err, msgAndArgs...)\n}\n\n// Errorf asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.Errorf(err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedErrorf, err)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool {\n\treturn Errorf(a.t, err, msg, args...)\n}\n\n// Exactly asserts that two objects are equal in value and type.\n//\n//    a.Exactly(int32(123), int64(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\treturn Exactly(a.t, expected, actual, msgAndArgs...)\n}\n\n// Exactlyf asserts that two objects are equal in value and type.\n//\n//    a.Exactlyf(int32(123, \"error message %s\", \"formatted\"), int64(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\treturn Exactlyf(a.t, expected, actual, msg, args...)\n}\n\n// Fail reports a failure through\nfunc (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool {\n\treturn Fail(a.t, failureMessage, msgAndArgs...)\n}\n\n// FailNow fails test\nfunc (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool {\n\treturn FailNow(a.t, failureMessage, msgAndArgs...)\n}\n\n// FailNowf fails test\nfunc (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool {\n\treturn FailNowf(a.t, failureMessage, msg, args...)\n}\n\n// Failf reports a failure through\nfunc (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool {\n\treturn Failf(a.t, failureMessage, msg, args...)\n}\n\n// False asserts that the specified value is false.\n//\n//    a.False(myBool)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool {\n\treturn False(a.t, value, msgAndArgs...)\n}\n\n// Falsef asserts that the specified value is false.\n//\n//    a.Falsef(myBool, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool {\n\treturn Falsef(a.t, value, msg, args...)\n}\n\n// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool {\n\treturn FileExists(a.t, path, msgAndArgs...)\n}\n\n// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) bool {\n\treturn FileExistsf(a.t, path, msg, args...)\n}\n\n// HTTPBodyContains asserts that a specified handler returns a\n// body that contains a string.\n//\n//  a.HTTPBodyContains(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {\n\treturn HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...)\n}\n\n// HTTPBodyContainsf asserts that a specified handler returns a\n// body that contains a string.\n//\n//  a.HTTPBodyContainsf(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {\n\treturn HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...)\n}\n\n// HTTPBodyNotContains asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  a.HTTPBodyNotContains(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {\n\treturn HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...)\n}\n\n// HTTPBodyNotContainsf asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  a.HTTPBodyNotContainsf(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {\n\treturn HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...)\n}\n\n// HTTPError asserts that a specified handler returns an error status code.\n//\n//  a.HTTPError(myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\treturn HTTPError(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPErrorf asserts that a specified handler returns an error status code.\n//\n//  a.HTTPErrorf(myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\treturn HTTPErrorf(a.t, handler, method, url, values, msg, args...)\n}\n\n// HTTPRedirect asserts that a specified handler returns a redirect status code.\n//\n//  a.HTTPRedirect(myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\treturn HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPRedirectf asserts that a specified handler returns a redirect status code.\n//\n//  a.HTTPRedirectf(myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\treturn HTTPRedirectf(a.t, handler, method, url, values, msg, args...)\n}\n\n// HTTPSuccess asserts that a specified handler returns a success status code.\n//\n//  a.HTTPSuccess(myHandler, \"POST\", \"http://www.google.com\", nil)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\treturn HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPSuccessf asserts that a specified handler returns a success status code.\n//\n//  a.HTTPSuccessf(myHandler, \"POST\", \"http://www.google.com\", nil, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {\n\treturn HTTPSuccessf(a.t, handler, method, url, values, msg, args...)\n}\n\n// Implements asserts that an object is implemented by the specified interface.\n//\n//    a.Implements((*MyInterface)(nil), new(MyObject))\nfunc (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\treturn Implements(a.t, interfaceObject, object, msgAndArgs...)\n}\n\n// Implementsf asserts that an object is implemented by the specified interface.\n//\n//    a.Implementsf((*MyInterface, \"error message %s\", \"formatted\")(nil), new(MyObject))\nfunc (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {\n\treturn Implementsf(a.t, interfaceObject, object, msg, args...)\n}\n\n// InDelta asserts that the two numerals are within delta of each other.\n//\n// \t a.InDelta(math.Pi, (22 / 7.0), 0.01)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\treturn InDelta(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\treturn InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\treturn InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...)\n}\n\n// InDeltaSlice is the same as InDelta, except it compares two slices.\nfunc (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\treturn InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaSlicef is the same as InDelta, except it compares two slices.\nfunc (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\treturn InDeltaSlicef(a.t, expected, actual, delta, msg, args...)\n}\n\n// InDeltaf asserts that the two numerals are within delta of each other.\n//\n// \t a.InDeltaf(math.Pi, (22 / 7.0, \"error message %s\", \"formatted\"), 0.01)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {\n\treturn InDeltaf(a.t, expected, actual, delta, msg, args...)\n}\n\n// InEpsilon asserts that expected and actual have a relative error less than epsilon\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {\n\treturn InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)\n}\n\n// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.\nfunc (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {\n\treturn InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)\n}\n\n// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.\nfunc (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {\n\treturn InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)\n}\n\n// InEpsilonf asserts that expected and actual have a relative error less than epsilon\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {\n\treturn InEpsilonf(a.t, expected, actual, epsilon, msg, args...)\n}\n\n// IsType asserts that the specified objects are of the same type.\nfunc (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\treturn IsType(a.t, expectedType, object, msgAndArgs...)\n}\n\n// IsTypef asserts that the specified objects are of the same type.\nfunc (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {\n\treturn IsTypef(a.t, expectedType, object, msg, args...)\n}\n\n// JSONEq asserts that two JSON strings are equivalent.\n//\n//  a.JSONEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool {\n\treturn JSONEq(a.t, expected, actual, msgAndArgs...)\n}\n\n// JSONEqf asserts that two JSON strings are equivalent.\n//\n//  a.JSONEqf(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool {\n\treturn JSONEqf(a.t, expected, actual, msg, args...)\n}\n\n// Len asserts that the specified object has specific length.\n// Len also fails if the object has a type that len() not accept.\n//\n//    a.Len(mySlice, 3)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool {\n\treturn Len(a.t, object, length, msgAndArgs...)\n}\n\n// Lenf asserts that the specified object has specific length.\n// Lenf also fails if the object has a type that len() not accept.\n//\n//    a.Lenf(mySlice, 3, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool {\n\treturn Lenf(a.t, object, length, msg, args...)\n}\n\n// Nil asserts that the specified object is nil.\n//\n//    a.Nil(err)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool {\n\treturn Nil(a.t, object, msgAndArgs...)\n}\n\n// Nilf asserts that the specified object is nil.\n//\n//    a.Nilf(err, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool {\n\treturn Nilf(a.t, object, msg, args...)\n}\n\n// NoError asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.NoError(err) {\n// \t   assert.Equal(t, expectedObj, actualObj)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool {\n\treturn NoError(a.t, err, msgAndArgs...)\n}\n\n// NoErrorf asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.NoErrorf(err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedObj, actualObj)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool {\n\treturn NoErrorf(a.t, err, msg, args...)\n}\n\n// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    a.NotContains(\"Hello World\", \"Earth\")\n//    a.NotContains([\"Hello\", \"World\"], \"Earth\")\n//    a.NotContains({\"Hello\": \"World\"}, \"Earth\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {\n\treturn NotContains(a.t, s, contains, msgAndArgs...)\n}\n\n// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    a.NotContainsf(\"Hello World\", \"Earth\", \"error message %s\", \"formatted\")\n//    a.NotContainsf([\"Hello\", \"World\"], \"Earth\", \"error message %s\", \"formatted\")\n//    a.NotContainsf({\"Hello\": \"World\"}, \"Earth\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {\n\treturn NotContainsf(a.t, s, contains, msg, args...)\n}\n\n// NotEmpty asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if a.NotEmpty(obj) {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool {\n\treturn NotEmpty(a.t, object, msgAndArgs...)\n}\n\n// NotEmptyf asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if a.NotEmptyf(obj, \"error message %s\", \"formatted\") {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool {\n\treturn NotEmptyf(a.t, object, msg, args...)\n}\n\n// NotEqual asserts that the specified values are NOT equal.\n//\n//    a.NotEqual(obj1, obj2)\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {\n\treturn NotEqual(a.t, expected, actual, msgAndArgs...)\n}\n\n// NotEqualf asserts that the specified values are NOT equal.\n//\n//    a.NotEqualf(obj1, obj2, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {\n\treturn NotEqualf(a.t, expected, actual, msg, args...)\n}\n\n// NotNil asserts that the specified object is not nil.\n//\n//    a.NotNil(err)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool {\n\treturn NotNil(a.t, object, msgAndArgs...)\n}\n\n// NotNilf asserts that the specified object is not nil.\n//\n//    a.NotNilf(err, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool {\n\treturn NotNilf(a.t, object, msg, args...)\n}\n\n// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   a.NotPanics(func(){ RemainCalm() })\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\treturn NotPanics(a.t, f, msgAndArgs...)\n}\n\n// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   a.NotPanicsf(func(){ RemainCalm() }, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool {\n\treturn NotPanicsf(a.t, f, msg, args...)\n}\n\n// NotRegexp asserts that a specified regexp does not match a string.\n//\n//  a.NotRegexp(regexp.MustCompile(\"starts\"), \"it's starting\")\n//  a.NotRegexp(\"^start\", \"it's not starting\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {\n\treturn NotRegexp(a.t, rx, str, msgAndArgs...)\n}\n\n// NotRegexpf asserts that a specified regexp does not match a string.\n//\n//  a.NotRegexpf(regexp.MustCompile(\"starts\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  a.NotRegexpf(\"^start\", \"it's not starting\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {\n\treturn NotRegexpf(a.t, rx, str, msg, args...)\n}\n\n// NotSubset asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    a.NotSubset([1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {\n\treturn NotSubset(a.t, list, subset, msgAndArgs...)\n}\n\n// NotSubsetf asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    a.NotSubsetf([1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {\n\treturn NotSubsetf(a.t, list, subset, msg, args...)\n}\n\n// NotZero asserts that i is not the zero value for its type and returns the truth.\nfunc (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool {\n\treturn NotZero(a.t, i, msgAndArgs...)\n}\n\n// NotZerof asserts that i is not the zero value for its type and returns the truth.\nfunc (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool {\n\treturn NotZerof(a.t, i, msg, args...)\n}\n\n// Panics asserts that the code inside the specified PanicTestFunc panics.\n//\n//   a.Panics(func(){ GoCrazy() })\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\treturn Panics(a.t, f, msgAndArgs...)\n}\n\n// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   a.PanicsWithValue(\"crazy error\", func(){ GoCrazy() })\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\treturn PanicsWithValue(a.t, expected, f, msgAndArgs...)\n}\n\n// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   a.PanicsWithValuef(\"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {\n\treturn PanicsWithValuef(a.t, expected, f, msg, args...)\n}\n\n// Panicsf asserts that the code inside the specified PanicTestFunc panics.\n//\n//   a.Panicsf(func(){ GoCrazy() }, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool {\n\treturn Panicsf(a.t, f, msg, args...)\n}\n\n// Regexp asserts that a specified regexp matches a string.\n//\n//  a.Regexp(regexp.MustCompile(\"start\"), \"it's starting\")\n//  a.Regexp(\"start...$\", \"it's not starting\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {\n\treturn Regexp(a.t, rx, str, msgAndArgs...)\n}\n\n// Regexpf asserts that a specified regexp matches a string.\n//\n//  a.Regexpf(regexp.MustCompile(\"start\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  a.Regexpf(\"start...$\", \"it's not starting\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {\n\treturn Regexpf(a.t, rx, str, msg, args...)\n}\n\n// Subset asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    a.Subset([1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {\n\treturn Subset(a.t, list, subset, msgAndArgs...)\n}\n\n// Subsetf asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    a.Subsetf([1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {\n\treturn Subsetf(a.t, list, subset, msg, args...)\n}\n\n// True asserts that the specified value is true.\n//\n//    a.True(myBool)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool {\n\treturn True(a.t, value, msgAndArgs...)\n}\n\n// Truef asserts that the specified value is true.\n//\n//    a.Truef(myBool, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool {\n\treturn Truef(a.t, value, msg, args...)\n}\n\n// WithinDuration asserts that the two times are within duration delta of each other.\n//\n//   a.WithinDuration(time.Now(), time.Now(), 10*time.Second)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {\n\treturn WithinDuration(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// WithinDurationf asserts that the two times are within duration delta of each other.\n//\n//   a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {\n\treturn WithinDurationf(a.t, expected, actual, delta, msg, args...)\n}\n\n// Zero asserts that i is the zero value for its type and returns the truth.\nfunc (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool {\n\treturn Zero(a.t, i, msgAndArgs...)\n}\n\n// Zerof asserts that i is the zero value for its type and returns the truth.\nfunc (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool {\n\treturn Zerof(a.t, i, msg, args...)\n}\n"
  },
  {
    "path": "vendor/github.com/stretchr/testify/assert/assertions.go",
    "content": "package assert\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"math\"\n\t\"os\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strings\"\n\t\"time\"\n\t\"unicode\"\n\t\"unicode/utf8\"\n\n\t\"github.com/davecgh/go-spew/spew\"\n\t\"github.com/pmezard/go-difflib/difflib\"\n)\n\n//go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_format.go.tmpl\n\n// TestingT is an interface wrapper around *testing.T\ntype TestingT interface {\n\tErrorf(format string, args ...interface{})\n}\n\n// Comparison a custom function that returns true on success and false on failure\ntype Comparison func() (success bool)\n\n/*\n\tHelper functions\n*/\n\n// ObjectsAreEqual determines if two objects are considered equal.\n//\n// This function does no assertion of any kind.\nfunc ObjectsAreEqual(expected, actual interface{}) bool {\n\n\tif expected == nil || actual == nil {\n\t\treturn expected == actual\n\t}\n\tif exp, ok := expected.([]byte); ok {\n\t\tact, ok := actual.([]byte)\n\t\tif !ok {\n\t\t\treturn false\n\t\t} else if exp == nil || act == nil {\n\t\t\treturn exp == nil && act == nil\n\t\t}\n\t\treturn bytes.Equal(exp, act)\n\t}\n\treturn reflect.DeepEqual(expected, actual)\n\n}\n\n// ObjectsAreEqualValues gets whether two objects are equal, or if their\n// values are equal.\nfunc ObjectsAreEqualValues(expected, actual interface{}) bool {\n\tif ObjectsAreEqual(expected, actual) {\n\t\treturn true\n\t}\n\n\tactualType := reflect.TypeOf(actual)\n\tif actualType == nil {\n\t\treturn false\n\t}\n\texpectedValue := reflect.ValueOf(expected)\n\tif expectedValue.IsValid() && expectedValue.Type().ConvertibleTo(actualType) {\n\t\t// Attempt comparison after type conversion\n\t\treturn reflect.DeepEqual(expectedValue.Convert(actualType).Interface(), actual)\n\t}\n\n\treturn false\n}\n\n/* CallerInfo is necessary because the assert functions use the testing object\ninternally, causing it to print the file:line of the assert method, rather than where\nthe problem actually occurred in calling code.*/\n\n// CallerInfo returns an array of strings containing the file and line number\n// of each stack frame leading from the current test to the assert call that\n// failed.\nfunc CallerInfo() []string {\n\n\tpc := uintptr(0)\n\tfile := \"\"\n\tline := 0\n\tok := false\n\tname := \"\"\n\n\tcallers := []string{}\n\tfor i := 0; ; i++ {\n\t\tpc, file, line, ok = runtime.Caller(i)\n\t\tif !ok {\n\t\t\t// The breaks below failed to terminate the loop, and we ran off the\n\t\t\t// end of the call stack.\n\t\t\tbreak\n\t\t}\n\n\t\t// This is a huge edge case, but it will panic if this is the case, see #180\n\t\tif file == \"<autogenerated>\" {\n\t\t\tbreak\n\t\t}\n\n\t\tf := runtime.FuncForPC(pc)\n\t\tif f == nil {\n\t\t\tbreak\n\t\t}\n\t\tname = f.Name()\n\n\t\t// testing.tRunner is the standard library function that calls\n\t\t// tests. Subtests are called directly by tRunner, without going through\n\t\t// the Test/Benchmark/Example function that contains the t.Run calls, so\n\t\t// with subtests we should break when we hit tRunner, without adding it\n\t\t// to the list of callers.\n\t\tif name == \"testing.tRunner\" {\n\t\t\tbreak\n\t\t}\n\n\t\tparts := strings.Split(file, \"/\")\n\t\tfile = parts[len(parts)-1]\n\t\tif len(parts) > 1 {\n\t\t\tdir := parts[len(parts)-2]\n\t\t\tif (dir != \"assert\" && dir != \"mock\" && dir != \"require\") || file == \"mock_test.go\" {\n\t\t\t\tcallers = append(callers, fmt.Sprintf(\"%s:%d\", file, line))\n\t\t\t}\n\t\t}\n\n\t\t// Drop the package\n\t\tsegments := strings.Split(name, \".\")\n\t\tname = segments[len(segments)-1]\n\t\tif isTest(name, \"Test\") ||\n\t\t\tisTest(name, \"Benchmark\") ||\n\t\t\tisTest(name, \"Example\") {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn callers\n}\n\n// Stolen from the `go test` tool.\n// isTest tells whether name looks like a test (or benchmark, according to prefix).\n// It is a Test (say) if there is a character after Test that is not a lower-case letter.\n// We don't want TesticularCancer.\nfunc isTest(name, prefix string) bool {\n\tif !strings.HasPrefix(name, prefix) {\n\t\treturn false\n\t}\n\tif len(name) == len(prefix) { // \"Test\" is ok\n\t\treturn true\n\t}\n\trune, _ := utf8.DecodeRuneInString(name[len(prefix):])\n\treturn !unicode.IsLower(rune)\n}\n\n// getWhitespaceString returns a string that is long enough to overwrite the default\n// output from the go testing framework.\nfunc getWhitespaceString() string {\n\n\t_, file, line, ok := runtime.Caller(1)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\tparts := strings.Split(file, \"/\")\n\tfile = parts[len(parts)-1]\n\n\treturn strings.Repeat(\" \", len(fmt.Sprintf(\"%s:%d:        \", file, line)))\n\n}\n\nfunc messageFromMsgAndArgs(msgAndArgs ...interface{}) string {\n\tif len(msgAndArgs) == 0 || msgAndArgs == nil {\n\t\treturn \"\"\n\t}\n\tif len(msgAndArgs) == 1 {\n\t\treturn msgAndArgs[0].(string)\n\t}\n\tif len(msgAndArgs) > 1 {\n\t\treturn fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...)\n\t}\n\treturn \"\"\n}\n\n// Aligns the provided message so that all lines after the first line start at the same location as the first line.\n// Assumes that the first line starts at the correct location (after carriage return, tab, label, spacer and tab).\n// The longestLabelLen parameter specifies the length of the longest label in the output (required becaues this is the\n// basis on which the alignment occurs).\nfunc indentMessageLines(message string, longestLabelLen int) string {\n\toutBuf := new(bytes.Buffer)\n\n\tfor i, scanner := 0, bufio.NewScanner(strings.NewReader(message)); scanner.Scan(); i++ {\n\t\t// no need to align first line because it starts at the correct location (after the label)\n\t\tif i != 0 {\n\t\t\t// append alignLen+1 spaces to align with \"{{longestLabel}}:\" before adding tab\n\t\t\toutBuf.WriteString(\"\\n\\r\\t\" + strings.Repeat(\" \", longestLabelLen+1) + \"\\t\")\n\t\t}\n\t\toutBuf.WriteString(scanner.Text())\n\t}\n\n\treturn outBuf.String()\n}\n\ntype failNower interface {\n\tFailNow()\n}\n\n// FailNow fails test\nfunc FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {\n\tFail(t, failureMessage, msgAndArgs...)\n\n\t// We cannot extend TestingT with FailNow() and\n\t// maintain backwards compatibility, so we fallback\n\t// to panicking when FailNow is not available in\n\t// TestingT.\n\t// See issue #263\n\n\tif t, ok := t.(failNower); ok {\n\t\tt.FailNow()\n\t} else {\n\t\tpanic(\"test failed and t is missing `FailNow()`\")\n\t}\n\treturn false\n}\n\n// Fail reports a failure through\nfunc Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {\n\tcontent := []labeledContent{\n\t\t{\"Error Trace\", strings.Join(CallerInfo(), \"\\n\\r\\t\\t\\t\")},\n\t\t{\"Error\", failureMessage},\n\t}\n\n\t// Add test name if the Go version supports it\n\tif n, ok := t.(interface {\n\t\tName() string\n\t}); ok {\n\t\tcontent = append(content, labeledContent{\"Test\", n.Name()})\n\t}\n\n\tmessage := messageFromMsgAndArgs(msgAndArgs...)\n\tif len(message) > 0 {\n\t\tcontent = append(content, labeledContent{\"Messages\", message})\n\t}\n\n\tt.Errorf(\"%s\", \"\\r\"+getWhitespaceString()+labeledOutput(content...))\n\n\treturn false\n}\n\ntype labeledContent struct {\n\tlabel   string\n\tcontent string\n}\n\n// labeledOutput returns a string consisting of the provided labeledContent. Each labeled output is appended in the following manner:\n//\n//   \\r\\t{{label}}:{{align_spaces}}\\t{{content}}\\n\n//\n// The initial carriage return is required to undo/erase any padding added by testing.T.Errorf. The \"\\t{{label}}:\" is for the label.\n// If a label is shorter than the longest label provided, padding spaces are added to make all the labels match in length. Once this\n// alignment is achieved, \"\\t{{content}}\\n\" is added for the output.\n//\n// If the content of the labeledOutput contains line breaks, the subsequent lines are aligned so that they start at the same location as the first line.\nfunc labeledOutput(content ...labeledContent) string {\n\tlongestLabel := 0\n\tfor _, v := range content {\n\t\tif len(v.label) > longestLabel {\n\t\t\tlongestLabel = len(v.label)\n\t\t}\n\t}\n\tvar output string\n\tfor _, v := range content {\n\t\toutput += \"\\r\\t\" + v.label + \":\" + strings.Repeat(\" \", longestLabel-len(v.label)) + \"\\t\" + indentMessageLines(v.content, longestLabel) + \"\\n\"\n\t}\n\treturn output\n}\n\n// Implements asserts that an object is implemented by the specified interface.\n//\n//    assert.Implements(t, (*MyInterface)(nil), new(MyObject))\nfunc Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\tinterfaceType := reflect.TypeOf(interfaceObject).Elem()\n\n\tif object == nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Cannot check if nil implements %v\", interfaceType), msgAndArgs...)\n\t}\n\tif !reflect.TypeOf(object).Implements(interfaceType) {\n\t\treturn Fail(t, fmt.Sprintf(\"%T must implement %v\", object, interfaceType), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// IsType asserts that the specified objects are of the same type.\nfunc IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {\n\n\tif !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) {\n\t\treturn Fail(t, fmt.Sprintf(\"Object expected to be of type %v, but was %v\", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// Equal asserts that two objects are equal.\n//\n//    assert.Equal(t, 123, 123)\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif err := validateEqualArgs(expected, actual); err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Invalid operation: %#v == %#v (%s)\",\n\t\t\texpected, actual, err), msgAndArgs...)\n\t}\n\n\tif !ObjectsAreEqual(expected, actual) {\n\t\tdiff := diff(expected, actual)\n\t\texpected, actual = formatUnequalValues(expected, actual)\n\t\treturn Fail(t, fmt.Sprintf(\"Not equal: \\n\"+\n\t\t\t\"expected: %s\\n\"+\n\t\t\t\"actual  : %s%s\", expected, actual, diff), msgAndArgs...)\n\t}\n\n\treturn true\n\n}\n\n// formatUnequalValues takes two values of arbitrary types and returns string\n// representations appropriate to be presented to the user.\n//\n// If the values are not of like type, the returned strings will be prefixed\n// with the type name, and the value will be enclosed in parenthesis similar\n// to a type conversion in the Go grammar.\nfunc formatUnequalValues(expected, actual interface{}) (e string, a string) {\n\tif reflect.TypeOf(expected) != reflect.TypeOf(actual) {\n\t\treturn fmt.Sprintf(\"%T(%#v)\", expected, expected),\n\t\t\tfmt.Sprintf(\"%T(%#v)\", actual, actual)\n\t}\n\n\treturn fmt.Sprintf(\"%#v\", expected),\n\t\tfmt.Sprintf(\"%#v\", actual)\n}\n\n// EqualValues asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    assert.EqualValues(t, uint32(123), int32(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\n\tif !ObjectsAreEqualValues(expected, actual) {\n\t\tdiff := diff(expected, actual)\n\t\texpected, actual = formatUnequalValues(expected, actual)\n\t\treturn Fail(t, fmt.Sprintf(\"Not equal: \\n\"+\n\t\t\t\"expected: %s\\n\"+\n\t\t\t\"actual  : %s%s\", expected, actual, diff), msgAndArgs...)\n\t}\n\n\treturn true\n\n}\n\n// Exactly asserts that two objects are equal in value and type.\n//\n//    assert.Exactly(t, int32(123), int64(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\n\taType := reflect.TypeOf(expected)\n\tbType := reflect.TypeOf(actual)\n\n\tif aType != bType {\n\t\treturn Fail(t, fmt.Sprintf(\"Types expected to match exactly\\n\\r\\t%v != %v\", aType, bType), msgAndArgs...)\n\t}\n\n\treturn Equal(t, expected, actual, msgAndArgs...)\n\n}\n\n// NotNil asserts that the specified object is not nil.\n//\n//    assert.NotNil(t, err)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\tif !isNil(object) {\n\t\treturn true\n\t}\n\treturn Fail(t, \"Expected value not to be nil.\", msgAndArgs...)\n}\n\n// isNil checks if a specified object is nil or not, without Failing.\nfunc isNil(object interface{}) bool {\n\tif object == nil {\n\t\treturn true\n\t}\n\n\tvalue := reflect.ValueOf(object)\n\tkind := value.Kind()\n\tif kind >= reflect.Chan && kind <= reflect.Slice && value.IsNil() {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n// Nil asserts that the specified object is nil.\n//\n//    assert.Nil(t, err)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\tif isNil(object) {\n\t\treturn true\n\t}\n\treturn Fail(t, fmt.Sprintf(\"Expected nil, but got: %#v\", object), msgAndArgs...)\n}\n\n// isEmpty gets whether the specified object is considered empty or not.\nfunc isEmpty(object interface{}) bool {\n\n\t// get nil case out of the way\n\tif object == nil {\n\t\treturn true\n\t}\n\n\tobjValue := reflect.ValueOf(object)\n\n\tswitch objValue.Kind() {\n\t// collection types are empty when they have no element\n\tcase reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:\n\t\treturn objValue.Len() == 0\n\t// pointers are empty if nil or if the value they point to is empty\n\tcase reflect.Ptr:\n\t\tif objValue.IsNil() {\n\t\t\treturn true\n\t\t}\n\t\tderef := objValue.Elem().Interface()\n\t\treturn isEmpty(deref)\n\t// for all other types, compare against the zero value\n\tdefault:\n\t\tzero := reflect.Zero(objValue.Type())\n\t\treturn reflect.DeepEqual(object, zero.Interface())\n\t}\n}\n\n// Empty asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  assert.Empty(t, obj)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\n\tpass := isEmpty(object)\n\tif !pass {\n\t\tFail(t, fmt.Sprintf(\"Should be empty, but was %v\", object), msgAndArgs...)\n\t}\n\n\treturn pass\n\n}\n\n// NotEmpty asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if assert.NotEmpty(t, obj) {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {\n\n\tpass := !isEmpty(object)\n\tif !pass {\n\t\tFail(t, fmt.Sprintf(\"Should NOT be empty, but was %v\", object), msgAndArgs...)\n\t}\n\n\treturn pass\n\n}\n\n// getLen try to get length of object.\n// return (false, 0) if impossible.\nfunc getLen(x interface{}) (ok bool, length int) {\n\tv := reflect.ValueOf(x)\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tok = false\n\t\t}\n\t}()\n\treturn true, v.Len()\n}\n\n// Len asserts that the specified object has specific length.\n// Len also fails if the object has a type that len() not accept.\n//\n//    assert.Len(t, mySlice, 3)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool {\n\tok, l := getLen(object)\n\tif !ok {\n\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" could not be applied builtin len()\", object), msgAndArgs...)\n\t}\n\n\tif l != length {\n\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" should have %d item(s), but has %d\", object, length, l), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// True asserts that the specified value is true.\n//\n//    assert.True(t, myBool)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc True(t TestingT, value bool, msgAndArgs ...interface{}) bool {\n\n\tif value != true {\n\t\treturn Fail(t, \"Should be true\", msgAndArgs...)\n\t}\n\n\treturn true\n\n}\n\n// False asserts that the specified value is false.\n//\n//    assert.False(t, myBool)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc False(t TestingT, value bool, msgAndArgs ...interface{}) bool {\n\n\tif value != false {\n\t\treturn Fail(t, \"Should be false\", msgAndArgs...)\n\t}\n\n\treturn true\n\n}\n\n// NotEqual asserts that the specified values are NOT equal.\n//\n//    assert.NotEqual(t, obj1, obj2)\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\tif err := validateEqualArgs(expected, actual); err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Invalid operation: %#v != %#v (%s)\",\n\t\t\texpected, actual, err), msgAndArgs...)\n\t}\n\n\tif ObjectsAreEqual(expected, actual) {\n\t\treturn Fail(t, fmt.Sprintf(\"Should not be: %#v\\n\", actual), msgAndArgs...)\n\t}\n\n\treturn true\n\n}\n\n// containsElement try loop over the list check if the list includes the element.\n// return (false, false) if impossible.\n// return (true, false) if element was not found.\n// return (true, true) if element was found.\nfunc includeElement(list interface{}, element interface{}) (ok, found bool) {\n\n\tlistValue := reflect.ValueOf(list)\n\telementValue := reflect.ValueOf(element)\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tok = false\n\t\t\tfound = false\n\t\t}\n\t}()\n\n\tif reflect.TypeOf(list).Kind() == reflect.String {\n\t\treturn true, strings.Contains(listValue.String(), elementValue.String())\n\t}\n\n\tif reflect.TypeOf(list).Kind() == reflect.Map {\n\t\tmapKeys := listValue.MapKeys()\n\t\tfor i := 0; i < len(mapKeys); i++ {\n\t\t\tif ObjectsAreEqual(mapKeys[i].Interface(), element) {\n\t\t\t\treturn true, true\n\t\t\t}\n\t\t}\n\t\treturn true, false\n\t}\n\n\tfor i := 0; i < listValue.Len(); i++ {\n\t\tif ObjectsAreEqual(listValue.Index(i).Interface(), element) {\n\t\t\treturn true, true\n\t\t}\n\t}\n\treturn true, false\n\n}\n\n// Contains asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    assert.Contains(t, \"Hello World\", \"World\")\n//    assert.Contains(t, [\"Hello\", \"World\"], \"World\")\n//    assert.Contains(t, {\"Hello\": \"World\"}, \"Hello\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {\n\n\tok, found := includeElement(s, contains)\n\tif !ok {\n\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" could not be applied builtin len()\", s), msgAndArgs...)\n\t}\n\tif !found {\n\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" does not contain \\\"%s\\\"\", s, contains), msgAndArgs...)\n\t}\n\n\treturn true\n\n}\n\n// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    assert.NotContains(t, \"Hello World\", \"Earth\")\n//    assert.NotContains(t, [\"Hello\", \"World\"], \"Earth\")\n//    assert.NotContains(t, {\"Hello\": \"World\"}, \"Earth\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {\n\n\tok, found := includeElement(s, contains)\n\tif !ok {\n\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" could not be applied builtin len()\", s), msgAndArgs...)\n\t}\n\tif found {\n\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" should not contain \\\"%s\\\"\", s, contains), msgAndArgs...)\n\t}\n\n\treturn true\n\n}\n\n// Subset asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.Subset(t, [1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {\n\tif subset == nil {\n\t\treturn true // we consider nil to be equal to the nil set\n\t}\n\n\tsubsetValue := reflect.ValueOf(subset)\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tok = false\n\t\t}\n\t}()\n\n\tlistKind := reflect.TypeOf(list).Kind()\n\tsubsetKind := reflect.TypeOf(subset).Kind()\n\n\tif listKind != reflect.Array && listKind != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", list, listKind), msgAndArgs...)\n\t}\n\n\tif subsetKind != reflect.Array && subsetKind != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", subset, subsetKind), msgAndArgs...)\n\t}\n\n\tfor i := 0; i < subsetValue.Len(); i++ {\n\t\telement := subsetValue.Index(i).Interface()\n\t\tok, found := includeElement(list, element)\n\t\tif !ok {\n\t\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" could not be applied builtin len()\", list), msgAndArgs...)\n\t\t}\n\t\tif !found {\n\t\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" does not contain \\\"%s\\\"\", list, element), msgAndArgs...)\n\t\t}\n\t}\n\n\treturn true\n}\n\n// NotSubset asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.NotSubset(t, [1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {\n\tif subset == nil {\n\t\treturn Fail(t, fmt.Sprintf(\"nil is the empty set which is a subset of every set\"), msgAndArgs...)\n\t}\n\n\tsubsetValue := reflect.ValueOf(subset)\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tok = false\n\t\t}\n\t}()\n\n\tlistKind := reflect.TypeOf(list).Kind()\n\tsubsetKind := reflect.TypeOf(subset).Kind()\n\n\tif listKind != reflect.Array && listKind != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", list, listKind), msgAndArgs...)\n\t}\n\n\tif subsetKind != reflect.Array && subsetKind != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", subset, subsetKind), msgAndArgs...)\n\t}\n\n\tfor i := 0; i < subsetValue.Len(); i++ {\n\t\telement := subsetValue.Index(i).Interface()\n\t\tok, found := includeElement(list, element)\n\t\tif !ok {\n\t\t\treturn Fail(t, fmt.Sprintf(\"\\\"%s\\\" could not be applied builtin len()\", list), msgAndArgs...)\n\t\t}\n\t\tif !found {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn Fail(t, fmt.Sprintf(\"%q is a subset of %q\", subset, list), msgAndArgs...)\n}\n\n// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2]))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) {\n\tif isEmpty(listA) && isEmpty(listB) {\n\t\treturn true\n\t}\n\n\taKind := reflect.TypeOf(listA).Kind()\n\tbKind := reflect.TypeOf(listB).Kind()\n\n\tif aKind != reflect.Array && aKind != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", listA, aKind), msgAndArgs...)\n\t}\n\n\tif bKind != reflect.Array && bKind != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"%q has an unsupported type %s\", listB, bKind), msgAndArgs...)\n\t}\n\n\taValue := reflect.ValueOf(listA)\n\tbValue := reflect.ValueOf(listB)\n\n\taLen := aValue.Len()\n\tbLen := bValue.Len()\n\n\tif aLen != bLen {\n\t\treturn Fail(t, fmt.Sprintf(\"lengths don't match: %d != %d\", aLen, bLen), msgAndArgs...)\n\t}\n\n\t// Mark indexes in bValue that we already used\n\tvisited := make([]bool, bLen)\n\tfor i := 0; i < aLen; i++ {\n\t\telement := aValue.Index(i).Interface()\n\t\tfound := false\n\t\tfor j := 0; j < bLen; j++ {\n\t\t\tif visited[j] {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ObjectsAreEqual(bValue.Index(j).Interface(), element) {\n\t\t\t\tvisited[j] = true\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\treturn Fail(t, fmt.Sprintf(\"element %s appears more times in %s than in %s\", element, aValue, bValue), msgAndArgs...)\n\t\t}\n\t}\n\n\treturn true\n}\n\n// Condition uses a Comparison to assert a complex condition.\nfunc Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool {\n\tresult := comp()\n\tif !result {\n\t\tFail(t, \"Condition failed!\", msgAndArgs...)\n\t}\n\treturn result\n}\n\n// PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics\n// methods, and represents a simple func that takes no arguments, and returns nothing.\ntype PanicTestFunc func()\n\n// didPanic returns true if the function passed to it panics. Otherwise, it returns false.\nfunc didPanic(f PanicTestFunc) (bool, interface{}) {\n\n\tdidPanic := false\n\tvar message interface{}\n\tfunc() {\n\n\t\tdefer func() {\n\t\t\tif message = recover(); message != nil {\n\t\t\t\tdidPanic = true\n\t\t\t}\n\t\t}()\n\n\t\t// call the target function\n\t\tf()\n\n\t}()\n\n\treturn didPanic, message\n\n}\n\n// Panics asserts that the code inside the specified PanicTestFunc panics.\n//\n//   assert.Panics(t, func(){ GoCrazy() })\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\n\tif funcDidPanic, panicValue := didPanic(f); !funcDidPanic {\n\t\treturn Fail(t, fmt.Sprintf(\"func %#v should panic\\n\\r\\tPanic value:\\t%v\", f, panicValue), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   assert.PanicsWithValue(t, \"crazy error\", func(){ GoCrazy() })\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\n\tfuncDidPanic, panicValue := didPanic(f)\n\tif !funcDidPanic {\n\t\treturn Fail(t, fmt.Sprintf(\"func %#v should panic\\n\\r\\tPanic value:\\t%v\", f, panicValue), msgAndArgs...)\n\t}\n\tif panicValue != expected {\n\t\treturn Fail(t, fmt.Sprintf(\"func %#v should panic with value:\\t%v\\n\\r\\tPanic value:\\t%v\", f, expected, panicValue), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   assert.NotPanics(t, func(){ RemainCalm() })\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {\n\n\tif funcDidPanic, panicValue := didPanic(f); funcDidPanic {\n\t\treturn Fail(t, fmt.Sprintf(\"func %#v should not panic\\n\\r\\tPanic value:\\t%v\", f, panicValue), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// WithinDuration asserts that the two times are within duration delta of each other.\n//\n//   assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {\n\n\tdt := expected.Sub(actual)\n\tif dt < -delta || dt > delta {\n\t\treturn Fail(t, fmt.Sprintf(\"Max difference between %v and %v allowed is %v, but difference was %v\", expected, actual, delta, dt), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\nfunc toFloat(x interface{}) (float64, bool) {\n\tvar xf float64\n\txok := true\n\n\tswitch xn := x.(type) {\n\tcase uint8:\n\t\txf = float64(xn)\n\tcase uint16:\n\t\txf = float64(xn)\n\tcase uint32:\n\t\txf = float64(xn)\n\tcase uint64:\n\t\txf = float64(xn)\n\tcase int:\n\t\txf = float64(xn)\n\tcase int8:\n\t\txf = float64(xn)\n\tcase int16:\n\t\txf = float64(xn)\n\tcase int32:\n\t\txf = float64(xn)\n\tcase int64:\n\t\txf = float64(xn)\n\tcase float32:\n\t\txf = float64(xn)\n\tcase float64:\n\t\txf = float64(xn)\n\tcase time.Duration:\n\t\txf = float64(xn)\n\tdefault:\n\t\txok = false\n\t}\n\n\treturn xf, xok\n}\n\n// InDelta asserts that the two numerals are within delta of each other.\n//\n// \t assert.InDelta(t, math.Pi, (22 / 7.0), 0.01)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\n\taf, aok := toFloat(expected)\n\tbf, bok := toFloat(actual)\n\n\tif !aok || !bok {\n\t\treturn Fail(t, fmt.Sprintf(\"Parameters must be numerical\"), msgAndArgs...)\n\t}\n\n\tif math.IsNaN(af) {\n\t\treturn Fail(t, fmt.Sprintf(\"Expected must not be NaN\"), msgAndArgs...)\n\t}\n\n\tif math.IsNaN(bf) {\n\t\treturn Fail(t, fmt.Sprintf(\"Expected %v with delta %v, but was NaN\", expected, delta), msgAndArgs...)\n\t}\n\n\tdt := af - bf\n\tif dt < -delta || dt > delta {\n\t\treturn Fail(t, fmt.Sprintf(\"Max difference between %v and %v allowed is %v, but difference was %v\", expected, actual, delta, dt), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// InDeltaSlice is the same as InDelta, except it compares two slices.\nfunc InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\tif expected == nil || actual == nil ||\n\t\treflect.TypeOf(actual).Kind() != reflect.Slice ||\n\t\treflect.TypeOf(expected).Kind() != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"Parameters must be slice\"), msgAndArgs...)\n\t}\n\n\tactualSlice := reflect.ValueOf(actual)\n\texpectedSlice := reflect.ValueOf(expected)\n\n\tfor i := 0; i < actualSlice.Len(); i++ {\n\t\tresult := InDelta(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), delta, msgAndArgs...)\n\t\tif !result {\n\t\t\treturn result\n\t\t}\n\t}\n\n\treturn true\n}\n\n// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {\n\tif expected == nil || actual == nil ||\n\t\treflect.TypeOf(actual).Kind() != reflect.Map ||\n\t\treflect.TypeOf(expected).Kind() != reflect.Map {\n\t\treturn Fail(t, \"Arguments must be maps\", msgAndArgs...)\n\t}\n\n\texpectedMap := reflect.ValueOf(expected)\n\tactualMap := reflect.ValueOf(actual)\n\n\tif expectedMap.Len() != actualMap.Len() {\n\t\treturn Fail(t, \"Arguments must have the same numbe of keys\", msgAndArgs...)\n\t}\n\n\tfor _, k := range expectedMap.MapKeys() {\n\t\tev := expectedMap.MapIndex(k)\n\t\tav := actualMap.MapIndex(k)\n\n\t\tif !ev.IsValid() {\n\t\t\treturn Fail(t, fmt.Sprintf(\"missing key %q in expected map\", k), msgAndArgs...)\n\t\t}\n\n\t\tif !av.IsValid() {\n\t\t\treturn Fail(t, fmt.Sprintf(\"missing key %q in actual map\", k), msgAndArgs...)\n\t\t}\n\n\t\tif !InDelta(\n\t\t\tt,\n\t\t\tev.Interface(),\n\t\t\tav.Interface(),\n\t\t\tdelta,\n\t\t\tmsgAndArgs...,\n\t\t) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}\n\nfunc calcRelativeError(expected, actual interface{}) (float64, error) {\n\taf, aok := toFloat(expected)\n\tif !aok {\n\t\treturn 0, fmt.Errorf(\"expected value %q cannot be converted to float\", expected)\n\t}\n\tif af == 0 {\n\t\treturn 0, fmt.Errorf(\"expected value must have a value other than zero to calculate the relative error\")\n\t}\n\tbf, bok := toFloat(actual)\n\tif !bok {\n\t\treturn 0, fmt.Errorf(\"actual value %q cannot be converted to float\", actual)\n\t}\n\n\treturn math.Abs(af-bf) / math.Abs(af), nil\n}\n\n// InEpsilon asserts that expected and actual have a relative error less than epsilon\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {\n\tactualEpsilon, err := calcRelativeError(expected, actual)\n\tif err != nil {\n\t\treturn Fail(t, err.Error(), msgAndArgs...)\n\t}\n\tif actualEpsilon > epsilon {\n\t\treturn Fail(t, fmt.Sprintf(\"Relative error is too high: %#v (expected)\\n\"+\n\t\t\t\"        < %#v (actual)\", epsilon, actualEpsilon), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.\nfunc InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {\n\tif expected == nil || actual == nil ||\n\t\treflect.TypeOf(actual).Kind() != reflect.Slice ||\n\t\treflect.TypeOf(expected).Kind() != reflect.Slice {\n\t\treturn Fail(t, fmt.Sprintf(\"Parameters must be slice\"), msgAndArgs...)\n\t}\n\n\tactualSlice := reflect.ValueOf(actual)\n\texpectedSlice := reflect.ValueOf(expected)\n\n\tfor i := 0; i < actualSlice.Len(); i++ {\n\t\tresult := InEpsilon(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), epsilon)\n\t\tif !result {\n\t\t\treturn result\n\t\t}\n\t}\n\n\treturn true\n}\n\n/*\n\tErrors\n*/\n\n// NoError asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.NoError(t, err) {\n//\t   assert.Equal(t, expectedObj, actualObj)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {\n\tif err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Received unexpected error:\\n%+v\", err), msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// Error asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.Error(t, err) {\n//\t   assert.Equal(t, expectedError, err)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Error(t TestingT, err error, msgAndArgs ...interface{}) bool {\n\n\tif err == nil {\n\t\treturn Fail(t, \"An error is expected but got nil.\", msgAndArgs...)\n\t}\n\n\treturn true\n}\n\n// EqualError asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   assert.EqualError(t, err,  expectedErrorString)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool {\n\tif !Error(t, theError, msgAndArgs...) {\n\t\treturn false\n\t}\n\texpected := errString\n\tactual := theError.Error()\n\t// don't need to use deep equals here, we know they are both strings\n\tif expected != actual {\n\t\treturn Fail(t, fmt.Sprintf(\"Error message not equal:\\n\"+\n\t\t\t\"expected: %q\\n\"+\n\t\t\t\"actual  : %q\", expected, actual), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// matchRegexp return true if a specified regexp matches a string.\nfunc matchRegexp(rx interface{}, str interface{}) bool {\n\n\tvar r *regexp.Regexp\n\tif rr, ok := rx.(*regexp.Regexp); ok {\n\t\tr = rr\n\t} else {\n\t\tr = regexp.MustCompile(fmt.Sprint(rx))\n\t}\n\n\treturn (r.FindStringIndex(fmt.Sprint(str)) != nil)\n\n}\n\n// Regexp asserts that a specified regexp matches a string.\n//\n//  assert.Regexp(t, regexp.MustCompile(\"start\"), \"it's starting\")\n//  assert.Regexp(t, \"start...$\", \"it's not starting\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {\n\n\tmatch := matchRegexp(rx, str)\n\n\tif !match {\n\t\tFail(t, fmt.Sprintf(\"Expect \\\"%v\\\" to match \\\"%v\\\"\", str, rx), msgAndArgs...)\n\t}\n\n\treturn match\n}\n\n// NotRegexp asserts that a specified regexp does not match a string.\n//\n//  assert.NotRegexp(t, regexp.MustCompile(\"starts\"), \"it's starting\")\n//  assert.NotRegexp(t, \"^start\", \"it's not starting\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {\n\tmatch := matchRegexp(rx, str)\n\n\tif match {\n\t\tFail(t, fmt.Sprintf(\"Expect \\\"%v\\\" to NOT match \\\"%v\\\"\", str, rx), msgAndArgs...)\n\t}\n\n\treturn !match\n\n}\n\n// Zero asserts that i is the zero value for its type and returns the truth.\nfunc Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {\n\tif i != nil && !reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) {\n\t\treturn Fail(t, fmt.Sprintf(\"Should be zero, but was %v\", i), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// NotZero asserts that i is not the zero value for its type and returns the truth.\nfunc NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {\n\tif i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) {\n\t\treturn Fail(t, fmt.Sprintf(\"Should not be zero, but was %v\", i), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool {\n\tinfo, err := os.Lstat(path)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn Fail(t, fmt.Sprintf(\"unable to find file %q\", path), msgAndArgs...)\n\t\t}\n\t\treturn Fail(t, fmt.Sprintf(\"error when running os.Lstat(%q): %s\", path, err), msgAndArgs...)\n\t}\n\tif info.IsDir() {\n\t\treturn Fail(t, fmt.Sprintf(\"%q is a directory\", path), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool {\n\tinfo, err := os.Lstat(path)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn Fail(t, fmt.Sprintf(\"unable to find file %q\", path), msgAndArgs...)\n\t\t}\n\t\treturn Fail(t, fmt.Sprintf(\"error when running os.Lstat(%q): %s\", path, err), msgAndArgs...)\n\t}\n\tif !info.IsDir() {\n\t\treturn Fail(t, fmt.Sprintf(\"%q is a file\", path), msgAndArgs...)\n\t}\n\treturn true\n}\n\n// JSONEq asserts that two JSON strings are equivalent.\n//\n//  assert.JSONEq(t, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool {\n\tvar expectedJSONAsInterface, actualJSONAsInterface interface{}\n\n\tif err := json.Unmarshal([]byte(expected), &expectedJSONAsInterface); err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Expected value ('%s') is not valid json.\\nJSON parsing error: '%s'\", expected, err.Error()), msgAndArgs...)\n\t}\n\n\tif err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil {\n\t\treturn Fail(t, fmt.Sprintf(\"Input ('%s') needs to be valid json.\\nJSON parsing error: '%s'\", actual, err.Error()), msgAndArgs...)\n\t}\n\n\treturn Equal(t, expectedJSONAsInterface, actualJSONAsInterface, msgAndArgs...)\n}\n\nfunc typeAndKind(v interface{}) (reflect.Type, reflect.Kind) {\n\tt := reflect.TypeOf(v)\n\tk := t.Kind()\n\n\tif k == reflect.Ptr {\n\t\tt = t.Elem()\n\t\tk = t.Kind()\n\t}\n\treturn t, k\n}\n\n// diff returns a diff of both values as long as both are of the same type and\n// are a struct, map, slice or array. Otherwise it returns an empty string.\nfunc diff(expected interface{}, actual interface{}) string {\n\tif expected == nil || actual == nil {\n\t\treturn \"\"\n\t}\n\n\tet, ek := typeAndKind(expected)\n\tat, _ := typeAndKind(actual)\n\n\tif et != at {\n\t\treturn \"\"\n\t}\n\n\tif ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array {\n\t\treturn \"\"\n\t}\n\n\te := spewConfig.Sdump(expected)\n\ta := spewConfig.Sdump(actual)\n\n\tdiff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{\n\t\tA:        difflib.SplitLines(e),\n\t\tB:        difflib.SplitLines(a),\n\t\tFromFile: \"Expected\",\n\t\tFromDate: \"\",\n\t\tToFile:   \"Actual\",\n\t\tToDate:   \"\",\n\t\tContext:  1,\n\t})\n\n\treturn \"\\n\\nDiff:\\n\" + diff\n}\n\n// validateEqualArgs checks whether provided arguments can be safely used in the\n// Equal/NotEqual functions.\nfunc validateEqualArgs(expected, actual interface{}) error {\n\tif isFunction(expected) || isFunction(actual) {\n\t\treturn errors.New(\"cannot take func type as argument\")\n\t}\n\treturn nil\n}\n\nfunc isFunction(arg interface{}) bool {\n\tif arg == nil {\n\t\treturn false\n\t}\n\treturn reflect.TypeOf(arg).Kind() == reflect.Func\n}\n\nvar spewConfig = spew.ConfigState{\n\tIndent:                  \" \",\n\tDisablePointerAddresses: true,\n\tDisableCapacities:       true,\n\tSortKeys:                true,\n}\n"
  },
  {
    "path": "vendor/github.com/stretchr/testify/assert/doc.go",
    "content": "// Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.\n//\n// Example Usage\n//\n// The following is a complete example using assert in a standard test function:\n//    import (\n//      \"testing\"\n//      \"github.com/stretchr/testify/assert\"\n//    )\n//\n//    func TestSomething(t *testing.T) {\n//\n//      var a string = \"Hello\"\n//      var b string = \"Hello\"\n//\n//      assert.Equal(t, a, b, \"The two words should be the same.\")\n//\n//    }\n//\n// if you assert many times, use the format below:\n//\n//    import (\n//      \"testing\"\n//      \"github.com/stretchr/testify/assert\"\n//    )\n//\n//    func TestSomething(t *testing.T) {\n//      assert := assert.New(t)\n//\n//      var a string = \"Hello\"\n//      var b string = \"Hello\"\n//\n//      assert.Equal(a, b, \"The two words should be the same.\")\n//    }\n//\n// Assertions\n//\n// Assertions allow you to easily write test code, and are global funcs in the `assert` package.\n// All assertion functions take, as the first argument, the `*testing.T` object provided by the\n// testing framework. This allows the assertion funcs to write the failings and other details to\n// the correct place.\n//\n// Every assertion function also takes an optional string message as the final argument,\n// allowing custom error messages to be appended to the message the assertion method outputs.\npackage assert\n"
  },
  {
    "path": "vendor/github.com/stretchr/testify/assert/errors.go",
    "content": "package assert\n\nimport (\n\t\"errors\"\n)\n\n// AnError is an error instance useful for testing.  If the code does not care\n// about error specifics, and only needs to return the error for example, this\n// error should be used to make the test code more readable.\nvar AnError = errors.New(\"assert.AnError general error for testing\")\n"
  },
  {
    "path": "vendor/github.com/stretchr/testify/assert/forward_assertions.go",
    "content": "package assert\n\n// Assertions provides assertion methods around the\n// TestingT interface.\ntype Assertions struct {\n\tt TestingT\n}\n\n// New makes a new Assertions object for the specified TestingT.\nfunc New(t TestingT) *Assertions {\n\treturn &Assertions{\n\t\tt: t,\n\t}\n}\n\n//go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs\n"
  },
  {
    "path": "vendor/github.com/stretchr/testify/assert/http_assertions.go",
    "content": "package assert\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/http/httptest\"\n\t\"net/url\"\n\t\"strings\"\n)\n\n// httpCode is a helper that returns HTTP code of the response. It returns -1 and\n// an error if building a new request fails.\nfunc httpCode(handler http.HandlerFunc, method, url string, values url.Values) (int, error) {\n\tw := httptest.NewRecorder()\n\treq, err := http.NewRequest(method, url+\"?\"+values.Encode(), nil)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\thandler(w, req)\n\treturn w.Code, nil\n}\n\n// HTTPSuccess asserts that a specified handler returns a success status code.\n//\n//  assert.HTTPSuccess(t, myHandler, \"POST\", \"http://www.google.com\", nil)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tcode, err := httpCode(handler, method, url, values)\n\tif err != nil {\n\t\tFail(t, fmt.Sprintf(\"Failed to build test request, got error: %s\", err))\n\t\treturn false\n\t}\n\n\tisSuccessCode := code >= http.StatusOK && code <= http.StatusPartialContent\n\tif !isSuccessCode {\n\t\tFail(t, fmt.Sprintf(\"Expected HTTP success status code for %q but received %d\", url+\"?\"+values.Encode(), code))\n\t}\n\n\treturn isSuccessCode\n}\n\n// HTTPRedirect asserts that a specified handler returns a redirect status code.\n//\n//  assert.HTTPRedirect(t, myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tcode, err := httpCode(handler, method, url, values)\n\tif err != nil {\n\t\tFail(t, fmt.Sprintf(\"Failed to build test request, got error: %s\", err))\n\t\treturn false\n\t}\n\n\tisRedirectCode := code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect\n\tif !isRedirectCode {\n\t\tFail(t, fmt.Sprintf(\"Expected HTTP redirect status code for %q but received %d\", url+\"?\"+values.Encode(), code))\n\t}\n\n\treturn isRedirectCode\n}\n\n// HTTPError asserts that a specified handler returns an error status code.\n//\n//  assert.HTTPError(t, myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {\n\tcode, err := httpCode(handler, method, url, values)\n\tif err != nil {\n\t\tFail(t, fmt.Sprintf(\"Failed to build test request, got error: %s\", err))\n\t\treturn false\n\t}\n\n\tisErrorCode := code >= http.StatusBadRequest\n\tif !isErrorCode {\n\t\tFail(t, fmt.Sprintf(\"Expected HTTP error status code for %q but received %d\", url+\"?\"+values.Encode(), code))\n\t}\n\n\treturn isErrorCode\n}\n\n// HTTPBody is a helper that returns HTTP body of the response. It returns\n// empty string if building a new request fails.\nfunc HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string {\n\tw := httptest.NewRecorder()\n\treq, err := http.NewRequest(method, url+\"?\"+values.Encode(), nil)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\thandler(w, req)\n\treturn w.Body.String()\n}\n\n// HTTPBodyContains asserts that a specified handler returns a\n// body that contains a string.\n//\n//  assert.HTTPBodyContains(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {\n\tbody := HTTPBody(handler, method, url, values)\n\n\tcontains := strings.Contains(body, fmt.Sprint(str))\n\tif !contains {\n\t\tFail(t, fmt.Sprintf(\"Expected response body for \\\"%s\\\" to contain \\\"%s\\\" but found \\\"%s\\\"\", url+\"?\"+values.Encode(), str, body))\n\t}\n\n\treturn contains\n}\n\n// HTTPBodyNotContains asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  assert.HTTPBodyNotContains(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {\n\tbody := HTTPBody(handler, method, url, values)\n\n\tcontains := strings.Contains(body, fmt.Sprint(str))\n\tif contains {\n\t\tFail(t, fmt.Sprintf(\"Expected response body for \\\"%s\\\" to NOT contain \\\"%s\\\" but found \\\"%s\\\"\", url+\"?\"+values.Encode(), str, body))\n\t}\n\n\treturn !contains\n}\n"
  },
  {
    "path": "vendor/github.com/stretchr/testify/require/doc.go",
    "content": "// Package require implements the same assertions as the `assert` package but\n// stops test execution when a test fails.\n//\n// Example Usage\n//\n// The following is a complete example using require in a standard test function:\n//    import (\n//      \"testing\"\n//      \"github.com/stretchr/testify/require\"\n//    )\n//\n//    func TestSomething(t *testing.T) {\n//\n//      var a string = \"Hello\"\n//      var b string = \"Hello\"\n//\n//      require.Equal(t, a, b, \"The two words should be the same.\")\n//\n//    }\n//\n// Assertions\n//\n// The `require` package have same global functions as in the `assert` package,\n// but instead of returning a boolean result they call `t.FailNow()`.\n//\n// Every assertion function also takes an optional string message as the final argument,\n// allowing custom error messages to be appended to the message the assertion method outputs.\npackage require\n"
  },
  {
    "path": "vendor/github.com/stretchr/testify/require/forward_requirements.go",
    "content": "package require\n\n// Assertions provides assertion methods around the\n// TestingT interface.\ntype Assertions struct {\n\tt TestingT\n}\n\n// New makes a new Assertions object for the specified TestingT.\nfunc New(t TestingT) *Assertions {\n\treturn &Assertions{\n\t\tt: t,\n\t}\n}\n\n//go:generate go run ../_codegen/main.go -output-package=require -template=require_forward.go.tmpl -include-format-funcs\n"
  },
  {
    "path": "vendor/github.com/stretchr/testify/require/require.go",
    "content": "/*\n* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen\n* THIS FILE MUST NOT BE EDITED BY HAND\n */\n\npackage require\n\nimport (\n\tassert \"github.com/stretchr/testify/assert\"\n\thttp \"net/http\"\n\turl \"net/url\"\n\ttime \"time\"\n)\n\n// Condition uses a Comparison to assert a complex condition.\nfunc Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) {\n\tif !assert.Condition(t, comp, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Conditionf uses a Comparison to assert a complex condition.\nfunc Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interface{}) {\n\tif !assert.Conditionf(t, comp, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Contains asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    assert.Contains(t, \"Hello World\", \"World\")\n//    assert.Contains(t, [\"Hello\", \"World\"], \"World\")\n//    assert.Contains(t, {\"Hello\": \"World\"}, \"Hello\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {\n\tif !assert.Contains(t, s, contains, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Containsf asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    assert.Containsf(t, \"Hello World\", \"World\", \"error message %s\", \"formatted\")\n//    assert.Containsf(t, [\"Hello\", \"World\"], \"World\", \"error message %s\", \"formatted\")\n//    assert.Containsf(t, {\"Hello\": \"World\"}, \"Hello\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {\n\tif !assert.Containsf(t, s, contains, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc DirExists(t TestingT, path string, msgAndArgs ...interface{}) {\n\tif !assert.DirExists(t, path, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc DirExistsf(t TestingT, path string, msg string, args ...interface{}) {\n\tif !assert.DirExistsf(t, path, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2]))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc ElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) {\n\tif !assert.ElementsMatch(t, listA, listB, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], \"error message %s\", \"formatted\"))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) {\n\tif !assert.ElementsMatchf(t, listA, listB, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Empty asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  assert.Empty(t, obj)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif !assert.Empty(t, object, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Emptyf asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  assert.Emptyf(t, obj, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif !assert.Emptyf(t, object, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Equal asserts that two objects are equal.\n//\n//    assert.Equal(t, 123, 123)\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif !assert.Equal(t, expected, actual, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// EqualError asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   assert.EqualError(t, err,  expectedErrorString)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) {\n\tif !assert.EqualError(t, theError, errString, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// EqualErrorf asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   assert.EqualErrorf(t, err,  expectedErrorString, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) {\n\tif !assert.EqualErrorf(t, theError, errString, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// EqualValues asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    assert.EqualValues(t, uint32(123), int32(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif !assert.EqualValues(t, expected, actual, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// EqualValuesf asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    assert.EqualValuesf(t, uint32(123, \"error message %s\", \"formatted\"), int32(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif !assert.EqualValuesf(t, expected, actual, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Equalf asserts that two objects are equal.\n//\n//    assert.Equalf(t, 123, 123, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif !assert.Equalf(t, expected, actual, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Error asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.Error(t, err) {\n// \t   assert.Equal(t, expectedError, err)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Error(t TestingT, err error, msgAndArgs ...interface{}) {\n\tif !assert.Error(t, err, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Errorf asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.Errorf(t, err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedErrorf, err)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Errorf(t TestingT, err error, msg string, args ...interface{}) {\n\tif !assert.Errorf(t, err, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Exactly asserts that two objects are equal in value and type.\n//\n//    assert.Exactly(t, int32(123), int64(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif !assert.Exactly(t, expected, actual, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Exactlyf asserts that two objects are equal in value and type.\n//\n//    assert.Exactlyf(t, int32(123, \"error message %s\", \"formatted\"), int64(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif !assert.Exactlyf(t, expected, actual, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Fail reports a failure through\nfunc Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) {\n\tif !assert.Fail(t, failureMessage, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// FailNow fails test\nfunc FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) {\n\tif !assert.FailNow(t, failureMessage, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// FailNowf fails test\nfunc FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) {\n\tif !assert.FailNowf(t, failureMessage, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Failf reports a failure through\nfunc Failf(t TestingT, failureMessage string, msg string, args ...interface{}) {\n\tif !assert.Failf(t, failureMessage, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// False asserts that the specified value is false.\n//\n//    assert.False(t, myBool)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc False(t TestingT, value bool, msgAndArgs ...interface{}) {\n\tif !assert.False(t, value, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Falsef asserts that the specified value is false.\n//\n//    assert.Falsef(t, myBool, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Falsef(t TestingT, value bool, msg string, args ...interface{}) {\n\tif !assert.Falsef(t, value, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc FileExists(t TestingT, path string, msgAndArgs ...interface{}) {\n\tif !assert.FileExists(t, path, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc FileExistsf(t TestingT, path string, msg string, args ...interface{}) {\n\tif !assert.FileExistsf(t, path, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPBodyContains asserts that a specified handler returns a\n// body that contains a string.\n//\n//  assert.HTTPBodyContains(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {\n\tif !assert.HTTPBodyContains(t, handler, method, url, values, str, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPBodyContainsf asserts that a specified handler returns a\n// body that contains a string.\n//\n//  assert.HTTPBodyContainsf(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {\n\tif !assert.HTTPBodyContainsf(t, handler, method, url, values, str, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPBodyNotContains asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  assert.HTTPBodyNotContains(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {\n\tif !assert.HTTPBodyNotContains(t, handler, method, url, values, str, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPBodyNotContainsf asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  assert.HTTPBodyNotContainsf(t, myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {\n\tif !assert.HTTPBodyNotContainsf(t, handler, method, url, values, str, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPError asserts that a specified handler returns an error status code.\n//\n//  assert.HTTPError(t, myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif !assert.HTTPError(t, handler, method, url, values, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPErrorf asserts that a specified handler returns an error status code.\n//\n//  assert.HTTPErrorf(t, myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif !assert.HTTPErrorf(t, handler, method, url, values, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPRedirect asserts that a specified handler returns a redirect status code.\n//\n//  assert.HTTPRedirect(t, myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif !assert.HTTPRedirect(t, handler, method, url, values, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPRedirectf asserts that a specified handler returns a redirect status code.\n//\n//  assert.HTTPRedirectf(t, myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif !assert.HTTPRedirectf(t, handler, method, url, values, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPSuccess asserts that a specified handler returns a success status code.\n//\n//  assert.HTTPSuccess(t, myHandler, \"POST\", \"http://www.google.com\", nil)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tif !assert.HTTPSuccess(t, handler, method, url, values, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// HTTPSuccessf asserts that a specified handler returns a success status code.\n//\n//  assert.HTTPSuccessf(t, myHandler, \"POST\", \"http://www.google.com\", nil, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tif !assert.HTTPSuccessf(t, handler, method, url, values, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Implements asserts that an object is implemented by the specified interface.\n//\n//    assert.Implements(t, (*MyInterface)(nil), new(MyObject))\nfunc Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif !assert.Implements(t, interfaceObject, object, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Implementsf asserts that an object is implemented by the specified interface.\n//\n//    assert.Implementsf(t, (*MyInterface, \"error message %s\", \"formatted\")(nil), new(MyObject))\nfunc Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {\n\tif !assert.Implementsf(t, interfaceObject, object, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InDelta asserts that the two numerals are within delta of each other.\n//\n// \t assert.InDelta(t, math.Pi, (22 / 7.0), 0.01)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif !assert.InDelta(t, expected, actual, delta, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc InDeltaMapValues(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif !assert.InDeltaMapValues(t, expected, actual, delta, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif !assert.InDeltaMapValuesf(t, expected, actual, delta, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InDeltaSlice is the same as InDelta, except it compares two slices.\nfunc InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tif !assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InDeltaSlicef is the same as InDelta, except it compares two slices.\nfunc InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif !assert.InDeltaSlicef(t, expected, actual, delta, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InDeltaf asserts that the two numerals are within delta of each other.\n//\n// \t assert.InDeltaf(t, math.Pi, (22 / 7.0, \"error message %s\", \"formatted\"), 0.01)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tif !assert.InDeltaf(t, expected, actual, delta, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InEpsilon asserts that expected and actual have a relative error less than epsilon\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {\n\tif !assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.\nfunc InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {\n\tif !assert.InEpsilonSlice(t, expected, actual, epsilon, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.\nfunc InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {\n\tif !assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// InEpsilonf asserts that expected and actual have a relative error less than epsilon\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {\n\tif !assert.InEpsilonf(t, expected, actual, epsilon, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// IsType asserts that the specified objects are of the same type.\nfunc IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif !assert.IsType(t, expectedType, object, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// IsTypef asserts that the specified objects are of the same type.\nfunc IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) {\n\tif !assert.IsTypef(t, expectedType, object, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// JSONEq asserts that two JSON strings are equivalent.\n//\n//  assert.JSONEq(t, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) {\n\tif !assert.JSONEq(t, expected, actual, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// JSONEqf asserts that two JSON strings are equivalent.\n//\n//  assert.JSONEqf(t, `{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) {\n\tif !assert.JSONEqf(t, expected, actual, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Len asserts that the specified object has specific length.\n// Len also fails if the object has a type that len() not accept.\n//\n//    assert.Len(t, mySlice, 3)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) {\n\tif !assert.Len(t, object, length, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Lenf asserts that the specified object has specific length.\n// Lenf also fails if the object has a type that len() not accept.\n//\n//    assert.Lenf(t, mySlice, 3, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) {\n\tif !assert.Lenf(t, object, length, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Nil asserts that the specified object is nil.\n//\n//    assert.Nil(t, err)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif !assert.Nil(t, object, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Nilf asserts that the specified object is nil.\n//\n//    assert.Nilf(t, err, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Nilf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif !assert.Nilf(t, object, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NoError asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.NoError(t, err) {\n// \t   assert.Equal(t, expectedObj, actualObj)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NoError(t TestingT, err error, msgAndArgs ...interface{}) {\n\tif !assert.NoError(t, err, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NoErrorf asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if assert.NoErrorf(t, err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedObj, actualObj)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NoErrorf(t TestingT, err error, msg string, args ...interface{}) {\n\tif !assert.NoErrorf(t, err, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    assert.NotContains(t, \"Hello World\", \"Earth\")\n//    assert.NotContains(t, [\"Hello\", \"World\"], \"Earth\")\n//    assert.NotContains(t, {\"Hello\": \"World\"}, \"Earth\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {\n\tif !assert.NotContains(t, s, contains, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    assert.NotContainsf(t, \"Hello World\", \"Earth\", \"error message %s\", \"formatted\")\n//    assert.NotContainsf(t, [\"Hello\", \"World\"], \"Earth\", \"error message %s\", \"formatted\")\n//    assert.NotContainsf(t, {\"Hello\": \"World\"}, \"Earth\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {\n\tif !assert.NotContainsf(t, s, contains, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotEmpty asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if assert.NotEmpty(t, obj) {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif !assert.NotEmpty(t, object, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotEmptyf asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if assert.NotEmptyf(t, obj, \"error message %s\", \"formatted\") {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif !assert.NotEmptyf(t, object, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotEqual asserts that the specified values are NOT equal.\n//\n//    assert.NotEqual(t, obj1, obj2)\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tif !assert.NotEqual(t, expected, actual, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotEqualf asserts that the specified values are NOT equal.\n//\n//    assert.NotEqualf(t, obj1, obj2, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tif !assert.NotEqualf(t, expected, actual, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotNil asserts that the specified object is not nil.\n//\n//    assert.NotNil(t, err)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) {\n\tif !assert.NotNil(t, object, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotNilf asserts that the specified object is not nil.\n//\n//    assert.NotNilf(t, err, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) {\n\tif !assert.NotNilf(t, object, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   assert.NotPanics(t, func(){ RemainCalm() })\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif !assert.NotPanics(t, f, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   assert.NotPanicsf(t, func(){ RemainCalm() }, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif !assert.NotPanicsf(t, f, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotRegexp asserts that a specified regexp does not match a string.\n//\n//  assert.NotRegexp(t, regexp.MustCompile(\"starts\"), \"it's starting\")\n//  assert.NotRegexp(t, \"^start\", \"it's not starting\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {\n\tif !assert.NotRegexp(t, rx, str, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotRegexpf asserts that a specified regexp does not match a string.\n//\n//  assert.NotRegexpf(t, regexp.MustCompile(\"starts\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  assert.NotRegexpf(t, \"^start\", \"it's not starting\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {\n\tif !assert.NotRegexpf(t, rx, str, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotSubset asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.NotSubset(t, [1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {\n\tif !assert.NotSubset(t, list, subset, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotSubsetf asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.NotSubsetf(t, [1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {\n\tif !assert.NotSubsetf(t, list, subset, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotZero asserts that i is not the zero value for its type and returns the truth.\nfunc NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) {\n\tif !assert.NotZero(t, i, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// NotZerof asserts that i is not the zero value for its type and returns the truth.\nfunc NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) {\n\tif !assert.NotZerof(t, i, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Panics asserts that the code inside the specified PanicTestFunc panics.\n//\n//   assert.Panics(t, func(){ GoCrazy() })\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif !assert.Panics(t, f, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   assert.PanicsWithValue(t, \"crazy error\", func(){ GoCrazy() })\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tif !assert.PanicsWithValue(t, expected, f, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   assert.PanicsWithValuef(t, \"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc PanicsWithValuef(t TestingT, expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif !assert.PanicsWithValuef(t, expected, f, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Panicsf asserts that the code inside the specified PanicTestFunc panics.\n//\n//   assert.Panicsf(t, func(){ GoCrazy() }, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Panicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tif !assert.Panicsf(t, f, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Regexp asserts that a specified regexp matches a string.\n//\n//  assert.Regexp(t, regexp.MustCompile(\"start\"), \"it's starting\")\n//  assert.Regexp(t, \"start...$\", \"it's not starting\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {\n\tif !assert.Regexp(t, rx, str, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Regexpf asserts that a specified regexp matches a string.\n//\n//  assert.Regexpf(t, regexp.MustCompile(\"start\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  assert.Regexpf(t, \"start...$\", \"it's not starting\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {\n\tif !assert.Regexpf(t, rx, str, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Subset asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.Subset(t, [1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {\n\tif !assert.Subset(t, list, subset, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Subsetf asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    assert.Subsetf(t, [1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {\n\tif !assert.Subsetf(t, list, subset, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// True asserts that the specified value is true.\n//\n//    assert.True(t, myBool)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc True(t TestingT, value bool, msgAndArgs ...interface{}) {\n\tif !assert.True(t, value, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Truef asserts that the specified value is true.\n//\n//    assert.Truef(t, myBool, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc Truef(t TestingT, value bool, msg string, args ...interface{}) {\n\tif !assert.Truef(t, value, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// WithinDuration asserts that the two times are within duration delta of each other.\n//\n//   assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {\n\tif !assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// WithinDurationf asserts that the two times are within duration delta of each other.\n//\n//   assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {\n\tif !assert.WithinDurationf(t, expected, actual, delta, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Zero asserts that i is the zero value for its type and returns the truth.\nfunc Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) {\n\tif !assert.Zero(t, i, msgAndArgs...) {\n\t\tt.FailNow()\n\t}\n}\n\n// Zerof asserts that i is the zero value for its type and returns the truth.\nfunc Zerof(t TestingT, i interface{}, msg string, args ...interface{}) {\n\tif !assert.Zerof(t, i, msg, args...) {\n\t\tt.FailNow()\n\t}\n}\n"
  },
  {
    "path": "vendor/github.com/stretchr/testify/require/require_forward.go",
    "content": "/*\n* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen\n* THIS FILE MUST NOT BE EDITED BY HAND\n */\n\npackage require\n\nimport (\n\tassert \"github.com/stretchr/testify/assert\"\n\thttp \"net/http\"\n\turl \"net/url\"\n\ttime \"time\"\n)\n\n// Condition uses a Comparison to assert a complex condition.\nfunc (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) {\n\tCondition(a.t, comp, msgAndArgs...)\n}\n\n// Conditionf uses a Comparison to assert a complex condition.\nfunc (a *Assertions) Conditionf(comp assert.Comparison, msg string, args ...interface{}) {\n\tConditionf(a.t, comp, msg, args...)\n}\n\n// Contains asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    a.Contains(\"Hello World\", \"World\")\n//    a.Contains([\"Hello\", \"World\"], \"World\")\n//    a.Contains({\"Hello\": \"World\"}, \"Hello\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {\n\tContains(a.t, s, contains, msgAndArgs...)\n}\n\n// Containsf asserts that the specified string, list(array, slice...) or map contains the\n// specified substring or element.\n//\n//    a.Containsf(\"Hello World\", \"World\", \"error message %s\", \"formatted\")\n//    a.Containsf([\"Hello\", \"World\"], \"World\", \"error message %s\", \"formatted\")\n//    a.Containsf({\"Hello\": \"World\"}, \"Hello\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) {\n\tContainsf(a.t, s, contains, msg, args...)\n}\n\n// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) {\n\tDirExists(a.t, path, msgAndArgs...)\n}\n\n// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.\nfunc (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) {\n\tDirExistsf(a.t, path, msg, args...)\n}\n\n// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2]))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) {\n\tElementsMatch(a.t, listA, listB, msgAndArgs...)\n}\n\n// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified\n// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,\n// the number of appearances of each of them in both lists should match.\n//\n// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], \"error message %s\", \"formatted\"))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) {\n\tElementsMatchf(a.t, listA, listB, msg, args...)\n}\n\n// Empty asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  a.Empty(obj)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) {\n\tEmpty(a.t, object, msgAndArgs...)\n}\n\n// Emptyf asserts that the specified object is empty.  I.e. nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  a.Emptyf(obj, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) {\n\tEmptyf(a.t, object, msg, args...)\n}\n\n// Equal asserts that two objects are equal.\n//\n//    a.Equal(123, 123)\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tEqual(a.t, expected, actual, msgAndArgs...)\n}\n\n// EqualError asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   a.EqualError(err,  expectedErrorString)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) {\n\tEqualError(a.t, theError, errString, msgAndArgs...)\n}\n\n// EqualErrorf asserts that a function returned an error (i.e. not `nil`)\n// and that it is equal to the provided error.\n//\n//   actualObj, err := SomeFunction()\n//   a.EqualErrorf(err,  expectedErrorString, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) {\n\tEqualErrorf(a.t, theError, errString, msg, args...)\n}\n\n// EqualValues asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    a.EqualValues(uint32(123), int32(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tEqualValues(a.t, expected, actual, msgAndArgs...)\n}\n\n// EqualValuesf asserts that two objects are equal or convertable to the same types\n// and equal.\n//\n//    a.EqualValuesf(uint32(123, \"error message %s\", \"formatted\"), int32(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tEqualValuesf(a.t, expected, actual, msg, args...)\n}\n\n// Equalf asserts that two objects are equal.\n//\n//    a.Equalf(123, 123, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses). Function equality\n// cannot be determined and will always fail.\nfunc (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tEqualf(a.t, expected, actual, msg, args...)\n}\n\n// Error asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.Error(err) {\n// \t   assert.Equal(t, expectedError, err)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Error(err error, msgAndArgs ...interface{}) {\n\tError(a.t, err, msgAndArgs...)\n}\n\n// Errorf asserts that a function returned an error (i.e. not `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.Errorf(err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedErrorf, err)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Errorf(err error, msg string, args ...interface{}) {\n\tErrorf(a.t, err, msg, args...)\n}\n\n// Exactly asserts that two objects are equal in value and type.\n//\n//    a.Exactly(int32(123), int64(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tExactly(a.t, expected, actual, msgAndArgs...)\n}\n\n// Exactlyf asserts that two objects are equal in value and type.\n//\n//    a.Exactlyf(int32(123, \"error message %s\", \"formatted\"), int64(123))\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tExactlyf(a.t, expected, actual, msg, args...)\n}\n\n// Fail reports a failure through\nfunc (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) {\n\tFail(a.t, failureMessage, msgAndArgs...)\n}\n\n// FailNow fails test\nfunc (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) {\n\tFailNow(a.t, failureMessage, msgAndArgs...)\n}\n\n// FailNowf fails test\nfunc (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) {\n\tFailNowf(a.t, failureMessage, msg, args...)\n}\n\n// Failf reports a failure through\nfunc (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) {\n\tFailf(a.t, failureMessage, msg, args...)\n}\n\n// False asserts that the specified value is false.\n//\n//    a.False(myBool)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) False(value bool, msgAndArgs ...interface{}) {\n\tFalse(a.t, value, msgAndArgs...)\n}\n\n// Falsef asserts that the specified value is false.\n//\n//    a.Falsef(myBool, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Falsef(value bool, msg string, args ...interface{}) {\n\tFalsef(a.t, value, msg, args...)\n}\n\n// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) {\n\tFileExists(a.t, path, msgAndArgs...)\n}\n\n// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.\nfunc (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) {\n\tFileExistsf(a.t, path, msg, args...)\n}\n\n// HTTPBodyContains asserts that a specified handler returns a\n// body that contains a string.\n//\n//  a.HTTPBodyContains(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {\n\tHTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...)\n}\n\n// HTTPBodyContainsf asserts that a specified handler returns a\n// body that contains a string.\n//\n//  a.HTTPBodyContainsf(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {\n\tHTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...)\n}\n\n// HTTPBodyNotContains asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  a.HTTPBodyNotContains(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {\n\tHTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...)\n}\n\n// HTTPBodyNotContainsf asserts that a specified handler returns a\n// body that does not contain a string.\n//\n//  a.HTTPBodyNotContainsf(myHandler, \"www.google.com\", nil, \"I'm Feeling Lucky\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {\n\tHTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...)\n}\n\n// HTTPError asserts that a specified handler returns an error status code.\n//\n//  a.HTTPError(myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tHTTPError(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPErrorf asserts that a specified handler returns an error status code.\n//\n//  a.HTTPErrorf(myHandler, \"POST\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tHTTPErrorf(a.t, handler, method, url, values, msg, args...)\n}\n\n// HTTPRedirect asserts that a specified handler returns a redirect status code.\n//\n//  a.HTTPRedirect(myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tHTTPRedirect(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPRedirectf asserts that a specified handler returns a redirect status code.\n//\n//  a.HTTPRedirectf(myHandler, \"GET\", \"/a/b/c\", url.Values{\"a\": []string{\"b\", \"c\"}}\n//\n// Returns whether the assertion was successful (true, \"error message %s\", \"formatted\") or not (false).\nfunc (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tHTTPRedirectf(a.t, handler, method, url, values, msg, args...)\n}\n\n// HTTPSuccess asserts that a specified handler returns a success status code.\n//\n//  a.HTTPSuccess(myHandler, \"POST\", \"http://www.google.com\", nil)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {\n\tHTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)\n}\n\n// HTTPSuccessf asserts that a specified handler returns a success status code.\n//\n//  a.HTTPSuccessf(myHandler, \"POST\", \"http://www.google.com\", nil, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {\n\tHTTPSuccessf(a.t, handler, method, url, values, msg, args...)\n}\n\n// Implements asserts that an object is implemented by the specified interface.\n//\n//    a.Implements((*MyInterface)(nil), new(MyObject))\nfunc (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tImplements(a.t, interfaceObject, object, msgAndArgs...)\n}\n\n// Implementsf asserts that an object is implemented by the specified interface.\n//\n//    a.Implementsf((*MyInterface, \"error message %s\", \"formatted\")(nil), new(MyObject))\nfunc (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {\n\tImplementsf(a.t, interfaceObject, object, msg, args...)\n}\n\n// InDelta asserts that the two numerals are within delta of each other.\n//\n// \t a.InDelta(math.Pi, (22 / 7.0), 0.01)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tInDelta(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tInDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.\nfunc (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tInDeltaMapValuesf(a.t, expected, actual, delta, msg, args...)\n}\n\n// InDeltaSlice is the same as InDelta, except it compares two slices.\nfunc (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {\n\tInDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// InDeltaSlicef is the same as InDelta, except it compares two slices.\nfunc (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tInDeltaSlicef(a.t, expected, actual, delta, msg, args...)\n}\n\n// InDeltaf asserts that the two numerals are within delta of each other.\n//\n// \t a.InDeltaf(math.Pi, (22 / 7.0, \"error message %s\", \"formatted\"), 0.01)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {\n\tInDeltaf(a.t, expected, actual, delta, msg, args...)\n}\n\n// InEpsilon asserts that expected and actual have a relative error less than epsilon\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {\n\tInEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)\n}\n\n// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.\nfunc (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {\n\tInEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)\n}\n\n// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.\nfunc (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {\n\tInEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)\n}\n\n// InEpsilonf asserts that expected and actual have a relative error less than epsilon\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {\n\tInEpsilonf(a.t, expected, actual, epsilon, msg, args...)\n}\n\n// IsType asserts that the specified objects are of the same type.\nfunc (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tIsType(a.t, expectedType, object, msgAndArgs...)\n}\n\n// IsTypef asserts that the specified objects are of the same type.\nfunc (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) {\n\tIsTypef(a.t, expectedType, object, msg, args...)\n}\n\n// JSONEq asserts that two JSON strings are equivalent.\n//\n//  a.JSONEq(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) {\n\tJSONEq(a.t, expected, actual, msgAndArgs...)\n}\n\n// JSONEqf asserts that two JSON strings are equivalent.\n//\n//  a.JSONEqf(`{\"hello\": \"world\", \"foo\": \"bar\"}`, `{\"foo\": \"bar\", \"hello\": \"world\"}`, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) {\n\tJSONEqf(a.t, expected, actual, msg, args...)\n}\n\n// Len asserts that the specified object has specific length.\n// Len also fails if the object has a type that len() not accept.\n//\n//    a.Len(mySlice, 3)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) {\n\tLen(a.t, object, length, msgAndArgs...)\n}\n\n// Lenf asserts that the specified object has specific length.\n// Lenf also fails if the object has a type that len() not accept.\n//\n//    a.Lenf(mySlice, 3, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) {\n\tLenf(a.t, object, length, msg, args...)\n}\n\n// Nil asserts that the specified object is nil.\n//\n//    a.Nil(err)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) {\n\tNil(a.t, object, msgAndArgs...)\n}\n\n// Nilf asserts that the specified object is nil.\n//\n//    a.Nilf(err, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) {\n\tNilf(a.t, object, msg, args...)\n}\n\n// NoError asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.NoError(err) {\n// \t   assert.Equal(t, expectedObj, actualObj)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NoError(err error, msgAndArgs ...interface{}) {\n\tNoError(a.t, err, msgAndArgs...)\n}\n\n// NoErrorf asserts that a function returned no error (i.e. `nil`).\n//\n//   actualObj, err := SomeFunction()\n//   if a.NoErrorf(err, \"error message %s\", \"formatted\") {\n// \t   assert.Equal(t, expectedObj, actualObj)\n//   }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) {\n\tNoErrorf(a.t, err, msg, args...)\n}\n\n// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    a.NotContains(\"Hello World\", \"Earth\")\n//    a.NotContains([\"Hello\", \"World\"], \"Earth\")\n//    a.NotContains({\"Hello\": \"World\"}, \"Earth\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {\n\tNotContains(a.t, s, contains, msgAndArgs...)\n}\n\n// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the\n// specified substring or element.\n//\n//    a.NotContainsf(\"Hello World\", \"Earth\", \"error message %s\", \"formatted\")\n//    a.NotContainsf([\"Hello\", \"World\"], \"Earth\", \"error message %s\", \"formatted\")\n//    a.NotContainsf({\"Hello\": \"World\"}, \"Earth\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) {\n\tNotContainsf(a.t, s, contains, msg, args...)\n}\n\n// NotEmpty asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if a.NotEmpty(obj) {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) {\n\tNotEmpty(a.t, object, msgAndArgs...)\n}\n\n// NotEmptyf asserts that the specified object is NOT empty.  I.e. not nil, \"\", false, 0 or either\n// a slice or a channel with len == 0.\n//\n//  if a.NotEmptyf(obj, \"error message %s\", \"formatted\") {\n//    assert.Equal(t, \"two\", obj[1])\n//  }\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) {\n\tNotEmptyf(a.t, object, msg, args...)\n}\n\n// NotEqual asserts that the specified values are NOT equal.\n//\n//    a.NotEqual(obj1, obj2)\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {\n\tNotEqual(a.t, expected, actual, msgAndArgs...)\n}\n\n// NotEqualf asserts that the specified values are NOT equal.\n//\n//    a.NotEqualf(obj1, obj2, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\n//\n// Pointer variable equality is determined based on the equality of the\n// referenced values (as opposed to the memory addresses).\nfunc (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) {\n\tNotEqualf(a.t, expected, actual, msg, args...)\n}\n\n// NotNil asserts that the specified object is not nil.\n//\n//    a.NotNil(err)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) {\n\tNotNil(a.t, object, msgAndArgs...)\n}\n\n// NotNilf asserts that the specified object is not nil.\n//\n//    a.NotNilf(err, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) {\n\tNotNilf(a.t, object, msg, args...)\n}\n\n// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   a.NotPanics(func(){ RemainCalm() })\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tNotPanics(a.t, f, msgAndArgs...)\n}\n\n// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.\n//\n//   a.NotPanicsf(func(){ RemainCalm() }, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tNotPanicsf(a.t, f, msg, args...)\n}\n\n// NotRegexp asserts that a specified regexp does not match a string.\n//\n//  a.NotRegexp(regexp.MustCompile(\"starts\"), \"it's starting\")\n//  a.NotRegexp(\"^start\", \"it's not starting\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {\n\tNotRegexp(a.t, rx, str, msgAndArgs...)\n}\n\n// NotRegexpf asserts that a specified regexp does not match a string.\n//\n//  a.NotRegexpf(regexp.MustCompile(\"starts\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  a.NotRegexpf(\"^start\", \"it's not starting\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {\n\tNotRegexpf(a.t, rx, str, msg, args...)\n}\n\n// NotSubset asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    a.NotSubset([1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {\n\tNotSubset(a.t, list, subset, msgAndArgs...)\n}\n\n// NotSubsetf asserts that the specified list(array, slice...) contains not all\n// elements given in the specified subset(array, slice...).\n//\n//    a.NotSubsetf([1, 3, 4], [1, 2], \"But [1, 3, 4] does not contain [1, 2]\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {\n\tNotSubsetf(a.t, list, subset, msg, args...)\n}\n\n// NotZero asserts that i is not the zero value for its type and returns the truth.\nfunc (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) {\n\tNotZero(a.t, i, msgAndArgs...)\n}\n\n// NotZerof asserts that i is not the zero value for its type and returns the truth.\nfunc (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) {\n\tNotZerof(a.t, i, msg, args...)\n}\n\n// Panics asserts that the code inside the specified PanicTestFunc panics.\n//\n//   a.Panics(func(){ GoCrazy() })\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tPanics(a.t, f, msgAndArgs...)\n}\n\n// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   a.PanicsWithValue(\"crazy error\", func(){ GoCrazy() })\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {\n\tPanicsWithValue(a.t, expected, f, msgAndArgs...)\n}\n\n// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that\n// the recovered panic value equals the expected panic value.\n//\n//   a.PanicsWithValuef(\"crazy error\", func(){ GoCrazy() }, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tPanicsWithValuef(a.t, expected, f, msg, args...)\n}\n\n// Panicsf asserts that the code inside the specified PanicTestFunc panics.\n//\n//   a.Panicsf(func(){ GoCrazy() }, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Panicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {\n\tPanicsf(a.t, f, msg, args...)\n}\n\n// Regexp asserts that a specified regexp matches a string.\n//\n//  a.Regexp(regexp.MustCompile(\"start\"), \"it's starting\")\n//  a.Regexp(\"start...$\", \"it's not starting\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {\n\tRegexp(a.t, rx, str, msgAndArgs...)\n}\n\n// Regexpf asserts that a specified regexp matches a string.\n//\n//  a.Regexpf(regexp.MustCompile(\"start\", \"error message %s\", \"formatted\"), \"it's starting\")\n//  a.Regexpf(\"start...$\", \"it's not starting\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {\n\tRegexpf(a.t, rx, str, msg, args...)\n}\n\n// Subset asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    a.Subset([1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {\n\tSubset(a.t, list, subset, msgAndArgs...)\n}\n\n// Subsetf asserts that the specified list(array, slice...) contains all\n// elements given in the specified subset(array, slice...).\n//\n//    a.Subsetf([1, 2, 3], [1, 2], \"But [1, 2, 3] does contain [1, 2]\", \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {\n\tSubsetf(a.t, list, subset, msg, args...)\n}\n\n// True asserts that the specified value is true.\n//\n//    a.True(myBool)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) True(value bool, msgAndArgs ...interface{}) {\n\tTrue(a.t, value, msgAndArgs...)\n}\n\n// Truef asserts that the specified value is true.\n//\n//    a.Truef(myBool, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) Truef(value bool, msg string, args ...interface{}) {\n\tTruef(a.t, value, msg, args...)\n}\n\n// WithinDuration asserts that the two times are within duration delta of each other.\n//\n//   a.WithinDuration(time.Now(), time.Now(), 10*time.Second)\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {\n\tWithinDuration(a.t, expected, actual, delta, msgAndArgs...)\n}\n\n// WithinDurationf asserts that the two times are within duration delta of each other.\n//\n//   a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, \"error message %s\", \"formatted\")\n//\n// Returns whether the assertion was successful (true) or not (false).\nfunc (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {\n\tWithinDurationf(a.t, expected, actual, delta, msg, args...)\n}\n\n// Zero asserts that i is the zero value for its type and returns the truth.\nfunc (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) {\n\tZero(a.t, i, msgAndArgs...)\n}\n\n// Zerof asserts that i is the zero value for its type and returns the truth.\nfunc (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) {\n\tZerof(a.t, i, msg, args...)\n}\n"
  },
  {
    "path": "vendor/github.com/stretchr/testify/require/requirements.go",
    "content": "package require\n\n// TestingT is an interface wrapper around *testing.T\ntype TestingT interface {\n\tErrorf(format string, args ...interface{})\n\tFailNow()\n}\n\n//go:generate go run ../_codegen/main.go -output-package=require -template=require.go.tmpl -include-format-funcs\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/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 https://tip.golang.org/AUTHORS.\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/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 https://tip.golang.org/CONTRIBUTORS.\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/LICENSE",
    "content": "Copyright (c) 2018 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"
  },
  {
    "path": "vendor/google.golang.org/protobuf/PATENTS",
    "content": "Additional IP Rights Grant (Patents)\n\n\"This implementation\" means the copyrightable works distributed by\nGoogle as part of the Go project.\n\nGoogle hereby grants to You a perpetual, worldwide, non-exclusive,\nno-charge, royalty-free, irrevocable (except as stated in this section)\npatent license to make, have made, use, offer to sell, sell, import,\ntransfer and otherwise run, modify and propagate the contents of this\nimplementation of Go, where such license applies only to those patent\nclaims, both currently owned or controlled by Google and acquired in\nthe future, licensable by Google that are necessarily infringed by this\nimplementation of Go.  This grant does not include claims that would be\ninfringed only as a consequence of further modification of this\nimplementation.  If you or your agent or exclusive licensee institute or\norder or agree to the institution of patent litigation against any\nentity (including a cross-claim or counterclaim in a lawsuit) alleging\nthat this implementation of Go or any code incorporated within this\nimplementation of Go constitutes direct or contributory patent\ninfringement, or inducement of patent infringement, then any patent\nrights granted to you under this License for this implementation of Go\nshall terminate as of the date such litigation is filed.\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/encoding/protojson/decode.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 protojson\n\nimport (\n\t\"encoding/base64\"\n\t\"fmt\"\n\t\"math\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"google.golang.org/protobuf/internal/encoding/json\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/internal/set\"\n\t\"google.golang.org/protobuf/proto\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// Unmarshal reads the given []byte into the given proto.Message.\n// The provided message must be mutable (e.g., a non-nil pointer to a message).\nfunc Unmarshal(b []byte, m proto.Message) error {\n\treturn UnmarshalOptions{}.Unmarshal(b, m)\n}\n\n// UnmarshalOptions is a configurable JSON format parser.\ntype UnmarshalOptions struct {\n\tpragma.NoUnkeyedLiterals\n\n\t// If AllowPartial is set, input for messages that will result in missing\n\t// required fields will not return an error.\n\tAllowPartial bool\n\n\t// If DiscardUnknown is set, unknown fields are ignored.\n\tDiscardUnknown bool\n\n\t// Resolver is used for looking up types when unmarshaling\n\t// google.protobuf.Any messages or extension fields.\n\t// If nil, this defaults to using protoregistry.GlobalTypes.\n\tResolver interface {\n\t\tprotoregistry.MessageTypeResolver\n\t\tprotoregistry.ExtensionTypeResolver\n\t}\n}\n\n// Unmarshal reads the given []byte and populates the given proto.Message\n// using options in the UnmarshalOptions object.\n// It will clear the message first before setting the fields.\n// If it returns an error, the given message may be partially set.\n// The provided message must be mutable (e.g., a non-nil pointer to a message).\nfunc (o UnmarshalOptions) Unmarshal(b []byte, m proto.Message) error {\n\treturn o.unmarshal(b, m)\n}\n\n// unmarshal is a centralized function that all unmarshal operations go through.\n// For profiling purposes, avoid changing the name of this function or\n// introducing other code paths for unmarshal that do not go through this.\nfunc (o UnmarshalOptions) unmarshal(b []byte, m proto.Message) error {\n\tproto.Reset(m)\n\n\tif o.Resolver == nil {\n\t\to.Resolver = protoregistry.GlobalTypes\n\t}\n\n\tdec := decoder{json.NewDecoder(b), o}\n\tif err := dec.unmarshalMessage(m.ProtoReflect(), false); err != nil {\n\t\treturn err\n\t}\n\n\t// Check for EOF.\n\ttok, err := dec.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tok.Kind() != json.EOF {\n\t\treturn dec.unexpectedTokenError(tok)\n\t}\n\n\tif o.AllowPartial {\n\t\treturn nil\n\t}\n\treturn proto.CheckInitialized(m)\n}\n\ntype decoder struct {\n\t*json.Decoder\n\topts UnmarshalOptions\n}\n\n// newError returns an error object with position info.\nfunc (d decoder) newError(pos int, f string, x ...interface{}) error {\n\tline, column := d.Position(pos)\n\thead := fmt.Sprintf(\"(line %d:%d): \", line, column)\n\treturn errors.New(head+f, x...)\n}\n\n// unexpectedTokenError returns a syntax error for the given unexpected token.\nfunc (d decoder) unexpectedTokenError(tok json.Token) error {\n\treturn d.syntaxError(tok.Pos(), \"unexpected token %s\", tok.RawString())\n}\n\n// syntaxError returns a syntax error for given position.\nfunc (d decoder) syntaxError(pos int, f string, x ...interface{}) error {\n\tline, column := d.Position(pos)\n\thead := fmt.Sprintf(\"syntax error (line %d:%d): \", line, column)\n\treturn errors.New(head+f, x...)\n}\n\n// unmarshalMessage unmarshals a message into the given protoreflect.Message.\nfunc (d decoder) unmarshalMessage(m pref.Message, skipTypeURL bool) error {\n\tif unmarshal := wellKnownTypeUnmarshaler(m.Descriptor().FullName()); unmarshal != nil {\n\t\treturn unmarshal(d, m)\n\t}\n\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tok.Kind() != json.ObjectOpen {\n\t\treturn d.unexpectedTokenError(tok)\n\t}\n\n\tmessageDesc := m.Descriptor()\n\tif !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {\n\t\treturn errors.New(\"no support for proto1 MessageSets\")\n\t}\n\n\tvar seenNums set.Ints\n\tvar seenOneofs set.Ints\n\tfieldDescs := messageDesc.Fields()\n\tfor {\n\t\t// Read field name.\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch tok.Kind() {\n\t\tdefault:\n\t\t\treturn d.unexpectedTokenError(tok)\n\t\tcase json.ObjectClose:\n\t\t\treturn nil\n\t\tcase json.Name:\n\t\t\t// Continue below.\n\t\t}\n\n\t\tname := tok.Name()\n\t\t// Unmarshaling a non-custom embedded message in Any will contain the\n\t\t// JSON field \"@type\" which should be skipped because it is not a field\n\t\t// of the embedded message, but simply an artifact of the Any format.\n\t\tif skipTypeURL && name == \"@type\" {\n\t\t\td.Read()\n\t\t\tcontinue\n\t\t}\n\n\t\t// Get the FieldDescriptor.\n\t\tvar fd pref.FieldDescriptor\n\t\tif strings.HasPrefix(name, \"[\") && strings.HasSuffix(name, \"]\") {\n\t\t\t// Only extension names are in [name] format.\n\t\t\textName := pref.FullName(name[1 : len(name)-1])\n\t\t\textType, err := d.opts.Resolver.FindExtensionByName(extName)\n\t\t\tif err != nil && err != protoregistry.NotFound {\n\t\t\t\treturn d.newError(tok.Pos(), \"unable to resolve %s: %v\", tok.RawString(), err)\n\t\t\t}\n\t\t\tif extType != nil {\n\t\t\t\tfd = extType.TypeDescriptor()\n\t\t\t\tif !messageDesc.ExtensionRanges().Has(fd.Number()) || fd.ContainingMessage().FullName() != messageDesc.FullName() {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"message %v cannot be extended by %v\", messageDesc.FullName(), fd.FullName())\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// The name can either be the JSON name or the proto field name.\n\t\t\tfd = fieldDescs.ByJSONName(name)\n\t\t\tif fd == nil {\n\t\t\t\tfd = fieldDescs.ByTextName(name)\n\t\t\t}\n\t\t}\n\t\tif flags.ProtoLegacy {\n\t\t\tif fd != nil && fd.IsWeak() && fd.Message().IsPlaceholder() {\n\t\t\t\tfd = nil // reset since the weak reference is not linked in\n\t\t\t}\n\t\t}\n\n\t\tif fd == nil {\n\t\t\t// Field is unknown.\n\t\t\tif d.opts.DiscardUnknown {\n\t\t\t\tif err := d.skipJSONValue(); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn d.newError(tok.Pos(), \"unknown field %v\", tok.RawString())\n\t\t}\n\n\t\t// Do not allow duplicate fields.\n\t\tnum := uint64(fd.Number())\n\t\tif seenNums.Has(num) {\n\t\t\treturn d.newError(tok.Pos(), \"duplicate field %v\", tok.RawString())\n\t\t}\n\t\tseenNums.Set(num)\n\n\t\t// No need to set values for JSON null unless the field type is\n\t\t// google.protobuf.Value or google.protobuf.NullValue.\n\t\tif tok, _ := d.Peek(); tok.Kind() == json.Null && !isKnownValue(fd) && !isNullValue(fd) {\n\t\t\td.Read()\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch {\n\t\tcase fd.IsList():\n\t\t\tlist := m.Mutable(fd).List()\n\t\t\tif err := d.unmarshalList(list, fd); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase fd.IsMap():\n\t\t\tmmap := m.Mutable(fd).Map()\n\t\t\tif err := d.unmarshalMap(mmap, fd); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tdefault:\n\t\t\t// If field is a oneof, check if it has already been set.\n\t\t\tif od := fd.ContainingOneof(); od != nil {\n\t\t\t\tidx := uint64(od.Index())\n\t\t\t\tif seenOneofs.Has(idx) {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"error parsing %s, oneof %v is already set\", tok.RawString(), od.FullName())\n\t\t\t\t}\n\t\t\t\tseenOneofs.Set(idx)\n\t\t\t}\n\n\t\t\t// Required or optional fields.\n\t\t\tif err := d.unmarshalSingular(m, fd); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc isKnownValue(fd pref.FieldDescriptor) bool {\n\tmd := fd.Message()\n\treturn md != nil && md.FullName() == genid.Value_message_fullname\n}\n\nfunc isNullValue(fd pref.FieldDescriptor) bool {\n\ted := fd.Enum()\n\treturn ed != nil && ed.FullName() == genid.NullValue_enum_fullname\n}\n\n// unmarshalSingular unmarshals to the non-repeated field specified\n// by the given FieldDescriptor.\nfunc (d decoder) unmarshalSingular(m pref.Message, fd pref.FieldDescriptor) error {\n\tvar val pref.Value\n\tvar err error\n\tswitch fd.Kind() {\n\tcase pref.MessageKind, pref.GroupKind:\n\t\tval = m.NewField(fd)\n\t\terr = d.unmarshalMessage(val.Message(), false)\n\tdefault:\n\t\tval, err = d.unmarshalScalar(fd)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tm.Set(fd, val)\n\treturn nil\n}\n\n// unmarshalScalar unmarshals to a scalar/enum protoreflect.Value specified by\n// the given FieldDescriptor.\nfunc (d decoder) unmarshalScalar(fd pref.FieldDescriptor) (pref.Value, error) {\n\tconst b32 int = 32\n\tconst b64 int = 64\n\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn pref.Value{}, err\n\t}\n\n\tkind := fd.Kind()\n\tswitch kind {\n\tcase pref.BoolKind:\n\t\tif tok.Kind() == json.Bool {\n\t\t\treturn pref.ValueOfBool(tok.Bool()), nil\n\t\t}\n\n\tcase pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:\n\t\tif v, ok := unmarshalInt(tok, b32); ok {\n\t\t\treturn v, nil\n\t\t}\n\n\tcase pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:\n\t\tif v, ok := unmarshalInt(tok, b64); ok {\n\t\t\treturn v, nil\n\t\t}\n\n\tcase pref.Uint32Kind, pref.Fixed32Kind:\n\t\tif v, ok := unmarshalUint(tok, b32); ok {\n\t\t\treturn v, nil\n\t\t}\n\n\tcase pref.Uint64Kind, pref.Fixed64Kind:\n\t\tif v, ok := unmarshalUint(tok, b64); ok {\n\t\t\treturn v, nil\n\t\t}\n\n\tcase pref.FloatKind:\n\t\tif v, ok := unmarshalFloat(tok, b32); ok {\n\t\t\treturn v, nil\n\t\t}\n\n\tcase pref.DoubleKind:\n\t\tif v, ok := unmarshalFloat(tok, b64); ok {\n\t\t\treturn v, nil\n\t\t}\n\n\tcase pref.StringKind:\n\t\tif tok.Kind() == json.String {\n\t\t\treturn pref.ValueOfString(tok.ParsedString()), nil\n\t\t}\n\n\tcase pref.BytesKind:\n\t\tif v, ok := unmarshalBytes(tok); ok {\n\t\t\treturn v, nil\n\t\t}\n\n\tcase pref.EnumKind:\n\t\tif v, ok := unmarshalEnum(tok, fd); ok {\n\t\t\treturn v, nil\n\t\t}\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unmarshalScalar: invalid scalar kind %v\", kind))\n\t}\n\n\treturn pref.Value{}, d.newError(tok.Pos(), \"invalid value for %v type: %v\", kind, tok.RawString())\n}\n\nfunc unmarshalInt(tok json.Token, bitSize int) (pref.Value, bool) {\n\tswitch tok.Kind() {\n\tcase json.Number:\n\t\treturn getInt(tok, bitSize)\n\n\tcase json.String:\n\t\t// Decode number from string.\n\t\ts := strings.TrimSpace(tok.ParsedString())\n\t\tif len(s) != len(tok.ParsedString()) {\n\t\t\treturn pref.Value{}, false\n\t\t}\n\t\tdec := json.NewDecoder([]byte(s))\n\t\ttok, err := dec.Read()\n\t\tif err != nil {\n\t\t\treturn pref.Value{}, false\n\t\t}\n\t\treturn getInt(tok, bitSize)\n\t}\n\treturn pref.Value{}, false\n}\n\nfunc getInt(tok json.Token, bitSize int) (pref.Value, bool) {\n\tn, ok := tok.Int(bitSize)\n\tif !ok {\n\t\treturn pref.Value{}, false\n\t}\n\tif bitSize == 32 {\n\t\treturn pref.ValueOfInt32(int32(n)), true\n\t}\n\treturn pref.ValueOfInt64(n), true\n}\n\nfunc unmarshalUint(tok json.Token, bitSize int) (pref.Value, bool) {\n\tswitch tok.Kind() {\n\tcase json.Number:\n\t\treturn getUint(tok, bitSize)\n\n\tcase json.String:\n\t\t// Decode number from string.\n\t\ts := strings.TrimSpace(tok.ParsedString())\n\t\tif len(s) != len(tok.ParsedString()) {\n\t\t\treturn pref.Value{}, false\n\t\t}\n\t\tdec := json.NewDecoder([]byte(s))\n\t\ttok, err := dec.Read()\n\t\tif err != nil {\n\t\t\treturn pref.Value{}, false\n\t\t}\n\t\treturn getUint(tok, bitSize)\n\t}\n\treturn pref.Value{}, false\n}\n\nfunc getUint(tok json.Token, bitSize int) (pref.Value, bool) {\n\tn, ok := tok.Uint(bitSize)\n\tif !ok {\n\t\treturn pref.Value{}, false\n\t}\n\tif bitSize == 32 {\n\t\treturn pref.ValueOfUint32(uint32(n)), true\n\t}\n\treturn pref.ValueOfUint64(n), true\n}\n\nfunc unmarshalFloat(tok json.Token, bitSize int) (pref.Value, bool) {\n\tswitch tok.Kind() {\n\tcase json.Number:\n\t\treturn getFloat(tok, bitSize)\n\n\tcase json.String:\n\t\ts := tok.ParsedString()\n\t\tswitch s {\n\t\tcase \"NaN\":\n\t\t\tif bitSize == 32 {\n\t\t\t\treturn pref.ValueOfFloat32(float32(math.NaN())), true\n\t\t\t}\n\t\t\treturn pref.ValueOfFloat64(math.NaN()), true\n\t\tcase \"Infinity\":\n\t\t\tif bitSize == 32 {\n\t\t\t\treturn pref.ValueOfFloat32(float32(math.Inf(+1))), true\n\t\t\t}\n\t\t\treturn pref.ValueOfFloat64(math.Inf(+1)), true\n\t\tcase \"-Infinity\":\n\t\t\tif bitSize == 32 {\n\t\t\t\treturn pref.ValueOfFloat32(float32(math.Inf(-1))), true\n\t\t\t}\n\t\t\treturn pref.ValueOfFloat64(math.Inf(-1)), true\n\t\t}\n\n\t\t// Decode number from string.\n\t\tif len(s) != len(strings.TrimSpace(s)) {\n\t\t\treturn pref.Value{}, false\n\t\t}\n\t\tdec := json.NewDecoder([]byte(s))\n\t\ttok, err := dec.Read()\n\t\tif err != nil {\n\t\t\treturn pref.Value{}, false\n\t\t}\n\t\treturn getFloat(tok, bitSize)\n\t}\n\treturn pref.Value{}, false\n}\n\nfunc getFloat(tok json.Token, bitSize int) (pref.Value, bool) {\n\tn, ok := tok.Float(bitSize)\n\tif !ok {\n\t\treturn pref.Value{}, false\n\t}\n\tif bitSize == 32 {\n\t\treturn pref.ValueOfFloat32(float32(n)), true\n\t}\n\treturn pref.ValueOfFloat64(n), true\n}\n\nfunc unmarshalBytes(tok json.Token) (pref.Value, bool) {\n\tif tok.Kind() != json.String {\n\t\treturn pref.Value{}, false\n\t}\n\n\ts := tok.ParsedString()\n\tenc := base64.StdEncoding\n\tif strings.ContainsAny(s, \"-_\") {\n\t\tenc = base64.URLEncoding\n\t}\n\tif len(s)%4 != 0 {\n\t\tenc = enc.WithPadding(base64.NoPadding)\n\t}\n\tb, err := enc.DecodeString(s)\n\tif err != nil {\n\t\treturn pref.Value{}, false\n\t}\n\treturn pref.ValueOfBytes(b), true\n}\n\nfunc unmarshalEnum(tok json.Token, fd pref.FieldDescriptor) (pref.Value, bool) {\n\tswitch tok.Kind() {\n\tcase json.String:\n\t\t// Lookup EnumNumber based on name.\n\t\ts := tok.ParsedString()\n\t\tif enumVal := fd.Enum().Values().ByName(pref.Name(s)); enumVal != nil {\n\t\t\treturn pref.ValueOfEnum(enumVal.Number()), true\n\t\t}\n\n\tcase json.Number:\n\t\tif n, ok := tok.Int(32); ok {\n\t\t\treturn pref.ValueOfEnum(pref.EnumNumber(n)), true\n\t\t}\n\n\tcase json.Null:\n\t\t// This is only valid for google.protobuf.NullValue.\n\t\tif isNullValue(fd) {\n\t\t\treturn pref.ValueOfEnum(0), true\n\t\t}\n\t}\n\n\treturn pref.Value{}, false\n}\n\nfunc (d decoder) unmarshalList(list pref.List, fd pref.FieldDescriptor) error {\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tok.Kind() != json.ArrayOpen {\n\t\treturn d.unexpectedTokenError(tok)\n\t}\n\n\tswitch fd.Kind() {\n\tcase pref.MessageKind, pref.GroupKind:\n\t\tfor {\n\t\t\ttok, err := d.Peek()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif tok.Kind() == json.ArrayClose {\n\t\t\t\td.Read()\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tval := list.NewElement()\n\t\t\tif err := d.unmarshalMessage(val.Message(), false); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlist.Append(val)\n\t\t}\n\tdefault:\n\t\tfor {\n\t\t\ttok, err := d.Peek()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif tok.Kind() == json.ArrayClose {\n\t\t\t\td.Read()\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tval, err := d.unmarshalScalar(fd)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlist.Append(val)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (d decoder) unmarshalMap(mmap pref.Map, fd pref.FieldDescriptor) error {\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tok.Kind() != json.ObjectOpen {\n\t\treturn d.unexpectedTokenError(tok)\n\t}\n\n\t// Determine ahead whether map entry is a scalar type or a message type in\n\t// order to call the appropriate unmarshalMapValue func inside the for loop\n\t// below.\n\tvar unmarshalMapValue func() (pref.Value, error)\n\tswitch fd.MapValue().Kind() {\n\tcase pref.MessageKind, pref.GroupKind:\n\t\tunmarshalMapValue = func() (pref.Value, error) {\n\t\t\tval := mmap.NewValue()\n\t\t\tif err := d.unmarshalMessage(val.Message(), false); err != nil {\n\t\t\t\treturn pref.Value{}, err\n\t\t\t}\n\t\t\treturn val, nil\n\t\t}\n\tdefault:\n\t\tunmarshalMapValue = func() (pref.Value, error) {\n\t\t\treturn d.unmarshalScalar(fd.MapValue())\n\t\t}\n\t}\n\nLoop:\n\tfor {\n\t\t// Read field name.\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch tok.Kind() {\n\t\tdefault:\n\t\t\treturn d.unexpectedTokenError(tok)\n\t\tcase json.ObjectClose:\n\t\t\tbreak Loop\n\t\tcase json.Name:\n\t\t\t// Continue.\n\t\t}\n\n\t\t// Unmarshal field name.\n\t\tpkey, err := d.unmarshalMapKey(tok, fd.MapKey())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Check for duplicate field name.\n\t\tif mmap.Has(pkey) {\n\t\t\treturn d.newError(tok.Pos(), \"duplicate map key %v\", tok.RawString())\n\t\t}\n\n\t\t// Read and unmarshal field value.\n\t\tpval, err := unmarshalMapValue()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tmmap.Set(pkey, pval)\n\t}\n\n\treturn nil\n}\n\n// unmarshalMapKey converts given token of Name kind into a protoreflect.MapKey.\n// A map key type is any integral or string type.\nfunc (d decoder) unmarshalMapKey(tok json.Token, fd pref.FieldDescriptor) (pref.MapKey, error) {\n\tconst b32 = 32\n\tconst b64 = 64\n\tconst base10 = 10\n\n\tname := tok.Name()\n\tkind := fd.Kind()\n\tswitch kind {\n\tcase pref.StringKind:\n\t\treturn pref.ValueOfString(name).MapKey(), nil\n\n\tcase pref.BoolKind:\n\t\tswitch name {\n\t\tcase \"true\":\n\t\t\treturn pref.ValueOfBool(true).MapKey(), nil\n\t\tcase \"false\":\n\t\t\treturn pref.ValueOfBool(false).MapKey(), nil\n\t\t}\n\n\tcase pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:\n\t\tif n, err := strconv.ParseInt(name, base10, b32); err == nil {\n\t\t\treturn pref.ValueOfInt32(int32(n)).MapKey(), nil\n\t\t}\n\n\tcase pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:\n\t\tif n, err := strconv.ParseInt(name, base10, b64); err == nil {\n\t\t\treturn pref.ValueOfInt64(int64(n)).MapKey(), nil\n\t\t}\n\n\tcase pref.Uint32Kind, pref.Fixed32Kind:\n\t\tif n, err := strconv.ParseUint(name, base10, b32); err == nil {\n\t\t\treturn pref.ValueOfUint32(uint32(n)).MapKey(), nil\n\t\t}\n\n\tcase pref.Uint64Kind, pref.Fixed64Kind:\n\t\tif n, err := strconv.ParseUint(name, base10, b64); err == nil {\n\t\t\treturn pref.ValueOfUint64(uint64(n)).MapKey(), nil\n\t\t}\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"invalid kind for map key: %v\", kind))\n\t}\n\n\treturn pref.MapKey{}, d.newError(tok.Pos(), \"invalid value for %v key: %s\", kind, tok.RawString())\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/encoding/protojson/doc.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 protojson marshals and unmarshals protocol buffer messages as JSON\n// format. It follows the guide at\n// https://developers.google.com/protocol-buffers/docs/proto3#json.\n//\n// This package produces a different output than the standard \"encoding/json\"\n// package, which does not operate correctly on protocol buffer messages.\npackage protojson\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/encoding/protojson/encode.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 protojson\n\nimport (\n\t\"encoding/base64\"\n\t\"fmt\"\n\n\t\"google.golang.org/protobuf/internal/encoding/json\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/order\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\nconst defaultIndent = \"  \"\n\n// Format formats the message as a multiline string.\n// This function is only intended for human consumption and ignores errors.\n// Do not depend on the output being stable. It may change over time across\n// different versions of the program.\nfunc Format(m proto.Message) string {\n\treturn MarshalOptions{Multiline: true}.Format(m)\n}\n\n// Marshal writes the given proto.Message in JSON format using default options.\n// Do not depend on the output being stable. It may change over time across\n// different versions of the program.\nfunc Marshal(m proto.Message) ([]byte, error) {\n\treturn MarshalOptions{}.Marshal(m)\n}\n\n// MarshalOptions is a configurable JSON format marshaler.\ntype MarshalOptions struct {\n\tpragma.NoUnkeyedLiterals\n\n\t// Multiline specifies whether the marshaler should format the output in\n\t// indented-form with every textual element on a new line.\n\t// If Indent is an empty string, then an arbitrary indent is chosen.\n\tMultiline bool\n\n\t// Indent specifies the set of indentation characters to use in a multiline\n\t// formatted output such that every entry is preceded by Indent and\n\t// terminated by a newline. If non-empty, then Multiline is treated as true.\n\t// Indent can only be composed of space or tab characters.\n\tIndent string\n\n\t// AllowPartial allows messages that have missing required fields to marshal\n\t// without returning an error. If AllowPartial is false (the default),\n\t// Marshal will return error if there are any missing required fields.\n\tAllowPartial bool\n\n\t// UseProtoNames uses proto field name instead of lowerCamelCase name in JSON\n\t// field names.\n\tUseProtoNames bool\n\n\t// UseEnumNumbers emits enum values as numbers.\n\tUseEnumNumbers bool\n\n\t// EmitUnpopulated specifies whether to emit unpopulated fields. It does not\n\t// emit unpopulated oneof fields or unpopulated extension fields.\n\t// The JSON value emitted for unpopulated fields are as follows:\n\t//  ╔═══════╤════════════════════════════╗\n\t//  ║ JSON  │ Protobuf field             ║\n\t//  ╠═══════╪════════════════════════════╣\n\t//  ║ false │ proto3 boolean fields      ║\n\t//  ║ 0     │ proto3 numeric fields      ║\n\t//  ║ \"\"    │ proto3 string/bytes fields ║\n\t//  ║ null  │ proto2 scalar fields       ║\n\t//  ║ null  │ message fields             ║\n\t//  ║ []    │ list fields                ║\n\t//  ║ {}    │ map fields                 ║\n\t//  ╚═══════╧════════════════════════════╝\n\tEmitUnpopulated bool\n\n\t// Resolver is used for looking up types when expanding google.protobuf.Any\n\t// messages. If nil, this defaults to using protoregistry.GlobalTypes.\n\tResolver interface {\n\t\tprotoregistry.ExtensionTypeResolver\n\t\tprotoregistry.MessageTypeResolver\n\t}\n}\n\n// Format formats the message as a string.\n// This method is only intended for human consumption and ignores errors.\n// Do not depend on the output being stable. It may change over time across\n// different versions of the program.\nfunc (o MarshalOptions) Format(m proto.Message) string {\n\tif m == nil || !m.ProtoReflect().IsValid() {\n\t\treturn \"<nil>\" // invalid syntax, but okay since this is for debugging\n\t}\n\to.AllowPartial = true\n\tb, _ := o.Marshal(m)\n\treturn string(b)\n}\n\n// Marshal marshals the given proto.Message in the JSON format using options in\n// MarshalOptions. Do not depend on the output being stable. It may change over\n// time across different versions of the program.\nfunc (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) {\n\treturn o.marshal(m)\n}\n\n// marshal is a centralized function that all marshal operations go through.\n// For profiling purposes, avoid changing the name of this function or\n// introducing other code paths for marshal that do not go through this.\nfunc (o MarshalOptions) marshal(m proto.Message) ([]byte, error) {\n\tif o.Multiline && o.Indent == \"\" {\n\t\to.Indent = defaultIndent\n\t}\n\tif o.Resolver == nil {\n\t\to.Resolver = protoregistry.GlobalTypes\n\t}\n\n\tinternalEnc, err := json.NewEncoder(o.Indent)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Treat nil message interface as an empty message,\n\t// in which case the output in an empty JSON object.\n\tif m == nil {\n\t\treturn []byte(\"{}\"), nil\n\t}\n\n\tenc := encoder{internalEnc, o}\n\tif err := enc.marshalMessage(m.ProtoReflect(), \"\"); err != nil {\n\t\treturn nil, err\n\t}\n\tif o.AllowPartial {\n\t\treturn enc.Bytes(), nil\n\t}\n\treturn enc.Bytes(), proto.CheckInitialized(m)\n}\n\ntype encoder struct {\n\t*json.Encoder\n\topts MarshalOptions\n}\n\n// typeFieldDesc is a synthetic field descriptor used for the \"@type\" field.\nvar typeFieldDesc = func() protoreflect.FieldDescriptor {\n\tvar fd filedesc.Field\n\tfd.L0.FullName = \"@type\"\n\tfd.L0.Index = -1\n\tfd.L1.Cardinality = protoreflect.Optional\n\tfd.L1.Kind = protoreflect.StringKind\n\treturn &fd\n}()\n\n// typeURLFieldRanger wraps a protoreflect.Message and modifies its Range method\n// to additionally iterate over a synthetic field for the type URL.\ntype typeURLFieldRanger struct {\n\torder.FieldRanger\n\ttypeURL string\n}\n\nfunc (m typeURLFieldRanger) Range(f func(pref.FieldDescriptor, pref.Value) bool) {\n\tif !f(typeFieldDesc, pref.ValueOfString(m.typeURL)) {\n\t\treturn\n\t}\n\tm.FieldRanger.Range(f)\n}\n\n// unpopulatedFieldRanger wraps a protoreflect.Message and modifies its Range\n// method to additionally iterate over unpopulated fields.\ntype unpopulatedFieldRanger struct{ pref.Message }\n\nfunc (m unpopulatedFieldRanger) Range(f func(pref.FieldDescriptor, pref.Value) bool) {\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) || fd.ContainingOneof() != nil {\n\t\t\tcontinue // ignore populated fields and fields within a oneofs\n\t\t}\n\n\t\tv := m.Get(fd)\n\t\tisProto2Scalar := fd.Syntax() == pref.Proto2 && fd.Default().IsValid()\n\t\tisSingularMessage := fd.Cardinality() != pref.Repeated && fd.Message() != nil\n\t\tif isProto2Scalar || isSingularMessage {\n\t\t\tv = pref.Value{} // use invalid value to emit null\n\t\t}\n\t\tif !f(fd, v) {\n\t\t\treturn\n\t\t}\n\t}\n\tm.Message.Range(f)\n}\n\n// marshalMessage marshals the fields in the given protoreflect.Message.\n// If the typeURL is non-empty, then a synthetic \"@type\" field is injected\n// containing the URL as the value.\nfunc (e encoder) marshalMessage(m pref.Message, typeURL string) error {\n\tif !flags.ProtoLegacy && messageset.IsMessageSet(m.Descriptor()) {\n\t\treturn errors.New(\"no support for proto1 MessageSets\")\n\t}\n\n\tif marshal := wellKnownTypeMarshaler(m.Descriptor().FullName()); marshal != nil {\n\t\treturn marshal(e, m)\n\t}\n\n\te.StartObject()\n\tdefer e.EndObject()\n\n\tvar fields order.FieldRanger = m\n\tif e.opts.EmitUnpopulated {\n\t\tfields = unpopulatedFieldRanger{m}\n\t}\n\tif typeURL != \"\" {\n\t\tfields = typeURLFieldRanger{fields, typeURL}\n\t}\n\n\tvar err error\n\torder.RangeFields(fields, order.IndexNameFieldOrder, func(fd pref.FieldDescriptor, v pref.Value) bool {\n\t\tname := fd.JSONName()\n\t\tif e.opts.UseProtoNames {\n\t\t\tname = fd.TextName()\n\t\t}\n\n\t\tif err = e.WriteName(name); err != nil {\n\t\t\treturn false\n\t\t}\n\t\tif err = e.marshalValue(v, fd); err != nil {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t})\n\treturn err\n}\n\n// marshalValue marshals the given protoreflect.Value.\nfunc (e encoder) marshalValue(val pref.Value, fd pref.FieldDescriptor) error {\n\tswitch {\n\tcase fd.IsList():\n\t\treturn e.marshalList(val.List(), fd)\n\tcase fd.IsMap():\n\t\treturn e.marshalMap(val.Map(), fd)\n\tdefault:\n\t\treturn e.marshalSingular(val, fd)\n\t}\n}\n\n// marshalSingular marshals the given non-repeated field value. This includes\n// all scalar types, enums, messages, and groups.\nfunc (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error {\n\tif !val.IsValid() {\n\t\te.WriteNull()\n\t\treturn nil\n\t}\n\n\tswitch kind := fd.Kind(); kind {\n\tcase pref.BoolKind:\n\t\te.WriteBool(val.Bool())\n\n\tcase pref.StringKind:\n\t\tif e.WriteString(val.String()) != nil {\n\t\t\treturn errors.InvalidUTF8(string(fd.FullName()))\n\t\t}\n\n\tcase pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:\n\t\te.WriteInt(val.Int())\n\n\tcase pref.Uint32Kind, pref.Fixed32Kind:\n\t\te.WriteUint(val.Uint())\n\n\tcase pref.Int64Kind, pref.Sint64Kind, pref.Uint64Kind,\n\t\tpref.Sfixed64Kind, pref.Fixed64Kind:\n\t\t// 64-bit integers are written out as JSON string.\n\t\te.WriteString(val.String())\n\n\tcase pref.FloatKind:\n\t\t// Encoder.WriteFloat handles the special numbers NaN and infinites.\n\t\te.WriteFloat(val.Float(), 32)\n\n\tcase pref.DoubleKind:\n\t\t// Encoder.WriteFloat handles the special numbers NaN and infinites.\n\t\te.WriteFloat(val.Float(), 64)\n\n\tcase pref.BytesKind:\n\t\te.WriteString(base64.StdEncoding.EncodeToString(val.Bytes()))\n\n\tcase pref.EnumKind:\n\t\tif fd.Enum().FullName() == genid.NullValue_enum_fullname {\n\t\t\te.WriteNull()\n\t\t} else {\n\t\t\tdesc := fd.Enum().Values().ByNumber(val.Enum())\n\t\t\tif e.opts.UseEnumNumbers || desc == nil {\n\t\t\t\te.WriteInt(int64(val.Enum()))\n\t\t\t} else {\n\t\t\t\te.WriteString(string(desc.Name()))\n\t\t\t}\n\t\t}\n\n\tcase pref.MessageKind, pref.GroupKind:\n\t\tif err := e.marshalMessage(val.Message(), \"\"); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"%v has unknown kind: %v\", fd.FullName(), kind))\n\t}\n\treturn nil\n}\n\n// marshalList marshals the given protoreflect.List.\nfunc (e encoder) marshalList(list pref.List, fd pref.FieldDescriptor) error {\n\te.StartArray()\n\tdefer e.EndArray()\n\n\tfor i := 0; i < list.Len(); i++ {\n\t\titem := list.Get(i)\n\t\tif err := e.marshalSingular(item, fd); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// marshalMap marshals given protoreflect.Map.\nfunc (e encoder) marshalMap(mmap pref.Map, fd pref.FieldDescriptor) error {\n\te.StartObject()\n\tdefer e.EndObject()\n\n\tvar err error\n\torder.RangeEntries(mmap, order.GenericKeyOrder, func(k pref.MapKey, v pref.Value) bool {\n\t\tif err = e.WriteName(k.String()); err != nil {\n\t\t\treturn false\n\t\t}\n\t\tif err = e.marshalSingular(v, fd.MapValue()); err != nil {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t})\n\treturn err\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.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 protojson\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"math\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"google.golang.org/protobuf/internal/encoding/json\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/proto\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype marshalFunc func(encoder, pref.Message) error\n\n// wellKnownTypeMarshaler returns a marshal function if the message type\n// has specialized serialization behavior. It returns nil otherwise.\nfunc wellKnownTypeMarshaler(name pref.FullName) marshalFunc {\n\tif name.Parent() == genid.GoogleProtobuf_package {\n\t\tswitch name.Name() {\n\t\tcase genid.Any_message_name:\n\t\t\treturn encoder.marshalAny\n\t\tcase genid.Timestamp_message_name:\n\t\t\treturn encoder.marshalTimestamp\n\t\tcase genid.Duration_message_name:\n\t\t\treturn encoder.marshalDuration\n\t\tcase genid.BoolValue_message_name,\n\t\t\tgenid.Int32Value_message_name,\n\t\t\tgenid.Int64Value_message_name,\n\t\t\tgenid.UInt32Value_message_name,\n\t\t\tgenid.UInt64Value_message_name,\n\t\t\tgenid.FloatValue_message_name,\n\t\t\tgenid.DoubleValue_message_name,\n\t\t\tgenid.StringValue_message_name,\n\t\t\tgenid.BytesValue_message_name:\n\t\t\treturn encoder.marshalWrapperType\n\t\tcase genid.Struct_message_name:\n\t\t\treturn encoder.marshalStruct\n\t\tcase genid.ListValue_message_name:\n\t\t\treturn encoder.marshalListValue\n\t\tcase genid.Value_message_name:\n\t\t\treturn encoder.marshalKnownValue\n\t\tcase genid.FieldMask_message_name:\n\t\t\treturn encoder.marshalFieldMask\n\t\tcase genid.Empty_message_name:\n\t\t\treturn encoder.marshalEmpty\n\t\t}\n\t}\n\treturn nil\n}\n\ntype unmarshalFunc func(decoder, pref.Message) error\n\n// wellKnownTypeUnmarshaler returns a unmarshal function if the message type\n// has specialized serialization behavior. It returns nil otherwise.\nfunc wellKnownTypeUnmarshaler(name pref.FullName) unmarshalFunc {\n\tif name.Parent() == genid.GoogleProtobuf_package {\n\t\tswitch name.Name() {\n\t\tcase genid.Any_message_name:\n\t\t\treturn decoder.unmarshalAny\n\t\tcase genid.Timestamp_message_name:\n\t\t\treturn decoder.unmarshalTimestamp\n\t\tcase genid.Duration_message_name:\n\t\t\treturn decoder.unmarshalDuration\n\t\tcase genid.BoolValue_message_name,\n\t\t\tgenid.Int32Value_message_name,\n\t\t\tgenid.Int64Value_message_name,\n\t\t\tgenid.UInt32Value_message_name,\n\t\t\tgenid.UInt64Value_message_name,\n\t\t\tgenid.FloatValue_message_name,\n\t\t\tgenid.DoubleValue_message_name,\n\t\t\tgenid.StringValue_message_name,\n\t\t\tgenid.BytesValue_message_name:\n\t\t\treturn decoder.unmarshalWrapperType\n\t\tcase genid.Struct_message_name:\n\t\t\treturn decoder.unmarshalStruct\n\t\tcase genid.ListValue_message_name:\n\t\t\treturn decoder.unmarshalListValue\n\t\tcase genid.Value_message_name:\n\t\t\treturn decoder.unmarshalKnownValue\n\t\tcase genid.FieldMask_message_name:\n\t\t\treturn decoder.unmarshalFieldMask\n\t\tcase genid.Empty_message_name:\n\t\t\treturn decoder.unmarshalEmpty\n\t\t}\n\t}\n\treturn nil\n}\n\n// The JSON representation of an Any message uses the regular representation of\n// the deserialized, embedded message, with an additional field `@type` which\n// contains the type URL. If the embedded message type is well-known and has a\n// custom JSON representation, that representation will be embedded adding a\n// field `value` which holds the custom JSON in addition to the `@type` field.\n\nfunc (e encoder) marshalAny(m pref.Message) error {\n\tfds := m.Descriptor().Fields()\n\tfdType := fds.ByNumber(genid.Any_TypeUrl_field_number)\n\tfdValue := fds.ByNumber(genid.Any_Value_field_number)\n\n\tif !m.Has(fdType) {\n\t\tif !m.Has(fdValue) {\n\t\t\t// If message is empty, marshal out empty JSON object.\n\t\t\te.StartObject()\n\t\t\te.EndObject()\n\t\t\treturn nil\n\t\t} else {\n\t\t\t// Return error if type_url field is not set, but value is set.\n\t\t\treturn errors.New(\"%s: %v is not set\", genid.Any_message_fullname, genid.Any_TypeUrl_field_name)\n\t\t}\n\t}\n\n\ttypeVal := m.Get(fdType)\n\tvalueVal := m.Get(fdValue)\n\n\t// Resolve the type in order to unmarshal value field.\n\ttypeURL := typeVal.String()\n\temt, err := e.opts.Resolver.FindMessageByURL(typeURL)\n\tif err != nil {\n\t\treturn errors.New(\"%s: unable to resolve %q: %v\", genid.Any_message_fullname, typeURL, err)\n\t}\n\n\tem := emt.New()\n\terr = proto.UnmarshalOptions{\n\t\tAllowPartial: true, // never check required fields inside an Any\n\t\tResolver:     e.opts.Resolver,\n\t}.Unmarshal(valueVal.Bytes(), em.Interface())\n\tif err != nil {\n\t\treturn errors.New(\"%s: unable to unmarshal %q: %v\", genid.Any_message_fullname, typeURL, err)\n\t}\n\n\t// If type of value has custom JSON encoding, marshal out a field \"value\"\n\t// with corresponding custom JSON encoding of the embedded message as a\n\t// field.\n\tif marshal := wellKnownTypeMarshaler(emt.Descriptor().FullName()); marshal != nil {\n\t\te.StartObject()\n\t\tdefer e.EndObject()\n\n\t\t// Marshal out @type field.\n\t\te.WriteName(\"@type\")\n\t\tif err := e.WriteString(typeURL); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\te.WriteName(\"value\")\n\t\treturn marshal(e, em)\n\t}\n\n\t// Else, marshal out the embedded message's fields in this Any object.\n\tif err := e.marshalMessage(em, typeURL); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (d decoder) unmarshalAny(m pref.Message) error {\n\t// Peek to check for json.ObjectOpen to avoid advancing a read.\n\tstart, err := d.Peek()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif start.Kind() != json.ObjectOpen {\n\t\treturn d.unexpectedTokenError(start)\n\t}\n\n\t// Use another decoder to parse the unread bytes for @type field. This\n\t// avoids advancing a read from current decoder because the current JSON\n\t// object may contain the fields of the embedded type.\n\tdec := decoder{d.Clone(), UnmarshalOptions{}}\n\ttok, err := findTypeURL(dec)\n\tswitch err {\n\tcase errEmptyObject:\n\t\t// An empty JSON object translates to an empty Any message.\n\t\td.Read() // Read json.ObjectOpen.\n\t\td.Read() // Read json.ObjectClose.\n\t\treturn nil\n\n\tcase errMissingType:\n\t\tif d.opts.DiscardUnknown {\n\t\t\t// Treat all fields as unknowns, similar to an empty object.\n\t\t\treturn d.skipJSONValue()\n\t\t}\n\t\t// Use start.Pos() for line position.\n\t\treturn d.newError(start.Pos(), err.Error())\n\n\tdefault:\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttypeURL := tok.ParsedString()\n\temt, err := d.opts.Resolver.FindMessageByURL(typeURL)\n\tif err != nil {\n\t\treturn d.newError(tok.Pos(), \"unable to resolve %v: %q\", tok.RawString(), err)\n\t}\n\n\t// Create new message for the embedded message type and unmarshal into it.\n\tem := emt.New()\n\tif unmarshal := wellKnownTypeUnmarshaler(emt.Descriptor().FullName()); unmarshal != nil {\n\t\t// If embedded message is a custom type,\n\t\t// unmarshal the JSON \"value\" field into it.\n\t\tif err := d.unmarshalAnyValue(unmarshal, em); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\t// Else unmarshal the current JSON object into it.\n\t\tif err := d.unmarshalMessage(em, true); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Serialize the embedded message and assign the resulting bytes to the\n\t// proto value field.\n\tb, err := proto.MarshalOptions{\n\t\tAllowPartial:  true, // No need to check required fields inside an Any.\n\t\tDeterministic: true,\n\t}.Marshal(em.Interface())\n\tif err != nil {\n\t\treturn d.newError(start.Pos(), \"error in marshaling Any.value field: %v\", err)\n\t}\n\n\tfds := m.Descriptor().Fields()\n\tfdType := fds.ByNumber(genid.Any_TypeUrl_field_number)\n\tfdValue := fds.ByNumber(genid.Any_Value_field_number)\n\n\tm.Set(fdType, pref.ValueOfString(typeURL))\n\tm.Set(fdValue, pref.ValueOfBytes(b))\n\treturn nil\n}\n\nvar errEmptyObject = fmt.Errorf(`empty object`)\nvar errMissingType = fmt.Errorf(`missing \"@type\" field`)\n\n// findTypeURL returns the token for the \"@type\" field value from the given\n// JSON bytes. It is expected that the given bytes start with json.ObjectOpen.\n// It returns errEmptyObject if the JSON object is empty or errMissingType if\n// @type field does not exist. It returns other error if the @type field is not\n// valid or other decoding issues.\nfunc findTypeURL(d decoder) (json.Token, error) {\n\tvar typeURL string\n\tvar typeTok json.Token\n\tnumFields := 0\n\t// Skip start object.\n\td.Read()\n\nLoop:\n\tfor {\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn json.Token{}, err\n\t\t}\n\n\t\tswitch tok.Kind() {\n\t\tcase json.ObjectClose:\n\t\t\tif typeURL == \"\" {\n\t\t\t\t// Did not find @type field.\n\t\t\t\tif numFields > 0 {\n\t\t\t\t\treturn json.Token{}, errMissingType\n\t\t\t\t}\n\t\t\t\treturn json.Token{}, errEmptyObject\n\t\t\t}\n\t\t\tbreak Loop\n\n\t\tcase json.Name:\n\t\t\tnumFields++\n\t\t\tif tok.Name() != \"@type\" {\n\t\t\t\t// Skip value.\n\t\t\t\tif err := d.skipJSONValue(); err != nil {\n\t\t\t\t\treturn json.Token{}, err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Return error if this was previously set already.\n\t\t\tif typeURL != \"\" {\n\t\t\t\treturn json.Token{}, d.newError(tok.Pos(), `duplicate \"@type\" field`)\n\t\t\t}\n\t\t\t// Read field value.\n\t\t\ttok, err := d.Read()\n\t\t\tif err != nil {\n\t\t\t\treturn json.Token{}, err\n\t\t\t}\n\t\t\tif tok.Kind() != json.String {\n\t\t\t\treturn json.Token{}, d.newError(tok.Pos(), `@type field value is not a string: %v`, tok.RawString())\n\t\t\t}\n\t\t\ttypeURL = tok.ParsedString()\n\t\t\tif typeURL == \"\" {\n\t\t\t\treturn json.Token{}, d.newError(tok.Pos(), `@type field contains empty value`)\n\t\t\t}\n\t\t\ttypeTok = tok\n\t\t}\n\t}\n\n\treturn typeTok, nil\n}\n\n// skipJSONValue parses a JSON value (null, boolean, string, number, object and\n// array) in order to advance the read to the next JSON value. It relies on\n// the decoder returning an error if the types are not in valid sequence.\nfunc (d decoder) skipJSONValue() error {\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Only need to continue reading for objects and arrays.\n\tswitch tok.Kind() {\n\tcase json.ObjectOpen:\n\t\tfor {\n\t\t\ttok, err := d.Read()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tswitch tok.Kind() {\n\t\t\tcase json.ObjectClose:\n\t\t\t\treturn nil\n\t\t\tcase json.Name:\n\t\t\t\t// Skip object field value.\n\t\t\t\tif err := d.skipJSONValue(); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\tcase json.ArrayOpen:\n\t\tfor {\n\t\t\ttok, err := d.Peek()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tswitch tok.Kind() {\n\t\t\tcase json.ArrayClose:\n\t\t\t\td.Read()\n\t\t\t\treturn nil\n\t\t\tdefault:\n\t\t\t\t// Skip array item.\n\t\t\t\tif err := d.skipJSONValue(); 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\n// unmarshalAnyValue unmarshals the given custom-type message from the JSON\n// object's \"value\" field.\nfunc (d decoder) unmarshalAnyValue(unmarshal unmarshalFunc, m pref.Message) error {\n\t// Skip ObjectOpen, and start reading the fields.\n\td.Read()\n\n\tvar found bool // Used for detecting duplicate \"value\".\n\tfor {\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch tok.Kind() {\n\t\tcase json.ObjectClose:\n\t\t\tif !found {\n\t\t\t\treturn d.newError(tok.Pos(), `missing \"value\" field`)\n\t\t\t}\n\t\t\treturn nil\n\n\t\tcase json.Name:\n\t\t\tswitch tok.Name() {\n\t\t\tcase \"@type\":\n\t\t\t\t// Skip the value as this was previously parsed already.\n\t\t\t\td.Read()\n\n\t\t\tcase \"value\":\n\t\t\t\tif found {\n\t\t\t\t\treturn d.newError(tok.Pos(), `duplicate \"value\" field`)\n\t\t\t\t}\n\t\t\t\t// Unmarshal the field value into the given message.\n\t\t\t\tif err := unmarshal(d, m); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfound = true\n\n\t\t\tdefault:\n\t\t\t\tif d.opts.DiscardUnknown {\n\t\t\t\t\tif err := d.skipJSONValue(); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn d.newError(tok.Pos(), \"unknown field %v\", tok.RawString())\n\t\t\t}\n\t\t}\n\t}\n}\n\n// Wrapper types are encoded as JSON primitives like string, number or boolean.\n\nfunc (e encoder) marshalWrapperType(m pref.Message) error {\n\tfd := m.Descriptor().Fields().ByNumber(genid.WrapperValue_Value_field_number)\n\tval := m.Get(fd)\n\treturn e.marshalSingular(val, fd)\n}\n\nfunc (d decoder) unmarshalWrapperType(m pref.Message) error {\n\tfd := m.Descriptor().Fields().ByNumber(genid.WrapperValue_Value_field_number)\n\tval, err := d.unmarshalScalar(fd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tm.Set(fd, val)\n\treturn nil\n}\n\n// The JSON representation for Empty is an empty JSON object.\n\nfunc (e encoder) marshalEmpty(pref.Message) error {\n\te.StartObject()\n\te.EndObject()\n\treturn nil\n}\n\nfunc (d decoder) unmarshalEmpty(pref.Message) error {\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tok.Kind() != json.ObjectOpen {\n\t\treturn d.unexpectedTokenError(tok)\n\t}\n\n\tfor {\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch tok.Kind() {\n\t\tcase json.ObjectClose:\n\t\t\treturn nil\n\n\t\tcase json.Name:\n\t\t\tif d.opts.DiscardUnknown {\n\t\t\t\tif err := d.skipJSONValue(); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn d.newError(tok.Pos(), \"unknown field %v\", tok.RawString())\n\n\t\tdefault:\n\t\t\treturn d.unexpectedTokenError(tok)\n\t\t}\n\t}\n}\n\n// The JSON representation for Struct is a JSON object that contains the encoded\n// Struct.fields map and follows the serialization rules for a map.\n\nfunc (e encoder) marshalStruct(m pref.Message) error {\n\tfd := m.Descriptor().Fields().ByNumber(genid.Struct_Fields_field_number)\n\treturn e.marshalMap(m.Get(fd).Map(), fd)\n}\n\nfunc (d decoder) unmarshalStruct(m pref.Message) error {\n\tfd := m.Descriptor().Fields().ByNumber(genid.Struct_Fields_field_number)\n\treturn d.unmarshalMap(m.Mutable(fd).Map(), fd)\n}\n\n// The JSON representation for ListValue is JSON array that contains the encoded\n// ListValue.values repeated field and follows the serialization rules for a\n// repeated field.\n\nfunc (e encoder) marshalListValue(m pref.Message) error {\n\tfd := m.Descriptor().Fields().ByNumber(genid.ListValue_Values_field_number)\n\treturn e.marshalList(m.Get(fd).List(), fd)\n}\n\nfunc (d decoder) unmarshalListValue(m pref.Message) error {\n\tfd := m.Descriptor().Fields().ByNumber(genid.ListValue_Values_field_number)\n\treturn d.unmarshalList(m.Mutable(fd).List(), fd)\n}\n\n// The JSON representation for a Value is dependent on the oneof field that is\n// set. Each of the field in the oneof has its own custom serialization rule. A\n// Value message needs to be a oneof field set, else it is an error.\n\nfunc (e encoder) marshalKnownValue(m pref.Message) error {\n\tod := m.Descriptor().Oneofs().ByName(genid.Value_Kind_oneof_name)\n\tfd := m.WhichOneof(od)\n\tif fd == nil {\n\t\treturn errors.New(\"%s: none of the oneof fields is set\", genid.Value_message_fullname)\n\t}\n\tif fd.Number() == genid.Value_NumberValue_field_number {\n\t\tif v := m.Get(fd).Float(); math.IsNaN(v) || math.IsInf(v, 0) {\n\t\t\treturn errors.New(\"%s: invalid %v value\", genid.Value_NumberValue_field_fullname, v)\n\t\t}\n\t}\n\treturn e.marshalSingular(m.Get(fd), fd)\n}\n\nfunc (d decoder) unmarshalKnownValue(m pref.Message) error {\n\ttok, err := d.Peek()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar fd pref.FieldDescriptor\n\tvar val pref.Value\n\tswitch tok.Kind() {\n\tcase json.Null:\n\t\td.Read()\n\t\tfd = m.Descriptor().Fields().ByNumber(genid.Value_NullValue_field_number)\n\t\tval = pref.ValueOfEnum(0)\n\n\tcase json.Bool:\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfd = m.Descriptor().Fields().ByNumber(genid.Value_BoolValue_field_number)\n\t\tval = pref.ValueOfBool(tok.Bool())\n\n\tcase json.Number:\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfd = m.Descriptor().Fields().ByNumber(genid.Value_NumberValue_field_number)\n\t\tvar ok bool\n\t\tval, ok = unmarshalFloat(tok, 64)\n\t\tif !ok {\n\t\t\treturn d.newError(tok.Pos(), \"invalid %v: %v\", genid.Value_message_fullname, tok.RawString())\n\t\t}\n\n\tcase json.String:\n\t\t// A JSON string may have been encoded from the number_value field,\n\t\t// e.g. \"NaN\", \"Infinity\", etc. Parsing a proto double type also allows\n\t\t// for it to be in JSON string form. Given this custom encoding spec,\n\t\t// however, there is no way to identify that and hence a JSON string is\n\t\t// always assigned to the string_value field, which means that certain\n\t\t// encoding cannot be parsed back to the same field.\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfd = m.Descriptor().Fields().ByNumber(genid.Value_StringValue_field_number)\n\t\tval = pref.ValueOfString(tok.ParsedString())\n\n\tcase json.ObjectOpen:\n\t\tfd = m.Descriptor().Fields().ByNumber(genid.Value_StructValue_field_number)\n\t\tval = m.NewField(fd)\n\t\tif err := d.unmarshalStruct(val.Message()); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tcase json.ArrayOpen:\n\t\tfd = m.Descriptor().Fields().ByNumber(genid.Value_ListValue_field_number)\n\t\tval = m.NewField(fd)\n\t\tif err := d.unmarshalListValue(val.Message()); err != nil {\n\t\t\treturn err\n\t\t}\n\n\tdefault:\n\t\treturn d.newError(tok.Pos(), \"invalid %v: %v\", genid.Value_message_fullname, tok.RawString())\n\t}\n\n\tm.Set(fd, val)\n\treturn nil\n}\n\n// The JSON representation for a Duration is a JSON string that ends in the\n// suffix \"s\" (indicating seconds) and is preceded by the number of seconds,\n// with nanoseconds expressed as fractional seconds.\n//\n// Durations less than one second are represented with a 0 seconds field and a\n// positive or negative nanos field. For durations of one second or more, a\n// non-zero value for the nanos field must be of the same sign as the seconds\n// field.\n//\n// Duration.seconds must be from -315,576,000,000 to +315,576,000,000 inclusive.\n// Duration.nanos must be from -999,999,999 to +999,999,999 inclusive.\n\nconst (\n\tsecondsInNanos       = 999999999\n\tmaxSecondsInDuration = 315576000000\n)\n\nfunc (e encoder) marshalDuration(m pref.Message) error {\n\tfds := m.Descriptor().Fields()\n\tfdSeconds := fds.ByNumber(genid.Duration_Seconds_field_number)\n\tfdNanos := fds.ByNumber(genid.Duration_Nanos_field_number)\n\n\tsecsVal := m.Get(fdSeconds)\n\tnanosVal := m.Get(fdNanos)\n\tsecs := secsVal.Int()\n\tnanos := nanosVal.Int()\n\tif secs < -maxSecondsInDuration || secs > maxSecondsInDuration {\n\t\treturn errors.New(\"%s: seconds out of range %v\", genid.Duration_message_fullname, secs)\n\t}\n\tif nanos < -secondsInNanos || nanos > secondsInNanos {\n\t\treturn errors.New(\"%s: nanos out of range %v\", genid.Duration_message_fullname, nanos)\n\t}\n\tif (secs > 0 && nanos < 0) || (secs < 0 && nanos > 0) {\n\t\treturn errors.New(\"%s: signs of seconds and nanos do not match\", genid.Duration_message_fullname)\n\t}\n\t// Generated output always contains 0, 3, 6, or 9 fractional digits,\n\t// depending on required precision, followed by the suffix \"s\".\n\tvar sign string\n\tif secs < 0 || nanos < 0 {\n\t\tsign, secs, nanos = \"-\", -1*secs, -1*nanos\n\t}\n\tx := fmt.Sprintf(\"%s%d.%09d\", sign, secs, nanos)\n\tx = strings.TrimSuffix(x, \"000\")\n\tx = strings.TrimSuffix(x, \"000\")\n\tx = strings.TrimSuffix(x, \".000\")\n\te.WriteString(x + \"s\")\n\treturn nil\n}\n\nfunc (d decoder) unmarshalDuration(m pref.Message) error {\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tok.Kind() != json.String {\n\t\treturn d.unexpectedTokenError(tok)\n\t}\n\n\tsecs, nanos, ok := parseDuration(tok.ParsedString())\n\tif !ok {\n\t\treturn d.newError(tok.Pos(), \"invalid %v value %v\", genid.Duration_message_fullname, tok.RawString())\n\t}\n\t// Validate seconds. No need to validate nanos because parseDuration would\n\t// have covered that already.\n\tif secs < -maxSecondsInDuration || secs > maxSecondsInDuration {\n\t\treturn d.newError(tok.Pos(), \"%v value out of range: %v\", genid.Duration_message_fullname, tok.RawString())\n\t}\n\n\tfds := m.Descriptor().Fields()\n\tfdSeconds := fds.ByNumber(genid.Duration_Seconds_field_number)\n\tfdNanos := fds.ByNumber(genid.Duration_Nanos_field_number)\n\n\tm.Set(fdSeconds, pref.ValueOfInt64(secs))\n\tm.Set(fdNanos, pref.ValueOfInt32(nanos))\n\treturn nil\n}\n\n// parseDuration parses the given input string for seconds and nanoseconds value\n// for the Duration JSON format. The format is a decimal number with a suffix\n// 's'. It can have optional plus/minus sign. There needs to be at least an\n// integer or fractional part. Fractional part is limited to 9 digits only for\n// nanoseconds precision, regardless of whether there are trailing zero digits.\n// Example values are 1s, 0.1s, 1.s, .1s, +1s, -1s, -.1s.\nfunc parseDuration(input string) (int64, int32, bool) {\n\tb := []byte(input)\n\tsize := len(b)\n\tif size < 2 {\n\t\treturn 0, 0, false\n\t}\n\tif b[size-1] != 's' {\n\t\treturn 0, 0, false\n\t}\n\tb = b[:size-1]\n\n\t// Read optional plus/minus symbol.\n\tvar neg bool\n\tswitch b[0] {\n\tcase '-':\n\t\tneg = true\n\t\tb = b[1:]\n\tcase '+':\n\t\tb = b[1:]\n\t}\n\tif len(b) == 0 {\n\t\treturn 0, 0, false\n\t}\n\n\t// Read the integer part.\n\tvar intp []byte\n\tswitch {\n\tcase b[0] == '0':\n\t\tb = b[1:]\n\n\tcase '1' <= b[0] && b[0] <= '9':\n\t\tintp = b[0:]\n\t\tb = b[1:]\n\t\tn := 1\n\t\tfor len(b) > 0 && '0' <= b[0] && b[0] <= '9' {\n\t\t\tn++\n\t\t\tb = b[1:]\n\t\t}\n\t\tintp = intp[:n]\n\n\tcase b[0] == '.':\n\t\t// Continue below.\n\n\tdefault:\n\t\treturn 0, 0, false\n\t}\n\n\thasFrac := false\n\tvar frac [9]byte\n\tif len(b) > 0 {\n\t\tif b[0] != '.' {\n\t\t\treturn 0, 0, false\n\t\t}\n\t\t// Read the fractional part.\n\t\tb = b[1:]\n\t\tn := 0\n\t\tfor len(b) > 0 && n < 9 && '0' <= b[0] && b[0] <= '9' {\n\t\t\tfrac[n] = b[0]\n\t\t\tn++\n\t\t\tb = b[1:]\n\t\t}\n\t\t// It is not valid if there are more bytes left.\n\t\tif len(b) > 0 {\n\t\t\treturn 0, 0, false\n\t\t}\n\t\t// Pad fractional part with 0s.\n\t\tfor i := n; i < 9; i++ {\n\t\t\tfrac[i] = '0'\n\t\t}\n\t\thasFrac = true\n\t}\n\n\tvar secs int64\n\tif len(intp) > 0 {\n\t\tvar err error\n\t\tsecs, err = strconv.ParseInt(string(intp), 10, 64)\n\t\tif err != nil {\n\t\t\treturn 0, 0, false\n\t\t}\n\t}\n\n\tvar nanos int64\n\tif hasFrac {\n\t\tnanob := bytes.TrimLeft(frac[:], \"0\")\n\t\tif len(nanob) > 0 {\n\t\t\tvar err error\n\t\t\tnanos, err = strconv.ParseInt(string(nanob), 10, 32)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, 0, false\n\t\t\t}\n\t\t}\n\t}\n\n\tif neg {\n\t\tif secs > 0 {\n\t\t\tsecs = -secs\n\t\t}\n\t\tif nanos > 0 {\n\t\t\tnanos = -nanos\n\t\t}\n\t}\n\treturn secs, int32(nanos), true\n}\n\n// The JSON representation for a Timestamp is a JSON string in the RFC 3339\n// format, i.e. \"{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z\" where\n// {year} is always expressed using four digits while {month}, {day}, {hour},\n// {min}, and {sec} are zero-padded to two digits each. The fractional seconds,\n// which can go up to 9 digits, up to 1 nanosecond resolution, is optional. The\n// \"Z\" suffix indicates the timezone (\"UTC\"); the timezone is required. Encoding\n// should always use UTC (as indicated by \"Z\") and a decoder should be able to\n// accept both UTC and other timezones (as indicated by an offset).\n//\n// Timestamp.seconds must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z\n// inclusive.\n// Timestamp.nanos must be from 0 to 999,999,999 inclusive.\n\nconst (\n\tmaxTimestampSeconds = 253402300799\n\tminTimestampSeconds = -62135596800\n)\n\nfunc (e encoder) marshalTimestamp(m pref.Message) error {\n\tfds := m.Descriptor().Fields()\n\tfdSeconds := fds.ByNumber(genid.Timestamp_Seconds_field_number)\n\tfdNanos := fds.ByNumber(genid.Timestamp_Nanos_field_number)\n\n\tsecsVal := m.Get(fdSeconds)\n\tnanosVal := m.Get(fdNanos)\n\tsecs := secsVal.Int()\n\tnanos := nanosVal.Int()\n\tif secs < minTimestampSeconds || secs > maxTimestampSeconds {\n\t\treturn errors.New(\"%s: seconds out of range %v\", genid.Timestamp_message_fullname, secs)\n\t}\n\tif nanos < 0 || nanos > secondsInNanos {\n\t\treturn errors.New(\"%s: nanos out of range %v\", genid.Timestamp_message_fullname, nanos)\n\t}\n\t// Uses RFC 3339, where generated output will be Z-normalized and uses 0, 3,\n\t// 6 or 9 fractional digits.\n\tt := time.Unix(secs, nanos).UTC()\n\tx := t.Format(\"2006-01-02T15:04:05.000000000\")\n\tx = strings.TrimSuffix(x, \"000\")\n\tx = strings.TrimSuffix(x, \"000\")\n\tx = strings.TrimSuffix(x, \".000\")\n\te.WriteString(x + \"Z\")\n\treturn nil\n}\n\nfunc (d decoder) unmarshalTimestamp(m pref.Message) error {\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tok.Kind() != json.String {\n\t\treturn d.unexpectedTokenError(tok)\n\t}\n\n\tt, err := time.Parse(time.RFC3339Nano, tok.ParsedString())\n\tif err != nil {\n\t\treturn d.newError(tok.Pos(), \"invalid %v value %v\", genid.Timestamp_message_fullname, tok.RawString())\n\t}\n\t// Validate seconds. No need to validate nanos because time.Parse would have\n\t// covered that already.\n\tsecs := t.Unix()\n\tif secs < minTimestampSeconds || secs > maxTimestampSeconds {\n\t\treturn d.newError(tok.Pos(), \"%v value out of range: %v\", genid.Timestamp_message_fullname, tok.RawString())\n\t}\n\n\tfds := m.Descriptor().Fields()\n\tfdSeconds := fds.ByNumber(genid.Timestamp_Seconds_field_number)\n\tfdNanos := fds.ByNumber(genid.Timestamp_Nanos_field_number)\n\n\tm.Set(fdSeconds, pref.ValueOfInt64(secs))\n\tm.Set(fdNanos, pref.ValueOfInt32(int32(t.Nanosecond())))\n\treturn nil\n}\n\n// The JSON representation for a FieldMask is a JSON string where paths are\n// separated by a comma. Fields name in each path are converted to/from\n// lower-camel naming conventions. Encoding should fail if the path name would\n// end up differently after a round-trip.\n\nfunc (e encoder) marshalFieldMask(m pref.Message) error {\n\tfd := m.Descriptor().Fields().ByNumber(genid.FieldMask_Paths_field_number)\n\tlist := m.Get(fd).List()\n\tpaths := make([]string, 0, list.Len())\n\n\tfor i := 0; i < list.Len(); i++ {\n\t\ts := list.Get(i).String()\n\t\tif !pref.FullName(s).IsValid() {\n\t\t\treturn errors.New(\"%s contains invalid path: %q\", genid.FieldMask_Paths_field_fullname, s)\n\t\t}\n\t\t// Return error if conversion to camelCase is not reversible.\n\t\tcc := strs.JSONCamelCase(s)\n\t\tif s != strs.JSONSnakeCase(cc) {\n\t\t\treturn errors.New(\"%s contains irreversible value %q\", genid.FieldMask_Paths_field_fullname, s)\n\t\t}\n\t\tpaths = append(paths, cc)\n\t}\n\n\te.WriteString(strings.Join(paths, \",\"))\n\treturn nil\n}\n\nfunc (d decoder) unmarshalFieldMask(m pref.Message) error {\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif tok.Kind() != json.String {\n\t\treturn d.unexpectedTokenError(tok)\n\t}\n\tstr := strings.TrimSpace(tok.ParsedString())\n\tif str == \"\" {\n\t\treturn nil\n\t}\n\tpaths := strings.Split(str, \",\")\n\n\tfd := m.Descriptor().Fields().ByNumber(genid.FieldMask_Paths_field_number)\n\tlist := m.Mutable(fd).List()\n\n\tfor _, s0 := range paths {\n\t\ts := strs.JSONSnakeCase(s0)\n\t\tif strings.Contains(s0, \"_\") || !pref.FullName(s).IsValid() {\n\t\t\treturn d.newError(tok.Pos(), \"%v contains invalid path: %q\", genid.FieldMask_Paths_field_fullname, s0)\n\t\t}\n\t\tlist.Append(pref.ValueOfString(s))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/encoding/prototext/decode.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 prototext\n\nimport (\n\t\"fmt\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/encoding/text\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/internal/set\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/proto\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// Unmarshal reads the given []byte into the given proto.Message.\n// The provided message must be mutable (e.g., a non-nil pointer to a message).\nfunc Unmarshal(b []byte, m proto.Message) error {\n\treturn UnmarshalOptions{}.Unmarshal(b, m)\n}\n\n// UnmarshalOptions is a configurable textproto format unmarshaler.\ntype UnmarshalOptions struct {\n\tpragma.NoUnkeyedLiterals\n\n\t// AllowPartial accepts input for messages that will result in missing\n\t// required fields. If AllowPartial is false (the default), Unmarshal will\n\t// return error if there are any missing required fields.\n\tAllowPartial bool\n\n\t// DiscardUnknown specifies whether to ignore unknown fields when parsing.\n\t// An unknown field is any field whose field name or field number does not\n\t// resolve to any known or extension field in the message.\n\t// By default, unmarshal rejects unknown fields as an error.\n\tDiscardUnknown bool\n\n\t// Resolver is used for looking up types when unmarshaling\n\t// google.protobuf.Any messages or extension fields.\n\t// If nil, this defaults to using protoregistry.GlobalTypes.\n\tResolver interface {\n\t\tprotoregistry.MessageTypeResolver\n\t\tprotoregistry.ExtensionTypeResolver\n\t}\n}\n\n// Unmarshal reads the given []byte and populates the given proto.Message\n// using options in the UnmarshalOptions object.\n// The provided message must be mutable (e.g., a non-nil pointer to a message).\nfunc (o UnmarshalOptions) Unmarshal(b []byte, m proto.Message) error {\n\treturn o.unmarshal(b, m)\n}\n\n// unmarshal is a centralized function that all unmarshal operations go through.\n// For profiling purposes, avoid changing the name of this function or\n// introducing other code paths for unmarshal that do not go through this.\nfunc (o UnmarshalOptions) unmarshal(b []byte, m proto.Message) error {\n\tproto.Reset(m)\n\n\tif o.Resolver == nil {\n\t\to.Resolver = protoregistry.GlobalTypes\n\t}\n\n\tdec := decoder{text.NewDecoder(b), o}\n\tif err := dec.unmarshalMessage(m.ProtoReflect(), false); err != nil {\n\t\treturn err\n\t}\n\tif o.AllowPartial {\n\t\treturn nil\n\t}\n\treturn proto.CheckInitialized(m)\n}\n\ntype decoder struct {\n\t*text.Decoder\n\topts UnmarshalOptions\n}\n\n// newError returns an error object with position info.\nfunc (d decoder) newError(pos int, f string, x ...interface{}) error {\n\tline, column := d.Position(pos)\n\thead := fmt.Sprintf(\"(line %d:%d): \", line, column)\n\treturn errors.New(head+f, x...)\n}\n\n// unexpectedTokenError returns a syntax error for the given unexpected token.\nfunc (d decoder) unexpectedTokenError(tok text.Token) error {\n\treturn d.syntaxError(tok.Pos(), \"unexpected token: %s\", tok.RawString())\n}\n\n// syntaxError returns a syntax error for given position.\nfunc (d decoder) syntaxError(pos int, f string, x ...interface{}) error {\n\tline, column := d.Position(pos)\n\thead := fmt.Sprintf(\"syntax error (line %d:%d): \", line, column)\n\treturn errors.New(head+f, x...)\n}\n\n// unmarshalMessage unmarshals into the given protoreflect.Message.\nfunc (d decoder) unmarshalMessage(m pref.Message, checkDelims bool) error {\n\tmessageDesc := m.Descriptor()\n\tif !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {\n\t\treturn errors.New(\"no support for proto1 MessageSets\")\n\t}\n\n\tif messageDesc.FullName() == genid.Any_message_fullname {\n\t\treturn d.unmarshalAny(m, checkDelims)\n\t}\n\n\tif checkDelims {\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif tok.Kind() != text.MessageOpen {\n\t\t\treturn d.unexpectedTokenError(tok)\n\t\t}\n\t}\n\n\tvar seenNums set.Ints\n\tvar seenOneofs set.Ints\n\tfieldDescs := messageDesc.Fields()\n\n\tfor {\n\t\t// Read field name.\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch typ := tok.Kind(); typ {\n\t\tcase text.Name:\n\t\t\t// Continue below.\n\t\tcase text.EOF:\n\t\t\tif checkDelims {\n\t\t\t\treturn text.ErrUnexpectedEOF\n\t\t\t}\n\t\t\treturn nil\n\t\tdefault:\n\t\t\tif checkDelims && typ == text.MessageClose {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn d.unexpectedTokenError(tok)\n\t\t}\n\n\t\t// Resolve the field descriptor.\n\t\tvar name pref.Name\n\t\tvar fd pref.FieldDescriptor\n\t\tvar xt pref.ExtensionType\n\t\tvar xtErr error\n\t\tvar isFieldNumberName bool\n\n\t\tswitch tok.NameKind() {\n\t\tcase text.IdentName:\n\t\t\tname = pref.Name(tok.IdentName())\n\t\t\tfd = fieldDescs.ByTextName(string(name))\n\n\t\tcase text.TypeName:\n\t\t\t// Handle extensions only. This code path is not for Any.\n\t\t\txt, xtErr = d.opts.Resolver.FindExtensionByName(pref.FullName(tok.TypeName()))\n\n\t\tcase text.FieldNumber:\n\t\t\tisFieldNumberName = true\n\t\t\tnum := pref.FieldNumber(tok.FieldNumber())\n\t\t\tif !num.IsValid() {\n\t\t\t\treturn d.newError(tok.Pos(), \"invalid field number: %d\", num)\n\t\t\t}\n\t\t\tfd = fieldDescs.ByNumber(num)\n\t\t\tif fd == nil {\n\t\t\t\txt, xtErr = d.opts.Resolver.FindExtensionByNumber(messageDesc.FullName(), num)\n\t\t\t}\n\t\t}\n\n\t\tif xt != nil {\n\t\t\tfd = xt.TypeDescriptor()\n\t\t\tif !messageDesc.ExtensionRanges().Has(fd.Number()) || fd.ContainingMessage().FullName() != messageDesc.FullName() {\n\t\t\t\treturn d.newError(tok.Pos(), \"message %v cannot be extended by %v\", messageDesc.FullName(), fd.FullName())\n\t\t\t}\n\t\t} else if xtErr != nil && xtErr != protoregistry.NotFound {\n\t\t\treturn d.newError(tok.Pos(), \"unable to resolve [%s]: %v\", tok.RawString(), xtErr)\n\t\t}\n\t\tif flags.ProtoLegacy {\n\t\t\tif fd != nil && fd.IsWeak() && fd.Message().IsPlaceholder() {\n\t\t\t\tfd = nil // reset since the weak reference is not linked in\n\t\t\t}\n\t\t}\n\n\t\t// Handle unknown fields.\n\t\tif fd == nil {\n\t\t\tif d.opts.DiscardUnknown || messageDesc.ReservedNames().Has(name) {\n\t\t\t\td.skipValue()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn d.newError(tok.Pos(), \"unknown field: %v\", tok.RawString())\n\t\t}\n\n\t\t// Handle fields identified by field number.\n\t\tif isFieldNumberName {\n\t\t\t// TODO: Add an option to permit parsing field numbers.\n\t\t\t//\n\t\t\t// This requires careful thought as the MarshalOptions.EmitUnknown\n\t\t\t// option allows formatting unknown fields as the field number and the\n\t\t\t// best-effort textual representation of the field value.  In that case,\n\t\t\t// it may not be possible to unmarshal the value from a parser that does\n\t\t\t// have information about the unknown field.\n\t\t\treturn d.newError(tok.Pos(), \"cannot specify field by number: %v\", tok.RawString())\n\t\t}\n\n\t\tswitch {\n\t\tcase fd.IsList():\n\t\t\tkind := fd.Kind()\n\t\t\tif kind != pref.MessageKind && kind != pref.GroupKind && !tok.HasSeparator() {\n\t\t\t\treturn d.syntaxError(tok.Pos(), \"missing field separator :\")\n\t\t\t}\n\n\t\t\tlist := m.Mutable(fd).List()\n\t\t\tif err := d.unmarshalList(fd, list); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tcase fd.IsMap():\n\t\t\tmmap := m.Mutable(fd).Map()\n\t\t\tif err := d.unmarshalMap(fd, mmap); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tdefault:\n\t\t\tkind := fd.Kind()\n\t\t\tif kind != pref.MessageKind && kind != pref.GroupKind && !tok.HasSeparator() {\n\t\t\t\treturn d.syntaxError(tok.Pos(), \"missing field separator :\")\n\t\t\t}\n\n\t\t\t// If field is a oneof, check if it has already been set.\n\t\t\tif od := fd.ContainingOneof(); od != nil {\n\t\t\t\tidx := uint64(od.Index())\n\t\t\t\tif seenOneofs.Has(idx) {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"error parsing %q, oneof %v is already set\", tok.RawString(), od.FullName())\n\t\t\t\t}\n\t\t\t\tseenOneofs.Set(idx)\n\t\t\t}\n\n\t\t\tnum := uint64(fd.Number())\n\t\t\tif seenNums.Has(num) {\n\t\t\t\treturn d.newError(tok.Pos(), \"non-repeated field %q is repeated\", tok.RawString())\n\t\t\t}\n\n\t\t\tif err := d.unmarshalSingular(fd, m); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tseenNums.Set(num)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// unmarshalSingular unmarshals a non-repeated field value specified by the\n// given FieldDescriptor.\nfunc (d decoder) unmarshalSingular(fd pref.FieldDescriptor, m pref.Message) error {\n\tvar val pref.Value\n\tvar err error\n\tswitch fd.Kind() {\n\tcase pref.MessageKind, pref.GroupKind:\n\t\tval = m.NewField(fd)\n\t\terr = d.unmarshalMessage(val.Message(), true)\n\tdefault:\n\t\tval, err = d.unmarshalScalar(fd)\n\t}\n\tif err == nil {\n\t\tm.Set(fd, val)\n\t}\n\treturn err\n}\n\n// unmarshalScalar unmarshals a scalar/enum protoreflect.Value specified by the\n// given FieldDescriptor.\nfunc (d decoder) unmarshalScalar(fd pref.FieldDescriptor) (pref.Value, error) {\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn pref.Value{}, err\n\t}\n\n\tif tok.Kind() != text.Scalar {\n\t\treturn pref.Value{}, d.unexpectedTokenError(tok)\n\t}\n\n\tkind := fd.Kind()\n\tswitch kind {\n\tcase pref.BoolKind:\n\t\tif b, ok := tok.Bool(); ok {\n\t\t\treturn pref.ValueOfBool(b), nil\n\t\t}\n\n\tcase pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:\n\t\tif n, ok := tok.Int32(); ok {\n\t\t\treturn pref.ValueOfInt32(n), nil\n\t\t}\n\n\tcase pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:\n\t\tif n, ok := tok.Int64(); ok {\n\t\t\treturn pref.ValueOfInt64(n), nil\n\t\t}\n\n\tcase pref.Uint32Kind, pref.Fixed32Kind:\n\t\tif n, ok := tok.Uint32(); ok {\n\t\t\treturn pref.ValueOfUint32(n), nil\n\t\t}\n\n\tcase pref.Uint64Kind, pref.Fixed64Kind:\n\t\tif n, ok := tok.Uint64(); ok {\n\t\t\treturn pref.ValueOfUint64(n), nil\n\t\t}\n\n\tcase pref.FloatKind:\n\t\tif n, ok := tok.Float32(); ok {\n\t\t\treturn pref.ValueOfFloat32(n), nil\n\t\t}\n\n\tcase pref.DoubleKind:\n\t\tif n, ok := tok.Float64(); ok {\n\t\t\treturn pref.ValueOfFloat64(n), nil\n\t\t}\n\n\tcase pref.StringKind:\n\t\tif s, ok := tok.String(); ok {\n\t\t\tif strs.EnforceUTF8(fd) && !utf8.ValidString(s) {\n\t\t\t\treturn pref.Value{}, d.newError(tok.Pos(), \"contains invalid UTF-8\")\n\t\t\t}\n\t\t\treturn pref.ValueOfString(s), nil\n\t\t}\n\n\tcase pref.BytesKind:\n\t\tif b, ok := tok.String(); ok {\n\t\t\treturn pref.ValueOfBytes([]byte(b)), nil\n\t\t}\n\n\tcase pref.EnumKind:\n\t\tif lit, ok := tok.Enum(); ok {\n\t\t\t// Lookup EnumNumber based on name.\n\t\t\tif enumVal := fd.Enum().Values().ByName(pref.Name(lit)); enumVal != nil {\n\t\t\t\treturn pref.ValueOfEnum(enumVal.Number()), nil\n\t\t\t}\n\t\t}\n\t\tif num, ok := tok.Int32(); ok {\n\t\t\treturn pref.ValueOfEnum(pref.EnumNumber(num)), nil\n\t\t}\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"invalid scalar kind %v\", kind))\n\t}\n\n\treturn pref.Value{}, d.newError(tok.Pos(), \"invalid value for %v type: %v\", kind, tok.RawString())\n}\n\n// unmarshalList unmarshals into given protoreflect.List. A list value can\n// either be in [] syntax or simply just a single scalar/message value.\nfunc (d decoder) unmarshalList(fd pref.FieldDescriptor, list pref.List) error {\n\ttok, err := d.Peek()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch fd.Kind() {\n\tcase pref.MessageKind, pref.GroupKind:\n\t\tswitch tok.Kind() {\n\t\tcase text.ListOpen:\n\t\t\td.Read()\n\t\t\tfor {\n\t\t\t\ttok, err := d.Peek()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tswitch tok.Kind() {\n\t\t\t\tcase text.ListClose:\n\t\t\t\t\td.Read()\n\t\t\t\t\treturn nil\n\t\t\t\tcase text.MessageOpen:\n\t\t\t\t\tpval := list.NewElement()\n\t\t\t\t\tif err := d.unmarshalMessage(pval.Message(), true); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tlist.Append(pval)\n\t\t\t\tdefault:\n\t\t\t\t\treturn d.unexpectedTokenError(tok)\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase text.MessageOpen:\n\t\t\tpval := list.NewElement()\n\t\t\tif err := d.unmarshalMessage(pval.Message(), true); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlist.Append(pval)\n\t\t\treturn nil\n\t\t}\n\n\tdefault:\n\t\tswitch tok.Kind() {\n\t\tcase text.ListOpen:\n\t\t\td.Read()\n\t\t\tfor {\n\t\t\t\ttok, err := d.Peek()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tswitch tok.Kind() {\n\t\t\t\tcase text.ListClose:\n\t\t\t\t\td.Read()\n\t\t\t\t\treturn nil\n\t\t\t\tcase text.Scalar:\n\t\t\t\t\tpval, err := d.unmarshalScalar(fd)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tlist.Append(pval)\n\t\t\t\tdefault:\n\t\t\t\t\treturn d.unexpectedTokenError(tok)\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase text.Scalar:\n\t\t\tpval, err := d.unmarshalScalar(fd)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlist.Append(pval)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn d.unexpectedTokenError(tok)\n}\n\n// unmarshalMap unmarshals into given protoreflect.Map. A map value is a\n// textproto message containing {key: <kvalue>, value: <mvalue>}.\nfunc (d decoder) unmarshalMap(fd pref.FieldDescriptor, mmap pref.Map) error {\n\t// Determine ahead whether map entry is a scalar type or a message type in\n\t// order to call the appropriate unmarshalMapValue func inside\n\t// unmarshalMapEntry.\n\tvar unmarshalMapValue func() (pref.Value, error)\n\tswitch fd.MapValue().Kind() {\n\tcase pref.MessageKind, pref.GroupKind:\n\t\tunmarshalMapValue = func() (pref.Value, error) {\n\t\t\tpval := mmap.NewValue()\n\t\t\tif err := d.unmarshalMessage(pval.Message(), true); err != nil {\n\t\t\t\treturn pref.Value{}, err\n\t\t\t}\n\t\t\treturn pval, nil\n\t\t}\n\tdefault:\n\t\tunmarshalMapValue = func() (pref.Value, error) {\n\t\t\treturn d.unmarshalScalar(fd.MapValue())\n\t\t}\n\t}\n\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\tswitch tok.Kind() {\n\tcase text.MessageOpen:\n\t\treturn d.unmarshalMapEntry(fd, mmap, unmarshalMapValue)\n\n\tcase text.ListOpen:\n\t\tfor {\n\t\t\ttok, err := d.Read()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tswitch tok.Kind() {\n\t\t\tcase text.ListClose:\n\t\t\t\treturn nil\n\t\t\tcase text.MessageOpen:\n\t\t\t\tif err := d.unmarshalMapEntry(fd, mmap, unmarshalMapValue); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn d.unexpectedTokenError(tok)\n\t\t\t}\n\t\t}\n\n\tdefault:\n\t\treturn d.unexpectedTokenError(tok)\n\t}\n}\n\n// unmarshalMap unmarshals into given protoreflect.Map. A map value is a\n// textproto message containing {key: <kvalue>, value: <mvalue>}.\nfunc (d decoder) unmarshalMapEntry(fd pref.FieldDescriptor, mmap pref.Map, unmarshalMapValue func() (pref.Value, error)) error {\n\tvar key pref.MapKey\n\tvar pval pref.Value\nLoop:\n\tfor {\n\t\t// Read field name.\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch tok.Kind() {\n\t\tcase text.Name:\n\t\t\tif tok.NameKind() != text.IdentName {\n\t\t\t\tif !d.opts.DiscardUnknown {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"unknown map entry field %q\", tok.RawString())\n\t\t\t\t}\n\t\t\t\td.skipValue()\n\t\t\t\tcontinue Loop\n\t\t\t}\n\t\t\t// Continue below.\n\t\tcase text.MessageClose:\n\t\t\tbreak Loop\n\t\tdefault:\n\t\t\treturn d.unexpectedTokenError(tok)\n\t\t}\n\n\t\tswitch name := pref.Name(tok.IdentName()); name {\n\t\tcase genid.MapEntry_Key_field_name:\n\t\t\tif !tok.HasSeparator() {\n\t\t\t\treturn d.syntaxError(tok.Pos(), \"missing field separator :\")\n\t\t\t}\n\t\t\tif key.IsValid() {\n\t\t\t\treturn d.newError(tok.Pos(), \"map entry %q cannot be repeated\", name)\n\t\t\t}\n\t\t\tval, err := d.unmarshalScalar(fd.MapKey())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tkey = val.MapKey()\n\n\t\tcase genid.MapEntry_Value_field_name:\n\t\t\tif kind := fd.MapValue().Kind(); (kind != pref.MessageKind) && (kind != pref.GroupKind) {\n\t\t\t\tif !tok.HasSeparator() {\n\t\t\t\t\treturn d.syntaxError(tok.Pos(), \"missing field separator :\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tif pval.IsValid() {\n\t\t\t\treturn d.newError(tok.Pos(), \"map entry %q cannot be repeated\", name)\n\t\t\t}\n\t\t\tpval, err = unmarshalMapValue()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\tdefault:\n\t\t\tif !d.opts.DiscardUnknown {\n\t\t\t\treturn d.newError(tok.Pos(), \"unknown map entry field %q\", name)\n\t\t\t}\n\t\t\td.skipValue()\n\t\t}\n\t}\n\n\tif !key.IsValid() {\n\t\tkey = fd.MapKey().Default().MapKey()\n\t}\n\tif !pval.IsValid() {\n\t\tswitch fd.MapValue().Kind() {\n\t\tcase pref.MessageKind, pref.GroupKind:\n\t\t\t// If value field is not set for message/group types, construct an\n\t\t\t// empty one as default.\n\t\t\tpval = mmap.NewValue()\n\t\tdefault:\n\t\t\tpval = fd.MapValue().Default()\n\t\t}\n\t}\n\tmmap.Set(key, pval)\n\treturn nil\n}\n\n// unmarshalAny unmarshals an Any textproto. It can either be in expanded form\n// or non-expanded form.\nfunc (d decoder) unmarshalAny(m pref.Message, checkDelims bool) error {\n\tvar typeURL string\n\tvar bValue []byte\n\tvar seenTypeUrl bool\n\tvar seenValue bool\n\tvar isExpanded bool\n\n\tif checkDelims {\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif tok.Kind() != text.MessageOpen {\n\t\t\treturn d.unexpectedTokenError(tok)\n\t\t}\n\t}\n\nLoop:\n\tfor {\n\t\t// Read field name. Can only have 3 possible field names, i.e. type_url,\n\t\t// value and type URL name inside [].\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif typ := tok.Kind(); typ != text.Name {\n\t\t\tif checkDelims {\n\t\t\t\tif typ == text.MessageClose {\n\t\t\t\t\tbreak Loop\n\t\t\t\t}\n\t\t\t} else if typ == text.EOF {\n\t\t\t\tbreak Loop\n\t\t\t}\n\t\t\treturn d.unexpectedTokenError(tok)\n\t\t}\n\n\t\tswitch tok.NameKind() {\n\t\tcase text.IdentName:\n\t\t\t// Both type_url and value fields require field separator :.\n\t\t\tif !tok.HasSeparator() {\n\t\t\t\treturn d.syntaxError(tok.Pos(), \"missing field separator :\")\n\t\t\t}\n\n\t\t\tswitch name := pref.Name(tok.IdentName()); name {\n\t\t\tcase genid.Any_TypeUrl_field_name:\n\t\t\t\tif seenTypeUrl {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"duplicate %v field\", genid.Any_TypeUrl_field_fullname)\n\t\t\t\t}\n\t\t\t\tif isExpanded {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"conflict with [%s] field\", typeURL)\n\t\t\t\t}\n\t\t\t\ttok, err := d.Read()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tvar ok bool\n\t\t\t\ttypeURL, ok = tok.String()\n\t\t\t\tif !ok {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"invalid %v field value: %v\", genid.Any_TypeUrl_field_fullname, tok.RawString())\n\t\t\t\t}\n\t\t\t\tseenTypeUrl = true\n\n\t\t\tcase genid.Any_Value_field_name:\n\t\t\t\tif seenValue {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"duplicate %v field\", genid.Any_Value_field_fullname)\n\t\t\t\t}\n\t\t\t\tif isExpanded {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"conflict with [%s] field\", typeURL)\n\t\t\t\t}\n\t\t\t\ttok, err := d.Read()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ts, ok := tok.String()\n\t\t\t\tif !ok {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"invalid %v field value: %v\", genid.Any_Value_field_fullname, tok.RawString())\n\t\t\t\t}\n\t\t\t\tbValue = []byte(s)\n\t\t\t\tseenValue = true\n\n\t\t\tdefault:\n\t\t\t\tif !d.opts.DiscardUnknown {\n\t\t\t\t\treturn d.newError(tok.Pos(), \"invalid field name %q in %v message\", tok.RawString(), genid.Any_message_fullname)\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase text.TypeName:\n\t\t\tif isExpanded {\n\t\t\t\treturn d.newError(tok.Pos(), \"cannot have more than one type\")\n\t\t\t}\n\t\t\tif seenTypeUrl {\n\t\t\t\treturn d.newError(tok.Pos(), \"conflict with type_url field\")\n\t\t\t}\n\t\t\ttypeURL = tok.TypeName()\n\t\t\tvar err error\n\t\t\tbValue, err = d.unmarshalExpandedAny(typeURL, tok.Pos())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tisExpanded = true\n\n\t\tdefault:\n\t\t\tif !d.opts.DiscardUnknown {\n\t\t\t\treturn d.newError(tok.Pos(), \"invalid field name %q in %v message\", tok.RawString(), genid.Any_message_fullname)\n\t\t\t}\n\t\t}\n\t}\n\n\tfds := m.Descriptor().Fields()\n\tif len(typeURL) > 0 {\n\t\tm.Set(fds.ByNumber(genid.Any_TypeUrl_field_number), pref.ValueOfString(typeURL))\n\t}\n\tif len(bValue) > 0 {\n\t\tm.Set(fds.ByNumber(genid.Any_Value_field_number), pref.ValueOfBytes(bValue))\n\t}\n\treturn nil\n}\n\nfunc (d decoder) unmarshalExpandedAny(typeURL string, pos int) ([]byte, error) {\n\tmt, err := d.opts.Resolver.FindMessageByURL(typeURL)\n\tif err != nil {\n\t\treturn nil, d.newError(pos, \"unable to resolve message [%v]: %v\", typeURL, err)\n\t}\n\t// Create new message for the embedded message type and unmarshal the value\n\t// field into it.\n\tm := mt.New()\n\tif err := d.unmarshalMessage(m, true); err != nil {\n\t\treturn nil, err\n\t}\n\t// Serialize the embedded message and return the resulting bytes.\n\tb, err := proto.MarshalOptions{\n\t\tAllowPartial:  true, // Never check required fields inside an Any.\n\t\tDeterministic: true,\n\t}.Marshal(m.Interface())\n\tif err != nil {\n\t\treturn nil, d.newError(pos, \"error in marshaling message into Any.value: %v\", err)\n\t}\n\treturn b, nil\n}\n\n// skipValue makes the decoder parse a field value in order to advance the read\n// to the next field. It relies on Read returning an error if the types are not\n// in valid sequence.\nfunc (d decoder) skipValue() error {\n\ttok, err := d.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Only need to continue reading for messages and lists.\n\tswitch tok.Kind() {\n\tcase text.MessageOpen:\n\t\treturn d.skipMessageValue()\n\n\tcase text.ListOpen:\n\t\tfor {\n\t\t\ttok, err := d.Read()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tswitch tok.Kind() {\n\t\t\tcase text.ListClose:\n\t\t\t\treturn nil\n\t\t\tcase text.MessageOpen:\n\t\t\t\treturn d.skipMessageValue()\n\t\t\tdefault:\n\t\t\t\t// Skip items. This will not validate whether skipped values are\n\t\t\t\t// of the same type or not, same behavior as C++\n\t\t\t\t// TextFormat::Parser::AllowUnknownField(true) version 3.8.0.\n\t\t\t\tif err := d.skipValue(); 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\n// skipMessageValue makes the decoder parse and skip over all fields in a\n// message. It assumes that the previous read type is MessageOpen.\nfunc (d decoder) skipMessageValue() error {\n\tfor {\n\t\ttok, err := d.Read()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tswitch tok.Kind() {\n\t\tcase text.MessageClose:\n\t\t\treturn nil\n\t\tcase text.Name:\n\t\t\tif err := d.skipValue(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/encoding/prototext/doc.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 prototext marshals and unmarshals protocol buffer messages as the\n// textproto format.\npackage prototext\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/encoding/prototext/encode.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 prototext\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/encoding/text\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/order\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\nconst defaultIndent = \"  \"\n\n// Format formats the message as a multiline string.\n// This function is only intended for human consumption and ignores errors.\n// Do not depend on the output being stable. It may change over time across\n// different versions of the program.\nfunc Format(m proto.Message) string {\n\treturn MarshalOptions{Multiline: true}.Format(m)\n}\n\n// Marshal writes the given proto.Message in textproto format using default\n// options. Do not depend on the output being stable. It may change over time\n// across different versions of the program.\nfunc Marshal(m proto.Message) ([]byte, error) {\n\treturn MarshalOptions{}.Marshal(m)\n}\n\n// MarshalOptions is a configurable text format marshaler.\ntype MarshalOptions struct {\n\tpragma.NoUnkeyedLiterals\n\n\t// Multiline specifies whether the marshaler should format the output in\n\t// indented-form with every textual element on a new line.\n\t// If Indent is an empty string, then an arbitrary indent is chosen.\n\tMultiline bool\n\n\t// Indent specifies the set of indentation characters to use in a multiline\n\t// formatted output such that every entry is preceded by Indent and\n\t// terminated by a newline. If non-empty, then Multiline is treated as true.\n\t// Indent can only be composed of space or tab characters.\n\tIndent string\n\n\t// EmitASCII specifies whether to format strings and bytes as ASCII only\n\t// as opposed to using UTF-8 encoding when possible.\n\tEmitASCII bool\n\n\t// allowInvalidUTF8 specifies whether to permit the encoding of strings\n\t// with invalid UTF-8. This is unexported as it is intended to only\n\t// be specified by the Format method.\n\tallowInvalidUTF8 bool\n\n\t// AllowPartial allows messages that have missing required fields to marshal\n\t// without returning an error. If AllowPartial is false (the default),\n\t// Marshal will return error if there are any missing required fields.\n\tAllowPartial bool\n\n\t// EmitUnknown specifies whether to emit unknown fields in the output.\n\t// If specified, the unmarshaler may be unable to parse the output.\n\t// The default is to exclude unknown fields.\n\tEmitUnknown bool\n\n\t// Resolver is used for looking up types when expanding google.protobuf.Any\n\t// messages. If nil, this defaults to using protoregistry.GlobalTypes.\n\tResolver interface {\n\t\tprotoregistry.ExtensionTypeResolver\n\t\tprotoregistry.MessageTypeResolver\n\t}\n}\n\n// Format formats the message as a string.\n// This method is only intended for human consumption and ignores errors.\n// Do not depend on the output being stable. It may change over time across\n// different versions of the program.\nfunc (o MarshalOptions) Format(m proto.Message) string {\n\tif m == nil || !m.ProtoReflect().IsValid() {\n\t\treturn \"<nil>\" // invalid syntax, but okay since this is for debugging\n\t}\n\to.allowInvalidUTF8 = true\n\to.AllowPartial = true\n\to.EmitUnknown = true\n\tb, _ := o.Marshal(m)\n\treturn string(b)\n}\n\n// Marshal writes the given proto.Message in textproto format using options in\n// MarshalOptions object. Do not depend on the output being stable. It may\n// change over time across different versions of the program.\nfunc (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) {\n\treturn o.marshal(m)\n}\n\n// marshal is a centralized function that all marshal operations go through.\n// For profiling purposes, avoid changing the name of this function or\n// introducing other code paths for marshal that do not go through this.\nfunc (o MarshalOptions) marshal(m proto.Message) ([]byte, error) {\n\tvar delims = [2]byte{'{', '}'}\n\n\tif o.Multiline && o.Indent == \"\" {\n\t\to.Indent = defaultIndent\n\t}\n\tif o.Resolver == nil {\n\t\to.Resolver = protoregistry.GlobalTypes\n\t}\n\n\tinternalEnc, err := text.NewEncoder(o.Indent, delims, o.EmitASCII)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Treat nil message interface as an empty message,\n\t// in which case there is nothing to output.\n\tif m == nil {\n\t\treturn []byte{}, nil\n\t}\n\n\tenc := encoder{internalEnc, o}\n\terr = enc.marshalMessage(m.ProtoReflect(), false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout := enc.Bytes()\n\tif len(o.Indent) > 0 && len(out) > 0 {\n\t\tout = append(out, '\\n')\n\t}\n\tif o.AllowPartial {\n\t\treturn out, nil\n\t}\n\treturn out, proto.CheckInitialized(m)\n}\n\ntype encoder struct {\n\t*text.Encoder\n\topts MarshalOptions\n}\n\n// marshalMessage marshals the given protoreflect.Message.\nfunc (e encoder) marshalMessage(m pref.Message, inclDelims bool) error {\n\tmessageDesc := m.Descriptor()\n\tif !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {\n\t\treturn errors.New(\"no support for proto1 MessageSets\")\n\t}\n\n\tif inclDelims {\n\t\te.StartMessage()\n\t\tdefer e.EndMessage()\n\t}\n\n\t// Handle Any expansion.\n\tif messageDesc.FullName() == genid.Any_message_fullname {\n\t\tif e.marshalAny(m) {\n\t\t\treturn nil\n\t\t}\n\t\t// If unable to expand, continue on to marshal Any as a regular message.\n\t}\n\n\t// Marshal fields.\n\tvar err error\n\torder.RangeFields(m, order.IndexNameFieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tif err = e.marshalField(fd.TextName(), v, fd); err != nil {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Marshal unknown fields.\n\tif e.opts.EmitUnknown {\n\t\te.marshalUnknown(m.GetUnknown())\n\t}\n\n\treturn nil\n}\n\n// marshalField marshals the given field with protoreflect.Value.\nfunc (e encoder) marshalField(name string, val pref.Value, fd pref.FieldDescriptor) error {\n\tswitch {\n\tcase fd.IsList():\n\t\treturn e.marshalList(name, val.List(), fd)\n\tcase fd.IsMap():\n\t\treturn e.marshalMap(name, val.Map(), fd)\n\tdefault:\n\t\te.WriteName(name)\n\t\treturn e.marshalSingular(val, fd)\n\t}\n}\n\n// marshalSingular marshals the given non-repeated field value. This includes\n// all scalar types, enums, messages, and groups.\nfunc (e encoder) marshalSingular(val pref.Value, fd pref.FieldDescriptor) error {\n\tkind := fd.Kind()\n\tswitch kind {\n\tcase pref.BoolKind:\n\t\te.WriteBool(val.Bool())\n\n\tcase pref.StringKind:\n\t\ts := val.String()\n\t\tif !e.opts.allowInvalidUTF8 && strs.EnforceUTF8(fd) && !utf8.ValidString(s) {\n\t\t\treturn errors.InvalidUTF8(string(fd.FullName()))\n\t\t}\n\t\te.WriteString(s)\n\n\tcase pref.Int32Kind, pref.Int64Kind,\n\t\tpref.Sint32Kind, pref.Sint64Kind,\n\t\tpref.Sfixed32Kind, pref.Sfixed64Kind:\n\t\te.WriteInt(val.Int())\n\n\tcase pref.Uint32Kind, pref.Uint64Kind,\n\t\tpref.Fixed32Kind, pref.Fixed64Kind:\n\t\te.WriteUint(val.Uint())\n\n\tcase pref.FloatKind:\n\t\t// Encoder.WriteFloat handles the special numbers NaN and infinites.\n\t\te.WriteFloat(val.Float(), 32)\n\n\tcase pref.DoubleKind:\n\t\t// Encoder.WriteFloat handles the special numbers NaN and infinites.\n\t\te.WriteFloat(val.Float(), 64)\n\n\tcase pref.BytesKind:\n\t\te.WriteString(string(val.Bytes()))\n\n\tcase pref.EnumKind:\n\t\tnum := val.Enum()\n\t\tif desc := fd.Enum().Values().ByNumber(num); desc != nil {\n\t\t\te.WriteLiteral(string(desc.Name()))\n\t\t} else {\n\t\t\t// Use numeric value if there is no enum description.\n\t\t\te.WriteInt(int64(num))\n\t\t}\n\n\tcase pref.MessageKind, pref.GroupKind:\n\t\treturn e.marshalMessage(val.Message(), true)\n\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"%v has unknown kind: %v\", fd.FullName(), kind))\n\t}\n\treturn nil\n}\n\n// marshalList marshals the given protoreflect.List as multiple name-value fields.\nfunc (e encoder) marshalList(name string, list pref.List, fd pref.FieldDescriptor) error {\n\tsize := list.Len()\n\tfor i := 0; i < size; i++ {\n\t\te.WriteName(name)\n\t\tif err := e.marshalSingular(list.Get(i), fd); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// marshalMap marshals the given protoreflect.Map as multiple name-value fields.\nfunc (e encoder) marshalMap(name string, mmap pref.Map, fd pref.FieldDescriptor) error {\n\tvar err error\n\torder.RangeEntries(mmap, order.GenericKeyOrder, func(key pref.MapKey, val pref.Value) bool {\n\t\te.WriteName(name)\n\t\te.StartMessage()\n\t\tdefer e.EndMessage()\n\n\t\te.WriteName(string(genid.MapEntry_Key_field_name))\n\t\terr = e.marshalSingular(key.Value(), fd.MapKey())\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\n\t\te.WriteName(string(genid.MapEntry_Value_field_name))\n\t\terr = e.marshalSingular(val, fd.MapValue())\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t})\n\treturn err\n}\n\n// marshalUnknown parses the given []byte and marshals fields out.\n// This function assumes proper encoding in the given []byte.\nfunc (e encoder) marshalUnknown(b []byte) {\n\tconst dec = 10\n\tconst hex = 16\n\tfor len(b) > 0 {\n\t\tnum, wtype, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\te.WriteName(strconv.FormatInt(int64(num), dec))\n\n\t\tswitch wtype {\n\t\tcase protowire.VarintType:\n\t\t\tvar v uint64\n\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\te.WriteUint(v)\n\t\tcase protowire.Fixed32Type:\n\t\t\tvar v uint32\n\t\t\tv, n = protowire.ConsumeFixed32(b)\n\t\t\te.WriteLiteral(\"0x\" + strconv.FormatUint(uint64(v), hex))\n\t\tcase protowire.Fixed64Type:\n\t\t\tvar v uint64\n\t\t\tv, n = protowire.ConsumeFixed64(b)\n\t\t\te.WriteLiteral(\"0x\" + strconv.FormatUint(v, hex))\n\t\tcase protowire.BytesType:\n\t\t\tvar v []byte\n\t\t\tv, n = protowire.ConsumeBytes(b)\n\t\t\te.WriteString(string(v))\n\t\tcase protowire.StartGroupType:\n\t\t\te.StartMessage()\n\t\t\tvar v []byte\n\t\t\tv, n = protowire.ConsumeGroup(num, b)\n\t\t\te.marshalUnknown(v)\n\t\t\te.EndMessage()\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"prototext: error parsing unknown field wire type: %v\", wtype))\n\t\t}\n\n\t\tb = b[n:]\n\t}\n}\n\n// marshalAny marshals the given google.protobuf.Any message in expanded form.\n// It returns true if it was able to marshal, else false.\nfunc (e encoder) marshalAny(any pref.Message) bool {\n\t// Construct the embedded message.\n\tfds := any.Descriptor().Fields()\n\tfdType := fds.ByNumber(genid.Any_TypeUrl_field_number)\n\ttypeURL := any.Get(fdType).String()\n\tmt, err := e.opts.Resolver.FindMessageByURL(typeURL)\n\tif err != nil {\n\t\treturn false\n\t}\n\tm := mt.New().Interface()\n\n\t// Unmarshal bytes into embedded message.\n\tfdValue := fds.ByNumber(genid.Any_Value_field_number)\n\tvalue := any.Get(fdValue)\n\terr = proto.UnmarshalOptions{\n\t\tAllowPartial: true,\n\t\tResolver:     e.opts.Resolver,\n\t}.Unmarshal(value.Bytes(), m)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\t// Get current encoder position. If marshaling fails, reset encoder output\n\t// back to this position.\n\tpos := e.Snapshot()\n\n\t// Field name is the proto field name enclosed in [].\n\te.WriteName(\"[\" + typeURL + \"]\")\n\terr = e.marshalMessage(m.ProtoReflect(), true)\n\tif err != nil {\n\t\te.Reset(pos)\n\t\treturn false\n\t}\n\treturn true\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/encoding/protowire/wire.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 protowire parses and formats the raw wire encoding.\n// See https://developers.google.com/protocol-buffers/docs/encoding.\n//\n// For marshaling and unmarshaling entire protobuf messages,\n// use the \"google.golang.org/protobuf/proto\" package instead.\npackage protowire\n\nimport (\n\t\"io\"\n\t\"math\"\n\t\"math/bits\"\n\n\t\"google.golang.org/protobuf/internal/errors\"\n)\n\n// Number represents the field number.\ntype Number int32\n\nconst (\n\tMinValidNumber      Number = 1\n\tFirstReservedNumber Number = 19000\n\tLastReservedNumber  Number = 19999\n\tMaxValidNumber      Number = 1<<29 - 1\n)\n\n// IsValid reports whether the field number is semantically valid.\n//\n// Note that while numbers within the reserved range are semantically invalid,\n// they are syntactically valid in the wire format.\n// Implementations may treat records with reserved field numbers as unknown.\nfunc (n Number) IsValid() bool {\n\treturn MinValidNumber <= n && n < FirstReservedNumber || LastReservedNumber < n && n <= MaxValidNumber\n}\n\n// Type represents the wire type.\ntype Type int8\n\nconst (\n\tVarintType     Type = 0\n\tFixed32Type    Type = 5\n\tFixed64Type    Type = 1\n\tBytesType      Type = 2\n\tStartGroupType Type = 3\n\tEndGroupType   Type = 4\n)\n\nconst (\n\t_ = -iota\n\terrCodeTruncated\n\terrCodeFieldNumber\n\terrCodeOverflow\n\terrCodeReserved\n\terrCodeEndGroup\n)\n\nvar (\n\terrFieldNumber = errors.New(\"invalid field number\")\n\terrOverflow    = errors.New(\"variable length integer overflow\")\n\terrReserved    = errors.New(\"cannot parse reserved wire type\")\n\terrEndGroup    = errors.New(\"mismatching end group marker\")\n\terrParse       = errors.New(\"parse error\")\n)\n\n// ParseError converts an error code into an error value.\n// This returns nil if n is a non-negative number.\nfunc ParseError(n int) error {\n\tif n >= 0 {\n\t\treturn nil\n\t}\n\tswitch n {\n\tcase errCodeTruncated:\n\t\treturn io.ErrUnexpectedEOF\n\tcase errCodeFieldNumber:\n\t\treturn errFieldNumber\n\tcase errCodeOverflow:\n\t\treturn errOverflow\n\tcase errCodeReserved:\n\t\treturn errReserved\n\tcase errCodeEndGroup:\n\t\treturn errEndGroup\n\tdefault:\n\t\treturn errParse\n\t}\n}\n\n// ConsumeField parses an entire field record (both tag and value) and returns\n// the field number, the wire type, and the total length.\n// This returns a negative length upon an error (see ParseError).\n//\n// The total length includes the tag header and the end group marker (if the\n// field is a group).\nfunc ConsumeField(b []byte) (Number, Type, int) {\n\tnum, typ, n := ConsumeTag(b)\n\tif n < 0 {\n\t\treturn 0, 0, n // forward error code\n\t}\n\tm := ConsumeFieldValue(num, typ, b[n:])\n\tif m < 0 {\n\t\treturn 0, 0, m // forward error code\n\t}\n\treturn num, typ, n + m\n}\n\n// ConsumeFieldValue parses a field value and returns its length.\n// This assumes that the field Number and wire Type have already been parsed.\n// This returns a negative length upon an error (see ParseError).\n//\n// When parsing a group, the length includes the end group marker and\n// the end group is verified to match the starting field number.\nfunc ConsumeFieldValue(num Number, typ Type, b []byte) (n int) {\n\tswitch typ {\n\tcase VarintType:\n\t\t_, n = ConsumeVarint(b)\n\t\treturn n\n\tcase Fixed32Type:\n\t\t_, n = ConsumeFixed32(b)\n\t\treturn n\n\tcase Fixed64Type:\n\t\t_, n = ConsumeFixed64(b)\n\t\treturn n\n\tcase BytesType:\n\t\t_, n = ConsumeBytes(b)\n\t\treturn n\n\tcase StartGroupType:\n\t\tn0 := len(b)\n\t\tfor {\n\t\t\tnum2, typ2, n := ConsumeTag(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn n // forward error code\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t\tif typ2 == EndGroupType {\n\t\t\t\tif num != num2 {\n\t\t\t\t\treturn errCodeEndGroup\n\t\t\t\t}\n\t\t\t\treturn n0 - len(b)\n\t\t\t}\n\n\t\t\tn = ConsumeFieldValue(num2, typ2, b)\n\t\t\tif n < 0 {\n\t\t\t\treturn n // forward error code\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t}\n\tcase EndGroupType:\n\t\treturn errCodeEndGroup\n\tdefault:\n\t\treturn errCodeReserved\n\t}\n}\n\n// AppendTag encodes num and typ as a varint-encoded tag and appends it to b.\nfunc AppendTag(b []byte, num Number, typ Type) []byte {\n\treturn AppendVarint(b, EncodeTag(num, typ))\n}\n\n// ConsumeTag parses b as a varint-encoded tag, reporting its length.\n// This returns a negative length upon an error (see ParseError).\nfunc ConsumeTag(b []byte) (Number, Type, int) {\n\tv, n := ConsumeVarint(b)\n\tif n < 0 {\n\t\treturn 0, 0, n // forward error code\n\t}\n\tnum, typ := DecodeTag(v)\n\tif num < MinValidNumber {\n\t\treturn 0, 0, errCodeFieldNumber\n\t}\n\treturn num, typ, n\n}\n\nfunc SizeTag(num Number) int {\n\treturn SizeVarint(EncodeTag(num, 0)) // wire type has no effect on size\n}\n\n// AppendVarint appends v to b as a varint-encoded uint64.\nfunc AppendVarint(b []byte, v uint64) []byte {\n\tswitch {\n\tcase v < 1<<7:\n\t\tb = append(b, byte(v))\n\tcase v < 1<<14:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte(v>>7))\n\tcase v < 1<<21:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte(v>>14))\n\tcase v < 1<<28:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte((v>>14)&0x7f|0x80),\n\t\t\tbyte(v>>21))\n\tcase v < 1<<35:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte((v>>14)&0x7f|0x80),\n\t\t\tbyte((v>>21)&0x7f|0x80),\n\t\t\tbyte(v>>28))\n\tcase v < 1<<42:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte((v>>14)&0x7f|0x80),\n\t\t\tbyte((v>>21)&0x7f|0x80),\n\t\t\tbyte((v>>28)&0x7f|0x80),\n\t\t\tbyte(v>>35))\n\tcase v < 1<<49:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte((v>>14)&0x7f|0x80),\n\t\t\tbyte((v>>21)&0x7f|0x80),\n\t\t\tbyte((v>>28)&0x7f|0x80),\n\t\t\tbyte((v>>35)&0x7f|0x80),\n\t\t\tbyte(v>>42))\n\tcase v < 1<<56:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte((v>>14)&0x7f|0x80),\n\t\t\tbyte((v>>21)&0x7f|0x80),\n\t\t\tbyte((v>>28)&0x7f|0x80),\n\t\t\tbyte((v>>35)&0x7f|0x80),\n\t\t\tbyte((v>>42)&0x7f|0x80),\n\t\t\tbyte(v>>49))\n\tcase v < 1<<63:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte((v>>14)&0x7f|0x80),\n\t\t\tbyte((v>>21)&0x7f|0x80),\n\t\t\tbyte((v>>28)&0x7f|0x80),\n\t\t\tbyte((v>>35)&0x7f|0x80),\n\t\t\tbyte((v>>42)&0x7f|0x80),\n\t\t\tbyte((v>>49)&0x7f|0x80),\n\t\t\tbyte(v>>56))\n\tdefault:\n\t\tb = append(b,\n\t\t\tbyte((v>>0)&0x7f|0x80),\n\t\t\tbyte((v>>7)&0x7f|0x80),\n\t\t\tbyte((v>>14)&0x7f|0x80),\n\t\t\tbyte((v>>21)&0x7f|0x80),\n\t\t\tbyte((v>>28)&0x7f|0x80),\n\t\t\tbyte((v>>35)&0x7f|0x80),\n\t\t\tbyte((v>>42)&0x7f|0x80),\n\t\t\tbyte((v>>49)&0x7f|0x80),\n\t\t\tbyte((v>>56)&0x7f|0x80),\n\t\t\t1)\n\t}\n\treturn b\n}\n\n// ConsumeVarint parses b as a varint-encoded uint64, reporting its length.\n// This returns a negative length upon an error (see ParseError).\nfunc ConsumeVarint(b []byte) (v uint64, n int) {\n\tvar y uint64\n\tif len(b) <= 0 {\n\t\treturn 0, errCodeTruncated\n\t}\n\tv = uint64(b[0])\n\tif v < 0x80 {\n\t\treturn v, 1\n\t}\n\tv -= 0x80\n\n\tif len(b) <= 1 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[1])\n\tv += y << 7\n\tif y < 0x80 {\n\t\treturn v, 2\n\t}\n\tv -= 0x80 << 7\n\n\tif len(b) <= 2 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[2])\n\tv += y << 14\n\tif y < 0x80 {\n\t\treturn v, 3\n\t}\n\tv -= 0x80 << 14\n\n\tif len(b) <= 3 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[3])\n\tv += y << 21\n\tif y < 0x80 {\n\t\treturn v, 4\n\t}\n\tv -= 0x80 << 21\n\n\tif len(b) <= 4 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[4])\n\tv += y << 28\n\tif y < 0x80 {\n\t\treturn v, 5\n\t}\n\tv -= 0x80 << 28\n\n\tif len(b) <= 5 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[5])\n\tv += y << 35\n\tif y < 0x80 {\n\t\treturn v, 6\n\t}\n\tv -= 0x80 << 35\n\n\tif len(b) <= 6 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[6])\n\tv += y << 42\n\tif y < 0x80 {\n\t\treturn v, 7\n\t}\n\tv -= 0x80 << 42\n\n\tif len(b) <= 7 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[7])\n\tv += y << 49\n\tif y < 0x80 {\n\t\treturn v, 8\n\t}\n\tv -= 0x80 << 49\n\n\tif len(b) <= 8 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[8])\n\tv += y << 56\n\tif y < 0x80 {\n\t\treturn v, 9\n\t}\n\tv -= 0x80 << 56\n\n\tif len(b) <= 9 {\n\t\treturn 0, errCodeTruncated\n\t}\n\ty = uint64(b[9])\n\tv += y << 63\n\tif y < 2 {\n\t\treturn v, 10\n\t}\n\treturn 0, errCodeOverflow\n}\n\n// SizeVarint returns the encoded size of a varint.\n// The size is guaranteed to be within 1 and 10, inclusive.\nfunc SizeVarint(v uint64) int {\n\t// This computes 1 + (bits.Len64(v)-1)/7.\n\t// 9/64 is a good enough approximation of 1/7\n\treturn int(9*uint32(bits.Len64(v))+64) / 64\n}\n\n// AppendFixed32 appends v to b as a little-endian uint32.\nfunc AppendFixed32(b []byte, v uint32) []byte {\n\treturn append(b,\n\t\tbyte(v>>0),\n\t\tbyte(v>>8),\n\t\tbyte(v>>16),\n\t\tbyte(v>>24))\n}\n\n// ConsumeFixed32 parses b as a little-endian uint32, reporting its length.\n// This returns a negative length upon an error (see ParseError).\nfunc ConsumeFixed32(b []byte) (v uint32, n int) {\n\tif len(b) < 4 {\n\t\treturn 0, errCodeTruncated\n\t}\n\tv = uint32(b[0])<<0 | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24\n\treturn v, 4\n}\n\n// SizeFixed32 returns the encoded size of a fixed32; which is always 4.\nfunc SizeFixed32() int {\n\treturn 4\n}\n\n// AppendFixed64 appends v to b as a little-endian uint64.\nfunc AppendFixed64(b []byte, v uint64) []byte {\n\treturn append(b,\n\t\tbyte(v>>0),\n\t\tbyte(v>>8),\n\t\tbyte(v>>16),\n\t\tbyte(v>>24),\n\t\tbyte(v>>32),\n\t\tbyte(v>>40),\n\t\tbyte(v>>48),\n\t\tbyte(v>>56))\n}\n\n// ConsumeFixed64 parses b as a little-endian uint64, reporting its length.\n// This returns a negative length upon an error (see ParseError).\nfunc ConsumeFixed64(b []byte) (v uint64, n int) {\n\tif len(b) < 8 {\n\t\treturn 0, errCodeTruncated\n\t}\n\tv = uint64(b[0])<<0 | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56\n\treturn v, 8\n}\n\n// SizeFixed64 returns the encoded size of a fixed64; which is always 8.\nfunc SizeFixed64() int {\n\treturn 8\n}\n\n// AppendBytes appends v to b as a length-prefixed bytes value.\nfunc AppendBytes(b []byte, v []byte) []byte {\n\treturn append(AppendVarint(b, uint64(len(v))), v...)\n}\n\n// ConsumeBytes parses b as a length-prefixed bytes value, reporting its length.\n// This returns a negative length upon an error (see ParseError).\nfunc ConsumeBytes(b []byte) (v []byte, n int) {\n\tm, n := ConsumeVarint(b)\n\tif n < 0 {\n\t\treturn nil, n // forward error code\n\t}\n\tif m > uint64(len(b[n:])) {\n\t\treturn nil, errCodeTruncated\n\t}\n\treturn b[n:][:m], n + int(m)\n}\n\n// SizeBytes returns the encoded size of a length-prefixed bytes value,\n// given only the length.\nfunc SizeBytes(n int) int {\n\treturn SizeVarint(uint64(n)) + n\n}\n\n// AppendString appends v to b as a length-prefixed bytes value.\nfunc AppendString(b []byte, v string) []byte {\n\treturn append(AppendVarint(b, uint64(len(v))), v...)\n}\n\n// ConsumeString parses b as a length-prefixed bytes value, reporting its length.\n// This returns a negative length upon an error (see ParseError).\nfunc ConsumeString(b []byte) (v string, n int) {\n\tbb, n := ConsumeBytes(b)\n\treturn string(bb), n\n}\n\n// AppendGroup appends v to b as group value, with a trailing end group marker.\n// The value v must not contain the end marker.\nfunc AppendGroup(b []byte, num Number, v []byte) []byte {\n\treturn AppendVarint(append(b, v...), EncodeTag(num, EndGroupType))\n}\n\n// ConsumeGroup parses b as a group value until the trailing end group marker,\n// and verifies that the end marker matches the provided num. The value v\n// does not contain the end marker, while the length does contain the end marker.\n// This returns a negative length upon an error (see ParseError).\nfunc ConsumeGroup(num Number, b []byte) (v []byte, n int) {\n\tn = ConsumeFieldValue(num, StartGroupType, b)\n\tif n < 0 {\n\t\treturn nil, n // forward error code\n\t}\n\tb = b[:n]\n\n\t// Truncate off end group marker, but need to handle denormalized varints.\n\t// Assuming end marker is never 0 (which is always the case since\n\t// EndGroupType is non-zero), we can truncate all trailing bytes where the\n\t// lower 7 bits are all zero (implying that the varint is denormalized).\n\tfor len(b) > 0 && b[len(b)-1]&0x7f == 0 {\n\t\tb = b[:len(b)-1]\n\t}\n\tb = b[:len(b)-SizeTag(num)]\n\treturn b, n\n}\n\n// SizeGroup returns the encoded size of a group, given only the length.\nfunc SizeGroup(num Number, n int) int {\n\treturn n + SizeTag(num)\n}\n\n// DecodeTag decodes the field Number and wire Type from its unified form.\n// The Number is -1 if the decoded field number overflows int32.\n// Other than overflow, this does not check for field number validity.\nfunc DecodeTag(x uint64) (Number, Type) {\n\t// NOTE: MessageSet allows for larger field numbers than normal.\n\tif x>>3 > uint64(math.MaxInt32) {\n\t\treturn -1, 0\n\t}\n\treturn Number(x >> 3), Type(x & 7)\n}\n\n// EncodeTag encodes the field Number and wire Type into its unified form.\nfunc EncodeTag(num Number, typ Type) uint64 {\n\treturn uint64(num)<<3 | uint64(typ&7)\n}\n\n// DecodeZigZag decodes a zig-zag-encoded uint64 as an int64.\n//\tInput:  {…,  5,  3,  1,  0,  2,  4,  6, …}\n//\tOutput: {…, -3, -2, -1,  0, +1, +2, +3, …}\nfunc DecodeZigZag(x uint64) int64 {\n\treturn int64(x>>1) ^ int64(x)<<63>>63\n}\n\n// EncodeZigZag encodes an int64 as a zig-zag-encoded uint64.\n//\tInput:  {…, -3, -2, -1,  0, +1, +2, +3, …}\n//\tOutput: {…,  5,  3,  1,  0,  2,  4,  6, …}\nfunc EncodeZigZag(x int64) uint64 {\n\treturn uint64(x<<1) ^ uint64(x>>63)\n}\n\n// DecodeBool decodes a uint64 as a bool.\n//\tInput:  {    0,    1,    2, …}\n//\tOutput: {false, true, true, …}\nfunc DecodeBool(x uint64) bool {\n\treturn x != 0\n}\n\n// EncodeBool encodes a bool as a uint64.\n//\tInput:  {false, true}\n//\tOutput: {    0,    1}\nfunc EncodeBool(x bool) uint64 {\n\tif x {\n\t\treturn 1\n\t}\n\treturn 0\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/descfmt/stringer.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 descfmt provides functionality to format descriptors.\npackage descfmt\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"google.golang.org/protobuf/internal/detrand\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype list interface {\n\tLen() int\n\tpragma.DoNotImplement\n}\n\nfunc FormatList(s fmt.State, r rune, vs list) {\n\tio.WriteString(s, formatListOpt(vs, true, r == 'v' && (s.Flag('+') || s.Flag('#'))))\n}\nfunc formatListOpt(vs list, isRoot, allowMulti bool) string {\n\tstart, end := \"[\", \"]\"\n\tif isRoot {\n\t\tvar name string\n\t\tswitch vs.(type) {\n\t\tcase pref.Names:\n\t\t\tname = \"Names\"\n\t\tcase pref.FieldNumbers:\n\t\t\tname = \"FieldNumbers\"\n\t\tcase pref.FieldRanges:\n\t\t\tname = \"FieldRanges\"\n\t\tcase pref.EnumRanges:\n\t\t\tname = \"EnumRanges\"\n\t\tcase pref.FileImports:\n\t\t\tname = \"FileImports\"\n\t\tcase pref.Descriptor:\n\t\t\tname = reflect.ValueOf(vs).MethodByName(\"Get\").Type().Out(0).Name() + \"s\"\n\t\tdefault:\n\t\t\tname = reflect.ValueOf(vs).Elem().Type().Name()\n\t\t}\n\t\tstart, end = name+\"{\", \"}\"\n\t}\n\n\tvar ss []string\n\tswitch vs := vs.(type) {\n\tcase pref.Names:\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\tss = append(ss, fmt.Sprint(vs.Get(i)))\n\t\t}\n\t\treturn start + joinStrings(ss, false) + end\n\tcase pref.FieldNumbers:\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\tss = append(ss, fmt.Sprint(vs.Get(i)))\n\t\t}\n\t\treturn start + joinStrings(ss, false) + end\n\tcase pref.FieldRanges:\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\tr := vs.Get(i)\n\t\t\tif r[0]+1 == r[1] {\n\t\t\t\tss = append(ss, fmt.Sprintf(\"%d\", r[0]))\n\t\t\t} else {\n\t\t\t\tss = append(ss, fmt.Sprintf(\"%d:%d\", r[0], r[1])) // enum ranges are end exclusive\n\t\t\t}\n\t\t}\n\t\treturn start + joinStrings(ss, false) + end\n\tcase pref.EnumRanges:\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\tr := vs.Get(i)\n\t\t\tif r[0] == r[1] {\n\t\t\t\tss = append(ss, fmt.Sprintf(\"%d\", r[0]))\n\t\t\t} else {\n\t\t\t\tss = append(ss, fmt.Sprintf(\"%d:%d\", r[0], int64(r[1])+1)) // enum ranges are end inclusive\n\t\t\t}\n\t\t}\n\t\treturn start + joinStrings(ss, false) + end\n\tcase pref.FileImports:\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\tvar rs records\n\t\t\trs.Append(reflect.ValueOf(vs.Get(i)), \"Path\", \"Package\", \"IsPublic\", \"IsWeak\")\n\t\t\tss = append(ss, \"{\"+rs.Join()+\"}\")\n\t\t}\n\t\treturn start + joinStrings(ss, allowMulti) + end\n\tdefault:\n\t\t_, isEnumValue := vs.(pref.EnumValueDescriptors)\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\tm := reflect.ValueOf(vs).MethodByName(\"Get\")\n\t\t\tv := m.Call([]reflect.Value{reflect.ValueOf(i)})[0].Interface()\n\t\t\tss = append(ss, formatDescOpt(v.(pref.Descriptor), false, allowMulti && !isEnumValue))\n\t\t}\n\t\treturn start + joinStrings(ss, allowMulti && isEnumValue) + end\n\t}\n}\n\n// descriptorAccessors is a list of accessors to print for each descriptor.\n//\n// Do not print all accessors since some contain redundant information,\n// while others are pointers that we do not want to follow since the descriptor\n// is actually a cyclic graph.\n//\n// Using a list allows us to print the accessors in a sensible order.\nvar descriptorAccessors = map[reflect.Type][]string{\n\treflect.TypeOf((*pref.FileDescriptor)(nil)).Elem():      {\"Path\", \"Package\", \"Imports\", \"Messages\", \"Enums\", \"Extensions\", \"Services\"},\n\treflect.TypeOf((*pref.MessageDescriptor)(nil)).Elem():   {\"IsMapEntry\", \"Fields\", \"Oneofs\", \"ReservedNames\", \"ReservedRanges\", \"RequiredNumbers\", \"ExtensionRanges\", \"Messages\", \"Enums\", \"Extensions\"},\n\treflect.TypeOf((*pref.FieldDescriptor)(nil)).Elem():     {\"Number\", \"Cardinality\", \"Kind\", \"HasJSONName\", \"JSONName\", \"HasPresence\", \"IsExtension\", \"IsPacked\", \"IsWeak\", \"IsList\", \"IsMap\", \"MapKey\", \"MapValue\", \"HasDefault\", \"Default\", \"ContainingOneof\", \"ContainingMessage\", \"Message\", \"Enum\"},\n\treflect.TypeOf((*pref.OneofDescriptor)(nil)).Elem():     {\"Fields\"}, // not directly used; must keep in sync with formatDescOpt\n\treflect.TypeOf((*pref.EnumDescriptor)(nil)).Elem():      {\"Values\", \"ReservedNames\", \"ReservedRanges\"},\n\treflect.TypeOf((*pref.EnumValueDescriptor)(nil)).Elem(): {\"Number\"},\n\treflect.TypeOf((*pref.ServiceDescriptor)(nil)).Elem():   {\"Methods\"},\n\treflect.TypeOf((*pref.MethodDescriptor)(nil)).Elem():    {\"Input\", \"Output\", \"IsStreamingClient\", \"IsStreamingServer\"},\n}\n\nfunc FormatDesc(s fmt.State, r rune, t pref.Descriptor) {\n\tio.WriteString(s, formatDescOpt(t, true, r == 'v' && (s.Flag('+') || s.Flag('#'))))\n}\nfunc formatDescOpt(t pref.Descriptor, isRoot, allowMulti bool) string {\n\trv := reflect.ValueOf(t)\n\trt := rv.MethodByName(\"ProtoType\").Type().In(0)\n\n\tstart, end := \"{\", \"}\"\n\tif isRoot {\n\t\tstart = rt.Name() + \"{\"\n\t}\n\n\t_, isFile := t.(pref.FileDescriptor)\n\trs := records{allowMulti: allowMulti}\n\tif t.IsPlaceholder() {\n\t\tif isFile {\n\t\t\trs.Append(rv, \"Path\", \"Package\", \"IsPlaceholder\")\n\t\t} else {\n\t\t\trs.Append(rv, \"FullName\", \"IsPlaceholder\")\n\t\t}\n\t} else {\n\t\tswitch {\n\t\tcase isFile:\n\t\t\trs.Append(rv, \"Syntax\")\n\t\tcase isRoot:\n\t\t\trs.Append(rv, \"Syntax\", \"FullName\")\n\t\tdefault:\n\t\t\trs.Append(rv, \"Name\")\n\t\t}\n\t\tswitch t := t.(type) {\n\t\tcase pref.FieldDescriptor:\n\t\t\tfor _, s := range descriptorAccessors[rt] {\n\t\t\t\tswitch s {\n\t\t\t\tcase \"MapKey\":\n\t\t\t\t\tif k := t.MapKey(); k != nil {\n\t\t\t\t\t\trs.recs = append(rs.recs, [2]string{\"MapKey\", k.Kind().String()})\n\t\t\t\t\t}\n\t\t\t\tcase \"MapValue\":\n\t\t\t\t\tif v := t.MapValue(); v != nil {\n\t\t\t\t\t\tswitch v.Kind() {\n\t\t\t\t\t\tcase pref.EnumKind:\n\t\t\t\t\t\t\trs.recs = append(rs.recs, [2]string{\"MapValue\", string(v.Enum().FullName())})\n\t\t\t\t\t\tcase pref.MessageKind, pref.GroupKind:\n\t\t\t\t\t\t\trs.recs = append(rs.recs, [2]string{\"MapValue\", string(v.Message().FullName())})\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\trs.recs = append(rs.recs, [2]string{\"MapValue\", v.Kind().String()})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tcase \"ContainingOneof\":\n\t\t\t\t\tif od := t.ContainingOneof(); od != nil {\n\t\t\t\t\t\trs.recs = append(rs.recs, [2]string{\"Oneof\", string(od.Name())})\n\t\t\t\t\t}\n\t\t\t\tcase \"ContainingMessage\":\n\t\t\t\t\tif t.IsExtension() {\n\t\t\t\t\t\trs.recs = append(rs.recs, [2]string{\"Extendee\", string(t.ContainingMessage().FullName())})\n\t\t\t\t\t}\n\t\t\t\tcase \"Message\":\n\t\t\t\t\tif !t.IsMap() {\n\t\t\t\t\t\trs.Append(rv, s)\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\trs.Append(rv, s)\n\t\t\t\t}\n\t\t\t}\n\t\tcase pref.OneofDescriptor:\n\t\t\tvar ss []string\n\t\t\tfs := t.Fields()\n\t\t\tfor i := 0; i < fs.Len(); i++ {\n\t\t\t\tss = append(ss, string(fs.Get(i).Name()))\n\t\t\t}\n\t\t\tif len(ss) > 0 {\n\t\t\t\trs.recs = append(rs.recs, [2]string{\"Fields\", \"[\" + joinStrings(ss, false) + \"]\"})\n\t\t\t}\n\t\tdefault:\n\t\t\trs.Append(rv, descriptorAccessors[rt]...)\n\t\t}\n\t\tif rv.MethodByName(\"GoType\").IsValid() {\n\t\t\trs.Append(rv, \"GoType\")\n\t\t}\n\t}\n\treturn start + rs.Join() + end\n}\n\ntype records struct {\n\trecs       [][2]string\n\tallowMulti bool\n}\n\nfunc (rs *records) Append(v reflect.Value, accessors ...string) {\n\tfor _, a := range accessors {\n\t\tvar rv reflect.Value\n\t\tif m := v.MethodByName(a); m.IsValid() {\n\t\t\trv = m.Call(nil)[0]\n\t\t}\n\t\tif v.Kind() == reflect.Struct && !rv.IsValid() {\n\t\t\trv = v.FieldByName(a)\n\t\t}\n\t\tif !rv.IsValid() {\n\t\t\tpanic(fmt.Sprintf(\"unknown accessor: %v.%s\", v.Type(), a))\n\t\t}\n\t\tif _, ok := rv.Interface().(pref.Value); ok {\n\t\t\trv = rv.MethodByName(\"Interface\").Call(nil)[0]\n\t\t\tif !rv.IsNil() {\n\t\t\t\trv = rv.Elem()\n\t\t\t}\n\t\t}\n\n\t\t// Ignore zero values.\n\t\tvar isZero bool\n\t\tswitch rv.Kind() {\n\t\tcase reflect.Interface, reflect.Slice:\n\t\t\tisZero = rv.IsNil()\n\t\tcase reflect.Bool:\n\t\t\tisZero = rv.Bool() == false\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\tisZero = rv.Int() == 0\n\t\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\t\tisZero = rv.Uint() == 0\n\t\tcase reflect.String:\n\t\t\tisZero = rv.String() == \"\"\n\t\t}\n\t\tif n, ok := rv.Interface().(list); ok {\n\t\t\tisZero = n.Len() == 0\n\t\t}\n\t\tif isZero {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Format the value.\n\t\tvar s string\n\t\tv := rv.Interface()\n\t\tswitch v := v.(type) {\n\t\tcase list:\n\t\t\ts = formatListOpt(v, false, rs.allowMulti)\n\t\tcase pref.FieldDescriptor, pref.OneofDescriptor, pref.EnumValueDescriptor, pref.MethodDescriptor:\n\t\t\ts = string(v.(pref.Descriptor).Name())\n\t\tcase pref.Descriptor:\n\t\t\ts = string(v.FullName())\n\t\tcase string:\n\t\t\ts = strconv.Quote(v)\n\t\tcase []byte:\n\t\t\ts = fmt.Sprintf(\"%q\", v)\n\t\tdefault:\n\t\t\ts = fmt.Sprint(v)\n\t\t}\n\t\trs.recs = append(rs.recs, [2]string{a, s})\n\t}\n}\n\nfunc (rs *records) Join() string {\n\tvar ss []string\n\n\t// In single line mode, simply join all records with commas.\n\tif !rs.allowMulti {\n\t\tfor _, r := range rs.recs {\n\t\t\tss = append(ss, r[0]+formatColon(0)+r[1])\n\t\t}\n\t\treturn joinStrings(ss, false)\n\t}\n\n\t// In allowMulti line mode, align single line records for more readable output.\n\tvar maxLen int\n\tflush := func(i int) {\n\t\tfor _, r := range rs.recs[len(ss):i] {\n\t\t\tss = append(ss, r[0]+formatColon(maxLen-len(r[0]))+r[1])\n\t\t}\n\t\tmaxLen = 0\n\t}\n\tfor i, r := range rs.recs {\n\t\tif isMulti := strings.Contains(r[1], \"\\n\"); isMulti {\n\t\t\tflush(i)\n\t\t\tss = append(ss, r[0]+formatColon(0)+strings.Join(strings.Split(r[1], \"\\n\"), \"\\n\\t\"))\n\t\t} else if maxLen < len(r[0]) {\n\t\t\tmaxLen = len(r[0])\n\t\t}\n\t}\n\tflush(len(rs.recs))\n\treturn joinStrings(ss, true)\n}\n\nfunc formatColon(padding int) string {\n\t// Deliberately introduce instability into the debug output to\n\t// discourage users from performing string comparisons.\n\t// This provides us flexibility to change the output in the future.\n\tif detrand.Bool() {\n\t\treturn \":\" + strings.Repeat(\" \", 1+padding) // use non-breaking spaces (U+00a0)\n\t} else {\n\t\treturn \":\" + strings.Repeat(\" \", 1+padding) // use regular spaces (U+0020)\n\t}\n}\n\nfunc joinStrings(ss []string, isMulti bool) string {\n\tif len(ss) == 0 {\n\t\treturn \"\"\n\t}\n\tif isMulti {\n\t\treturn \"\\n\\t\" + strings.Join(ss, \"\\n\\t\") + \"\\n\"\n\t}\n\treturn strings.Join(ss, \", \")\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/descopts/options.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 descopts contains the nil pointers to concrete descriptor options.\n//\n// This package exists as a form of reverse dependency injection so that certain\n// packages (e.g., internal/filedesc and internal/filetype can avoid a direct\n// dependency on the descriptor proto package).\npackage descopts\n\nimport pref \"google.golang.org/protobuf/reflect/protoreflect\"\n\n// These variables are set by the init function in descriptor.pb.go via logic\n// in internal/filetype. In other words, so long as the descriptor proto package\n// is linked in, these variables will be populated.\n//\n// Each variable is populated with a nil pointer to the options struct.\nvar (\n\tFile           pref.ProtoMessage\n\tEnum           pref.ProtoMessage\n\tEnumValue      pref.ProtoMessage\n\tMessage        pref.ProtoMessage\n\tField          pref.ProtoMessage\n\tOneof          pref.ProtoMessage\n\tExtensionRange pref.ProtoMessage\n\tService        pref.ProtoMessage\n\tMethod         pref.ProtoMessage\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/detrand/rand.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 detrand provides deterministically random functionality.\n//\n// The pseudo-randomness of these functions is seeded by the program binary\n// itself and guarantees that the output does not change within a program,\n// while ensuring that the output is unstable across different builds.\npackage detrand\n\nimport (\n\t\"encoding/binary\"\n\t\"hash/fnv\"\n\t\"os\"\n)\n\n// Disable disables detrand such that all functions returns the zero value.\n// This function is not concurrent-safe and must be called during program init.\nfunc Disable() {\n\trandSeed = 0\n}\n\n// Bool returns a deterministically random boolean.\nfunc Bool() bool {\n\treturn randSeed%2 == 1\n}\n\n// Intn returns a deterministically random integer between 0 and n-1, inclusive.\nfunc Intn(n int) int {\n\tif n <= 0 {\n\t\tpanic(\"must be positive\")\n\t}\n\treturn int(randSeed % uint64(n))\n}\n\n// randSeed is a best-effort at an approximate hash of the Go binary.\nvar randSeed = binaryHash()\n\nfunc binaryHash() uint64 {\n\t// Open the Go binary.\n\ts, err := os.Executable()\n\tif err != nil {\n\t\treturn 0\n\t}\n\tf, err := os.Open(s)\n\tif err != nil {\n\t\treturn 0\n\t}\n\tdefer f.Close()\n\n\t// Hash the size and several samples of the Go binary.\n\tconst numSamples = 8\n\tvar buf [64]byte\n\th := fnv.New64()\n\tfi, err := f.Stat()\n\tif err != nil {\n\t\treturn 0\n\t}\n\tbinary.LittleEndian.PutUint64(buf[:8], uint64(fi.Size()))\n\th.Write(buf[:8])\n\tfor i := int64(0); i < numSamples; i++ {\n\t\tif _, err := f.ReadAt(buf[:], i*fi.Size()/numSamples); err != nil {\n\t\t\treturn 0\n\t\t}\n\t\th.Write(buf[:])\n\t}\n\treturn h.Sum64()\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/encoding/defval/default.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 defval marshals and unmarshals textual forms of default values.\n//\n// This package handles both the form historically used in Go struct field tags\n// and also the form used by google.protobuf.FieldDescriptorProto.default_value\n// since they differ in superficial ways.\npackage defval\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\t\"strconv\"\n\n\tptext \"google.golang.org/protobuf/internal/encoding/text\"\n\terrors \"google.golang.org/protobuf/internal/errors\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// Format is the serialization format used to represent the default value.\ntype Format int\n\nconst (\n\t_ Format = iota\n\n\t// Descriptor uses the serialization format that protoc uses with the\n\t// google.protobuf.FieldDescriptorProto.default_value field.\n\tDescriptor\n\n\t// GoTag uses the historical serialization format in Go struct field tags.\n\tGoTag\n)\n\n// Unmarshal deserializes the default string s according to the given kind k.\n// When k is an enum, a list of enum value descriptors must be provided.\nfunc Unmarshal(s string, k pref.Kind, evs pref.EnumValueDescriptors, f Format) (pref.Value, pref.EnumValueDescriptor, error) {\n\tswitch k {\n\tcase pref.BoolKind:\n\t\tif f == GoTag {\n\t\t\tswitch s {\n\t\t\tcase \"1\":\n\t\t\t\treturn pref.ValueOfBool(true), nil, nil\n\t\t\tcase \"0\":\n\t\t\t\treturn pref.ValueOfBool(false), nil, nil\n\t\t\t}\n\t\t} else {\n\t\t\tswitch s {\n\t\t\tcase \"true\":\n\t\t\t\treturn pref.ValueOfBool(true), nil, nil\n\t\t\tcase \"false\":\n\t\t\t\treturn pref.ValueOfBool(false), nil, nil\n\t\t\t}\n\t\t}\n\tcase pref.EnumKind:\n\t\tif f == GoTag {\n\t\t\t// Go tags use the numeric form of the enum value.\n\t\t\tif n, err := strconv.ParseInt(s, 10, 32); err == nil {\n\t\t\t\tif ev := evs.ByNumber(pref.EnumNumber(n)); ev != nil {\n\t\t\t\t\treturn pref.ValueOfEnum(ev.Number()), ev, nil\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Descriptor default_value use the enum identifier.\n\t\t\tev := evs.ByName(pref.Name(s))\n\t\t\tif ev != nil {\n\t\t\t\treturn pref.ValueOfEnum(ev.Number()), ev, nil\n\t\t\t}\n\t\t}\n\tcase pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:\n\t\tif v, err := strconv.ParseInt(s, 10, 32); err == nil {\n\t\t\treturn pref.ValueOfInt32(int32(v)), nil, nil\n\t\t}\n\tcase pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:\n\t\tif v, err := strconv.ParseInt(s, 10, 64); err == nil {\n\t\t\treturn pref.ValueOfInt64(int64(v)), nil, nil\n\t\t}\n\tcase pref.Uint32Kind, pref.Fixed32Kind:\n\t\tif v, err := strconv.ParseUint(s, 10, 32); err == nil {\n\t\t\treturn pref.ValueOfUint32(uint32(v)), nil, nil\n\t\t}\n\tcase pref.Uint64Kind, pref.Fixed64Kind:\n\t\tif v, err := strconv.ParseUint(s, 10, 64); err == nil {\n\t\t\treturn pref.ValueOfUint64(uint64(v)), nil, nil\n\t\t}\n\tcase pref.FloatKind, pref.DoubleKind:\n\t\tvar v float64\n\t\tvar err error\n\t\tswitch s {\n\t\tcase \"-inf\":\n\t\t\tv = math.Inf(-1)\n\t\tcase \"inf\":\n\t\t\tv = math.Inf(+1)\n\t\tcase \"nan\":\n\t\t\tv = math.NaN()\n\t\tdefault:\n\t\t\tv, err = strconv.ParseFloat(s, 64)\n\t\t}\n\t\tif err == nil {\n\t\t\tif k == pref.FloatKind {\n\t\t\t\treturn pref.ValueOfFloat32(float32(v)), nil, nil\n\t\t\t} else {\n\t\t\t\treturn pref.ValueOfFloat64(float64(v)), nil, nil\n\t\t\t}\n\t\t}\n\tcase pref.StringKind:\n\t\t// String values are already unescaped and can be used as is.\n\t\treturn pref.ValueOfString(s), nil, nil\n\tcase pref.BytesKind:\n\t\tif b, ok := unmarshalBytes(s); ok {\n\t\t\treturn pref.ValueOfBytes(b), nil, nil\n\t\t}\n\t}\n\treturn pref.Value{}, nil, errors.New(\"could not parse value for %v: %q\", k, s)\n}\n\n// Marshal serializes v as the default string according to the given kind k.\n// When specifying the Descriptor format for an enum kind, the associated\n// enum value descriptor must be provided.\nfunc Marshal(v pref.Value, ev pref.EnumValueDescriptor, k pref.Kind, f Format) (string, error) {\n\tswitch k {\n\tcase pref.BoolKind:\n\t\tif f == GoTag {\n\t\t\tif v.Bool() {\n\t\t\t\treturn \"1\", nil\n\t\t\t} else {\n\t\t\t\treturn \"0\", nil\n\t\t\t}\n\t\t} else {\n\t\t\tif v.Bool() {\n\t\t\t\treturn \"true\", nil\n\t\t\t} else {\n\t\t\t\treturn \"false\", nil\n\t\t\t}\n\t\t}\n\tcase pref.EnumKind:\n\t\tif f == GoTag {\n\t\t\treturn strconv.FormatInt(int64(v.Enum()), 10), nil\n\t\t} else {\n\t\t\treturn string(ev.Name()), nil\n\t\t}\n\tcase pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind, pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:\n\t\treturn strconv.FormatInt(v.Int(), 10), nil\n\tcase pref.Uint32Kind, pref.Fixed32Kind, pref.Uint64Kind, pref.Fixed64Kind:\n\t\treturn strconv.FormatUint(v.Uint(), 10), nil\n\tcase pref.FloatKind, pref.DoubleKind:\n\t\tf := v.Float()\n\t\tswitch {\n\t\tcase math.IsInf(f, -1):\n\t\t\treturn \"-inf\", nil\n\t\tcase math.IsInf(f, +1):\n\t\t\treturn \"inf\", nil\n\t\tcase math.IsNaN(f):\n\t\t\treturn \"nan\", nil\n\t\tdefault:\n\t\t\tif k == pref.FloatKind {\n\t\t\t\treturn strconv.FormatFloat(f, 'g', -1, 32), nil\n\t\t\t} else {\n\t\t\t\treturn strconv.FormatFloat(f, 'g', -1, 64), nil\n\t\t\t}\n\t\t}\n\tcase pref.StringKind:\n\t\t// String values are serialized as is without any escaping.\n\t\treturn v.String(), nil\n\tcase pref.BytesKind:\n\t\tif s, ok := marshalBytes(v.Bytes()); ok {\n\t\t\treturn s, nil\n\t\t}\n\t}\n\treturn \"\", errors.New(\"could not format value for %v: %v\", k, v)\n}\n\n// unmarshalBytes deserializes bytes by applying C unescaping.\nfunc unmarshalBytes(s string) ([]byte, bool) {\n\t// Bytes values use the same escaping as the text format,\n\t// however they lack the surrounding double quotes.\n\tv, err := ptext.UnmarshalString(`\"` + s + `\"`)\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\treturn []byte(v), true\n}\n\n// marshalBytes serializes bytes by using C escaping.\n// To match the exact output of protoc, this is identical to the\n// CEscape function in strutil.cc of the protoc source code.\nfunc marshalBytes(b []byte) (string, bool) {\n\tvar s []byte\n\tfor _, c := range b {\n\t\tswitch c {\n\t\tcase '\\n':\n\t\t\ts = append(s, `\\n`...)\n\t\tcase '\\r':\n\t\t\ts = append(s, `\\r`...)\n\t\tcase '\\t':\n\t\t\ts = append(s, `\\t`...)\n\t\tcase '\"':\n\t\t\ts = append(s, `\\\"`...)\n\t\tcase '\\'':\n\t\t\ts = append(s, `\\'`...)\n\t\tcase '\\\\':\n\t\t\ts = append(s, `\\\\`...)\n\t\tdefault:\n\t\t\tif printableASCII := c >= 0x20 && c <= 0x7e; printableASCII {\n\t\t\t\ts = append(s, c)\n\t\t\t} else {\n\t\t\t\ts = append(s, fmt.Sprintf(`\\%03o`, c)...)\n\t\t\t}\n\t\t}\n\t}\n\treturn string(s), true\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/encoding/json/decode.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 json\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"regexp\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/internal/errors\"\n)\n\n// call specifies which Decoder method was invoked.\ntype call uint8\n\nconst (\n\treadCall call = iota\n\tpeekCall\n)\n\nconst unexpectedFmt = \"unexpected token %s\"\n\n// ErrUnexpectedEOF means that EOF was encountered in the middle of the input.\nvar ErrUnexpectedEOF = errors.New(\"%v\", io.ErrUnexpectedEOF)\n\n// Decoder is a token-based JSON decoder.\ntype Decoder struct {\n\t// lastCall is last method called, either readCall or peekCall.\n\t// Initial value is readCall.\n\tlastCall call\n\n\t// lastToken contains the last read token.\n\tlastToken Token\n\n\t// lastErr contains the last read error.\n\tlastErr error\n\n\t// openStack is a stack containing ObjectOpen and ArrayOpen values. The\n\t// top of stack represents the object or the array the current value is\n\t// directly located in.\n\topenStack []Kind\n\n\t// orig is used in reporting line and column.\n\torig []byte\n\t// in contains the unconsumed input.\n\tin []byte\n}\n\n// NewDecoder returns a Decoder to read the given []byte.\nfunc NewDecoder(b []byte) *Decoder {\n\treturn &Decoder{orig: b, in: b}\n}\n\n// Peek looks ahead and returns the next token kind without advancing a read.\nfunc (d *Decoder) Peek() (Token, error) {\n\tdefer func() { d.lastCall = peekCall }()\n\tif d.lastCall == readCall {\n\t\td.lastToken, d.lastErr = d.Read()\n\t}\n\treturn d.lastToken, d.lastErr\n}\n\n// Read returns the next JSON token.\n// It will return an error if there is no valid token.\nfunc (d *Decoder) Read() (Token, error) {\n\tconst scalar = Null | Bool | Number | String\n\n\tdefer func() { d.lastCall = readCall }()\n\tif d.lastCall == peekCall {\n\t\treturn d.lastToken, d.lastErr\n\t}\n\n\ttok, err := d.parseNext()\n\tif err != nil {\n\t\treturn Token{}, err\n\t}\n\n\tswitch tok.kind {\n\tcase EOF:\n\t\tif len(d.openStack) != 0 ||\n\t\t\td.lastToken.kind&scalar|ObjectClose|ArrayClose == 0 {\n\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t}\n\n\tcase Null:\n\t\tif !d.isValueNext() {\n\t\t\treturn Token{}, d.newSyntaxError(tok.pos, unexpectedFmt, tok.RawString())\n\t\t}\n\n\tcase Bool, Number:\n\t\tif !d.isValueNext() {\n\t\t\treturn Token{}, d.newSyntaxError(tok.pos, unexpectedFmt, tok.RawString())\n\t\t}\n\n\tcase String:\n\t\tif d.isValueNext() {\n\t\t\tbreak\n\t\t}\n\t\t// This string token should only be for a field name.\n\t\tif d.lastToken.kind&(ObjectOpen|comma) == 0 {\n\t\t\treturn Token{}, d.newSyntaxError(tok.pos, unexpectedFmt, tok.RawString())\n\t\t}\n\t\tif len(d.in) == 0 {\n\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t}\n\t\tif c := d.in[0]; c != ':' {\n\t\t\treturn Token{}, d.newSyntaxError(d.currPos(), `unexpected character %s, missing \":\" after field name`, string(c))\n\t\t}\n\t\ttok.kind = Name\n\t\td.consume(1)\n\n\tcase ObjectOpen, ArrayOpen:\n\t\tif !d.isValueNext() {\n\t\t\treturn Token{}, d.newSyntaxError(tok.pos, unexpectedFmt, tok.RawString())\n\t\t}\n\t\td.openStack = append(d.openStack, tok.kind)\n\n\tcase ObjectClose:\n\t\tif len(d.openStack) == 0 ||\n\t\t\td.lastToken.kind == comma ||\n\t\t\td.openStack[len(d.openStack)-1] != ObjectOpen {\n\t\t\treturn Token{}, d.newSyntaxError(tok.pos, unexpectedFmt, tok.RawString())\n\t\t}\n\t\td.openStack = d.openStack[:len(d.openStack)-1]\n\n\tcase ArrayClose:\n\t\tif len(d.openStack) == 0 ||\n\t\t\td.lastToken.kind == comma ||\n\t\t\td.openStack[len(d.openStack)-1] != ArrayOpen {\n\t\t\treturn Token{}, d.newSyntaxError(tok.pos, unexpectedFmt, tok.RawString())\n\t\t}\n\t\td.openStack = d.openStack[:len(d.openStack)-1]\n\n\tcase comma:\n\t\tif len(d.openStack) == 0 ||\n\t\t\td.lastToken.kind&(scalar|ObjectClose|ArrayClose) == 0 {\n\t\t\treturn Token{}, d.newSyntaxError(tok.pos, unexpectedFmt, tok.RawString())\n\t\t}\n\t}\n\n\t// Update d.lastToken only after validating token to be in the right sequence.\n\td.lastToken = tok\n\n\tif d.lastToken.kind == comma {\n\t\treturn d.Read()\n\t}\n\treturn tok, nil\n}\n\n// Any sequence that looks like a non-delimiter (for error reporting).\nvar errRegexp = regexp.MustCompile(`^([-+._a-zA-Z0-9]{1,32}|.)`)\n\n// parseNext parses for the next JSON token. It returns a Token object for\n// different types, except for Name. It does not handle whether the next token\n// is in a valid sequence or not.\nfunc (d *Decoder) parseNext() (Token, error) {\n\t// Trim leading spaces.\n\td.consume(0)\n\n\tin := d.in\n\tif len(in) == 0 {\n\t\treturn d.consumeToken(EOF, 0), nil\n\t}\n\n\tswitch in[0] {\n\tcase 'n':\n\t\tif n := matchWithDelim(\"null\", in); n != 0 {\n\t\t\treturn d.consumeToken(Null, n), nil\n\t\t}\n\n\tcase 't':\n\t\tif n := matchWithDelim(\"true\", in); n != 0 {\n\t\t\treturn d.consumeBoolToken(true, n), nil\n\t\t}\n\n\tcase 'f':\n\t\tif n := matchWithDelim(\"false\", in); n != 0 {\n\t\t\treturn d.consumeBoolToken(false, n), nil\n\t\t}\n\n\tcase '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':\n\t\tif n, ok := parseNumber(in); ok {\n\t\t\treturn d.consumeToken(Number, n), nil\n\t\t}\n\n\tcase '\"':\n\t\ts, n, err := d.parseString(in)\n\t\tif err != nil {\n\t\t\treturn Token{}, err\n\t\t}\n\t\treturn d.consumeStringToken(s, n), nil\n\n\tcase '{':\n\t\treturn d.consumeToken(ObjectOpen, 1), nil\n\n\tcase '}':\n\t\treturn d.consumeToken(ObjectClose, 1), nil\n\n\tcase '[':\n\t\treturn d.consumeToken(ArrayOpen, 1), nil\n\n\tcase ']':\n\t\treturn d.consumeToken(ArrayClose, 1), nil\n\n\tcase ',':\n\t\treturn d.consumeToken(comma, 1), nil\n\t}\n\treturn Token{}, d.newSyntaxError(d.currPos(), \"invalid value %s\", errRegexp.Find(in))\n}\n\n// newSyntaxError returns an error with line and column information useful for\n// syntax errors.\nfunc (d *Decoder) newSyntaxError(pos int, f string, x ...interface{}) error {\n\te := errors.New(f, x...)\n\tline, column := d.Position(pos)\n\treturn errors.New(\"syntax error (line %d:%d): %v\", line, column, e)\n}\n\n// Position returns line and column number of given index of the original input.\n// It will panic if index is out of range.\nfunc (d *Decoder) Position(idx int) (line int, column int) {\n\tb := d.orig[:idx]\n\tline = bytes.Count(b, []byte(\"\\n\")) + 1\n\tif i := bytes.LastIndexByte(b, '\\n'); i >= 0 {\n\t\tb = b[i+1:]\n\t}\n\tcolumn = utf8.RuneCount(b) + 1 // ignore multi-rune characters\n\treturn line, column\n}\n\n// currPos returns the current index position of d.in from d.orig.\nfunc (d *Decoder) currPos() int {\n\treturn len(d.orig) - len(d.in)\n}\n\n// matchWithDelim matches s with the input b and verifies that the match\n// terminates with a delimiter of some form (e.g., r\"[^-+_.a-zA-Z0-9]\").\n// As a special case, EOF is considered a delimiter. It returns the length of s\n// if there is a match, else 0.\nfunc matchWithDelim(s string, b []byte) int {\n\tif !bytes.HasPrefix(b, []byte(s)) {\n\t\treturn 0\n\t}\n\n\tn := len(s)\n\tif n < len(b) && isNotDelim(b[n]) {\n\t\treturn 0\n\t}\n\treturn n\n}\n\n// isNotDelim returns true if given byte is a not delimiter character.\nfunc isNotDelim(c byte) bool {\n\treturn (c == '-' || c == '+' || c == '.' || c == '_' ||\n\t\t('a' <= c && c <= 'z') ||\n\t\t('A' <= c && c <= 'Z') ||\n\t\t('0' <= c && c <= '9'))\n}\n\n// consume consumes n bytes of input and any subsequent whitespace.\nfunc (d *Decoder) consume(n int) {\n\td.in = d.in[n:]\n\tfor len(d.in) > 0 {\n\t\tswitch d.in[0] {\n\t\tcase ' ', '\\n', '\\r', '\\t':\n\t\t\td.in = d.in[1:]\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t}\n}\n\n// isValueNext returns true if next type should be a JSON value: Null,\n// Number, String or Bool.\nfunc (d *Decoder) isValueNext() bool {\n\tif len(d.openStack) == 0 {\n\t\treturn d.lastToken.kind == 0\n\t}\n\n\tstart := d.openStack[len(d.openStack)-1]\n\tswitch start {\n\tcase ObjectOpen:\n\t\treturn d.lastToken.kind&Name != 0\n\tcase ArrayOpen:\n\t\treturn d.lastToken.kind&(ArrayOpen|comma) != 0\n\t}\n\tpanic(fmt.Sprintf(\n\t\t\"unreachable logic in Decoder.isValueNext, lastToken.kind: %v, openStack: %v\",\n\t\td.lastToken.kind, start))\n}\n\n// consumeToken constructs a Token for given Kind with raw value derived from\n// current d.in and given size, and consumes the given size-lenght of it.\nfunc (d *Decoder) consumeToken(kind Kind, size int) Token {\n\ttok := Token{\n\t\tkind: kind,\n\t\traw:  d.in[:size],\n\t\tpos:  len(d.orig) - len(d.in),\n\t}\n\td.consume(size)\n\treturn tok\n}\n\n// consumeBoolToken constructs a Token for a Bool kind with raw value derived from\n// current d.in and given size.\nfunc (d *Decoder) consumeBoolToken(b bool, size int) Token {\n\ttok := Token{\n\t\tkind: Bool,\n\t\traw:  d.in[:size],\n\t\tpos:  len(d.orig) - len(d.in),\n\t\tboo:  b,\n\t}\n\td.consume(size)\n\treturn tok\n}\n\n// consumeStringToken constructs a Token for a String kind with raw value derived\n// from current d.in and given size.\nfunc (d *Decoder) consumeStringToken(s string, size int) Token {\n\ttok := Token{\n\t\tkind: String,\n\t\traw:  d.in[:size],\n\t\tpos:  len(d.orig) - len(d.in),\n\t\tstr:  s,\n\t}\n\td.consume(size)\n\treturn tok\n}\n\n// Clone returns a copy of the Decoder for use in reading ahead the next JSON\n// object, array or other values without affecting current Decoder.\nfunc (d *Decoder) Clone() *Decoder {\n\tret := *d\n\tret.openStack = append([]Kind(nil), ret.openStack...)\n\treturn &ret\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/encoding/json/decode_number.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 json\n\nimport (\n\t\"bytes\"\n\t\"strconv\"\n)\n\n// parseNumber reads the given []byte for a valid JSON number. If it is valid,\n// it returns the number of bytes.  Parsing logic follows the definition in\n// https://tools.ietf.org/html/rfc7159#section-6, and is based off\n// encoding/json.isValidNumber function.\nfunc parseNumber(input []byte) (int, bool) {\n\tvar n int\n\n\ts := input\n\tif len(s) == 0 {\n\t\treturn 0, false\n\t}\n\n\t// Optional -\n\tif s[0] == '-' {\n\t\ts = s[1:]\n\t\tn++\n\t\tif len(s) == 0 {\n\t\t\treturn 0, false\n\t\t}\n\t}\n\n\t// Digits\n\tswitch {\n\tcase s[0] == '0':\n\t\ts = s[1:]\n\t\tn++\n\n\tcase '1' <= s[0] && s[0] <= '9':\n\t\ts = s[1:]\n\t\tn++\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t}\n\n\tdefault:\n\t\treturn 0, false\n\t}\n\n\t// . followed by 1 or more digits.\n\tif len(s) >= 2 && s[0] == '.' && '0' <= s[1] && s[1] <= '9' {\n\t\ts = s[2:]\n\t\tn += 2\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t}\n\t}\n\n\t// e or E followed by an optional - or + and\n\t// 1 or more digits.\n\tif len(s) >= 2 && (s[0] == 'e' || s[0] == 'E') {\n\t\ts = s[1:]\n\t\tn++\n\t\tif s[0] == '+' || s[0] == '-' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t\tif len(s) == 0 {\n\t\t\t\treturn 0, false\n\t\t\t}\n\t\t}\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t}\n\t}\n\n\t// Check that next byte is a delimiter or it is at the end.\n\tif n < len(input) && isNotDelim(input[n]) {\n\t\treturn 0, false\n\t}\n\n\treturn n, true\n}\n\n// numberParts is the result of parsing out a valid JSON number. It contains\n// the parts of a number. The parts are used for integer conversion.\ntype numberParts struct {\n\tneg  bool\n\tintp []byte\n\tfrac []byte\n\texp  []byte\n}\n\n// parseNumber constructs numberParts from given []byte. The logic here is\n// similar to consumeNumber above with the difference of having to construct\n// numberParts. The slice fields in numberParts are subslices of the input.\nfunc parseNumberParts(input []byte) (numberParts, bool) {\n\tvar neg bool\n\tvar intp []byte\n\tvar frac []byte\n\tvar exp []byte\n\n\ts := input\n\tif len(s) == 0 {\n\t\treturn numberParts{}, false\n\t}\n\n\t// Optional -\n\tif s[0] == '-' {\n\t\tneg = true\n\t\ts = s[1:]\n\t\tif len(s) == 0 {\n\t\t\treturn numberParts{}, false\n\t\t}\n\t}\n\n\t// Digits\n\tswitch {\n\tcase s[0] == '0':\n\t\t// Skip first 0 and no need to store.\n\t\ts = s[1:]\n\n\tcase '1' <= s[0] && s[0] <= '9':\n\t\tintp = s\n\t\tn := 1\n\t\ts = s[1:]\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t}\n\t\tintp = intp[:n]\n\n\tdefault:\n\t\treturn numberParts{}, false\n\t}\n\n\t// . followed by 1 or more digits.\n\tif len(s) >= 2 && s[0] == '.' && '0' <= s[1] && s[1] <= '9' {\n\t\tfrac = s[1:]\n\t\tn := 1\n\t\ts = s[2:]\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t}\n\t\tfrac = frac[:n]\n\t}\n\n\t// e or E followed by an optional - or + and\n\t// 1 or more digits.\n\tif len(s) >= 2 && (s[0] == 'e' || s[0] == 'E') {\n\t\ts = s[1:]\n\t\texp = s\n\t\tn := 0\n\t\tif s[0] == '+' || s[0] == '-' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t\tif len(s) == 0 {\n\t\t\t\treturn numberParts{}, false\n\t\t\t}\n\t\t}\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t}\n\t\texp = exp[:n]\n\t}\n\n\treturn numberParts{\n\t\tneg:  neg,\n\t\tintp: intp,\n\t\tfrac: bytes.TrimRight(frac, \"0\"), // Remove unnecessary 0s to the right.\n\t\texp:  exp,\n\t}, true\n}\n\n// normalizeToIntString returns an integer string in normal form without the\n// E-notation for given numberParts. It will return false if it is not an\n// integer or if the exponent exceeds than max/min int value.\nfunc normalizeToIntString(n numberParts) (string, bool) {\n\tintpSize := len(n.intp)\n\tfracSize := len(n.frac)\n\n\tif intpSize == 0 && fracSize == 0 {\n\t\treturn \"0\", true\n\t}\n\n\tvar exp int\n\tif len(n.exp) > 0 {\n\t\ti, err := strconv.ParseInt(string(n.exp), 10, 32)\n\t\tif err != nil {\n\t\t\treturn \"\", false\n\t\t}\n\t\texp = int(i)\n\t}\n\n\tvar num []byte\n\tif exp >= 0 {\n\t\t// For positive E, shift fraction digits into integer part and also pad\n\t\t// with zeroes as needed.\n\n\t\t// If there are more digits in fraction than the E value, then the\n\t\t// number is not an integer.\n\t\tif fracSize > exp {\n\t\t\treturn \"\", false\n\t\t}\n\n\t\t// Make sure resulting digits are within max value limit to avoid\n\t\t// unnecessarily constructing a large byte slice that may simply fail\n\t\t// later on.\n\t\tconst maxDigits = 20 // Max uint64 value has 20 decimal digits.\n\t\tif intpSize+exp > maxDigits {\n\t\t\treturn \"\", false\n\t\t}\n\n\t\t// Set cap to make a copy of integer part when appended.\n\t\tnum = n.intp[:len(n.intp):len(n.intp)]\n\t\tnum = append(num, n.frac...)\n\t\tfor i := 0; i < exp-fracSize; i++ {\n\t\t\tnum = append(num, '0')\n\t\t}\n\t} else {\n\t\t// For negative E, shift digits in integer part out.\n\n\t\t// If there are fractions, then the number is not an integer.\n\t\tif fracSize > 0 {\n\t\t\treturn \"\", false\n\t\t}\n\n\t\t// index is where the decimal point will be after adjusting for negative\n\t\t// exponent.\n\t\tindex := intpSize + exp\n\t\tif index < 0 {\n\t\t\treturn \"\", false\n\t\t}\n\n\t\tnum = n.intp\n\t\t// If any of the digits being shifted to the right of the decimal point\n\t\t// is non-zero, then the number is not an integer.\n\t\tfor i := index; i < intpSize; i++ {\n\t\t\tif num[i] != '0' {\n\t\t\t\treturn \"\", false\n\t\t\t}\n\t\t}\n\t\tnum = num[:index]\n\t}\n\n\tif n.neg {\n\t\treturn \"-\" + string(num), true\n\t}\n\treturn string(num), true\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/encoding/json/decode_string.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 json\n\nimport (\n\t\"strconv\"\n\t\"unicode\"\n\t\"unicode/utf16\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/internal/strs\"\n)\n\nfunc (d *Decoder) parseString(in []byte) (string, int, error) {\n\tin0 := in\n\tif len(in) == 0 {\n\t\treturn \"\", 0, ErrUnexpectedEOF\n\t}\n\tif in[0] != '\"' {\n\t\treturn \"\", 0, d.newSyntaxError(d.currPos(), \"invalid character %q at start of string\", in[0])\n\t}\n\tin = in[1:]\n\ti := indexNeedEscapeInBytes(in)\n\tin, out := in[i:], in[:i:i] // set cap to prevent mutations\n\tfor len(in) > 0 {\n\t\tswitch r, n := utf8.DecodeRune(in); {\n\t\tcase r == utf8.RuneError && n == 1:\n\t\t\treturn \"\", 0, d.newSyntaxError(d.currPos(), \"invalid UTF-8 in string\")\n\t\tcase r < ' ':\n\t\t\treturn \"\", 0, d.newSyntaxError(d.currPos(), \"invalid character %q in string\", r)\n\t\tcase r == '\"':\n\t\t\tin = in[1:]\n\t\t\tn := len(in0) - len(in)\n\t\t\treturn string(out), n, nil\n\t\tcase r == '\\\\':\n\t\t\tif len(in) < 2 {\n\t\t\t\treturn \"\", 0, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch r := in[1]; r {\n\t\t\tcase '\"', '\\\\', '/':\n\t\t\t\tin, out = in[2:], append(out, r)\n\t\t\tcase 'b':\n\t\t\t\tin, out = in[2:], append(out, '\\b')\n\t\t\tcase 'f':\n\t\t\t\tin, out = in[2:], append(out, '\\f')\n\t\t\tcase 'n':\n\t\t\t\tin, out = in[2:], append(out, '\\n')\n\t\t\tcase 'r':\n\t\t\t\tin, out = in[2:], append(out, '\\r')\n\t\t\tcase 't':\n\t\t\t\tin, out = in[2:], append(out, '\\t')\n\t\t\tcase 'u':\n\t\t\t\tif len(in) < 6 {\n\t\t\t\t\treturn \"\", 0, ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tv, err := strconv.ParseUint(string(in[2:6]), 16, 16)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", 0, d.newSyntaxError(d.currPos(), \"invalid escape code %q in string\", in[:6])\n\t\t\t\t}\n\t\t\t\tin = in[6:]\n\n\t\t\t\tr := rune(v)\n\t\t\t\tif utf16.IsSurrogate(r) {\n\t\t\t\t\tif len(in) < 6 {\n\t\t\t\t\t\treturn \"\", 0, ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tv, err := strconv.ParseUint(string(in[2:6]), 16, 16)\n\t\t\t\t\tr = utf16.DecodeRune(r, rune(v))\n\t\t\t\t\tif in[0] != '\\\\' || in[1] != 'u' ||\n\t\t\t\t\t\tr == unicode.ReplacementChar || err != nil {\n\t\t\t\t\t\treturn \"\", 0, d.newSyntaxError(d.currPos(), \"invalid escape code %q in string\", in[:6])\n\t\t\t\t\t}\n\t\t\t\t\tin = in[6:]\n\t\t\t\t}\n\t\t\t\tout = append(out, string(r)...)\n\t\t\tdefault:\n\t\t\t\treturn \"\", 0, d.newSyntaxError(d.currPos(), \"invalid escape code %q in string\", in[:2])\n\t\t\t}\n\t\tdefault:\n\t\t\ti := indexNeedEscapeInBytes(in[n:])\n\t\t\tin, out = in[n+i:], append(out, in[:n+i]...)\n\t\t}\n\t}\n\treturn \"\", 0, ErrUnexpectedEOF\n}\n\n// indexNeedEscapeInBytes returns the index of the character that needs\n// escaping. If no characters need escaping, this returns the input length.\nfunc indexNeedEscapeInBytes(b []byte) int { return indexNeedEscapeInString(strs.UnsafeString(b)) }\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/encoding/json/decode_token.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 json\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"strconv\"\n)\n\n// Kind represents a token kind expressible in the JSON format.\ntype Kind uint16\n\nconst (\n\tInvalid Kind = (1 << iota) / 2\n\tEOF\n\tNull\n\tBool\n\tNumber\n\tString\n\tName\n\tObjectOpen\n\tObjectClose\n\tArrayOpen\n\tArrayClose\n\n\t// comma is only for parsing in between tokens and\n\t// does not need to be exported.\n\tcomma\n)\n\nfunc (k Kind) String() string {\n\tswitch k {\n\tcase EOF:\n\t\treturn \"eof\"\n\tcase Null:\n\t\treturn \"null\"\n\tcase Bool:\n\t\treturn \"bool\"\n\tcase Number:\n\t\treturn \"number\"\n\tcase String:\n\t\treturn \"string\"\n\tcase ObjectOpen:\n\t\treturn \"{\"\n\tcase ObjectClose:\n\t\treturn \"}\"\n\tcase Name:\n\t\treturn \"name\"\n\tcase ArrayOpen:\n\t\treturn \"[\"\n\tcase ArrayClose:\n\t\treturn \"]\"\n\tcase comma:\n\t\treturn \",\"\n\t}\n\treturn \"<invalid>\"\n}\n\n// Token provides a parsed token kind and value.\n//\n// Values are provided by the difference accessor methods. The accessor methods\n// Name, Bool, and ParsedString will panic if called on the wrong kind. There\n// are different accessor methods for the Number kind for converting to the\n// appropriate Go numeric type and those methods have the ok return value.\ntype Token struct {\n\t// Token kind.\n\tkind Kind\n\t// pos provides the position of the token in the original input.\n\tpos int\n\t// raw bytes of the serialized token.\n\t// This is a subslice into the original input.\n\traw []byte\n\t// boo is parsed boolean value.\n\tboo bool\n\t// str is parsed string value.\n\tstr string\n}\n\n// Kind returns the token kind.\nfunc (t Token) Kind() Kind {\n\treturn t.kind\n}\n\n// RawString returns the read value in string.\nfunc (t Token) RawString() string {\n\treturn string(t.raw)\n}\n\n// Pos returns the token position from the input.\nfunc (t Token) Pos() int {\n\treturn t.pos\n}\n\n// Name returns the object name if token is Name, else it panics.\nfunc (t Token) Name() string {\n\tif t.kind == Name {\n\t\treturn t.str\n\t}\n\tpanic(fmt.Sprintf(\"Token is not a Name: %v\", t.RawString()))\n}\n\n// Bool returns the bool value if token kind is Bool, else it panics.\nfunc (t Token) Bool() bool {\n\tif t.kind == Bool {\n\t\treturn t.boo\n\t}\n\tpanic(fmt.Sprintf(\"Token is not a Bool: %v\", t.RawString()))\n}\n\n// ParsedString returns the string value for a JSON string token or the read\n// value in string if token is not a string.\nfunc (t Token) ParsedString() string {\n\tif t.kind == String {\n\t\treturn t.str\n\t}\n\tpanic(fmt.Sprintf(\"Token is not a String: %v\", t.RawString()))\n}\n\n// Float returns the floating-point number if token kind is Number.\n//\n// The floating-point precision is specified by the bitSize parameter: 32 for\n// float32 or 64 for float64. If bitSize=32, the result still has type float64,\n// but it will be convertible to float32 without changing its value. It will\n// return false if the number exceeds the floating point limits for given\n// bitSize.\nfunc (t Token) Float(bitSize int) (float64, bool) {\n\tif t.kind != Number {\n\t\treturn 0, false\n\t}\n\tf, err := strconv.ParseFloat(t.RawString(), bitSize)\n\tif err != nil {\n\t\treturn 0, false\n\t}\n\treturn f, true\n}\n\n// Int returns the signed integer number if token is Number.\n//\n// The given bitSize specifies the integer type that the result must fit into.\n// It returns false if the number is not an integer value or if the result\n// exceeds the limits for given bitSize.\nfunc (t Token) Int(bitSize int) (int64, bool) {\n\ts, ok := t.getIntStr()\n\tif !ok {\n\t\treturn 0, false\n\t}\n\tn, err := strconv.ParseInt(s, 10, bitSize)\n\tif err != nil {\n\t\treturn 0, false\n\t}\n\treturn n, true\n}\n\n// Uint returns the signed integer number if token is Number.\n//\n// The given bitSize specifies the unsigned integer type that the result must\n// fit into. It returns false if the number is not an unsigned integer value\n// or if the result exceeds the limits for given bitSize.\nfunc (t Token) Uint(bitSize int) (uint64, bool) {\n\ts, ok := t.getIntStr()\n\tif !ok {\n\t\treturn 0, false\n\t}\n\tn, err := strconv.ParseUint(s, 10, bitSize)\n\tif err != nil {\n\t\treturn 0, false\n\t}\n\treturn n, true\n}\n\nfunc (t Token) getIntStr() (string, bool) {\n\tif t.kind != Number {\n\t\treturn \"\", false\n\t}\n\tparts, ok := parseNumberParts(t.raw)\n\tif !ok {\n\t\treturn \"\", false\n\t}\n\treturn normalizeToIntString(parts)\n}\n\n// TokenEquals returns true if given Tokens are equal, else false.\nfunc TokenEquals(x, y Token) bool {\n\treturn x.kind == y.kind &&\n\t\tx.pos == y.pos &&\n\t\tbytes.Equal(x.raw, y.raw) &&\n\t\tx.boo == y.boo &&\n\t\tx.str == y.str\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/encoding/json/encode.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 json\n\nimport (\n\t\"math\"\n\t\"math/bits\"\n\t\"strconv\"\n\t\"strings\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/internal/detrand\"\n\t\"google.golang.org/protobuf/internal/errors\"\n)\n\n// kind represents an encoding type.\ntype kind uint8\n\nconst (\n\t_ kind = (1 << iota) / 2\n\tname\n\tscalar\n\tobjectOpen\n\tobjectClose\n\tarrayOpen\n\tarrayClose\n)\n\n// Encoder provides methods to write out JSON constructs and values. The user is\n// responsible for producing valid sequences of JSON constructs and values.\ntype Encoder struct {\n\tindent   string\n\tlastKind kind\n\tindents  []byte\n\tout      []byte\n}\n\n// NewEncoder returns an Encoder.\n//\n// If indent is a non-empty string, it causes every entry for an Array or Object\n// to be preceded by the indent and trailed by a newline.\nfunc NewEncoder(indent string) (*Encoder, error) {\n\te := &Encoder{}\n\tif len(indent) > 0 {\n\t\tif strings.Trim(indent, \" \\t\") != \"\" {\n\t\t\treturn nil, errors.New(\"indent may only be composed of space or tab characters\")\n\t\t}\n\t\te.indent = indent\n\t}\n\treturn e, nil\n}\n\n// Bytes returns the content of the written bytes.\nfunc (e *Encoder) Bytes() []byte {\n\treturn e.out\n}\n\n// WriteNull writes out the null value.\nfunc (e *Encoder) WriteNull() {\n\te.prepareNext(scalar)\n\te.out = append(e.out, \"null\"...)\n}\n\n// WriteBool writes out the given boolean value.\nfunc (e *Encoder) WriteBool(b bool) {\n\te.prepareNext(scalar)\n\tif b {\n\t\te.out = append(e.out, \"true\"...)\n\t} else {\n\t\te.out = append(e.out, \"false\"...)\n\t}\n}\n\n// WriteString writes out the given string in JSON string value. Returns error\n// if input string contains invalid UTF-8.\nfunc (e *Encoder) WriteString(s string) error {\n\te.prepareNext(scalar)\n\tvar err error\n\tif e.out, err = appendString(e.out, s); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\n// Sentinel error used for indicating invalid UTF-8.\nvar errInvalidUTF8 = errors.New(\"invalid UTF-8\")\n\nfunc appendString(out []byte, in string) ([]byte, error) {\n\tout = append(out, '\"')\n\ti := indexNeedEscapeInString(in)\n\tin, out = in[i:], append(out, in[:i]...)\n\tfor len(in) > 0 {\n\t\tswitch r, n := utf8.DecodeRuneInString(in); {\n\t\tcase r == utf8.RuneError && n == 1:\n\t\t\treturn out, errInvalidUTF8\n\t\tcase r < ' ' || r == '\"' || r == '\\\\':\n\t\t\tout = append(out, '\\\\')\n\t\t\tswitch r {\n\t\t\tcase '\"', '\\\\':\n\t\t\t\tout = append(out, byte(r))\n\t\t\tcase '\\b':\n\t\t\t\tout = append(out, 'b')\n\t\t\tcase '\\f':\n\t\t\t\tout = append(out, 'f')\n\t\t\tcase '\\n':\n\t\t\t\tout = append(out, 'n')\n\t\t\tcase '\\r':\n\t\t\t\tout = append(out, 'r')\n\t\t\tcase '\\t':\n\t\t\t\tout = append(out, 't')\n\t\t\tdefault:\n\t\t\t\tout = append(out, 'u')\n\t\t\t\tout = append(out, \"0000\"[1+(bits.Len32(uint32(r))-1)/4:]...)\n\t\t\t\tout = strconv.AppendUint(out, uint64(r), 16)\n\t\t\t}\n\t\t\tin = in[n:]\n\t\tdefault:\n\t\t\ti := indexNeedEscapeInString(in[n:])\n\t\t\tin, out = in[n+i:], append(out, in[:n+i]...)\n\t\t}\n\t}\n\tout = append(out, '\"')\n\treturn out, nil\n}\n\n// indexNeedEscapeInString returns the index of the character that needs\n// escaping. If no characters need escaping, this returns the input length.\nfunc indexNeedEscapeInString(s string) int {\n\tfor i, r := range s {\n\t\tif r < ' ' || r == '\\\\' || r == '\"' || r == utf8.RuneError {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn len(s)\n}\n\n// WriteFloat writes out the given float and bitSize in JSON number value.\nfunc (e *Encoder) WriteFloat(n float64, bitSize int) {\n\te.prepareNext(scalar)\n\te.out = appendFloat(e.out, n, bitSize)\n}\n\n// appendFloat formats given float in bitSize, and appends to the given []byte.\nfunc appendFloat(out []byte, n float64, bitSize int) []byte {\n\tswitch {\n\tcase math.IsNaN(n):\n\t\treturn append(out, `\"NaN\"`...)\n\tcase math.IsInf(n, +1):\n\t\treturn append(out, `\"Infinity\"`...)\n\tcase math.IsInf(n, -1):\n\t\treturn append(out, `\"-Infinity\"`...)\n\t}\n\n\t// JSON number formatting logic based on encoding/json.\n\t// See floatEncoder.encode for reference.\n\tfmt := byte('f')\n\tif abs := math.Abs(n); abs != 0 {\n\t\tif bitSize == 64 && (abs < 1e-6 || abs >= 1e21) ||\n\t\t\tbitSize == 32 && (float32(abs) < 1e-6 || float32(abs) >= 1e21) {\n\t\t\tfmt = 'e'\n\t\t}\n\t}\n\tout = strconv.AppendFloat(out, n, fmt, -1, bitSize)\n\tif fmt == 'e' {\n\t\tn := len(out)\n\t\tif n >= 4 && out[n-4] == 'e' && out[n-3] == '-' && out[n-2] == '0' {\n\t\t\tout[n-2] = out[n-1]\n\t\t\tout = out[:n-1]\n\t\t}\n\t}\n\treturn out\n}\n\n// WriteInt writes out the given signed integer in JSON number value.\nfunc (e *Encoder) WriteInt(n int64) {\n\te.prepareNext(scalar)\n\te.out = append(e.out, strconv.FormatInt(n, 10)...)\n}\n\n// WriteUint writes out the given unsigned integer in JSON number value.\nfunc (e *Encoder) WriteUint(n uint64) {\n\te.prepareNext(scalar)\n\te.out = append(e.out, strconv.FormatUint(n, 10)...)\n}\n\n// StartObject writes out the '{' symbol.\nfunc (e *Encoder) StartObject() {\n\te.prepareNext(objectOpen)\n\te.out = append(e.out, '{')\n}\n\n// EndObject writes out the '}' symbol.\nfunc (e *Encoder) EndObject() {\n\te.prepareNext(objectClose)\n\te.out = append(e.out, '}')\n}\n\n// WriteName writes out the given string in JSON string value and the name\n// separator ':'. Returns error if input string contains invalid UTF-8, which\n// should not be likely as protobuf field names should be valid.\nfunc (e *Encoder) WriteName(s string) error {\n\te.prepareNext(name)\n\tvar err error\n\t// Append to output regardless of error.\n\te.out, err = appendString(e.out, s)\n\te.out = append(e.out, ':')\n\treturn err\n}\n\n// StartArray writes out the '[' symbol.\nfunc (e *Encoder) StartArray() {\n\te.prepareNext(arrayOpen)\n\te.out = append(e.out, '[')\n}\n\n// EndArray writes out the ']' symbol.\nfunc (e *Encoder) EndArray() {\n\te.prepareNext(arrayClose)\n\te.out = append(e.out, ']')\n}\n\n// prepareNext adds possible comma and indentation for the next value based\n// on last type and indent option. It also updates lastKind to next.\nfunc (e *Encoder) prepareNext(next kind) {\n\tdefer func() {\n\t\t// Set lastKind to next.\n\t\te.lastKind = next\n\t}()\n\n\tif len(e.indent) == 0 {\n\t\t// Need to add comma on the following condition.\n\t\tif e.lastKind&(scalar|objectClose|arrayClose) != 0 &&\n\t\t\tnext&(name|scalar|objectOpen|arrayOpen) != 0 {\n\t\t\te.out = append(e.out, ',')\n\t\t\t// For single-line output, add a random extra space after each\n\t\t\t// comma to make output unstable.\n\t\t\tif detrand.Bool() {\n\t\t\t\te.out = append(e.out, ' ')\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\tswitch {\n\tcase e.lastKind&(objectOpen|arrayOpen) != 0:\n\t\t// If next type is NOT closing, add indent and newline.\n\t\tif next&(objectClose|arrayClose) == 0 {\n\t\t\te.indents = append(e.indents, e.indent...)\n\t\t\te.out = append(e.out, '\\n')\n\t\t\te.out = append(e.out, e.indents...)\n\t\t}\n\n\tcase e.lastKind&(scalar|objectClose|arrayClose) != 0:\n\t\tswitch {\n\t\t// If next type is either a value or name, add comma and newline.\n\t\tcase next&(name|scalar|objectOpen|arrayOpen) != 0:\n\t\t\te.out = append(e.out, ',', '\\n')\n\n\t\t// If next type is a closing object or array, adjust indentation.\n\t\tcase next&(objectClose|arrayClose) != 0:\n\t\t\te.indents = e.indents[:len(e.indents)-len(e.indent)]\n\t\t\te.out = append(e.out, '\\n')\n\t\t}\n\t\te.out = append(e.out, e.indents...)\n\n\tcase e.lastKind&name != 0:\n\t\te.out = append(e.out, ' ')\n\t\t// For multi-line output, add a random extra space after key: to make\n\t\t// output unstable.\n\t\tif detrand.Bool() {\n\t\t\te.out = append(e.out, ' ')\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.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 messageset encodes and decodes the obsolete MessageSet wire format.\npackage messageset\n\nimport (\n\t\"math\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// The MessageSet wire format is equivalent to a message defined as follows,\n// where each Item defines an extension field with a field number of 'type_id'\n// and content of 'message'. MessageSet extensions must be non-repeated message\n// fields.\n//\n//\tmessage MessageSet {\n//\t\trepeated group Item = 1 {\n//\t\t\trequired int32 type_id = 2;\n//\t\t\trequired string message = 3;\n//\t\t}\n//\t}\nconst (\n\tFieldItem    = protowire.Number(1)\n\tFieldTypeID  = protowire.Number(2)\n\tFieldMessage = protowire.Number(3)\n)\n\n// ExtensionName is the field name for extensions of MessageSet.\n//\n// A valid MessageSet extension must be of the form:\n//\tmessage MyMessage {\n//\t\textend proto2.bridge.MessageSet {\n//\t\t\toptional MyMessage message_set_extension = 1234;\n//\t\t}\n//\t\t...\n//\t}\nconst ExtensionName = \"message_set_extension\"\n\n// IsMessageSet returns whether the message uses the MessageSet wire format.\nfunc IsMessageSet(md pref.MessageDescriptor) bool {\n\txmd, ok := md.(interface{ IsMessageSet() bool })\n\treturn ok && xmd.IsMessageSet()\n}\n\n// IsMessageSetExtension reports this field properly extends a MessageSet.\nfunc IsMessageSetExtension(fd pref.FieldDescriptor) bool {\n\tswitch {\n\tcase fd.Name() != ExtensionName:\n\t\treturn false\n\tcase !IsMessageSet(fd.ContainingMessage()):\n\t\treturn false\n\tcase fd.FullName().Parent() != fd.Message().FullName():\n\t\treturn false\n\t}\n\treturn true\n}\n\n// SizeField returns the size of a MessageSet item field containing an extension\n// with the given field number, not counting the contents of the message subfield.\nfunc SizeField(num protowire.Number) int {\n\treturn 2*protowire.SizeTag(FieldItem) + protowire.SizeTag(FieldTypeID) + protowire.SizeVarint(uint64(num))\n}\n\n// Unmarshal parses a MessageSet.\n//\n// It calls fn with the type ID and value of each item in the MessageSet.\n// Unknown fields are discarded.\n//\n// If wantLen is true, the item values include the varint length prefix.\n// This is ugly, but simplifies the fast-path decoder in internal/impl.\nfunc Unmarshal(b []byte, wantLen bool, fn func(typeID protowire.Number, value []byte) error) error {\n\tfor len(b) > 0 {\n\t\tnum, wtyp, n := protowire.ConsumeTag(b)\n\t\tif n < 0 {\n\t\t\treturn protowire.ParseError(n)\n\t\t}\n\t\tb = b[n:]\n\t\tif num != FieldItem || wtyp != protowire.StartGroupType {\n\t\t\tn := protowire.ConsumeFieldValue(num, wtyp, b)\n\t\t\tif n < 0 {\n\t\t\t\treturn protowire.ParseError(n)\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t\tcontinue\n\t\t}\n\t\ttypeID, value, n, err := ConsumeFieldValue(b, wantLen)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tb = b[n:]\n\t\tif typeID == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif err := fn(typeID, value); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// ConsumeFieldValue parses b as a MessageSet item field value until and including\n// the trailing end group marker. It assumes the start group tag has already been parsed.\n// It returns the contents of the type_id and message subfields and the total\n// item length.\n//\n// If wantLen is true, the returned message value includes the length prefix.\nfunc ConsumeFieldValue(b []byte, wantLen bool) (typeid protowire.Number, message []byte, n int, err error) {\n\tilen := len(b)\n\tfor {\n\t\tnum, wtyp, n := protowire.ConsumeTag(b)\n\t\tif n < 0 {\n\t\t\treturn 0, nil, 0, protowire.ParseError(n)\n\t\t}\n\t\tb = b[n:]\n\t\tswitch {\n\t\tcase num == FieldItem && wtyp == protowire.EndGroupType:\n\t\t\tif wantLen && len(message) == 0 {\n\t\t\t\t// The message field was missing, which should never happen.\n\t\t\t\t// Be prepared for this case anyway.\n\t\t\t\tmessage = protowire.AppendVarint(message, 0)\n\t\t\t}\n\t\t\treturn typeid, message, ilen - len(b), nil\n\t\tcase num == FieldTypeID && wtyp == protowire.VarintType:\n\t\t\tv, n := protowire.ConsumeVarint(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, nil, 0, protowire.ParseError(n)\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t\tif v < 1 || v > math.MaxInt32 {\n\t\t\t\treturn 0, nil, 0, errors.New(\"invalid type_id in message set\")\n\t\t\t}\n\t\t\ttypeid = protowire.Number(v)\n\t\tcase num == FieldMessage && wtyp == protowire.BytesType:\n\t\t\tm, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, nil, 0, protowire.ParseError(n)\n\t\t\t}\n\t\t\tif message == nil {\n\t\t\t\tif wantLen {\n\t\t\t\t\tmessage = b[:n:n]\n\t\t\t\t} else {\n\t\t\t\t\tmessage = m[:len(m):len(m)]\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// This case should never happen in practice, but handle it for\n\t\t\t\t// correctness: The MessageSet item contains multiple message\n\t\t\t\t// fields, which need to be merged.\n\t\t\t\t//\n\t\t\t\t// In the case where we're returning the length, this becomes\n\t\t\t\t// quite inefficient since we need to strip the length off\n\t\t\t\t// the existing data and reconstruct it with the combined length.\n\t\t\t\tif wantLen {\n\t\t\t\t\t_, nn := protowire.ConsumeVarint(message)\n\t\t\t\t\tm0 := message[nn:]\n\t\t\t\t\tmessage = nil\n\t\t\t\t\tmessage = protowire.AppendVarint(message, uint64(len(m0)+len(m)))\n\t\t\t\t\tmessage = append(message, m0...)\n\t\t\t\t\tmessage = append(message, m...)\n\t\t\t\t} else {\n\t\t\t\t\tmessage = append(message, m...)\n\t\t\t\t}\n\t\t\t}\n\t\t\tb = b[n:]\n\t\tdefault:\n\t\t\t// We have no place to put it, so we just ignore unknown fields.\n\t\t\tn := protowire.ConsumeFieldValue(num, wtyp, b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, nil, 0, protowire.ParseError(n)\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t}\n\t}\n}\n\n// AppendFieldStart appends the start of a MessageSet item field containing\n// an extension with the given number. The caller must add the message\n// subfield (including the tag).\nfunc AppendFieldStart(b []byte, num protowire.Number) []byte {\n\tb = protowire.AppendTag(b, FieldItem, protowire.StartGroupType)\n\tb = protowire.AppendTag(b, FieldTypeID, protowire.VarintType)\n\tb = protowire.AppendVarint(b, uint64(num))\n\treturn b\n}\n\n// AppendFieldEnd appends the trailing end group marker for a MessageSet item field.\nfunc AppendFieldEnd(b []byte) []byte {\n\treturn protowire.AppendTag(b, FieldItem, protowire.EndGroupType)\n}\n\n// SizeUnknown returns the size of an unknown fields section in MessageSet format.\n//\n// See AppendUnknown.\nfunc SizeUnknown(unknown []byte) (size int) {\n\tfor len(unknown) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(unknown)\n\t\tif n < 0 || typ != protowire.BytesType {\n\t\t\treturn 0\n\t\t}\n\t\tunknown = unknown[n:]\n\t\t_, n = protowire.ConsumeBytes(unknown)\n\t\tif n < 0 {\n\t\t\treturn 0\n\t\t}\n\t\tunknown = unknown[n:]\n\t\tsize += SizeField(num) + protowire.SizeTag(FieldMessage) + n\n\t}\n\treturn size\n}\n\n// AppendUnknown appends unknown fields to b in MessageSet format.\n//\n// For historic reasons, unresolved items in a MessageSet are stored in a\n// message's unknown fields section in non-MessageSet format. That is, an\n// unknown item with typeID T and value V appears in the unknown fields as\n// a field with number T and value V.\n//\n// This function converts the unknown fields back into MessageSet form.\nfunc AppendUnknown(b, unknown []byte) ([]byte, error) {\n\tfor len(unknown) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(unknown)\n\t\tif n < 0 || typ != protowire.BytesType {\n\t\t\treturn nil, errors.New(\"invalid data in message set unknown fields\")\n\t\t}\n\t\tunknown = unknown[n:]\n\t\t_, n = protowire.ConsumeBytes(unknown)\n\t\tif n < 0 {\n\t\t\treturn nil, errors.New(\"invalid data in message set unknown fields\")\n\t\t}\n\t\tb = AppendFieldStart(b, num)\n\t\tb = protowire.AppendTag(b, FieldMessage, protowire.BytesType)\n\t\tb = append(b, unknown[:n]...)\n\t\tb = AppendFieldEnd(b)\n\t\tunknown = unknown[n:]\n\t}\n\treturn b, nil\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/encoding/tag/tag.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 tag marshals and unmarshals the legacy struct tags as generated\n// by historical versions of protoc-gen-go.\npackage tag\n\nimport (\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\n\tdefval \"google.golang.org/protobuf/internal/encoding/defval\"\n\tfdesc \"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nvar byteType = reflect.TypeOf(byte(0))\n\n// Unmarshal decodes the tag into a prototype.Field.\n//\n// The goType is needed to determine the original protoreflect.Kind since the\n// tag does not record sufficient information to determine that.\n// The type is the underlying field type (e.g., a repeated field may be\n// represented by []T, but the Go type passed in is just T).\n// A list of enum value descriptors must be provided for enum fields.\n// This does not populate the Enum or Message (except for weak message).\n//\n// This function is a best effort attempt; parsing errors are ignored.\nfunc Unmarshal(tag string, goType reflect.Type, evs pref.EnumValueDescriptors) pref.FieldDescriptor {\n\tf := new(fdesc.Field)\n\tf.L0.ParentFile = fdesc.SurrogateProto2\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\tf.L0.FullName = pref.FullName(s[len(\"name=\"):])\n\t\tcase strings.Trim(s, \"0123456789\") == \"\":\n\t\t\tn, _ := strconv.ParseUint(s, 10, 32)\n\t\t\tf.L1.Number = pref.FieldNumber(n)\n\t\tcase s == \"opt\":\n\t\t\tf.L1.Cardinality = pref.Optional\n\t\tcase s == \"req\":\n\t\t\tf.L1.Cardinality = pref.Required\n\t\tcase s == \"rep\":\n\t\t\tf.L1.Cardinality = pref.Repeated\n\t\tcase s == \"varint\":\n\t\t\tswitch goType.Kind() {\n\t\t\tcase reflect.Bool:\n\t\t\t\tf.L1.Kind = pref.BoolKind\n\t\t\tcase reflect.Int32:\n\t\t\t\tf.L1.Kind = pref.Int32Kind\n\t\t\tcase reflect.Int64:\n\t\t\t\tf.L1.Kind = pref.Int64Kind\n\t\t\tcase reflect.Uint32:\n\t\t\t\tf.L1.Kind = pref.Uint32Kind\n\t\t\tcase reflect.Uint64:\n\t\t\t\tf.L1.Kind = pref.Uint64Kind\n\t\t\t}\n\t\tcase s == \"zigzag32\":\n\t\t\tif goType.Kind() == reflect.Int32 {\n\t\t\t\tf.L1.Kind = pref.Sint32Kind\n\t\t\t}\n\t\tcase s == \"zigzag64\":\n\t\t\tif goType.Kind() == reflect.Int64 {\n\t\t\t\tf.L1.Kind = pref.Sint64Kind\n\t\t\t}\n\t\tcase s == \"fixed32\":\n\t\t\tswitch goType.Kind() {\n\t\t\tcase reflect.Int32:\n\t\t\t\tf.L1.Kind = pref.Sfixed32Kind\n\t\t\tcase reflect.Uint32:\n\t\t\t\tf.L1.Kind = pref.Fixed32Kind\n\t\t\tcase reflect.Float32:\n\t\t\t\tf.L1.Kind = pref.FloatKind\n\t\t\t}\n\t\tcase s == \"fixed64\":\n\t\t\tswitch goType.Kind() {\n\t\t\tcase reflect.Int64:\n\t\t\t\tf.L1.Kind = pref.Sfixed64Kind\n\t\t\tcase reflect.Uint64:\n\t\t\t\tf.L1.Kind = pref.Fixed64Kind\n\t\t\tcase reflect.Float64:\n\t\t\t\tf.L1.Kind = pref.DoubleKind\n\t\t\t}\n\t\tcase s == \"bytes\":\n\t\t\tswitch {\n\t\t\tcase goType.Kind() == reflect.String:\n\t\t\t\tf.L1.Kind = pref.StringKind\n\t\t\tcase goType.Kind() == reflect.Slice && goType.Elem() == byteType:\n\t\t\t\tf.L1.Kind = pref.BytesKind\n\t\t\tdefault:\n\t\t\t\tf.L1.Kind = pref.MessageKind\n\t\t\t}\n\t\tcase s == \"group\":\n\t\t\tf.L1.Kind = pref.GroupKind\n\t\tcase strings.HasPrefix(s, \"enum=\"):\n\t\t\tf.L1.Kind = pref.EnumKind\n\t\tcase strings.HasPrefix(s, \"json=\"):\n\t\t\tjsonName := s[len(\"json=\"):]\n\t\t\tif jsonName != strs.JSONCamelCase(string(f.L0.FullName.Name())) {\n\t\t\t\tf.L1.StringName.InitJSON(jsonName)\n\t\t\t}\n\t\tcase s == \"packed\":\n\t\t\tf.L1.HasPacked = true\n\t\t\tf.L1.IsPacked = true\n\t\tcase strings.HasPrefix(s, \"weak=\"):\n\t\t\tf.L1.IsWeak = true\n\t\t\tf.L1.Message = fdesc.PlaceholderMessage(pref.FullName(s[len(\"weak=\"):]))\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\ts, i = tag[len(\"def=\"):], len(tag)\n\t\t\tv, ev, _ := defval.Unmarshal(s, f.L1.Kind, evs, defval.GoTag)\n\t\t\tf.L1.Default = fdesc.DefaultValue(v, ev)\n\t\tcase s == \"proto3\":\n\t\t\tf.L0.ParentFile = fdesc.SurrogateProto3\n\t\t}\n\t\ttag = strings.TrimPrefix(tag[i:], \",\")\n\t}\n\n\t// The generator uses the group message name instead of the field name.\n\t// We obtain the real field name by lowercasing the group name.\n\tif f.L1.Kind == pref.GroupKind {\n\t\tf.L0.FullName = pref.FullName(strings.ToLower(string(f.L0.FullName)))\n\t}\n\treturn f\n}\n\n// Marshal encodes the protoreflect.FieldDescriptor as a tag.\n//\n// The enumName must be provided if the kind is an enum.\n// Historically, the formulation of the enum \"name\" was the proto package\n// dot-concatenated with the generated Go identifier for the enum type.\n// Depending on the context on how Marshal is called, there are different ways\n// through which that information is determined. As such it is the caller's\n// responsibility to provide a function to obtain that information.\nfunc Marshal(fd pref.FieldDescriptor, enumName string) string {\n\tvar tag []string\n\tswitch fd.Kind() {\n\tcase pref.BoolKind, pref.EnumKind, pref.Int32Kind, pref.Uint32Kind, pref.Int64Kind, pref.Uint64Kind:\n\t\ttag = append(tag, \"varint\")\n\tcase pref.Sint32Kind:\n\t\ttag = append(tag, \"zigzag32\")\n\tcase pref.Sint64Kind:\n\t\ttag = append(tag, \"zigzag64\")\n\tcase pref.Sfixed32Kind, pref.Fixed32Kind, pref.FloatKind:\n\t\ttag = append(tag, \"fixed32\")\n\tcase pref.Sfixed64Kind, pref.Fixed64Kind, pref.DoubleKind:\n\t\ttag = append(tag, \"fixed64\")\n\tcase pref.StringKind, pref.BytesKind, pref.MessageKind:\n\t\ttag = append(tag, \"bytes\")\n\tcase pref.GroupKind:\n\t\ttag = append(tag, \"group\")\n\t}\n\ttag = append(tag, strconv.Itoa(int(fd.Number())))\n\tswitch fd.Cardinality() {\n\tcase pref.Optional:\n\t\ttag = append(tag, \"opt\")\n\tcase pref.Required:\n\t\ttag = append(tag, \"req\")\n\tcase pref.Repeated:\n\t\ttag = append(tag, \"rep\")\n\t}\n\tif fd.IsPacked() {\n\t\ttag = append(tag, \"packed\")\n\t}\n\tname := string(fd.Name())\n\tif fd.Kind() == pref.GroupKind {\n\t\t// The name of the FieldDescriptor for a group field is\n\t\t// lowercased. To find the original capitalization, we\n\t\t// look in the field's MessageType.\n\t\tname = string(fd.Message().Name())\n\t}\n\ttag = append(tag, \"name=\"+name)\n\tif jsonName := fd.JSONName(); jsonName != \"\" && jsonName != name && !fd.IsExtension() {\n\t\t// NOTE: The jsonName != name condition is suspect, but it preserve\n\t\t// the exact same semantics from the previous generator.\n\t\ttag = append(tag, \"json=\"+jsonName)\n\t}\n\tif fd.IsWeak() {\n\t\ttag = append(tag, \"weak=\"+string(fd.Message().FullName()))\n\t}\n\t// The previous implementation does not tag extension fields as proto3,\n\t// even when the field is defined in a proto3 file. Match that behavior\n\t// for consistency.\n\tif fd.Syntax() == pref.Proto3 && !fd.IsExtension() {\n\t\ttag = append(tag, \"proto3\")\n\t}\n\tif fd.Kind() == pref.EnumKind && enumName != \"\" {\n\t\ttag = append(tag, \"enum=\"+enumName)\n\t}\n\tif fd.ContainingOneof() != nil {\n\t\ttag = append(tag, \"oneof\")\n\t}\n\t// This must appear last in the tag, since commas in strings aren't escaped.\n\tif fd.HasDefault() {\n\t\tdef, _ := defval.Marshal(fd.Default(), fd.DefaultEnumValue(), fd.Kind(), defval.GoTag)\n\t\ttag = append(tag, \"def=\"+def)\n\t}\n\treturn strings.Join(tag, \",\")\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/encoding/text/decode.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 text\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/internal/errors\"\n)\n\n// Decoder is a token-based textproto decoder.\ntype Decoder struct {\n\t// lastCall is last method called, either readCall or peekCall.\n\t// Initial value is readCall.\n\tlastCall call\n\n\t// lastToken contains the last read token.\n\tlastToken Token\n\n\t// lastErr contains the last read error.\n\tlastErr error\n\n\t// openStack is a stack containing the byte characters for MessageOpen and\n\t// ListOpen kinds. The top of stack represents the message or the list that\n\t// the current token is nested in. An empty stack means the current token is\n\t// at the top level message. The characters '{' and '<' both represent the\n\t// MessageOpen kind.\n\topenStack []byte\n\n\t// orig is used in reporting line and column.\n\torig []byte\n\t// in contains the unconsumed input.\n\tin []byte\n}\n\n// NewDecoder returns a Decoder to read the given []byte.\nfunc NewDecoder(b []byte) *Decoder {\n\treturn &Decoder{orig: b, in: b}\n}\n\n// ErrUnexpectedEOF means that EOF was encountered in the middle of the input.\nvar ErrUnexpectedEOF = errors.New(\"%v\", io.ErrUnexpectedEOF)\n\n// call specifies which Decoder method was invoked.\ntype call uint8\n\nconst (\n\treadCall call = iota\n\tpeekCall\n)\n\n// Peek looks ahead and returns the next token and error without advancing a read.\nfunc (d *Decoder) Peek() (Token, error) {\n\tdefer func() { d.lastCall = peekCall }()\n\tif d.lastCall == readCall {\n\t\td.lastToken, d.lastErr = d.Read()\n\t}\n\treturn d.lastToken, d.lastErr\n}\n\n// Read returns the next token.\n// It will return an error if there is no valid token.\nfunc (d *Decoder) Read() (Token, error) {\n\tdefer func() { d.lastCall = readCall }()\n\tif d.lastCall == peekCall {\n\t\treturn d.lastToken, d.lastErr\n\t}\n\n\ttok, err := d.parseNext(d.lastToken.kind)\n\tif err != nil {\n\t\treturn Token{}, err\n\t}\n\n\tswitch tok.kind {\n\tcase comma, semicolon:\n\t\ttok, err = d.parseNext(tok.kind)\n\t\tif err != nil {\n\t\t\treturn Token{}, err\n\t\t}\n\t}\n\td.lastToken = tok\n\treturn tok, nil\n}\n\nconst (\n\tmismatchedFmt = \"mismatched close character %q\"\n\tunexpectedFmt = \"unexpected character %q\"\n)\n\n// parseNext parses the next Token based on given last kind.\nfunc (d *Decoder) parseNext(lastKind Kind) (Token, error) {\n\t// Trim leading spaces.\n\td.consume(0)\n\tisEOF := false\n\tif len(d.in) == 0 {\n\t\tisEOF = true\n\t}\n\n\tswitch lastKind {\n\tcase EOF:\n\t\treturn d.consumeToken(EOF, 0, 0), nil\n\n\tcase bof:\n\t\t// Start of top level message. Next token can be EOF or Name.\n\t\tif isEOF {\n\t\t\treturn d.consumeToken(EOF, 0, 0), nil\n\t\t}\n\t\treturn d.parseFieldName()\n\n\tcase Name:\n\t\t// Next token can be MessageOpen, ListOpen or Scalar.\n\t\tif isEOF {\n\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t}\n\t\tswitch ch := d.in[0]; ch {\n\t\tcase '{', '<':\n\t\t\td.pushOpenStack(ch)\n\t\t\treturn d.consumeToken(MessageOpen, 1, 0), nil\n\t\tcase '[':\n\t\t\td.pushOpenStack(ch)\n\t\t\treturn d.consumeToken(ListOpen, 1, 0), nil\n\t\tdefault:\n\t\t\treturn d.parseScalar()\n\t\t}\n\n\tcase Scalar:\n\t\topenKind, closeCh := d.currentOpenKind()\n\t\tswitch openKind {\n\t\tcase bof:\n\t\t\t// Top level message.\n\t\t\t// \tNext token can be EOF, comma, semicolon or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn d.consumeToken(EOF, 0, 0), nil\n\t\t\t}\n\t\t\tswitch d.in[0] {\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tcase ';':\n\t\t\t\treturn d.consumeToken(semicolon, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn d.parseFieldName()\n\t\t\t}\n\n\t\tcase MessageOpen:\n\t\t\t// Next token can be MessageClose, comma, semicolon or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase closeCh:\n\t\t\t\td.popOpenStack()\n\t\t\t\treturn d.consumeToken(MessageClose, 1, 0), nil\n\t\t\tcase otherCloseChar[closeCh]:\n\t\t\t\treturn Token{}, d.newSyntaxError(mismatchedFmt, ch)\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tcase ';':\n\t\t\t\treturn d.consumeToken(semicolon, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn d.parseFieldName()\n\t\t\t}\n\n\t\tcase ListOpen:\n\t\t\t// Next token can be ListClose or comma.\n\t\t\tif isEOF {\n\t\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase ']':\n\t\t\t\td.popOpenStack()\n\t\t\t\treturn d.consumeToken(ListClose, 1, 0), nil\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn Token{}, d.newSyntaxError(unexpectedFmt, ch)\n\t\t\t}\n\t\t}\n\n\tcase MessageOpen:\n\t\t// Next token can be MessageClose or Name.\n\t\tif isEOF {\n\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t}\n\t\t_, closeCh := d.currentOpenKind()\n\t\tswitch ch := d.in[0]; ch {\n\t\tcase closeCh:\n\t\t\td.popOpenStack()\n\t\t\treturn d.consumeToken(MessageClose, 1, 0), nil\n\t\tcase otherCloseChar[closeCh]:\n\t\t\treturn Token{}, d.newSyntaxError(mismatchedFmt, ch)\n\t\tdefault:\n\t\t\treturn d.parseFieldName()\n\t\t}\n\n\tcase MessageClose:\n\t\topenKind, closeCh := d.currentOpenKind()\n\t\tswitch openKind {\n\t\tcase bof:\n\t\t\t// Top level message.\n\t\t\t// Next token can be EOF, comma, semicolon or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn d.consumeToken(EOF, 0, 0), nil\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tcase ';':\n\t\t\t\treturn d.consumeToken(semicolon, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn d.parseFieldName()\n\t\t\t}\n\n\t\tcase MessageOpen:\n\t\t\t// Next token can be MessageClose, comma, semicolon or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase closeCh:\n\t\t\t\td.popOpenStack()\n\t\t\t\treturn d.consumeToken(MessageClose, 1, 0), nil\n\t\t\tcase otherCloseChar[closeCh]:\n\t\t\t\treturn Token{}, d.newSyntaxError(mismatchedFmt, ch)\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tcase ';':\n\t\t\t\treturn d.consumeToken(semicolon, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn d.parseFieldName()\n\t\t\t}\n\n\t\tcase ListOpen:\n\t\t\t// Next token can be ListClose or comma\n\t\t\tif isEOF {\n\t\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase closeCh:\n\t\t\t\td.popOpenStack()\n\t\t\t\treturn d.consumeToken(ListClose, 1, 0), nil\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn Token{}, d.newSyntaxError(unexpectedFmt, ch)\n\t\t\t}\n\t\t}\n\n\tcase ListOpen:\n\t\t// Next token can be ListClose, MessageStart or Scalar.\n\t\tif isEOF {\n\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t}\n\t\tswitch ch := d.in[0]; ch {\n\t\tcase ']':\n\t\t\td.popOpenStack()\n\t\t\treturn d.consumeToken(ListClose, 1, 0), nil\n\t\tcase '{', '<':\n\t\t\td.pushOpenStack(ch)\n\t\t\treturn d.consumeToken(MessageOpen, 1, 0), nil\n\t\tdefault:\n\t\t\treturn d.parseScalar()\n\t\t}\n\n\tcase ListClose:\n\t\topenKind, closeCh := d.currentOpenKind()\n\t\tswitch openKind {\n\t\tcase bof:\n\t\t\t// Top level message.\n\t\t\t// Next token can be EOF, comma, semicolon or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn d.consumeToken(EOF, 0, 0), nil\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tcase ';':\n\t\t\t\treturn d.consumeToken(semicolon, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn d.parseFieldName()\n\t\t\t}\n\n\t\tcase MessageOpen:\n\t\t\t// Next token can be MessageClose, comma, semicolon or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase closeCh:\n\t\t\t\td.popOpenStack()\n\t\t\t\treturn d.consumeToken(MessageClose, 1, 0), nil\n\t\t\tcase otherCloseChar[closeCh]:\n\t\t\t\treturn Token{}, d.newSyntaxError(mismatchedFmt, ch)\n\t\t\tcase ',':\n\t\t\t\treturn d.consumeToken(comma, 1, 0), nil\n\t\t\tcase ';':\n\t\t\t\treturn d.consumeToken(semicolon, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn d.parseFieldName()\n\t\t\t}\n\n\t\tdefault:\n\t\t\t// It is not possible to have this case. Let it panic below.\n\t\t}\n\n\tcase comma, semicolon:\n\t\topenKind, closeCh := d.currentOpenKind()\n\t\tswitch openKind {\n\t\tcase bof:\n\t\t\t// Top level message. Next token can be EOF or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn d.consumeToken(EOF, 0, 0), nil\n\t\t\t}\n\t\t\treturn d.parseFieldName()\n\n\t\tcase MessageOpen:\n\t\t\t// Next token can be MessageClose or Name.\n\t\t\tif isEOF {\n\t\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase closeCh:\n\t\t\t\td.popOpenStack()\n\t\t\t\treturn d.consumeToken(MessageClose, 1, 0), nil\n\t\t\tcase otherCloseChar[closeCh]:\n\t\t\t\treturn Token{}, d.newSyntaxError(mismatchedFmt, ch)\n\t\t\tdefault:\n\t\t\t\treturn d.parseFieldName()\n\t\t\t}\n\n\t\tcase ListOpen:\n\t\t\tif lastKind == semicolon {\n\t\t\t\t// It is not be possible to have this case as logic here\n\t\t\t\t// should not have produced a semicolon Token when inside a\n\t\t\t\t// list. Let it panic below.\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// Next token can be MessageOpen or Scalar.\n\t\t\tif isEOF {\n\t\t\t\treturn Token{}, ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch ch := d.in[0]; ch {\n\t\t\tcase '{', '<':\n\t\t\t\td.pushOpenStack(ch)\n\t\t\t\treturn d.consumeToken(MessageOpen, 1, 0), nil\n\t\t\tdefault:\n\t\t\t\treturn d.parseScalar()\n\t\t\t}\n\t\t}\n\t}\n\n\tline, column := d.Position(len(d.orig) - len(d.in))\n\tpanic(fmt.Sprintf(\"Decoder.parseNext: bug at handling line %d:%d with lastKind=%v\", line, column, lastKind))\n}\n\nvar otherCloseChar = map[byte]byte{\n\t'}': '>',\n\t'>': '}',\n}\n\n// currentOpenKind indicates whether current position is inside a message, list\n// or top-level message by returning MessageOpen, ListOpen or bof respectively.\n// If the returned kind is either a MessageOpen or ListOpen, it also returns the\n// corresponding closing character.\nfunc (d *Decoder) currentOpenKind() (Kind, byte) {\n\tif len(d.openStack) == 0 {\n\t\treturn bof, 0\n\t}\n\topenCh := d.openStack[len(d.openStack)-1]\n\tswitch openCh {\n\tcase '{':\n\t\treturn MessageOpen, '}'\n\tcase '<':\n\t\treturn MessageOpen, '>'\n\tcase '[':\n\t\treturn ListOpen, ']'\n\t}\n\tpanic(fmt.Sprintf(\"Decoder: openStack contains invalid byte %s\", string(openCh)))\n}\n\nfunc (d *Decoder) pushOpenStack(ch byte) {\n\td.openStack = append(d.openStack, ch)\n}\n\nfunc (d *Decoder) popOpenStack() {\n\td.openStack = d.openStack[:len(d.openStack)-1]\n}\n\n// parseFieldName parses field name and separator.\nfunc (d *Decoder) parseFieldName() (tok Token, err error) {\n\tdefer func() {\n\t\tif err == nil && d.tryConsumeChar(':') {\n\t\t\ttok.attrs |= hasSeparator\n\t\t}\n\t}()\n\n\t// Extension or Any type URL.\n\tif d.in[0] == '[' {\n\t\treturn d.parseTypeName()\n\t}\n\n\t// Identifier.\n\tif size := parseIdent(d.in, false); size > 0 {\n\t\treturn d.consumeToken(Name, size, uint8(IdentName)), nil\n\t}\n\n\t// Field number. Identify if input is a valid number that is not negative\n\t// and is decimal integer within 32-bit range.\n\tif num := parseNumber(d.in); num.size > 0 {\n\t\tif !num.neg && num.kind == numDec {\n\t\t\tif _, err := strconv.ParseInt(string(d.in[:num.size]), 10, 32); err == nil {\n\t\t\t\treturn d.consumeToken(Name, num.size, uint8(FieldNumber)), nil\n\t\t\t}\n\t\t}\n\t\treturn Token{}, d.newSyntaxError(\"invalid field number: %s\", d.in[:num.size])\n\t}\n\n\treturn Token{}, d.newSyntaxError(\"invalid field name: %s\", errRegexp.Find(d.in))\n}\n\n// parseTypeName parses Any type URL or extension field name. The name is\n// enclosed in [ and ] characters. The C++ parser does not handle many legal URL\n// strings. This implementation is more liberal and allows for the pattern\n// ^[-_a-zA-Z0-9]+([./][-_a-zA-Z0-9]+)*`). Whitespaces and comments are allowed\n// in between [ ], '.', '/' and the sub names.\nfunc (d *Decoder) parseTypeName() (Token, error) {\n\tstartPos := len(d.orig) - len(d.in)\n\t// Use alias s to advance first in order to use d.in for error handling.\n\t// Caller already checks for [ as first character.\n\ts := consume(d.in[1:], 0)\n\tif len(s) == 0 {\n\t\treturn Token{}, ErrUnexpectedEOF\n\t}\n\n\tvar name []byte\n\tfor len(s) > 0 && isTypeNameChar(s[0]) {\n\t\tname = append(name, s[0])\n\t\ts = s[1:]\n\t}\n\ts = consume(s, 0)\n\n\tvar closed bool\n\tfor len(s) > 0 && !closed {\n\t\tswitch {\n\t\tcase s[0] == ']':\n\t\t\ts = s[1:]\n\t\t\tclosed = true\n\n\t\tcase s[0] == '/', s[0] == '.':\n\t\t\tif len(name) > 0 && (name[len(name)-1] == '/' || name[len(name)-1] == '.') {\n\t\t\t\treturn Token{}, d.newSyntaxError(\"invalid type URL/extension field name: %s\",\n\t\t\t\t\td.orig[startPos:len(d.orig)-len(s)+1])\n\t\t\t}\n\t\t\tname = append(name, s[0])\n\t\t\ts = s[1:]\n\t\t\ts = consume(s, 0)\n\t\t\tfor len(s) > 0 && isTypeNameChar(s[0]) {\n\t\t\t\tname = append(name, s[0])\n\t\t\t\ts = s[1:]\n\t\t\t}\n\t\t\ts = consume(s, 0)\n\n\t\tdefault:\n\t\t\treturn Token{}, d.newSyntaxError(\n\t\t\t\t\"invalid type URL/extension field name: %s\", d.orig[startPos:len(d.orig)-len(s)+1])\n\t\t}\n\t}\n\n\tif !closed {\n\t\treturn Token{}, ErrUnexpectedEOF\n\t}\n\n\t// First character cannot be '.'. Last character cannot be '.' or '/'.\n\tsize := len(name)\n\tif size == 0 || name[0] == '.' || name[size-1] == '.' || name[size-1] == '/' {\n\t\treturn Token{}, d.newSyntaxError(\"invalid type URL/extension field name: %s\",\n\t\t\td.orig[startPos:len(d.orig)-len(s)])\n\t}\n\n\td.in = s\n\tendPos := len(d.orig) - len(d.in)\n\td.consume(0)\n\n\treturn Token{\n\t\tkind:  Name,\n\t\tattrs: uint8(TypeName),\n\t\tpos:   startPos,\n\t\traw:   d.orig[startPos:endPos],\n\t\tstr:   string(name),\n\t}, nil\n}\n\nfunc isTypeNameChar(b byte) bool {\n\treturn (b == '-' || b == '_' ||\n\t\t('0' <= b && b <= '9') ||\n\t\t('a' <= b && b <= 'z') ||\n\t\t('A' <= b && b <= 'Z'))\n}\n\nfunc isWhiteSpace(b byte) bool {\n\tswitch b {\n\tcase ' ', '\\n', '\\r', '\\t':\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\n// parseIdent parses an unquoted proto identifier and returns size.\n// If allowNeg is true, it allows '-' to be the first character in the\n// identifier. This is used when parsing literal values like -infinity, etc.\n// Regular expression matches an identifier: `^[_a-zA-Z][_a-zA-Z0-9]*`\nfunc parseIdent(input []byte, allowNeg bool) int {\n\tvar size int\n\n\ts := input\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\n\tif allowNeg && s[0] == '-' {\n\t\ts = s[1:]\n\t\tsize++\n\t\tif len(s) == 0 {\n\t\t\treturn 0\n\t\t}\n\t}\n\n\tswitch {\n\tcase s[0] == '_',\n\t\t'a' <= s[0] && s[0] <= 'z',\n\t\t'A' <= s[0] && s[0] <= 'Z':\n\t\ts = s[1:]\n\t\tsize++\n\tdefault:\n\t\treturn 0\n\t}\n\n\tfor len(s) > 0 && (s[0] == '_' ||\n\t\t'a' <= s[0] && s[0] <= 'z' ||\n\t\t'A' <= s[0] && s[0] <= 'Z' ||\n\t\t'0' <= s[0] && s[0] <= '9') {\n\t\ts = s[1:]\n\t\tsize++\n\t}\n\n\tif len(s) > 0 && !isDelim(s[0]) {\n\t\treturn 0\n\t}\n\n\treturn size\n}\n\n// parseScalar parses for a string, literal or number value.\nfunc (d *Decoder) parseScalar() (Token, error) {\n\tif d.in[0] == '\"' || d.in[0] == '\\'' {\n\t\treturn d.parseStringValue()\n\t}\n\n\tif tok, ok := d.parseLiteralValue(); ok {\n\t\treturn tok, nil\n\t}\n\n\tif tok, ok := d.parseNumberValue(); ok {\n\t\treturn tok, nil\n\t}\n\n\treturn Token{}, d.newSyntaxError(\"invalid scalar value: %s\", errRegexp.Find(d.in))\n}\n\n// parseLiteralValue parses a literal value. A literal value is used for\n// bools, special floats and enums. This function simply identifies that the\n// field value is a literal.\nfunc (d *Decoder) parseLiteralValue() (Token, bool) {\n\tsize := parseIdent(d.in, true)\n\tif size == 0 {\n\t\treturn Token{}, false\n\t}\n\treturn d.consumeToken(Scalar, size, literalValue), true\n}\n\n// consumeToken constructs a Token for given Kind from d.in and consumes given\n// size-length from it.\nfunc (d *Decoder) consumeToken(kind Kind, size int, attrs uint8) Token {\n\t// Important to compute raw and pos before consuming.\n\ttok := Token{\n\t\tkind:  kind,\n\t\tattrs: attrs,\n\t\tpos:   len(d.orig) - len(d.in),\n\t\traw:   d.in[:size],\n\t}\n\td.consume(size)\n\treturn tok\n}\n\n// newSyntaxError returns a syntax error with line and column information for\n// current position.\nfunc (d *Decoder) newSyntaxError(f string, x ...interface{}) error {\n\te := errors.New(f, x...)\n\tline, column := d.Position(len(d.orig) - len(d.in))\n\treturn errors.New(\"syntax error (line %d:%d): %v\", line, column, e)\n}\n\n// Position returns line and column number of given index of the original input.\n// It will panic if index is out of range.\nfunc (d *Decoder) Position(idx int) (line int, column int) {\n\tb := d.orig[:idx]\n\tline = bytes.Count(b, []byte(\"\\n\")) + 1\n\tif i := bytes.LastIndexByte(b, '\\n'); i >= 0 {\n\t\tb = b[i+1:]\n\t}\n\tcolumn = utf8.RuneCount(b) + 1 // ignore multi-rune characters\n\treturn line, column\n}\n\nfunc (d *Decoder) tryConsumeChar(c byte) bool {\n\tif len(d.in) > 0 && d.in[0] == c {\n\t\td.consume(1)\n\t\treturn true\n\t}\n\treturn false\n}\n\n// consume consumes n bytes of input and any subsequent whitespace or comments.\nfunc (d *Decoder) consume(n int) {\n\td.in = consume(d.in, n)\n\treturn\n}\n\n// consume consumes n bytes of input and any subsequent whitespace or comments.\nfunc consume(b []byte, n int) []byte {\n\tb = b[n:]\n\tfor len(b) > 0 {\n\t\tswitch b[0] {\n\t\tcase ' ', '\\n', '\\r', '\\t':\n\t\t\tb = b[1:]\n\t\tcase '#':\n\t\t\tif i := bytes.IndexByte(b, '\\n'); i >= 0 {\n\t\t\t\tb = b[i+len(\"\\n\"):]\n\t\t\t} else {\n\t\t\t\tb = nil\n\t\t\t}\n\t\tdefault:\n\t\t\treturn b\n\t\t}\n\t}\n\treturn b\n}\n\n// Any sequence that looks like a non-delimiter (for error reporting).\nvar errRegexp = regexp.MustCompile(`^([-+._a-zA-Z0-9\\/]+|.)`)\n\n// isDelim returns true if given byte is a delimiter character.\nfunc isDelim(c byte) bool {\n\treturn !(c == '-' || c == '+' || c == '.' || c == '_' ||\n\t\t('a' <= c && c <= 'z') ||\n\t\t('A' <= c && c <= 'Z') ||\n\t\t('0' <= c && c <= '9'))\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.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 text\n\n// parseNumberValue parses a number from the input and returns a Token object.\nfunc (d *Decoder) parseNumberValue() (Token, bool) {\n\tin := d.in\n\tnum := parseNumber(in)\n\tif num.size == 0 {\n\t\treturn Token{}, false\n\t}\n\tnumAttrs := num.kind\n\tif num.neg {\n\t\tnumAttrs |= isNegative\n\t}\n\tstrSize := num.size\n\tlast := num.size - 1\n\tif num.kind == numFloat && (d.in[last] == 'f' || d.in[last] == 'F') {\n\t\tstrSize = last\n\t}\n\ttok := Token{\n\t\tkind:     Scalar,\n\t\tattrs:    numberValue,\n\t\tpos:      len(d.orig) - len(d.in),\n\t\traw:      d.in[:num.size],\n\t\tstr:      string(d.in[:strSize]),\n\t\tnumAttrs: numAttrs,\n\t}\n\td.consume(num.size)\n\treturn tok, true\n}\n\nconst (\n\tnumDec uint8 = (1 << iota) / 2\n\tnumHex\n\tnumOct\n\tnumFloat\n)\n\n// number is the result of parsing out a valid number from parseNumber. It\n// contains data for doing float or integer conversion via the strconv package\n// in conjunction with the input bytes.\ntype number struct {\n\tkind uint8\n\tneg  bool\n\tsize int\n}\n\n// parseNumber constructs a number object from given input. It allows for the\n// following patterns:\n//   integer: ^-?([1-9][0-9]*|0[xX][0-9a-fA-F]+|0[0-7]*)\n//   float: ^-?((0|[1-9][0-9]*)?([.][0-9]*)?([eE][+-]?[0-9]+)?[fF]?)\n// It also returns the number of parsed bytes for the given number, 0 if it is\n// not a number.\nfunc parseNumber(input []byte) number {\n\tkind := numDec\n\tvar size int\n\tvar neg bool\n\n\ts := input\n\tif len(s) == 0 {\n\t\treturn number{}\n\t}\n\n\t// Optional -\n\tif s[0] == '-' {\n\t\tneg = true\n\t\ts = s[1:]\n\t\tsize++\n\t\tif len(s) == 0 {\n\t\t\treturn number{}\n\t\t}\n\t}\n\n\t// C++ allows for whitespace and comments in between the negative sign and\n\t// the rest of the number. This logic currently does not but is consistent\n\t// with v1.\n\n\tswitch {\n\tcase s[0] == '0':\n\t\tif len(s) > 1 {\n\t\t\tswitch {\n\t\t\tcase s[1] == 'x' || s[1] == 'X':\n\t\t\t\t// Parse as hex number.\n\t\t\t\tkind = numHex\n\t\t\t\tn := 2\n\t\t\t\ts = s[2:]\n\t\t\t\tfor len(s) > 0 && (('0' <= s[0] && s[0] <= '9') ||\n\t\t\t\t\t('a' <= s[0] && s[0] <= 'f') ||\n\t\t\t\t\t('A' <= s[0] && s[0] <= 'F')) {\n\t\t\t\t\ts = s[1:]\n\t\t\t\t\tn++\n\t\t\t\t}\n\t\t\t\tif n == 2 {\n\t\t\t\t\treturn number{}\n\t\t\t\t}\n\t\t\t\tsize += n\n\n\t\t\tcase '0' <= s[1] && s[1] <= '7':\n\t\t\t\t// Parse as octal number.\n\t\t\t\tkind = numOct\n\t\t\t\tn := 2\n\t\t\t\ts = s[2:]\n\t\t\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '7' {\n\t\t\t\t\ts = s[1:]\n\t\t\t\t\tn++\n\t\t\t\t}\n\t\t\t\tsize += n\n\t\t\t}\n\n\t\t\tif kind&(numHex|numOct) > 0 {\n\t\t\t\tif len(s) > 0 && !isDelim(s[0]) {\n\t\t\t\t\treturn number{}\n\t\t\t\t}\n\t\t\t\treturn number{kind: kind, neg: neg, size: size}\n\t\t\t}\n\t\t}\n\t\ts = s[1:]\n\t\tsize++\n\n\tcase '1' <= s[0] && s[0] <= '9':\n\t\tn := 1\n\t\ts = s[1:]\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t}\n\t\tsize += n\n\n\tcase s[0] == '.':\n\t\t// Set kind to numFloat to signify the intent to parse as float. And\n\t\t// that it needs to have other digits after '.'.\n\t\tkind = numFloat\n\n\tdefault:\n\t\treturn number{}\n\t}\n\n\t// . followed by 0 or more digits.\n\tif len(s) > 0 && s[0] == '.' {\n\t\tn := 1\n\t\ts = s[1:]\n\t\t// If decimal point was before any digits, it should be followed by\n\t\t// other digits.\n\t\tif len(s) == 0 && kind == numFloat {\n\t\t\treturn number{}\n\t\t}\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t}\n\t\tsize += n\n\t\tkind = numFloat\n\t}\n\n\t// e or E followed by an optional - or + and 1 or more digits.\n\tif len(s) >= 2 && (s[0] == 'e' || s[0] == 'E') {\n\t\tkind = numFloat\n\t\ts = s[1:]\n\t\tn := 1\n\t\tif s[0] == '+' || s[0] == '-' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t\tif len(s) == 0 {\n\t\t\t\treturn number{}\n\t\t\t}\n\t\t}\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t\tn++\n\t\t}\n\t\tsize += n\n\t}\n\n\t// Optional suffix f or F for floats.\n\tif len(s) > 0 && (s[0] == 'f' || s[0] == 'F') {\n\t\tkind = numFloat\n\t\ts = s[1:]\n\t\tsize++\n\t}\n\n\t// Check that next byte is a delimiter or it is at the end.\n\tif len(s) > 0 && !isDelim(s[0]) {\n\t\treturn number{}\n\t}\n\n\treturn number{kind: kind, neg: neg, size: size}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.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 text\n\nimport (\n\t\"bytes\"\n\t\"strconv\"\n\t\"strings\"\n\t\"unicode\"\n\t\"unicode/utf16\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/internal/strs\"\n)\n\n// parseStringValue parses string field token.\n// This differs from parseString since the text format allows\n// multiple back-to-back string literals where they are semantically treated\n// as a single large string with all values concatenated.\n//\n// E.g., `\"foo\" \"bar\" \"baz\"` => \"foobarbaz\"\nfunc (d *Decoder) parseStringValue() (Token, error) {\n\t// Note that the ending quote is sufficient to unambiguously mark the end\n\t// of a string. Thus, the text grammar does not require intervening\n\t// whitespace or control characters in-between strings.\n\t// Thus, the following is valid:\n\t//\t`\"foo\"'bar'\"baz\"` => \"foobarbaz\"\n\tin0 := d.in\n\tvar ss []string\n\tfor len(d.in) > 0 && (d.in[0] == '\"' || d.in[0] == '\\'') {\n\t\ts, err := d.parseString()\n\t\tif err != nil {\n\t\t\treturn Token{}, err\n\t\t}\n\t\tss = append(ss, s)\n\t}\n\t// d.in already points to the end of the value at this point.\n\treturn Token{\n\t\tkind:  Scalar,\n\t\tattrs: stringValue,\n\t\tpos:   len(d.orig) - len(in0),\n\t\traw:   in0[:len(in0)-len(d.in)],\n\t\tstr:   strings.Join(ss, \"\"),\n\t}, nil\n}\n\n// parseString parses a string value enclosed in \" or '.\nfunc (d *Decoder) parseString() (string, error) {\n\tin := d.in\n\tif len(in) == 0 {\n\t\treturn \"\", ErrUnexpectedEOF\n\t}\n\tquote := in[0]\n\tin = in[1:]\n\ti := indexNeedEscapeInBytes(in)\n\tin, out := in[i:], in[:i:i] // set cap to prevent mutations\n\tfor len(in) > 0 {\n\t\tswitch r, n := utf8.DecodeRune(in); {\n\t\tcase r == utf8.RuneError && n == 1:\n\t\t\treturn \"\", d.newSyntaxError(\"invalid UTF-8 detected\")\n\t\tcase r == 0 || r == '\\n':\n\t\t\treturn \"\", d.newSyntaxError(\"invalid character %q in string\", r)\n\t\tcase r == rune(quote):\n\t\t\tin = in[1:]\n\t\t\td.consume(len(d.in) - len(in))\n\t\t\treturn string(out), nil\n\t\tcase r == '\\\\':\n\t\t\tif len(in) < 2 {\n\t\t\t\treturn \"\", ErrUnexpectedEOF\n\t\t\t}\n\t\t\tswitch r := in[1]; r {\n\t\t\tcase '\"', '\\'', '\\\\', '?':\n\t\t\t\tin, out = in[2:], append(out, r)\n\t\t\tcase 'a':\n\t\t\t\tin, out = in[2:], append(out, '\\a')\n\t\t\tcase 'b':\n\t\t\t\tin, out = in[2:], append(out, '\\b')\n\t\t\tcase 'n':\n\t\t\t\tin, out = in[2:], append(out, '\\n')\n\t\t\tcase 'r':\n\t\t\t\tin, out = in[2:], append(out, '\\r')\n\t\t\tcase 't':\n\t\t\t\tin, out = in[2:], append(out, '\\t')\n\t\t\tcase 'v':\n\t\t\t\tin, out = in[2:], append(out, '\\v')\n\t\t\tcase 'f':\n\t\t\t\tin, out = in[2:], append(out, '\\f')\n\t\t\tcase '0', '1', '2', '3', '4', '5', '6', '7':\n\t\t\t\t// One, two, or three octal characters.\n\t\t\t\tn := len(in[1:]) - len(bytes.TrimLeft(in[1:], \"01234567\"))\n\t\t\t\tif n > 3 {\n\t\t\t\t\tn = 3\n\t\t\t\t}\n\t\t\t\tv, err := strconv.ParseUint(string(in[1:1+n]), 8, 8)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", d.newSyntaxError(\"invalid octal escape code %q in string\", in[:1+n])\n\t\t\t\t}\n\t\t\t\tin, out = in[1+n:], append(out, byte(v))\n\t\t\tcase 'x':\n\t\t\t\t// One or two hexadecimal characters.\n\t\t\t\tn := len(in[2:]) - len(bytes.TrimLeft(in[2:], \"0123456789abcdefABCDEF\"))\n\t\t\t\tif n > 2 {\n\t\t\t\t\tn = 2\n\t\t\t\t}\n\t\t\t\tv, err := strconv.ParseUint(string(in[2:2+n]), 16, 8)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", d.newSyntaxError(\"invalid hex escape code %q in string\", in[:2+n])\n\t\t\t\t}\n\t\t\t\tin, out = in[2+n:], append(out, byte(v))\n\t\t\tcase 'u', 'U':\n\t\t\t\t// Four or eight hexadecimal characters\n\t\t\t\tn := 6\n\t\t\t\tif r == 'U' {\n\t\t\t\t\tn = 10\n\t\t\t\t}\n\t\t\t\tif len(in) < n {\n\t\t\t\t\treturn \"\", ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tv, err := strconv.ParseUint(string(in[2:n]), 16, 32)\n\t\t\t\tif utf8.MaxRune < v || err != nil {\n\t\t\t\t\treturn \"\", d.newSyntaxError(\"invalid Unicode escape code %q in string\", in[:n])\n\t\t\t\t}\n\t\t\t\tin = in[n:]\n\n\t\t\t\tr := rune(v)\n\t\t\t\tif utf16.IsSurrogate(r) {\n\t\t\t\t\tif len(in) < 6 {\n\t\t\t\t\t\treturn \"\", ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tv, err := strconv.ParseUint(string(in[2:6]), 16, 16)\n\t\t\t\t\tr = utf16.DecodeRune(r, rune(v))\n\t\t\t\t\tif in[0] != '\\\\' || in[1] != 'u' || r == unicode.ReplacementChar || err != nil {\n\t\t\t\t\t\treturn \"\", d.newSyntaxError(\"invalid Unicode escape code %q in string\", in[:6])\n\t\t\t\t\t}\n\t\t\t\t\tin = in[6:]\n\t\t\t\t}\n\t\t\t\tout = append(out, string(r)...)\n\t\t\tdefault:\n\t\t\t\treturn \"\", d.newSyntaxError(\"invalid escape code %q in string\", in[:2])\n\t\t\t}\n\t\tdefault:\n\t\t\ti := indexNeedEscapeInBytes(in[n:])\n\t\t\tin, out = in[n+i:], append(out, in[:n+i]...)\n\t\t}\n\t}\n\treturn \"\", ErrUnexpectedEOF\n}\n\n// indexNeedEscapeInString returns the index of the character that needs\n// escaping. If no characters need escaping, this returns the input length.\nfunc indexNeedEscapeInBytes(b []byte) int { return indexNeedEscapeInString(strs.UnsafeString(b)) }\n\n// UnmarshalString returns an unescaped string given a textproto string value.\n// String value needs to contain single or double quotes. This is only used by\n// internal/encoding/defval package for unmarshaling bytes.\nfunc UnmarshalString(s string) (string, error) {\n\td := NewDecoder([]byte(s))\n\treturn d.parseString()\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.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 text\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"math\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"google.golang.org/protobuf/internal/flags\"\n)\n\n// Kind represents a token kind expressible in the textproto format.\ntype Kind uint8\n\n// Kind values.\nconst (\n\tInvalid Kind = iota\n\tEOF\n\tName   // Name indicates the field name.\n\tScalar // Scalar are scalar values, e.g. \"string\", 47, ENUM_LITERAL, true.\n\tMessageOpen\n\tMessageClose\n\tListOpen\n\tListClose\n\n\t// comma and semi-colon are only for parsing in between values and should not be exposed.\n\tcomma\n\tsemicolon\n\n\t// bof indicates beginning of file, which is the default token\n\t// kind at the beginning of parsing.\n\tbof = Invalid\n)\n\nfunc (t Kind) String() string {\n\tswitch t {\n\tcase Invalid:\n\t\treturn \"<invalid>\"\n\tcase EOF:\n\t\treturn \"eof\"\n\tcase Scalar:\n\t\treturn \"scalar\"\n\tcase Name:\n\t\treturn \"name\"\n\tcase MessageOpen:\n\t\treturn \"{\"\n\tcase MessageClose:\n\t\treturn \"}\"\n\tcase ListOpen:\n\t\treturn \"[\"\n\tcase ListClose:\n\t\treturn \"]\"\n\tcase comma:\n\t\treturn \",\"\n\tcase semicolon:\n\t\treturn \";\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"<invalid:%v>\", uint8(t))\n\t}\n}\n\n// NameKind represents different types of field names.\ntype NameKind uint8\n\n// NameKind values.\nconst (\n\tIdentName NameKind = iota + 1\n\tTypeName\n\tFieldNumber\n)\n\nfunc (t NameKind) String() string {\n\tswitch t {\n\tcase IdentName:\n\t\treturn \"IdentName\"\n\tcase TypeName:\n\t\treturn \"TypeName\"\n\tcase FieldNumber:\n\t\treturn \"FieldNumber\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"<invalid:%v>\", uint8(t))\n\t}\n}\n\n// Bit mask in Token.attrs to indicate if a Name token is followed by the\n// separator char ':'. The field name separator char is optional for message\n// field or repeated message field, but required for all other types. Decoder\n// simply indicates whether a Name token is followed by separator or not.  It is\n// up to the prototext package to validate.\nconst hasSeparator = 1 << 7\n\n// Scalar value types.\nconst (\n\tnumberValue = iota + 1\n\tstringValue\n\tliteralValue\n)\n\n// Bit mask in Token.numAttrs to indicate that the number is a negative.\nconst isNegative = 1 << 7\n\n// Token provides a parsed token kind and value. Values are provided by the\n// different accessor methods.\ntype Token struct {\n\t// Kind of the Token object.\n\tkind Kind\n\t// attrs contains metadata for the following Kinds:\n\t// Name: hasSeparator bit and one of NameKind.\n\t// Scalar: one of numberValue, stringValue, literalValue.\n\tattrs uint8\n\t// numAttrs contains metadata for numberValue:\n\t// - highest bit is whether negative or positive.\n\t// - lower bits indicate one of numDec, numHex, numOct, numFloat.\n\tnumAttrs uint8\n\t// pos provides the position of the token in the original input.\n\tpos int\n\t// raw bytes of the serialized token.\n\t// This is a subslice into the original input.\n\traw []byte\n\t// str contains parsed string for the following:\n\t// - stringValue of Scalar kind\n\t// - numberValue of Scalar kind\n\t// - TypeName of Name kind\n\tstr string\n}\n\n// Kind returns the token kind.\nfunc (t Token) Kind() Kind {\n\treturn t.kind\n}\n\n// RawString returns the read value in string.\nfunc (t Token) RawString() string {\n\treturn string(t.raw)\n}\n\n// Pos returns the token position from the input.\nfunc (t Token) Pos() int {\n\treturn t.pos\n}\n\n// NameKind returns IdentName, TypeName or FieldNumber.\n// It panics if type is not Name.\nfunc (t Token) NameKind() NameKind {\n\tif t.kind == Name {\n\t\treturn NameKind(t.attrs &^ hasSeparator)\n\t}\n\tpanic(fmt.Sprintf(\"Token is not a Name type: %s\", t.kind))\n}\n\n// HasSeparator returns true if the field name is followed by the separator char\n// ':', else false. It panics if type is not Name.\nfunc (t Token) HasSeparator() bool {\n\tif t.kind == Name {\n\t\treturn t.attrs&hasSeparator != 0\n\t}\n\tpanic(fmt.Sprintf(\"Token is not a Name type: %s\", t.kind))\n}\n\n// IdentName returns the value for IdentName type.\nfunc (t Token) IdentName() string {\n\tif t.kind == Name && t.attrs&uint8(IdentName) != 0 {\n\t\treturn string(t.raw)\n\t}\n\tpanic(fmt.Sprintf(\"Token is not an IdentName: %s:%s\", t.kind, NameKind(t.attrs&^hasSeparator)))\n}\n\n// TypeName returns the value for TypeName type.\nfunc (t Token) TypeName() string {\n\tif t.kind == Name && t.attrs&uint8(TypeName) != 0 {\n\t\treturn t.str\n\t}\n\tpanic(fmt.Sprintf(\"Token is not a TypeName: %s:%s\", t.kind, NameKind(t.attrs&^hasSeparator)))\n}\n\n// FieldNumber returns the value for FieldNumber type. It returns a\n// non-negative int32 value. Caller will still need to validate for the correct\n// field number range.\nfunc (t Token) FieldNumber() int32 {\n\tif t.kind != Name || t.attrs&uint8(FieldNumber) == 0 {\n\t\tpanic(fmt.Sprintf(\"Token is not a FieldNumber: %s:%s\", t.kind, NameKind(t.attrs&^hasSeparator)))\n\t}\n\t// Following should not return an error as it had already been called right\n\t// before this Token was constructed.\n\tnum, _ := strconv.ParseInt(string(t.raw), 10, 32)\n\treturn int32(num)\n}\n\n// String returns the string value for a Scalar type.\nfunc (t Token) String() (string, bool) {\n\tif t.kind != Scalar || t.attrs != stringValue {\n\t\treturn \"\", false\n\t}\n\treturn t.str, true\n}\n\n// Enum returns the literal value for a Scalar type for use as enum literals.\nfunc (t Token) Enum() (string, bool) {\n\tif t.kind != Scalar || t.attrs != literalValue || (len(t.raw) > 0 && t.raw[0] == '-') {\n\t\treturn \"\", false\n\t}\n\treturn string(t.raw), true\n}\n\n// Bool returns the bool value for a Scalar type.\nfunc (t Token) Bool() (bool, bool) {\n\tif t.kind != Scalar {\n\t\treturn false, false\n\t}\n\tswitch t.attrs {\n\tcase literalValue:\n\t\tif b, ok := boolLits[string(t.raw)]; ok {\n\t\t\treturn b, true\n\t\t}\n\tcase numberValue:\n\t\t// Unsigned integer representation of 0 or 1 is permitted: 00, 0x0, 01,\n\t\t// 0x1, etc.\n\t\tn, err := strconv.ParseUint(t.str, 0, 64)\n\t\tif err == nil {\n\t\t\tswitch n {\n\t\t\tcase 0:\n\t\t\t\treturn false, true\n\t\t\tcase 1:\n\t\t\t\treturn true, true\n\t\t\t}\n\t\t}\n\t}\n\treturn false, false\n}\n\n// These exact boolean literals are the ones supported in C++.\nvar boolLits = map[string]bool{\n\t\"t\":     true,\n\t\"true\":  true,\n\t\"True\":  true,\n\t\"f\":     false,\n\t\"false\": false,\n\t\"False\": false,\n}\n\n// Uint64 returns the uint64 value for a Scalar type.\nfunc (t Token) Uint64() (uint64, bool) {\n\tif t.kind != Scalar || t.attrs != numberValue ||\n\t\tt.numAttrs&isNegative > 0 || t.numAttrs&numFloat > 0 {\n\t\treturn 0, false\n\t}\n\tn, err := strconv.ParseUint(t.str, 0, 64)\n\tif err != nil {\n\t\treturn 0, false\n\t}\n\treturn n, true\n}\n\n// Uint32 returns the uint32 value for a Scalar type.\nfunc (t Token) Uint32() (uint32, bool) {\n\tif t.kind != Scalar || t.attrs != numberValue ||\n\t\tt.numAttrs&isNegative > 0 || t.numAttrs&numFloat > 0 {\n\t\treturn 0, false\n\t}\n\tn, err := strconv.ParseUint(t.str, 0, 32)\n\tif err != nil {\n\t\treturn 0, false\n\t}\n\treturn uint32(n), true\n}\n\n// Int64 returns the int64 value for a Scalar type.\nfunc (t Token) Int64() (int64, bool) {\n\tif t.kind != Scalar || t.attrs != numberValue || t.numAttrs&numFloat > 0 {\n\t\treturn 0, false\n\t}\n\tif n, err := strconv.ParseInt(t.str, 0, 64); err == nil {\n\t\treturn n, true\n\t}\n\t// C++ accepts large positive hex numbers as negative values.\n\t// This feature is here for proto1 backwards compatibility purposes.\n\tif flags.ProtoLegacy && (t.numAttrs == numHex) {\n\t\tif n, err := strconv.ParseUint(t.str, 0, 64); err == nil {\n\t\t\treturn int64(n), true\n\t\t}\n\t}\n\treturn 0, false\n}\n\n// Int32 returns the int32 value for a Scalar type.\nfunc (t Token) Int32() (int32, bool) {\n\tif t.kind != Scalar || t.attrs != numberValue || t.numAttrs&numFloat > 0 {\n\t\treturn 0, false\n\t}\n\tif n, err := strconv.ParseInt(t.str, 0, 32); err == nil {\n\t\treturn int32(n), true\n\t}\n\t// C++ accepts large positive hex numbers as negative values.\n\t// This feature is here for proto1 backwards compatibility purposes.\n\tif flags.ProtoLegacy && (t.numAttrs == numHex) {\n\t\tif n, err := strconv.ParseUint(t.str, 0, 32); err == nil {\n\t\t\treturn int32(n), true\n\t\t}\n\t}\n\treturn 0, false\n}\n\n// Float64 returns the float64 value for a Scalar type.\nfunc (t Token) Float64() (float64, bool) {\n\tif t.kind != Scalar {\n\t\treturn 0, false\n\t}\n\tswitch t.attrs {\n\tcase literalValue:\n\t\tif f, ok := floatLits[strings.ToLower(string(t.raw))]; ok {\n\t\t\treturn f, true\n\t\t}\n\tcase numberValue:\n\t\tn, err := strconv.ParseFloat(t.str, 64)\n\t\tif err == nil {\n\t\t\treturn n, true\n\t\t}\n\t\tnerr := err.(*strconv.NumError)\n\t\tif nerr.Err == strconv.ErrRange {\n\t\t\treturn n, true\n\t\t}\n\t}\n\treturn 0, false\n}\n\n// Float32 returns the float32 value for a Scalar type.\nfunc (t Token) Float32() (float32, bool) {\n\tif t.kind != Scalar {\n\t\treturn 0, false\n\t}\n\tswitch t.attrs {\n\tcase literalValue:\n\t\tif f, ok := floatLits[strings.ToLower(string(t.raw))]; ok {\n\t\t\treturn float32(f), true\n\t\t}\n\tcase numberValue:\n\t\tn, err := strconv.ParseFloat(t.str, 64)\n\t\tif err == nil {\n\t\t\t// Overflows are treated as (-)infinity.\n\t\t\treturn float32(n), true\n\t\t}\n\t\tnerr := err.(*strconv.NumError)\n\t\tif nerr.Err == strconv.ErrRange {\n\t\t\treturn float32(n), true\n\t\t}\n\t}\n\treturn 0, false\n}\n\n// These are the supported float literals which C++ permits case-insensitive\n// variants of these.\nvar floatLits = map[string]float64{\n\t\"nan\":       math.NaN(),\n\t\"inf\":       math.Inf(1),\n\t\"infinity\":  math.Inf(1),\n\t\"-inf\":      math.Inf(-1),\n\t\"-infinity\": math.Inf(-1),\n}\n\n// TokenEquals returns true if given Tokens are equal, else false.\nfunc TokenEquals(x, y Token) bool {\n\treturn x.kind == y.kind &&\n\t\tx.attrs == y.attrs &&\n\t\tx.numAttrs == y.numAttrs &&\n\t\tx.pos == y.pos &&\n\t\tbytes.Equal(x.raw, y.raw) &&\n\t\tx.str == y.str\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/encoding/text/doc.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 text implements the text format for protocol buffers.\n// This package has no semantic understanding for protocol buffers and is only\n// a parser and composer for the format.\n//\n// There is no formal specification for the protobuf text format, as such the\n// C++ implementation (see google::protobuf::TextFormat) is the reference\n// implementation of the text format.\n//\n// This package is neither a superset nor a subset of the C++ implementation.\n// This implementation permits a more liberal grammar in some cases to be\n// backwards compatible with the historical Go implementation.\n// Future parsings unique to Go should not be added.\n// Some grammars allowed by the C++ implementation are deliberately\n// not implemented here because they are considered a bug by the protobuf team\n// and should not be replicated.\n//\n// The Go implementation should implement a sufficient amount of the C++\n// grammar such that the default text serialization by C++ can be parsed by Go.\n// However, just because the C++ parser accepts some input does not mean that\n// the Go implementation should as well.\n//\n// The text format is almost a superset of JSON except:\n//\t* message keys are not quoted strings, but identifiers\n//\t* the top-level value must be a message without the delimiters\npackage text\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/encoding/text/encode.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 text\n\nimport (\n\t\"math\"\n\t\"math/bits\"\n\t\"strconv\"\n\t\"strings\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/internal/detrand\"\n\t\"google.golang.org/protobuf/internal/errors\"\n)\n\n// encType represents an encoding type.\ntype encType uint8\n\nconst (\n\t_ encType = (1 << iota) / 2\n\tname\n\tscalar\n\tmessageOpen\n\tmessageClose\n)\n\n// Encoder provides methods to write out textproto constructs and values. The user is\n// responsible for producing valid sequences of constructs and values.\ntype Encoder struct {\n\tencoderState\n\n\tindent      string\n\tdelims      [2]byte\n\toutputASCII bool\n}\n\ntype encoderState struct {\n\tlastType encType\n\tindents  []byte\n\tout      []byte\n}\n\n// NewEncoder returns an Encoder.\n//\n// If indent is a non-empty string, it causes every entry in a List or Message\n// to be preceded by the indent and trailed by a newline.\n//\n// If delims is not the zero value, it controls the delimiter characters used\n// for messages (e.g., \"{}\" vs \"<>\").\n//\n// If outputASCII is true, strings will be serialized in such a way that\n// multi-byte UTF-8 sequences are escaped. This property ensures that the\n// overall output is ASCII (as opposed to UTF-8).\nfunc NewEncoder(indent string, delims [2]byte, outputASCII bool) (*Encoder, error) {\n\te := &Encoder{}\n\tif len(indent) > 0 {\n\t\tif strings.Trim(indent, \" \\t\") != \"\" {\n\t\t\treturn nil, errors.New(\"indent may only be composed of space and tab characters\")\n\t\t}\n\t\te.indent = indent\n\t}\n\tswitch delims {\n\tcase [2]byte{0, 0}:\n\t\te.delims = [2]byte{'{', '}'}\n\tcase [2]byte{'{', '}'}, [2]byte{'<', '>'}:\n\t\te.delims = delims\n\tdefault:\n\t\treturn nil, errors.New(\"delimiters may only be \\\"{}\\\" or \\\"<>\\\"\")\n\t}\n\te.outputASCII = outputASCII\n\n\treturn e, nil\n}\n\n// Bytes returns the content of the written bytes.\nfunc (e *Encoder) Bytes() []byte {\n\treturn e.out\n}\n\n// StartMessage writes out the '{' or '<' symbol.\nfunc (e *Encoder) StartMessage() {\n\te.prepareNext(messageOpen)\n\te.out = append(e.out, e.delims[0])\n}\n\n// EndMessage writes out the '}' or '>' symbol.\nfunc (e *Encoder) EndMessage() {\n\te.prepareNext(messageClose)\n\te.out = append(e.out, e.delims[1])\n}\n\n// WriteName writes out the field name and the separator ':'.\nfunc (e *Encoder) WriteName(s string) {\n\te.prepareNext(name)\n\te.out = append(e.out, s...)\n\te.out = append(e.out, ':')\n}\n\n// WriteBool writes out the given boolean value.\nfunc (e *Encoder) WriteBool(b bool) {\n\tif b {\n\t\te.WriteLiteral(\"true\")\n\t} else {\n\t\te.WriteLiteral(\"false\")\n\t}\n}\n\n// WriteString writes out the given string value.\nfunc (e *Encoder) WriteString(s string) {\n\te.prepareNext(scalar)\n\te.out = appendString(e.out, s, e.outputASCII)\n}\n\nfunc appendString(out []byte, in string, outputASCII bool) []byte {\n\tout = append(out, '\"')\n\ti := indexNeedEscapeInString(in)\n\tin, out = in[i:], append(out, in[:i]...)\n\tfor len(in) > 0 {\n\t\tswitch r, n := utf8.DecodeRuneInString(in); {\n\t\tcase r == utf8.RuneError && n == 1:\n\t\t\t// We do not report invalid UTF-8 because strings in the text format\n\t\t\t// are used to represent both the proto string and bytes type.\n\t\t\tr = rune(in[0])\n\t\t\tfallthrough\n\t\tcase r < ' ' || r == '\"' || r == '\\\\' || r == 0x7f:\n\t\t\tout = append(out, '\\\\')\n\t\t\tswitch r {\n\t\t\tcase '\"', '\\\\':\n\t\t\t\tout = append(out, byte(r))\n\t\t\tcase '\\n':\n\t\t\t\tout = append(out, 'n')\n\t\t\tcase '\\r':\n\t\t\t\tout = append(out, 'r')\n\t\t\tcase '\\t':\n\t\t\t\tout = append(out, 't')\n\t\t\tdefault:\n\t\t\t\tout = append(out, 'x')\n\t\t\t\tout = append(out, \"00\"[1+(bits.Len32(uint32(r))-1)/4:]...)\n\t\t\t\tout = strconv.AppendUint(out, uint64(r), 16)\n\t\t\t}\n\t\t\tin = in[n:]\n\t\tcase r >= utf8.RuneSelf && (outputASCII || r <= 0x009f):\n\t\t\tout = append(out, '\\\\')\n\t\t\tif r <= math.MaxUint16 {\n\t\t\t\tout = append(out, 'u')\n\t\t\t\tout = append(out, \"0000\"[1+(bits.Len32(uint32(r))-1)/4:]...)\n\t\t\t\tout = strconv.AppendUint(out, uint64(r), 16)\n\t\t\t} else {\n\t\t\t\tout = append(out, 'U')\n\t\t\t\tout = append(out, \"00000000\"[1+(bits.Len32(uint32(r))-1)/4:]...)\n\t\t\t\tout = strconv.AppendUint(out, uint64(r), 16)\n\t\t\t}\n\t\t\tin = in[n:]\n\t\tdefault:\n\t\t\ti := indexNeedEscapeInString(in[n:])\n\t\t\tin, out = in[n+i:], append(out, in[:n+i]...)\n\t\t}\n\t}\n\tout = append(out, '\"')\n\treturn out\n}\n\n// indexNeedEscapeInString returns the index of the character that needs\n// escaping. If no characters need escaping, this returns the input length.\nfunc indexNeedEscapeInString(s string) int {\n\tfor i := 0; i < len(s); i++ {\n\t\tif c := s[i]; c < ' ' || c == '\"' || c == '\\'' || c == '\\\\' || c >= 0x7f {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn len(s)\n}\n\n// WriteFloat writes out the given float value for given bitSize.\nfunc (e *Encoder) WriteFloat(n float64, bitSize int) {\n\te.prepareNext(scalar)\n\te.out = appendFloat(e.out, n, bitSize)\n}\n\nfunc appendFloat(out []byte, n float64, bitSize int) []byte {\n\tswitch {\n\tcase math.IsNaN(n):\n\t\treturn append(out, \"nan\"...)\n\tcase math.IsInf(n, +1):\n\t\treturn append(out, \"inf\"...)\n\tcase math.IsInf(n, -1):\n\t\treturn append(out, \"-inf\"...)\n\tdefault:\n\t\treturn strconv.AppendFloat(out, n, 'g', -1, bitSize)\n\t}\n}\n\n// WriteInt writes out the given signed integer value.\nfunc (e *Encoder) WriteInt(n int64) {\n\te.prepareNext(scalar)\n\te.out = append(e.out, strconv.FormatInt(n, 10)...)\n}\n\n// WriteUint writes out the given unsigned integer value.\nfunc (e *Encoder) WriteUint(n uint64) {\n\te.prepareNext(scalar)\n\te.out = append(e.out, strconv.FormatUint(n, 10)...)\n}\n\n// WriteLiteral writes out the given string as a literal value without quotes.\n// This is used for writing enum literal strings.\nfunc (e *Encoder) WriteLiteral(s string) {\n\te.prepareNext(scalar)\n\te.out = append(e.out, s...)\n}\n\n// prepareNext adds possible space and indentation for the next value based\n// on last encType and indent option. It also updates e.lastType to next.\nfunc (e *Encoder) prepareNext(next encType) {\n\tdefer func() {\n\t\te.lastType = next\n\t}()\n\n\t// Single line.\n\tif len(e.indent) == 0 {\n\t\t// Add space after each field before the next one.\n\t\tif e.lastType&(scalar|messageClose) != 0 && next == name {\n\t\t\te.out = append(e.out, ' ')\n\t\t\t// Add a random extra space to make output unstable.\n\t\t\tif detrand.Bool() {\n\t\t\t\te.out = append(e.out, ' ')\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\t// Multi-line.\n\tswitch {\n\tcase e.lastType == name:\n\t\te.out = append(e.out, ' ')\n\t\t// Add a random extra space after name: to make output unstable.\n\t\tif detrand.Bool() {\n\t\t\te.out = append(e.out, ' ')\n\t\t}\n\n\tcase e.lastType == messageOpen && next != messageClose:\n\t\te.indents = append(e.indents, e.indent...)\n\t\te.out = append(e.out, '\\n')\n\t\te.out = append(e.out, e.indents...)\n\n\tcase e.lastType&(scalar|messageClose) != 0:\n\t\tif next == messageClose {\n\t\t\te.indents = e.indents[:len(e.indents)-len(e.indent)]\n\t\t}\n\t\te.out = append(e.out, '\\n')\n\t\te.out = append(e.out, e.indents...)\n\t}\n}\n\n// Snapshot returns the current snapshot for use in Reset.\nfunc (e *Encoder) Snapshot() encoderState {\n\treturn e.encoderState\n}\n\n// Reset resets the Encoder to the given encoderState from a Snapshot.\nfunc (e *Encoder) Reset(es encoderState) {\n\te.encoderState = es\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/errors/errors.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 errors implements functions to manipulate errors.\npackage errors\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\n\t\"google.golang.org/protobuf/internal/detrand\"\n)\n\n// Error is a sentinel matching all errors produced by this package.\nvar Error = errors.New(\"protobuf error\")\n\n// New formats a string according to the format specifier and arguments and\n// returns an error that has a \"proto\" prefix.\nfunc New(f string, x ...interface{}) error {\n\treturn &prefixError{s: format(f, x...)}\n}\n\ntype prefixError struct{ s string }\n\nvar prefix = func() string {\n\t// Deliberately introduce instability into the error message string to\n\t// discourage users from performing error string comparisons.\n\tif detrand.Bool() {\n\t\treturn \"proto: \" // use non-breaking spaces (U+00a0)\n\t} else {\n\t\treturn \"proto: \" // use regular spaces (U+0020)\n\t}\n}()\n\nfunc (e *prefixError) Error() string {\n\treturn prefix + e.s\n}\n\nfunc (e *prefixError) Unwrap() error {\n\treturn Error\n}\n\n// Wrap returns an error that has a \"proto\" prefix, the formatted string described\n// by the format specifier and arguments, and a suffix of err. The error wraps err.\nfunc Wrap(err error, f string, x ...interface{}) error {\n\treturn &wrapError{\n\t\ts:   format(f, x...),\n\t\terr: err,\n\t}\n}\n\ntype wrapError struct {\n\ts   string\n\terr error\n}\n\nfunc (e *wrapError) Error() string {\n\treturn format(\"%v%v: %v\", prefix, e.s, e.err)\n}\n\nfunc (e *wrapError) Unwrap() error {\n\treturn e.err\n}\n\nfunc (e *wrapError) Is(target error) bool {\n\treturn target == Error\n}\n\nfunc format(f string, x ...interface{}) string {\n\t// avoid \"proto: \" prefix when chaining\n\tfor i := 0; i < len(x); i++ {\n\t\tswitch e := x[i].(type) {\n\t\tcase *prefixError:\n\t\t\tx[i] = e.s\n\t\tcase *wrapError:\n\t\t\tx[i] = format(\"%v: %v\", e.s, e.err)\n\t\t}\n\t}\n\treturn fmt.Sprintf(f, x...)\n}\n\nfunc InvalidUTF8(name string) error {\n\treturn New(\"field %v contains invalid UTF-8\", name)\n}\n\nfunc RequiredNotSet(name string) error {\n\treturn New(\"required field %v not set\", name)\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/errors/is_go112.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\n// +build !go1.13\n\npackage errors\n\nimport \"reflect\"\n\n// Is is a copy of Go 1.13's errors.Is for use with older Go versions.\nfunc Is(err, target error) bool {\n\tif target == nil {\n\t\treturn err == target\n\t}\n\n\tisComparable := reflect.TypeOf(target).Comparable()\n\tfor {\n\t\tif isComparable && err == target {\n\t\t\treturn true\n\t\t}\n\t\tif x, ok := err.(interface{ Is(error) bool }); ok && x.Is(target) {\n\t\t\treturn true\n\t\t}\n\t\tif err = unwrap(err); err == nil {\n\t\t\treturn false\n\t\t}\n\t}\n}\n\nfunc unwrap(err error) error {\n\tu, ok := err.(interface {\n\t\tUnwrap() error\n\t})\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn u.Unwrap()\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/errors/is_go113.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\n// +build go1.13\n\npackage errors\n\nimport \"errors\"\n\n// Is is errors.Is.\nfunc Is(err, target error) bool { return errors.Is(err, target) }\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/filedesc/build.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 filedesc provides functionality for constructing descriptors.\n//\n// The types in this package implement interfaces in the protoreflect package\n// related to protobuf descripriptors.\npackage filedesc\n\nimport (\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// Builder construct a protoreflect.FileDescriptor from the raw descriptor.\ntype Builder struct {\n\t// GoPackagePath is the Go package path that is invoking this builder.\n\tGoPackagePath string\n\n\t// RawDescriptor is the wire-encoded bytes of FileDescriptorProto\n\t// and must be populated.\n\tRawDescriptor []byte\n\n\t// NumEnums is the total number of enums declared in the file.\n\tNumEnums int32\n\t// NumMessages is the total number of messages declared in the file.\n\t// It includes the implicit message declarations for map entries.\n\tNumMessages int32\n\t// NumExtensions is the total number of extensions declared in the file.\n\tNumExtensions int32\n\t// NumServices is the total number of services declared in the file.\n\tNumServices int32\n\n\t// TypeResolver resolves extension field types for descriptor options.\n\t// If nil, it uses protoregistry.GlobalTypes.\n\tTypeResolver interface {\n\t\tpreg.ExtensionTypeResolver\n\t}\n\n\t// FileRegistry is use to lookup file, enum, and message dependencies.\n\t// Once constructed, the file descriptor is registered here.\n\t// If nil, it uses protoregistry.GlobalFiles.\n\tFileRegistry interface {\n\t\tFindFileByPath(string) (protoreflect.FileDescriptor, error)\n\t\tFindDescriptorByName(pref.FullName) (pref.Descriptor, error)\n\t\tRegisterFile(pref.FileDescriptor) error\n\t}\n}\n\n// resolverByIndex is an interface Builder.FileRegistry may implement.\n// If so, it permits looking up an enum or message dependency based on the\n// sub-list and element index into filetype.Builder.DependencyIndexes.\ntype resolverByIndex interface {\n\tFindEnumByIndex(int32, int32, []Enum, []Message) pref.EnumDescriptor\n\tFindMessageByIndex(int32, int32, []Enum, []Message) pref.MessageDescriptor\n}\n\n// Indexes of each sub-list in filetype.Builder.DependencyIndexes.\nconst (\n\tlistFieldDeps int32 = iota\n\tlistExtTargets\n\tlistExtDeps\n\tlistMethInDeps\n\tlistMethOutDeps\n)\n\n// Out is the output of the Builder.\ntype Out struct {\n\tFile pref.FileDescriptor\n\n\t// Enums is all enum descriptors in \"flattened ordering\".\n\tEnums []Enum\n\t// Messages is all message descriptors in \"flattened ordering\".\n\t// It includes the implicit message declarations for map entries.\n\tMessages []Message\n\t// Extensions is all extension descriptors in \"flattened ordering\".\n\tExtensions []Extension\n\t// Service is all service descriptors in \"flattened ordering\".\n\tServices []Service\n}\n\n// Build constructs a FileDescriptor given the parameters set in Builder.\n// It assumes that the inputs are well-formed and panics if any inconsistencies\n// are encountered.\n//\n// If NumEnums+NumMessages+NumExtensions+NumServices is zero,\n// then Build automatically derives them from the raw descriptor.\nfunc (db Builder) Build() (out Out) {\n\t// Populate the counts if uninitialized.\n\tif db.NumEnums+db.NumMessages+db.NumExtensions+db.NumServices == 0 {\n\t\tdb.unmarshalCounts(db.RawDescriptor, true)\n\t}\n\n\t// Initialize resolvers and registries if unpopulated.\n\tif db.TypeResolver == nil {\n\t\tdb.TypeResolver = preg.GlobalTypes\n\t}\n\tif db.FileRegistry == nil {\n\t\tdb.FileRegistry = preg.GlobalFiles\n\t}\n\n\tfd := newRawFile(db)\n\tout.File = fd\n\tout.Enums = fd.allEnums\n\tout.Messages = fd.allMessages\n\tout.Extensions = fd.allExtensions\n\tout.Services = fd.allServices\n\n\tif err := db.FileRegistry.RegisterFile(fd); err != nil {\n\t\tpanic(err)\n\t}\n\treturn out\n}\n\n// unmarshalCounts counts the number of enum, message, extension, and service\n// declarations in the raw message, which is either a FileDescriptorProto\n// or a MessageDescriptorProto depending on whether isFile is set.\nfunc (db *Builder) unmarshalCounts(b []byte, isFile bool) {\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tif isFile {\n\t\t\t\tswitch num {\n\t\t\t\tcase genid.FileDescriptorProto_EnumType_field_number:\n\t\t\t\t\tdb.NumEnums++\n\t\t\t\tcase genid.FileDescriptorProto_MessageType_field_number:\n\t\t\t\t\tdb.unmarshalCounts(v, false)\n\t\t\t\t\tdb.NumMessages++\n\t\t\t\tcase genid.FileDescriptorProto_Extension_field_number:\n\t\t\t\t\tdb.NumExtensions++\n\t\t\t\tcase genid.FileDescriptorProto_Service_field_number:\n\t\t\t\t\tdb.NumServices++\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tswitch num {\n\t\t\t\tcase genid.DescriptorProto_EnumType_field_number:\n\t\t\t\t\tdb.NumEnums++\n\t\t\t\tcase genid.DescriptorProto_NestedType_field_number:\n\t\t\t\t\tdb.unmarshalCounts(v, false)\n\t\t\t\t\tdb.NumMessages++\n\t\t\t\tcase genid.DescriptorProto_Extension_field_number:\n\t\t\t\t\tdb.NumExtensions++\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/filedesc/desc.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 filedesc\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"sync\"\n\t\"sync/atomic\"\n\n\t\"google.golang.org/protobuf/internal/descfmt\"\n\t\"google.golang.org/protobuf/internal/descopts\"\n\t\"google.golang.org/protobuf/internal/encoding/defval\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// The types in this file may have a suffix:\n//\t• L0: Contains fields common to all descriptors (except File) and\n//\tmust be initialized up front.\n//\t• L1: Contains fields specific to a descriptor and\n//\tmust be initialized up front.\n//\t• L2: Contains fields that are lazily initialized when constructing\n//\tfrom the raw file descriptor. When constructing as a literal, the L2\n//\tfields must be initialized up front.\n//\n// The types are exported so that packages like reflect/protodesc can\n// directly construct descriptors.\n\ntype (\n\tFile struct {\n\t\tfileRaw\n\t\tL1 FileL1\n\n\t\tonce uint32     // atomically set if L2 is valid\n\t\tmu   sync.Mutex // protects L2\n\t\tL2   *FileL2\n\t}\n\tFileL1 struct {\n\t\tSyntax  pref.Syntax\n\t\tPath    string\n\t\tPackage pref.FullName\n\n\t\tEnums      Enums\n\t\tMessages   Messages\n\t\tExtensions Extensions\n\t\tServices   Services\n\t}\n\tFileL2 struct {\n\t\tOptions   func() pref.ProtoMessage\n\t\tImports   FileImports\n\t\tLocations SourceLocations\n\t}\n)\n\nfunc (fd *File) ParentFile() pref.FileDescriptor { return fd }\nfunc (fd *File) Parent() pref.Descriptor         { return nil }\nfunc (fd *File) Index() int                      { return 0 }\nfunc (fd *File) Syntax() pref.Syntax             { return fd.L1.Syntax }\nfunc (fd *File) Name() pref.Name                 { return fd.L1.Package.Name() }\nfunc (fd *File) FullName() pref.FullName         { return fd.L1.Package }\nfunc (fd *File) IsPlaceholder() bool             { return false }\nfunc (fd *File) Options() pref.ProtoMessage {\n\tif f := fd.lazyInit().Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.File\n}\nfunc (fd *File) Path() string                          { return fd.L1.Path }\nfunc (fd *File) Package() pref.FullName                { return fd.L1.Package }\nfunc (fd *File) Imports() pref.FileImports             { return &fd.lazyInit().Imports }\nfunc (fd *File) Enums() pref.EnumDescriptors           { return &fd.L1.Enums }\nfunc (fd *File) Messages() pref.MessageDescriptors     { return &fd.L1.Messages }\nfunc (fd *File) Extensions() pref.ExtensionDescriptors { return &fd.L1.Extensions }\nfunc (fd *File) Services() pref.ServiceDescriptors     { return &fd.L1.Services }\nfunc (fd *File) SourceLocations() pref.SourceLocations { return &fd.lazyInit().Locations }\nfunc (fd *File) Format(s fmt.State, r rune)            { descfmt.FormatDesc(s, r, fd) }\nfunc (fd *File) ProtoType(pref.FileDescriptor)         {}\nfunc (fd *File) ProtoInternal(pragma.DoNotImplement)   {}\n\nfunc (fd *File) lazyInit() *FileL2 {\n\tif atomic.LoadUint32(&fd.once) == 0 {\n\t\tfd.lazyInitOnce()\n\t}\n\treturn fd.L2\n}\n\nfunc (fd *File) lazyInitOnce() {\n\tfd.mu.Lock()\n\tif fd.L2 == nil {\n\t\tfd.lazyRawInit() // recursively initializes all L2 structures\n\t}\n\tatomic.StoreUint32(&fd.once, 1)\n\tfd.mu.Unlock()\n}\n\n// GoPackagePath is a pseudo-internal API for determining the Go package path\n// that this file descriptor is declared in.\n//\n// WARNING: This method is exempt from the compatibility promise and may be\n// removed in the future without warning.\nfunc (fd *File) GoPackagePath() string {\n\treturn fd.builder.GoPackagePath\n}\n\ntype (\n\tEnum struct {\n\t\tBase\n\t\tL1 EnumL1\n\t\tL2 *EnumL2 // protected by fileDesc.once\n\t}\n\tEnumL1 struct {\n\t\teagerValues bool // controls whether EnumL2.Values is already populated\n\t}\n\tEnumL2 struct {\n\t\tOptions        func() pref.ProtoMessage\n\t\tValues         EnumValues\n\t\tReservedNames  Names\n\t\tReservedRanges EnumRanges\n\t}\n\n\tEnumValue struct {\n\t\tBase\n\t\tL1 EnumValueL1\n\t}\n\tEnumValueL1 struct {\n\t\tOptions func() pref.ProtoMessage\n\t\tNumber  pref.EnumNumber\n\t}\n)\n\nfunc (ed *Enum) Options() pref.ProtoMessage {\n\tif f := ed.lazyInit().Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.Enum\n}\nfunc (ed *Enum) Values() pref.EnumValueDescriptors {\n\tif ed.L1.eagerValues {\n\t\treturn &ed.L2.Values\n\t}\n\treturn &ed.lazyInit().Values\n}\nfunc (ed *Enum) ReservedNames() pref.Names       { return &ed.lazyInit().ReservedNames }\nfunc (ed *Enum) ReservedRanges() pref.EnumRanges { return &ed.lazyInit().ReservedRanges }\nfunc (ed *Enum) Format(s fmt.State, r rune)      { descfmt.FormatDesc(s, r, ed) }\nfunc (ed *Enum) ProtoType(pref.EnumDescriptor)   {}\nfunc (ed *Enum) lazyInit() *EnumL2 {\n\ted.L0.ParentFile.lazyInit() // implicitly initializes L2\n\treturn ed.L2\n}\n\nfunc (ed *EnumValue) Options() pref.ProtoMessage {\n\tif f := ed.L1.Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.EnumValue\n}\nfunc (ed *EnumValue) Number() pref.EnumNumber            { return ed.L1.Number }\nfunc (ed *EnumValue) Format(s fmt.State, r rune)         { descfmt.FormatDesc(s, r, ed) }\nfunc (ed *EnumValue) ProtoType(pref.EnumValueDescriptor) {}\n\ntype (\n\tMessage struct {\n\t\tBase\n\t\tL1 MessageL1\n\t\tL2 *MessageL2 // protected by fileDesc.once\n\t}\n\tMessageL1 struct {\n\t\tEnums        Enums\n\t\tMessages     Messages\n\t\tExtensions   Extensions\n\t\tIsMapEntry   bool // promoted from google.protobuf.MessageOptions\n\t\tIsMessageSet bool // promoted from google.protobuf.MessageOptions\n\t}\n\tMessageL2 struct {\n\t\tOptions               func() pref.ProtoMessage\n\t\tFields                Fields\n\t\tOneofs                Oneofs\n\t\tReservedNames         Names\n\t\tReservedRanges        FieldRanges\n\t\tRequiredNumbers       FieldNumbers // must be consistent with Fields.Cardinality\n\t\tExtensionRanges       FieldRanges\n\t\tExtensionRangeOptions []func() pref.ProtoMessage // must be same length as ExtensionRanges\n\t}\n\n\tField struct {\n\t\tBase\n\t\tL1 FieldL1\n\t}\n\tFieldL1 struct {\n\t\tOptions          func() pref.ProtoMessage\n\t\tNumber           pref.FieldNumber\n\t\tCardinality      pref.Cardinality // must be consistent with Message.RequiredNumbers\n\t\tKind             pref.Kind\n\t\tStringName       stringName\n\t\tIsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto\n\t\tIsWeak           bool // promoted from google.protobuf.FieldOptions\n\t\tHasPacked        bool // promoted from google.protobuf.FieldOptions\n\t\tIsPacked         bool // promoted from google.protobuf.FieldOptions\n\t\tHasEnforceUTF8   bool // promoted from google.protobuf.FieldOptions\n\t\tEnforceUTF8      bool // promoted from google.protobuf.FieldOptions\n\t\tDefault          defaultValue\n\t\tContainingOneof  pref.OneofDescriptor // must be consistent with Message.Oneofs.Fields\n\t\tEnum             pref.EnumDescriptor\n\t\tMessage          pref.MessageDescriptor\n\t}\n\n\tOneof struct {\n\t\tBase\n\t\tL1 OneofL1\n\t}\n\tOneofL1 struct {\n\t\tOptions func() pref.ProtoMessage\n\t\tFields  OneofFields // must be consistent with Message.Fields.ContainingOneof\n\t}\n)\n\nfunc (md *Message) Options() pref.ProtoMessage {\n\tif f := md.lazyInit().Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.Message\n}\nfunc (md *Message) IsMapEntry() bool                   { return md.L1.IsMapEntry }\nfunc (md *Message) Fields() pref.FieldDescriptors      { return &md.lazyInit().Fields }\nfunc (md *Message) Oneofs() pref.OneofDescriptors      { return &md.lazyInit().Oneofs }\nfunc (md *Message) ReservedNames() pref.Names          { return &md.lazyInit().ReservedNames }\nfunc (md *Message) ReservedRanges() pref.FieldRanges   { return &md.lazyInit().ReservedRanges }\nfunc (md *Message) RequiredNumbers() pref.FieldNumbers { return &md.lazyInit().RequiredNumbers }\nfunc (md *Message) ExtensionRanges() pref.FieldRanges  { return &md.lazyInit().ExtensionRanges }\nfunc (md *Message) ExtensionRangeOptions(i int) pref.ProtoMessage {\n\tif f := md.lazyInit().ExtensionRangeOptions[i]; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.ExtensionRange\n}\nfunc (md *Message) Enums() pref.EnumDescriptors           { return &md.L1.Enums }\nfunc (md *Message) Messages() pref.MessageDescriptors     { return &md.L1.Messages }\nfunc (md *Message) Extensions() pref.ExtensionDescriptors { return &md.L1.Extensions }\nfunc (md *Message) ProtoType(pref.MessageDescriptor)      {}\nfunc (md *Message) Format(s fmt.State, r rune)            { descfmt.FormatDesc(s, r, md) }\nfunc (md *Message) lazyInit() *MessageL2 {\n\tmd.L0.ParentFile.lazyInit() // implicitly initializes L2\n\treturn md.L2\n}\n\n// IsMessageSet is a pseudo-internal API for checking whether a message\n// should serialize in the proto1 message format.\n//\n// WARNING: This method is exempt from the compatibility promise and may be\n// removed in the future without warning.\nfunc (md *Message) IsMessageSet() bool {\n\treturn md.L1.IsMessageSet\n}\n\nfunc (fd *Field) Options() pref.ProtoMessage {\n\tif f := fd.L1.Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.Field\n}\nfunc (fd *Field) Number() pref.FieldNumber      { return fd.L1.Number }\nfunc (fd *Field) Cardinality() pref.Cardinality { return fd.L1.Cardinality }\nfunc (fd *Field) Kind() pref.Kind               { return fd.L1.Kind }\nfunc (fd *Field) HasJSONName() bool             { return fd.L1.StringName.hasJSON }\nfunc (fd *Field) JSONName() string              { return fd.L1.StringName.getJSON(fd) }\nfunc (fd *Field) TextName() string              { return fd.L1.StringName.getText(fd) }\nfunc (fd *Field) HasPresence() bool {\n\treturn fd.L1.Cardinality != pref.Repeated && (fd.L0.ParentFile.L1.Syntax == pref.Proto2 || fd.L1.Message != nil || fd.L1.ContainingOneof != nil)\n}\nfunc (fd *Field) HasOptionalKeyword() bool {\n\treturn (fd.L0.ParentFile.L1.Syntax == pref.Proto2 && fd.L1.Cardinality == pref.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional\n}\nfunc (fd *Field) IsPacked() bool {\n\tif !fd.L1.HasPacked && fd.L0.ParentFile.L1.Syntax != pref.Proto2 && fd.L1.Cardinality == pref.Repeated {\n\t\tswitch fd.L1.Kind {\n\t\tcase pref.StringKind, pref.BytesKind, pref.MessageKind, pref.GroupKind:\n\t\tdefault:\n\t\t\treturn true\n\t\t}\n\t}\n\treturn fd.L1.IsPacked\n}\nfunc (fd *Field) IsExtension() bool { return false }\nfunc (fd *Field) IsWeak() bool      { return fd.L1.IsWeak }\nfunc (fd *Field) IsList() bool      { return fd.Cardinality() == pref.Repeated && !fd.IsMap() }\nfunc (fd *Field) IsMap() bool       { return fd.Message() != nil && fd.Message().IsMapEntry() }\nfunc (fd *Field) MapKey() pref.FieldDescriptor {\n\tif !fd.IsMap() {\n\t\treturn nil\n\t}\n\treturn fd.Message().Fields().ByNumber(genid.MapEntry_Key_field_number)\n}\nfunc (fd *Field) MapValue() pref.FieldDescriptor {\n\tif !fd.IsMap() {\n\t\treturn nil\n\t}\n\treturn fd.Message().Fields().ByNumber(genid.MapEntry_Value_field_number)\n}\nfunc (fd *Field) HasDefault() bool                           { return fd.L1.Default.has }\nfunc (fd *Field) Default() pref.Value                        { return fd.L1.Default.get(fd) }\nfunc (fd *Field) DefaultEnumValue() pref.EnumValueDescriptor { return fd.L1.Default.enum }\nfunc (fd *Field) ContainingOneof() pref.OneofDescriptor      { return fd.L1.ContainingOneof }\nfunc (fd *Field) ContainingMessage() pref.MessageDescriptor {\n\treturn fd.L0.Parent.(pref.MessageDescriptor)\n}\nfunc (fd *Field) Enum() pref.EnumDescriptor {\n\treturn fd.L1.Enum\n}\nfunc (fd *Field) Message() pref.MessageDescriptor {\n\tif fd.L1.IsWeak {\n\t\tif d, _ := protoregistry.GlobalFiles.FindDescriptorByName(fd.L1.Message.FullName()); d != nil {\n\t\t\treturn d.(pref.MessageDescriptor)\n\t\t}\n\t}\n\treturn fd.L1.Message\n}\nfunc (fd *Field) Format(s fmt.State, r rune)     { descfmt.FormatDesc(s, r, fd) }\nfunc (fd *Field) ProtoType(pref.FieldDescriptor) {}\n\n// EnforceUTF8 is a pseudo-internal API to determine whether to enforce UTF-8\n// validation for the string field. This exists for Google-internal use only\n// since proto3 did not enforce UTF-8 validity prior to the open-source release.\n// If this method does not exist, the default is to enforce valid UTF-8.\n//\n// WARNING: This method is exempt from the compatibility promise and may be\n// removed in the future without warning.\nfunc (fd *Field) EnforceUTF8() bool {\n\tif fd.L1.HasEnforceUTF8 {\n\t\treturn fd.L1.EnforceUTF8\n\t}\n\treturn fd.L0.ParentFile.L1.Syntax == pref.Proto3\n}\n\nfunc (od *Oneof) IsSynthetic() bool {\n\treturn od.L0.ParentFile.L1.Syntax == pref.Proto3 && len(od.L1.Fields.List) == 1 && od.L1.Fields.List[0].HasOptionalKeyword()\n}\nfunc (od *Oneof) Options() pref.ProtoMessage {\n\tif f := od.L1.Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.Oneof\n}\nfunc (od *Oneof) Fields() pref.FieldDescriptors  { return &od.L1.Fields }\nfunc (od *Oneof) Format(s fmt.State, r rune)     { descfmt.FormatDesc(s, r, od) }\nfunc (od *Oneof) ProtoType(pref.OneofDescriptor) {}\n\ntype (\n\tExtension struct {\n\t\tBase\n\t\tL1 ExtensionL1\n\t\tL2 *ExtensionL2 // protected by fileDesc.once\n\t}\n\tExtensionL1 struct {\n\t\tNumber      pref.FieldNumber\n\t\tExtendee    pref.MessageDescriptor\n\t\tCardinality pref.Cardinality\n\t\tKind        pref.Kind\n\t}\n\tExtensionL2 struct {\n\t\tOptions          func() pref.ProtoMessage\n\t\tStringName       stringName\n\t\tIsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto\n\t\tIsPacked         bool // promoted from google.protobuf.FieldOptions\n\t\tDefault          defaultValue\n\t\tEnum             pref.EnumDescriptor\n\t\tMessage          pref.MessageDescriptor\n\t}\n)\n\nfunc (xd *Extension) Options() pref.ProtoMessage {\n\tif f := xd.lazyInit().Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.Field\n}\nfunc (xd *Extension) Number() pref.FieldNumber      { return xd.L1.Number }\nfunc (xd *Extension) Cardinality() pref.Cardinality { return xd.L1.Cardinality }\nfunc (xd *Extension) Kind() pref.Kind               { return xd.L1.Kind }\nfunc (xd *Extension) HasJSONName() bool             { return xd.lazyInit().StringName.hasJSON }\nfunc (xd *Extension) JSONName() string              { return xd.lazyInit().StringName.getJSON(xd) }\nfunc (xd *Extension) TextName() string              { return xd.lazyInit().StringName.getText(xd) }\nfunc (xd *Extension) HasPresence() bool             { return xd.L1.Cardinality != pref.Repeated }\nfunc (xd *Extension) HasOptionalKeyword() bool {\n\treturn (xd.L0.ParentFile.L1.Syntax == pref.Proto2 && xd.L1.Cardinality == pref.Optional) || xd.lazyInit().IsProto3Optional\n}\nfunc (xd *Extension) IsPacked() bool                             { return xd.lazyInit().IsPacked }\nfunc (xd *Extension) IsExtension() bool                          { return true }\nfunc (xd *Extension) IsWeak() bool                               { return false }\nfunc (xd *Extension) IsList() bool                               { return xd.Cardinality() == pref.Repeated }\nfunc (xd *Extension) IsMap() bool                                { return false }\nfunc (xd *Extension) MapKey() pref.FieldDescriptor               { return nil }\nfunc (xd *Extension) MapValue() pref.FieldDescriptor             { return nil }\nfunc (xd *Extension) HasDefault() bool                           { return xd.lazyInit().Default.has }\nfunc (xd *Extension) Default() pref.Value                        { return xd.lazyInit().Default.get(xd) }\nfunc (xd *Extension) DefaultEnumValue() pref.EnumValueDescriptor { return xd.lazyInit().Default.enum }\nfunc (xd *Extension) ContainingOneof() pref.OneofDescriptor      { return nil }\nfunc (xd *Extension) ContainingMessage() pref.MessageDescriptor  { return xd.L1.Extendee }\nfunc (xd *Extension) Enum() pref.EnumDescriptor                  { return xd.lazyInit().Enum }\nfunc (xd *Extension) Message() pref.MessageDescriptor            { return xd.lazyInit().Message }\nfunc (xd *Extension) Format(s fmt.State, r rune)                 { descfmt.FormatDesc(s, r, xd) }\nfunc (xd *Extension) ProtoType(pref.FieldDescriptor)             {}\nfunc (xd *Extension) ProtoInternal(pragma.DoNotImplement)        {}\nfunc (xd *Extension) lazyInit() *ExtensionL2 {\n\txd.L0.ParentFile.lazyInit() // implicitly initializes L2\n\treturn xd.L2\n}\n\ntype (\n\tService struct {\n\t\tBase\n\t\tL1 ServiceL1\n\t\tL2 *ServiceL2 // protected by fileDesc.once\n\t}\n\tServiceL1 struct{}\n\tServiceL2 struct {\n\t\tOptions func() pref.ProtoMessage\n\t\tMethods Methods\n\t}\n\n\tMethod struct {\n\t\tBase\n\t\tL1 MethodL1\n\t}\n\tMethodL1 struct {\n\t\tOptions           func() pref.ProtoMessage\n\t\tInput             pref.MessageDescriptor\n\t\tOutput            pref.MessageDescriptor\n\t\tIsStreamingClient bool\n\t\tIsStreamingServer bool\n\t}\n)\n\nfunc (sd *Service) Options() pref.ProtoMessage {\n\tif f := sd.lazyInit().Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.Service\n}\nfunc (sd *Service) Methods() pref.MethodDescriptors     { return &sd.lazyInit().Methods }\nfunc (sd *Service) Format(s fmt.State, r rune)          { descfmt.FormatDesc(s, r, sd) }\nfunc (sd *Service) ProtoType(pref.ServiceDescriptor)    {}\nfunc (sd *Service) ProtoInternal(pragma.DoNotImplement) {}\nfunc (sd *Service) lazyInit() *ServiceL2 {\n\tsd.L0.ParentFile.lazyInit() // implicitly initializes L2\n\treturn sd.L2\n}\n\nfunc (md *Method) Options() pref.ProtoMessage {\n\tif f := md.L1.Options; f != nil {\n\t\treturn f()\n\t}\n\treturn descopts.Method\n}\nfunc (md *Method) Input() pref.MessageDescriptor       { return md.L1.Input }\nfunc (md *Method) Output() pref.MessageDescriptor      { return md.L1.Output }\nfunc (md *Method) IsStreamingClient() bool             { return md.L1.IsStreamingClient }\nfunc (md *Method) IsStreamingServer() bool             { return md.L1.IsStreamingServer }\nfunc (md *Method) Format(s fmt.State, r rune)          { descfmt.FormatDesc(s, r, md) }\nfunc (md *Method) ProtoType(pref.MethodDescriptor)     {}\nfunc (md *Method) ProtoInternal(pragma.DoNotImplement) {}\n\n// Surrogate files are can be used to create standalone descriptors\n// where the syntax is only information derived from the parent file.\nvar (\n\tSurrogateProto2 = &File{L1: FileL1{Syntax: pref.Proto2}, L2: &FileL2{}}\n\tSurrogateProto3 = &File{L1: FileL1{Syntax: pref.Proto3}, L2: &FileL2{}}\n)\n\ntype (\n\tBase struct {\n\t\tL0 BaseL0\n\t}\n\tBaseL0 struct {\n\t\tFullName   pref.FullName // must be populated\n\t\tParentFile *File         // must be populated\n\t\tParent     pref.Descriptor\n\t\tIndex      int\n\t}\n)\n\nfunc (d *Base) Name() pref.Name         { return d.L0.FullName.Name() }\nfunc (d *Base) FullName() pref.FullName { return d.L0.FullName }\nfunc (d *Base) ParentFile() pref.FileDescriptor {\n\tif d.L0.ParentFile == SurrogateProto2 || d.L0.ParentFile == SurrogateProto3 {\n\t\treturn nil // surrogate files are not real parents\n\t}\n\treturn d.L0.ParentFile\n}\nfunc (d *Base) Parent() pref.Descriptor             { return d.L0.Parent }\nfunc (d *Base) Index() int                          { return d.L0.Index }\nfunc (d *Base) Syntax() pref.Syntax                 { return d.L0.ParentFile.Syntax() }\nfunc (d *Base) IsPlaceholder() bool                 { return false }\nfunc (d *Base) ProtoInternal(pragma.DoNotImplement) {}\n\ntype stringName struct {\n\thasJSON  bool\n\tonce     sync.Once\n\tnameJSON string\n\tnameText string\n}\n\n// InitJSON initializes the name. It is exported for use by other internal packages.\nfunc (s *stringName) InitJSON(name string) {\n\ts.hasJSON = true\n\ts.nameJSON = name\n}\n\nfunc (s *stringName) lazyInit(fd pref.FieldDescriptor) *stringName {\n\ts.once.Do(func() {\n\t\tif fd.IsExtension() {\n\t\t\t// For extensions, JSON and text are formatted the same way.\n\t\t\tvar name string\n\t\t\tif messageset.IsMessageSetExtension(fd) {\n\t\t\t\tname = string(\"[\" + fd.FullName().Parent() + \"]\")\n\t\t\t} else {\n\t\t\t\tname = string(\"[\" + fd.FullName() + \"]\")\n\t\t\t}\n\t\t\ts.nameJSON = name\n\t\t\ts.nameText = name\n\t\t} else {\n\t\t\t// Format the JSON name.\n\t\t\tif !s.hasJSON {\n\t\t\t\ts.nameJSON = strs.JSONCamelCase(string(fd.Name()))\n\t\t\t}\n\n\t\t\t// Format the text name.\n\t\t\ts.nameText = string(fd.Name())\n\t\t\tif fd.Kind() == pref.GroupKind {\n\t\t\t\ts.nameText = string(fd.Message().Name())\n\t\t\t}\n\t\t}\n\t})\n\treturn s\n}\n\nfunc (s *stringName) getJSON(fd pref.FieldDescriptor) string { return s.lazyInit(fd).nameJSON }\nfunc (s *stringName) getText(fd pref.FieldDescriptor) string { return s.lazyInit(fd).nameText }\n\nfunc DefaultValue(v pref.Value, ev pref.EnumValueDescriptor) defaultValue {\n\tdv := defaultValue{has: v.IsValid(), val: v, enum: ev}\n\tif b, ok := v.Interface().([]byte); ok {\n\t\t// Store a copy of the default bytes, so that we can detect\n\t\t// accidental mutations of the original value.\n\t\tdv.bytes = append([]byte(nil), b...)\n\t}\n\treturn dv\n}\n\nfunc unmarshalDefault(b []byte, k pref.Kind, pf *File, ed pref.EnumDescriptor) defaultValue {\n\tvar evs pref.EnumValueDescriptors\n\tif k == pref.EnumKind {\n\t\t// If the enum is declared within the same file, be careful not to\n\t\t// blindly call the Values method, lest we bind ourselves in a deadlock.\n\t\tif e, ok := ed.(*Enum); ok && e.L0.ParentFile == pf {\n\t\t\tevs = &e.L2.Values\n\t\t} else {\n\t\t\tevs = ed.Values()\n\t\t}\n\n\t\t// If we are unable to resolve the enum dependency, use a placeholder\n\t\t// enum value since we will not be able to parse the default value.\n\t\tif ed.IsPlaceholder() && pref.Name(b).IsValid() {\n\t\t\tv := pref.ValueOfEnum(0)\n\t\t\tev := PlaceholderEnumValue(ed.FullName().Parent().Append(pref.Name(b)))\n\t\t\treturn DefaultValue(v, ev)\n\t\t}\n\t}\n\n\tv, ev, err := defval.Unmarshal(string(b), k, evs, defval.Descriptor)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn DefaultValue(v, ev)\n}\n\ntype defaultValue struct {\n\thas   bool\n\tval   pref.Value\n\tenum  pref.EnumValueDescriptor\n\tbytes []byte\n}\n\nfunc (dv *defaultValue) get(fd pref.FieldDescriptor) pref.Value {\n\t// Return the zero value as the default if unpopulated.\n\tif !dv.has {\n\t\tif fd.Cardinality() == pref.Repeated {\n\t\t\treturn pref.Value{}\n\t\t}\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\treturn pref.ValueOfBool(false)\n\t\tcase pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:\n\t\t\treturn pref.ValueOfInt32(0)\n\t\tcase pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:\n\t\t\treturn pref.ValueOfInt64(0)\n\t\tcase pref.Uint32Kind, pref.Fixed32Kind:\n\t\t\treturn pref.ValueOfUint32(0)\n\t\tcase pref.Uint64Kind, pref.Fixed64Kind:\n\t\t\treturn pref.ValueOfUint64(0)\n\t\tcase pref.FloatKind:\n\t\t\treturn pref.ValueOfFloat32(0)\n\t\tcase pref.DoubleKind:\n\t\t\treturn pref.ValueOfFloat64(0)\n\t\tcase pref.StringKind:\n\t\t\treturn pref.ValueOfString(\"\")\n\t\tcase pref.BytesKind:\n\t\t\treturn pref.ValueOfBytes(nil)\n\t\tcase pref.EnumKind:\n\t\t\tif evs := fd.Enum().Values(); evs.Len() > 0 {\n\t\t\t\treturn pref.ValueOfEnum(evs.Get(0).Number())\n\t\t\t}\n\t\t\treturn pref.ValueOfEnum(0)\n\t\t}\n\t}\n\n\tif len(dv.bytes) > 0 && !bytes.Equal(dv.bytes, dv.val.Bytes()) {\n\t\t// TODO: Avoid panic if we're running with the race detector\n\t\t// and instead spawn a goroutine that periodically resets\n\t\t// this value back to the original to induce a race.\n\t\tpanic(fmt.Sprintf(\"detected mutation on the default bytes for %v\", fd.FullName()))\n\t}\n\treturn dv.val\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/filedesc/desc_init.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 filedesc\n\nimport (\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// fileRaw is a data struct used when initializing a file descriptor from\n// a raw FileDescriptorProto.\ntype fileRaw struct {\n\tbuilder       Builder\n\tallEnums      []Enum\n\tallMessages   []Message\n\tallExtensions []Extension\n\tallServices   []Service\n}\n\nfunc newRawFile(db Builder) *File {\n\tfd := &File{fileRaw: fileRaw{builder: db}}\n\tfd.initDecls(db.NumEnums, db.NumMessages, db.NumExtensions, db.NumServices)\n\tfd.unmarshalSeed(db.RawDescriptor)\n\n\t// Extended message targets are eagerly resolved since registration\n\t// needs this information at program init time.\n\tfor i := range fd.allExtensions {\n\t\txd := &fd.allExtensions[i]\n\t\txd.L1.Extendee = fd.resolveMessageDependency(xd.L1.Extendee, listExtTargets, int32(i))\n\t}\n\n\tfd.checkDecls()\n\treturn fd\n}\n\n// initDecls pre-allocates slices for the exact number of enums, messages\n// (including map entries), extensions, and services declared in the proto file.\n// This is done to avoid regrowing the slice, which would change the address\n// for any previously seen declaration.\n//\n// The alloc methods \"allocates\" slices by pulling from the capacity.\nfunc (fd *File) initDecls(numEnums, numMessages, numExtensions, numServices int32) {\n\tfd.allEnums = make([]Enum, 0, numEnums)\n\tfd.allMessages = make([]Message, 0, numMessages)\n\tfd.allExtensions = make([]Extension, 0, numExtensions)\n\tfd.allServices = make([]Service, 0, numServices)\n}\n\nfunc (fd *File) allocEnums(n int) []Enum {\n\ttotal := len(fd.allEnums)\n\tes := fd.allEnums[total : total+n]\n\tfd.allEnums = fd.allEnums[:total+n]\n\treturn es\n}\nfunc (fd *File) allocMessages(n int) []Message {\n\ttotal := len(fd.allMessages)\n\tms := fd.allMessages[total : total+n]\n\tfd.allMessages = fd.allMessages[:total+n]\n\treturn ms\n}\nfunc (fd *File) allocExtensions(n int) []Extension {\n\ttotal := len(fd.allExtensions)\n\txs := fd.allExtensions[total : total+n]\n\tfd.allExtensions = fd.allExtensions[:total+n]\n\treturn xs\n}\nfunc (fd *File) allocServices(n int) []Service {\n\ttotal := len(fd.allServices)\n\txs := fd.allServices[total : total+n]\n\tfd.allServices = fd.allServices[:total+n]\n\treturn xs\n}\n\n// checkDecls performs a sanity check that the expected number of expected\n// declarations matches the number that were found in the descriptor proto.\nfunc (fd *File) checkDecls() {\n\tswitch {\n\tcase len(fd.allEnums) != cap(fd.allEnums):\n\tcase len(fd.allMessages) != cap(fd.allMessages):\n\tcase len(fd.allExtensions) != cap(fd.allExtensions):\n\tcase len(fd.allServices) != cap(fd.allServices):\n\tdefault:\n\t\treturn\n\t}\n\tpanic(\"mismatching cardinality\")\n}\n\nfunc (fd *File) unmarshalSeed(b []byte) {\n\tsb := getBuilder()\n\tdefer putBuilder(sb)\n\n\tvar prevField pref.FieldNumber\n\tvar numEnums, numMessages, numExtensions, numServices int\n\tvar posEnums, posMessages, posExtensions, posServices int\n\tb0 := b\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FileDescriptorProto_Syntax_field_number:\n\t\t\t\tswitch string(v) {\n\t\t\t\tcase \"proto2\":\n\t\t\t\t\tfd.L1.Syntax = pref.Proto2\n\t\t\t\tcase \"proto3\":\n\t\t\t\t\tfd.L1.Syntax = pref.Proto3\n\t\t\t\tdefault:\n\t\t\t\t\tpanic(\"invalid syntax\")\n\t\t\t\t}\n\t\t\tcase genid.FileDescriptorProto_Name_field_number:\n\t\t\t\tfd.L1.Path = sb.MakeString(v)\n\t\t\tcase genid.FileDescriptorProto_Package_field_number:\n\t\t\t\tfd.L1.Package = pref.FullName(sb.MakeString(v))\n\t\t\tcase genid.FileDescriptorProto_EnumType_field_number:\n\t\t\t\tif prevField != genid.FileDescriptorProto_EnumType_field_number {\n\t\t\t\t\tif numEnums > 0 {\n\t\t\t\t\t\tpanic(\"non-contiguous repeated field\")\n\t\t\t\t\t}\n\t\t\t\t\tposEnums = len(b0) - len(b) - n - m\n\t\t\t\t}\n\t\t\t\tnumEnums++\n\t\t\tcase genid.FileDescriptorProto_MessageType_field_number:\n\t\t\t\tif prevField != genid.FileDescriptorProto_MessageType_field_number {\n\t\t\t\t\tif numMessages > 0 {\n\t\t\t\t\t\tpanic(\"non-contiguous repeated field\")\n\t\t\t\t\t}\n\t\t\t\t\tposMessages = len(b0) - len(b) - n - m\n\t\t\t\t}\n\t\t\t\tnumMessages++\n\t\t\tcase genid.FileDescriptorProto_Extension_field_number:\n\t\t\t\tif prevField != genid.FileDescriptorProto_Extension_field_number {\n\t\t\t\t\tif numExtensions > 0 {\n\t\t\t\t\t\tpanic(\"non-contiguous repeated field\")\n\t\t\t\t\t}\n\t\t\t\t\tposExtensions = len(b0) - len(b) - n - m\n\t\t\t\t}\n\t\t\t\tnumExtensions++\n\t\t\tcase genid.FileDescriptorProto_Service_field_number:\n\t\t\t\tif prevField != genid.FileDescriptorProto_Service_field_number {\n\t\t\t\t\tif numServices > 0 {\n\t\t\t\t\t\tpanic(\"non-contiguous repeated field\")\n\t\t\t\t\t}\n\t\t\t\t\tposServices = len(b0) - len(b) - n - m\n\t\t\t\t}\n\t\t\t\tnumServices++\n\t\t\t}\n\t\t\tprevField = num\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t\tprevField = -1 // ignore known field numbers of unknown wire type\n\t\t}\n\t}\n\n\t// If syntax is missing, it is assumed to be proto2.\n\tif fd.L1.Syntax == 0 {\n\t\tfd.L1.Syntax = pref.Proto2\n\t}\n\n\t// Must allocate all declarations before parsing each descriptor type\n\t// to ensure we handled all descriptors in \"flattened ordering\".\n\tif numEnums > 0 {\n\t\tfd.L1.Enums.List = fd.allocEnums(numEnums)\n\t}\n\tif numMessages > 0 {\n\t\tfd.L1.Messages.List = fd.allocMessages(numMessages)\n\t}\n\tif numExtensions > 0 {\n\t\tfd.L1.Extensions.List = fd.allocExtensions(numExtensions)\n\t}\n\tif numServices > 0 {\n\t\tfd.L1.Services.List = fd.allocServices(numServices)\n\t}\n\n\tif numEnums > 0 {\n\t\tb := b0[posEnums:]\n\t\tfor i := range fd.L1.Enums.List {\n\t\t\t_, n := protowire.ConsumeVarint(b)\n\t\t\tv, m := protowire.ConsumeBytes(b[n:])\n\t\t\tfd.L1.Enums.List[i].unmarshalSeed(v, sb, fd, fd, i)\n\t\t\tb = b[n+m:]\n\t\t}\n\t}\n\tif numMessages > 0 {\n\t\tb := b0[posMessages:]\n\t\tfor i := range fd.L1.Messages.List {\n\t\t\t_, n := protowire.ConsumeVarint(b)\n\t\t\tv, m := protowire.ConsumeBytes(b[n:])\n\t\t\tfd.L1.Messages.List[i].unmarshalSeed(v, sb, fd, fd, i)\n\t\t\tb = b[n+m:]\n\t\t}\n\t}\n\tif numExtensions > 0 {\n\t\tb := b0[posExtensions:]\n\t\tfor i := range fd.L1.Extensions.List {\n\t\t\t_, n := protowire.ConsumeVarint(b)\n\t\t\tv, m := protowire.ConsumeBytes(b[n:])\n\t\t\tfd.L1.Extensions.List[i].unmarshalSeed(v, sb, fd, fd, i)\n\t\t\tb = b[n+m:]\n\t\t}\n\t}\n\tif numServices > 0 {\n\t\tb := b0[posServices:]\n\t\tfor i := range fd.L1.Services.List {\n\t\t\t_, n := protowire.ConsumeVarint(b)\n\t\t\tv, m := protowire.ConsumeBytes(b[n:])\n\t\t\tfd.L1.Services.List[i].unmarshalSeed(v, sb, fd, fd, i)\n\t\t\tb = b[n+m:]\n\t\t}\n\t}\n}\n\nfunc (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\ted.L0.ParentFile = pf\n\ted.L0.Parent = pd\n\ted.L0.Index = i\n\n\tvar numValues int\n\tfor b := b; len(b) > 0; {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.EnumDescriptorProto_Name_field_number:\n\t\t\t\ted.L0.FullName = appendFullName(sb, pd.FullName(), v)\n\t\t\tcase genid.EnumDescriptorProto_Value_field_number:\n\t\t\t\tnumValues++\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\n\t// Only construct enum value descriptors for top-level enums since\n\t// they are needed for registration.\n\tif pd != pf {\n\t\treturn\n\t}\n\ted.L1.eagerValues = true\n\ted.L2 = new(EnumL2)\n\ted.L2.Values.List = make([]EnumValue, numValues)\n\tfor i := 0; len(b) > 0; {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.EnumDescriptorProto_Value_field_number:\n\t\t\t\ted.L2.Values.List[i].unmarshalFull(v, sb, pf, ed, i)\n\t\t\t\ti++\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n\nfunc (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\tmd.L0.ParentFile = pf\n\tmd.L0.Parent = pd\n\tmd.L0.Index = i\n\n\tvar prevField pref.FieldNumber\n\tvar numEnums, numMessages, numExtensions int\n\tvar posEnums, posMessages, posExtensions int\n\tb0 := b\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.DescriptorProto_Name_field_number:\n\t\t\t\tmd.L0.FullName = appendFullName(sb, pd.FullName(), v)\n\t\t\tcase genid.DescriptorProto_EnumType_field_number:\n\t\t\t\tif prevField != genid.DescriptorProto_EnumType_field_number {\n\t\t\t\t\tif numEnums > 0 {\n\t\t\t\t\t\tpanic(\"non-contiguous repeated field\")\n\t\t\t\t\t}\n\t\t\t\t\tposEnums = len(b0) - len(b) - n - m\n\t\t\t\t}\n\t\t\t\tnumEnums++\n\t\t\tcase genid.DescriptorProto_NestedType_field_number:\n\t\t\t\tif prevField != genid.DescriptorProto_NestedType_field_number {\n\t\t\t\t\tif numMessages > 0 {\n\t\t\t\t\t\tpanic(\"non-contiguous repeated field\")\n\t\t\t\t\t}\n\t\t\t\t\tposMessages = len(b0) - len(b) - n - m\n\t\t\t\t}\n\t\t\t\tnumMessages++\n\t\t\tcase genid.DescriptorProto_Extension_field_number:\n\t\t\t\tif prevField != genid.DescriptorProto_Extension_field_number {\n\t\t\t\t\tif numExtensions > 0 {\n\t\t\t\t\t\tpanic(\"non-contiguous repeated field\")\n\t\t\t\t\t}\n\t\t\t\t\tposExtensions = len(b0) - len(b) - n - m\n\t\t\t\t}\n\t\t\t\tnumExtensions++\n\t\t\tcase genid.DescriptorProto_Options_field_number:\n\t\t\t\tmd.unmarshalSeedOptions(v)\n\t\t\t}\n\t\t\tprevField = num\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t\tprevField = -1 // ignore known field numbers of unknown wire type\n\t\t}\n\t}\n\n\t// Must allocate all declarations before parsing each descriptor type\n\t// to ensure we handled all descriptors in \"flattened ordering\".\n\tif numEnums > 0 {\n\t\tmd.L1.Enums.List = pf.allocEnums(numEnums)\n\t}\n\tif numMessages > 0 {\n\t\tmd.L1.Messages.List = pf.allocMessages(numMessages)\n\t}\n\tif numExtensions > 0 {\n\t\tmd.L1.Extensions.List = pf.allocExtensions(numExtensions)\n\t}\n\n\tif numEnums > 0 {\n\t\tb := b0[posEnums:]\n\t\tfor i := range md.L1.Enums.List {\n\t\t\t_, n := protowire.ConsumeVarint(b)\n\t\t\tv, m := protowire.ConsumeBytes(b[n:])\n\t\t\tmd.L1.Enums.List[i].unmarshalSeed(v, sb, pf, md, i)\n\t\t\tb = b[n+m:]\n\t\t}\n\t}\n\tif numMessages > 0 {\n\t\tb := b0[posMessages:]\n\t\tfor i := range md.L1.Messages.List {\n\t\t\t_, n := protowire.ConsumeVarint(b)\n\t\t\tv, m := protowire.ConsumeBytes(b[n:])\n\t\t\tmd.L1.Messages.List[i].unmarshalSeed(v, sb, pf, md, i)\n\t\t\tb = b[n+m:]\n\t\t}\n\t}\n\tif numExtensions > 0 {\n\t\tb := b0[posExtensions:]\n\t\tfor i := range md.L1.Extensions.List {\n\t\t\t_, n := protowire.ConsumeVarint(b)\n\t\t\tv, m := protowire.ConsumeBytes(b[n:])\n\t\t\tmd.L1.Extensions.List[i].unmarshalSeed(v, sb, pf, md, i)\n\t\t\tb = b[n+m:]\n\t\t}\n\t}\n}\n\nfunc (md *Message) unmarshalSeedOptions(b []byte) {\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.MessageOptions_MapEntry_field_number:\n\t\t\t\tmd.L1.IsMapEntry = protowire.DecodeBool(v)\n\t\t\tcase genid.MessageOptions_MessageSetWireFormat_field_number:\n\t\t\t\tmd.L1.IsMessageSet = protowire.DecodeBool(v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n\nfunc (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\txd.L0.ParentFile = pf\n\txd.L0.Parent = pd\n\txd.L0.Index = i\n\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldDescriptorProto_Number_field_number:\n\t\t\t\txd.L1.Number = pref.FieldNumber(v)\n\t\t\tcase genid.FieldDescriptorProto_Label_field_number:\n\t\t\t\txd.L1.Cardinality = pref.Cardinality(v)\n\t\t\tcase genid.FieldDescriptorProto_Type_field_number:\n\t\t\t\txd.L1.Kind = pref.Kind(v)\n\t\t\t}\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldDescriptorProto_Name_field_number:\n\t\t\t\txd.L0.FullName = appendFullName(sb, pd.FullName(), v)\n\t\t\tcase genid.FieldDescriptorProto_Extendee_field_number:\n\t\t\t\txd.L1.Extendee = PlaceholderMessage(makeFullName(sb, v))\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n\nfunc (sd *Service) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\tsd.L0.ParentFile = pf\n\tsd.L0.Parent = pd\n\tsd.L0.Index = i\n\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.ServiceDescriptorProto_Name_field_number:\n\t\t\t\tsd.L0.FullName = appendFullName(sb, pd.FullName(), v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n\nvar nameBuilderPool = sync.Pool{\n\tNew: func() interface{} { return new(strs.Builder) },\n}\n\nfunc getBuilder() *strs.Builder {\n\treturn nameBuilderPool.Get().(*strs.Builder)\n}\nfunc putBuilder(b *strs.Builder) {\n\tnameBuilderPool.Put(b)\n}\n\n// makeFullName converts b to a protoreflect.FullName,\n// where b must start with a leading dot.\nfunc makeFullName(sb *strs.Builder, b []byte) pref.FullName {\n\tif len(b) == 0 || b[0] != '.' {\n\t\tpanic(\"name reference must be fully qualified\")\n\t}\n\treturn pref.FullName(sb.MakeString(b[1:]))\n}\n\nfunc appendFullName(sb *strs.Builder, prefix pref.FullName, suffix []byte) pref.FullName {\n\treturn sb.AppendFullName(prefix, pref.Name(strs.UnsafeString(suffix)))\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.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 filedesc\n\nimport (\n\t\"reflect\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/descopts\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/proto\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nfunc (fd *File) lazyRawInit() {\n\tfd.unmarshalFull(fd.builder.RawDescriptor)\n\tfd.resolveMessages()\n\tfd.resolveExtensions()\n\tfd.resolveServices()\n}\n\nfunc (file *File) resolveMessages() {\n\tvar depIdx int32\n\tfor i := range file.allMessages {\n\t\tmd := &file.allMessages[i]\n\n\t\t// Resolve message field dependencies.\n\t\tfor j := range md.L2.Fields.List {\n\t\t\tfd := &md.L2.Fields.List[j]\n\n\t\t\t// Weak fields are resolved upon actual use.\n\t\t\tif fd.L1.IsWeak {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Resolve message field dependency.\n\t\t\tswitch fd.L1.Kind {\n\t\t\tcase pref.EnumKind:\n\t\t\t\tfd.L1.Enum = file.resolveEnumDependency(fd.L1.Enum, listFieldDeps, depIdx)\n\t\t\t\tdepIdx++\n\t\t\tcase pref.MessageKind, pref.GroupKind:\n\t\t\t\tfd.L1.Message = file.resolveMessageDependency(fd.L1.Message, listFieldDeps, depIdx)\n\t\t\t\tdepIdx++\n\t\t\t}\n\n\t\t\t// Default is resolved here since it depends on Enum being resolved.\n\t\t\tif v := fd.L1.Default.val; v.IsValid() {\n\t\t\t\tfd.L1.Default = unmarshalDefault(v.Bytes(), fd.L1.Kind, file, fd.L1.Enum)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc (file *File) resolveExtensions() {\n\tvar depIdx int32\n\tfor i := range file.allExtensions {\n\t\txd := &file.allExtensions[i]\n\n\t\t// Resolve extension field dependency.\n\t\tswitch xd.L1.Kind {\n\t\tcase pref.EnumKind:\n\t\t\txd.L2.Enum = file.resolveEnumDependency(xd.L2.Enum, listExtDeps, depIdx)\n\t\t\tdepIdx++\n\t\tcase pref.MessageKind, pref.GroupKind:\n\t\t\txd.L2.Message = file.resolveMessageDependency(xd.L2.Message, listExtDeps, depIdx)\n\t\t\tdepIdx++\n\t\t}\n\n\t\t// Default is resolved here since it depends on Enum being resolved.\n\t\tif v := xd.L2.Default.val; v.IsValid() {\n\t\t\txd.L2.Default = unmarshalDefault(v.Bytes(), xd.L1.Kind, file, xd.L2.Enum)\n\t\t}\n\t}\n}\n\nfunc (file *File) resolveServices() {\n\tvar depIdx int32\n\tfor i := range file.allServices {\n\t\tsd := &file.allServices[i]\n\n\t\t// Resolve method dependencies.\n\t\tfor j := range sd.L2.Methods.List {\n\t\t\tmd := &sd.L2.Methods.List[j]\n\t\t\tmd.L1.Input = file.resolveMessageDependency(md.L1.Input, listMethInDeps, depIdx)\n\t\t\tmd.L1.Output = file.resolveMessageDependency(md.L1.Output, listMethOutDeps, depIdx)\n\t\t\tdepIdx++\n\t\t}\n\t}\n}\n\nfunc (file *File) resolveEnumDependency(ed pref.EnumDescriptor, i, j int32) pref.EnumDescriptor {\n\tr := file.builder.FileRegistry\n\tif r, ok := r.(resolverByIndex); ok {\n\t\tif ed2 := r.FindEnumByIndex(i, j, file.allEnums, file.allMessages); ed2 != nil {\n\t\t\treturn ed2\n\t\t}\n\t}\n\tfor i := range file.allEnums {\n\t\tif ed2 := &file.allEnums[i]; ed2.L0.FullName == ed.FullName() {\n\t\t\treturn ed2\n\t\t}\n\t}\n\tif d, _ := r.FindDescriptorByName(ed.FullName()); d != nil {\n\t\treturn d.(pref.EnumDescriptor)\n\t}\n\treturn ed\n}\n\nfunc (file *File) resolveMessageDependency(md pref.MessageDescriptor, i, j int32) pref.MessageDescriptor {\n\tr := file.builder.FileRegistry\n\tif r, ok := r.(resolverByIndex); ok {\n\t\tif md2 := r.FindMessageByIndex(i, j, file.allEnums, file.allMessages); md2 != nil {\n\t\t\treturn md2\n\t\t}\n\t}\n\tfor i := range file.allMessages {\n\t\tif md2 := &file.allMessages[i]; md2.L0.FullName == md.FullName() {\n\t\t\treturn md2\n\t\t}\n\t}\n\tif d, _ := r.FindDescriptorByName(md.FullName()); d != nil {\n\t\treturn d.(pref.MessageDescriptor)\n\t}\n\treturn md\n}\n\nfunc (fd *File) unmarshalFull(b []byte) {\n\tsb := getBuilder()\n\tdefer putBuilder(sb)\n\n\tvar enumIdx, messageIdx, extensionIdx, serviceIdx int\n\tvar rawOptions []byte\n\tfd.L2 = new(FileL2)\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FileDescriptorProto_PublicDependency_field_number:\n\t\t\t\tfd.L2.Imports[v].IsPublic = true\n\t\t\tcase genid.FileDescriptorProto_WeakDependency_field_number:\n\t\t\t\tfd.L2.Imports[v].IsWeak = true\n\t\t\t}\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FileDescriptorProto_Dependency_field_number:\n\t\t\t\tpath := sb.MakeString(v)\n\t\t\t\timp, _ := fd.builder.FileRegistry.FindFileByPath(path)\n\t\t\t\tif imp == nil {\n\t\t\t\t\timp = PlaceholderFile(path)\n\t\t\t\t}\n\t\t\t\tfd.L2.Imports = append(fd.L2.Imports, pref.FileImport{FileDescriptor: imp})\n\t\t\tcase genid.FileDescriptorProto_EnumType_field_number:\n\t\t\t\tfd.L1.Enums.List[enumIdx].unmarshalFull(v, sb)\n\t\t\t\tenumIdx++\n\t\t\tcase genid.FileDescriptorProto_MessageType_field_number:\n\t\t\t\tfd.L1.Messages.List[messageIdx].unmarshalFull(v, sb)\n\t\t\t\tmessageIdx++\n\t\t\tcase genid.FileDescriptorProto_Extension_field_number:\n\t\t\t\tfd.L1.Extensions.List[extensionIdx].unmarshalFull(v, sb)\n\t\t\t\textensionIdx++\n\t\t\tcase genid.FileDescriptorProto_Service_field_number:\n\t\t\t\tfd.L1.Services.List[serviceIdx].unmarshalFull(v, sb)\n\t\t\t\tserviceIdx++\n\t\t\tcase genid.FileDescriptorProto_Options_field_number:\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tfd.L2.Options = fd.builder.optionsUnmarshaler(&descopts.File, rawOptions)\n}\n\nfunc (ed *Enum) unmarshalFull(b []byte, sb *strs.Builder) {\n\tvar rawValues [][]byte\n\tvar rawOptions []byte\n\tif !ed.L1.eagerValues {\n\t\ted.L2 = new(EnumL2)\n\t}\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.EnumDescriptorProto_Value_field_number:\n\t\t\t\trawValues = append(rawValues, v)\n\t\t\tcase genid.EnumDescriptorProto_ReservedName_field_number:\n\t\t\t\ted.L2.ReservedNames.List = append(ed.L2.ReservedNames.List, pref.Name(sb.MakeString(v)))\n\t\t\tcase genid.EnumDescriptorProto_ReservedRange_field_number:\n\t\t\t\ted.L2.ReservedRanges.List = append(ed.L2.ReservedRanges.List, unmarshalEnumReservedRange(v))\n\t\t\tcase genid.EnumDescriptorProto_Options_field_number:\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tif !ed.L1.eagerValues && len(rawValues) > 0 {\n\t\ted.L2.Values.List = make([]EnumValue, len(rawValues))\n\t\tfor i, b := range rawValues {\n\t\t\ted.L2.Values.List[i].unmarshalFull(b, sb, ed.L0.ParentFile, ed, i)\n\t\t}\n\t}\n\ted.L2.Options = ed.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Enum, rawOptions)\n}\n\nfunc unmarshalEnumReservedRange(b []byte) (r [2]pref.EnumNumber) {\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.EnumDescriptorProto_EnumReservedRange_Start_field_number:\n\t\t\t\tr[0] = pref.EnumNumber(v)\n\t\t\tcase genid.EnumDescriptorProto_EnumReservedRange_End_field_number:\n\t\t\t\tr[1] = pref.EnumNumber(v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\treturn r\n}\n\nfunc (vd *EnumValue) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\tvd.L0.ParentFile = pf\n\tvd.L0.Parent = pd\n\tvd.L0.Index = i\n\n\tvar rawOptions []byte\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.EnumValueDescriptorProto_Number_field_number:\n\t\t\t\tvd.L1.Number = pref.EnumNumber(v)\n\t\t\t}\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.EnumValueDescriptorProto_Name_field_number:\n\t\t\t\t// NOTE: Enum values are in the same scope as the enum parent.\n\t\t\t\tvd.L0.FullName = appendFullName(sb, pd.Parent().FullName(), v)\n\t\t\tcase genid.EnumValueDescriptorProto_Options_field_number:\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tvd.L1.Options = pf.builder.optionsUnmarshaler(&descopts.EnumValue, rawOptions)\n}\n\nfunc (md *Message) unmarshalFull(b []byte, sb *strs.Builder) {\n\tvar rawFields, rawOneofs [][]byte\n\tvar enumIdx, messageIdx, extensionIdx int\n\tvar rawOptions []byte\n\tmd.L2 = new(MessageL2)\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.DescriptorProto_Field_field_number:\n\t\t\t\trawFields = append(rawFields, v)\n\t\t\tcase genid.DescriptorProto_OneofDecl_field_number:\n\t\t\t\trawOneofs = append(rawOneofs, v)\n\t\t\tcase genid.DescriptorProto_ReservedName_field_number:\n\t\t\t\tmd.L2.ReservedNames.List = append(md.L2.ReservedNames.List, pref.Name(sb.MakeString(v)))\n\t\t\tcase genid.DescriptorProto_ReservedRange_field_number:\n\t\t\t\tmd.L2.ReservedRanges.List = append(md.L2.ReservedRanges.List, unmarshalMessageReservedRange(v))\n\t\t\tcase genid.DescriptorProto_ExtensionRange_field_number:\n\t\t\t\tr, rawOptions := unmarshalMessageExtensionRange(v)\n\t\t\t\topts := md.L0.ParentFile.builder.optionsUnmarshaler(&descopts.ExtensionRange, rawOptions)\n\t\t\t\tmd.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, r)\n\t\t\t\tmd.L2.ExtensionRangeOptions = append(md.L2.ExtensionRangeOptions, opts)\n\t\t\tcase genid.DescriptorProto_EnumType_field_number:\n\t\t\t\tmd.L1.Enums.List[enumIdx].unmarshalFull(v, sb)\n\t\t\t\tenumIdx++\n\t\t\tcase genid.DescriptorProto_NestedType_field_number:\n\t\t\t\tmd.L1.Messages.List[messageIdx].unmarshalFull(v, sb)\n\t\t\t\tmessageIdx++\n\t\t\tcase genid.DescriptorProto_Extension_field_number:\n\t\t\t\tmd.L1.Extensions.List[extensionIdx].unmarshalFull(v, sb)\n\t\t\t\textensionIdx++\n\t\t\tcase genid.DescriptorProto_Options_field_number:\n\t\t\t\tmd.unmarshalOptions(v)\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tif len(rawFields) > 0 || len(rawOneofs) > 0 {\n\t\tmd.L2.Fields.List = make([]Field, len(rawFields))\n\t\tmd.L2.Oneofs.List = make([]Oneof, len(rawOneofs))\n\t\tfor i, b := range rawFields {\n\t\t\tfd := &md.L2.Fields.List[i]\n\t\t\tfd.unmarshalFull(b, sb, md.L0.ParentFile, md, i)\n\t\t\tif fd.L1.Cardinality == pref.Required {\n\t\t\t\tmd.L2.RequiredNumbers.List = append(md.L2.RequiredNumbers.List, fd.L1.Number)\n\t\t\t}\n\t\t}\n\t\tfor i, b := range rawOneofs {\n\t\t\tod := &md.L2.Oneofs.List[i]\n\t\t\tod.unmarshalFull(b, sb, md.L0.ParentFile, md, i)\n\t\t}\n\t}\n\tmd.L2.Options = md.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Message, rawOptions)\n}\n\nfunc (md *Message) unmarshalOptions(b []byte) {\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.MessageOptions_MapEntry_field_number:\n\t\t\t\tmd.L1.IsMapEntry = protowire.DecodeBool(v)\n\t\t\tcase genid.MessageOptions_MessageSetWireFormat_field_number:\n\t\t\t\tmd.L1.IsMessageSet = protowire.DecodeBool(v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n\nfunc unmarshalMessageReservedRange(b []byte) (r [2]pref.FieldNumber) {\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.DescriptorProto_ReservedRange_Start_field_number:\n\t\t\t\tr[0] = pref.FieldNumber(v)\n\t\t\tcase genid.DescriptorProto_ReservedRange_End_field_number:\n\t\t\t\tr[1] = pref.FieldNumber(v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\treturn r\n}\n\nfunc unmarshalMessageExtensionRange(b []byte) (r [2]pref.FieldNumber, rawOptions []byte) {\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.DescriptorProto_ExtensionRange_Start_field_number:\n\t\t\t\tr[0] = pref.FieldNumber(v)\n\t\t\tcase genid.DescriptorProto_ExtensionRange_End_field_number:\n\t\t\t\tr[1] = pref.FieldNumber(v)\n\t\t\t}\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.DescriptorProto_ExtensionRange_Options_field_number:\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\treturn r, rawOptions\n}\n\nfunc (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\tfd.L0.ParentFile = pf\n\tfd.L0.Parent = pd\n\tfd.L0.Index = i\n\n\tvar rawTypeName []byte\n\tvar rawOptions []byte\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldDescriptorProto_Number_field_number:\n\t\t\t\tfd.L1.Number = pref.FieldNumber(v)\n\t\t\tcase genid.FieldDescriptorProto_Label_field_number:\n\t\t\t\tfd.L1.Cardinality = pref.Cardinality(v)\n\t\t\tcase genid.FieldDescriptorProto_Type_field_number:\n\t\t\t\tfd.L1.Kind = pref.Kind(v)\n\t\t\tcase genid.FieldDescriptorProto_OneofIndex_field_number:\n\t\t\t\t// In Message.unmarshalFull, we allocate slices for both\n\t\t\t\t// the field and oneof descriptors before unmarshaling either\n\t\t\t\t// of them. This ensures pointers to slice elements are stable.\n\t\t\t\tod := &pd.(*Message).L2.Oneofs.List[v]\n\t\t\t\tod.L1.Fields.List = append(od.L1.Fields.List, fd)\n\t\t\t\tif fd.L1.ContainingOneof != nil {\n\t\t\t\t\tpanic(\"oneof type already set\")\n\t\t\t\t}\n\t\t\t\tfd.L1.ContainingOneof = od\n\t\t\tcase genid.FieldDescriptorProto_Proto3Optional_field_number:\n\t\t\t\tfd.L1.IsProto3Optional = protowire.DecodeBool(v)\n\t\t\t}\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldDescriptorProto_Name_field_number:\n\t\t\t\tfd.L0.FullName = appendFullName(sb, pd.FullName(), v)\n\t\t\tcase genid.FieldDescriptorProto_JsonName_field_number:\n\t\t\t\tfd.L1.StringName.InitJSON(sb.MakeString(v))\n\t\t\tcase genid.FieldDescriptorProto_DefaultValue_field_number:\n\t\t\t\tfd.L1.Default.val = pref.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveMessages\n\t\t\tcase genid.FieldDescriptorProto_TypeName_field_number:\n\t\t\t\trawTypeName = v\n\t\t\tcase genid.FieldDescriptorProto_Options_field_number:\n\t\t\t\tfd.unmarshalOptions(v)\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tif rawTypeName != nil {\n\t\tname := makeFullName(sb, rawTypeName)\n\t\tswitch fd.L1.Kind {\n\t\tcase pref.EnumKind:\n\t\t\tfd.L1.Enum = PlaceholderEnum(name)\n\t\tcase pref.MessageKind, pref.GroupKind:\n\t\t\tfd.L1.Message = PlaceholderMessage(name)\n\t\t}\n\t}\n\tfd.L1.Options = pf.builder.optionsUnmarshaler(&descopts.Field, rawOptions)\n}\n\nfunc (fd *Field) unmarshalOptions(b []byte) {\n\tconst FieldOptions_EnforceUTF8 = 13\n\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldOptions_Packed_field_number:\n\t\t\t\tfd.L1.HasPacked = true\n\t\t\t\tfd.L1.IsPacked = protowire.DecodeBool(v)\n\t\t\tcase genid.FieldOptions_Weak_field_number:\n\t\t\t\tfd.L1.IsWeak = protowire.DecodeBool(v)\n\t\t\tcase FieldOptions_EnforceUTF8:\n\t\t\t\tfd.L1.HasEnforceUTF8 = true\n\t\t\t\tfd.L1.EnforceUTF8 = protowire.DecodeBool(v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n\nfunc (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\tod.L0.ParentFile = pf\n\tod.L0.Parent = pd\n\tod.L0.Index = i\n\n\tvar rawOptions []byte\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.OneofDescriptorProto_Name_field_number:\n\t\t\t\tod.L0.FullName = appendFullName(sb, pd.FullName(), v)\n\t\t\tcase genid.OneofDescriptorProto_Options_field_number:\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tod.L1.Options = pf.builder.optionsUnmarshaler(&descopts.Oneof, rawOptions)\n}\n\nfunc (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {\n\tvar rawTypeName []byte\n\tvar rawOptions []byte\n\txd.L2 = new(ExtensionL2)\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldDescriptorProto_Proto3Optional_field_number:\n\t\t\t\txd.L2.IsProto3Optional = protowire.DecodeBool(v)\n\t\t\t}\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldDescriptorProto_JsonName_field_number:\n\t\t\t\txd.L2.StringName.InitJSON(sb.MakeString(v))\n\t\t\tcase genid.FieldDescriptorProto_DefaultValue_field_number:\n\t\t\t\txd.L2.Default.val = pref.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveExtensions\n\t\t\tcase genid.FieldDescriptorProto_TypeName_field_number:\n\t\t\t\trawTypeName = v\n\t\t\tcase genid.FieldDescriptorProto_Options_field_number:\n\t\t\t\txd.unmarshalOptions(v)\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tif rawTypeName != nil {\n\t\tname := makeFullName(sb, rawTypeName)\n\t\tswitch xd.L1.Kind {\n\t\tcase pref.EnumKind:\n\t\t\txd.L2.Enum = PlaceholderEnum(name)\n\t\tcase pref.MessageKind, pref.GroupKind:\n\t\t\txd.L2.Message = PlaceholderMessage(name)\n\t\t}\n\t}\n\txd.L2.Options = xd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Field, rawOptions)\n}\n\nfunc (xd *Extension) unmarshalOptions(b []byte) {\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.FieldOptions_Packed_field_number:\n\t\t\t\txd.L2.IsPacked = protowire.DecodeBool(v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n}\n\nfunc (sd *Service) unmarshalFull(b []byte, sb *strs.Builder) {\n\tvar rawMethods [][]byte\n\tvar rawOptions []byte\n\tsd.L2 = new(ServiceL2)\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.ServiceDescriptorProto_Method_field_number:\n\t\t\t\trawMethods = append(rawMethods, v)\n\t\t\tcase genid.ServiceDescriptorProto_Options_field_number:\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tif len(rawMethods) > 0 {\n\t\tsd.L2.Methods.List = make([]Method, len(rawMethods))\n\t\tfor i, b := range rawMethods {\n\t\t\tsd.L2.Methods.List[i].unmarshalFull(b, sb, sd.L0.ParentFile, sd, i)\n\t\t}\n\t}\n\tsd.L2.Options = sd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Service, rawOptions)\n}\n\nfunc (md *Method) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd pref.Descriptor, i int) {\n\tmd.L0.ParentFile = pf\n\tmd.L0.Parent = pd\n\tmd.L0.Index = i\n\n\tvar rawOptions []byte\n\tfor len(b) > 0 {\n\t\tnum, typ, n := protowire.ConsumeTag(b)\n\t\tb = b[n:]\n\t\tswitch typ {\n\t\tcase protowire.VarintType:\n\t\t\tv, m := protowire.ConsumeVarint(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.MethodDescriptorProto_ClientStreaming_field_number:\n\t\t\t\tmd.L1.IsStreamingClient = protowire.DecodeBool(v)\n\t\t\tcase genid.MethodDescriptorProto_ServerStreaming_field_number:\n\t\t\t\tmd.L1.IsStreamingServer = protowire.DecodeBool(v)\n\t\t\t}\n\t\tcase protowire.BytesType:\n\t\t\tv, m := protowire.ConsumeBytes(b)\n\t\t\tb = b[m:]\n\t\t\tswitch num {\n\t\t\tcase genid.MethodDescriptorProto_Name_field_number:\n\t\t\t\tmd.L0.FullName = appendFullName(sb, pd.FullName(), v)\n\t\t\tcase genid.MethodDescriptorProto_InputType_field_number:\n\t\t\t\tmd.L1.Input = PlaceholderMessage(makeFullName(sb, v))\n\t\t\tcase genid.MethodDescriptorProto_OutputType_field_number:\n\t\t\t\tmd.L1.Output = PlaceholderMessage(makeFullName(sb, v))\n\t\t\tcase genid.MethodDescriptorProto_Options_field_number:\n\t\t\t\trawOptions = appendOptions(rawOptions, v)\n\t\t\t}\n\t\tdefault:\n\t\t\tm := protowire.ConsumeFieldValue(num, typ, b)\n\t\t\tb = b[m:]\n\t\t}\n\t}\n\tmd.L1.Options = pf.builder.optionsUnmarshaler(&descopts.Method, rawOptions)\n}\n\n// appendOptions appends src to dst, where the returned slice is never nil.\n// This is necessary to distinguish between empty and unpopulated options.\nfunc appendOptions(dst, src []byte) []byte {\n\tif dst == nil {\n\t\tdst = []byte{}\n\t}\n\treturn append(dst, src...)\n}\n\n// optionsUnmarshaler constructs a lazy unmarshal function for an options message.\n//\n// The type of message to unmarshal to is passed as a pointer since the\n// vars in descopts may not yet be populated at the time this function is called.\nfunc (db *Builder) optionsUnmarshaler(p *pref.ProtoMessage, b []byte) func() pref.ProtoMessage {\n\tif b == nil {\n\t\treturn nil\n\t}\n\tvar opts pref.ProtoMessage\n\tvar once sync.Once\n\treturn func() pref.ProtoMessage {\n\t\tonce.Do(func() {\n\t\t\tif *p == nil {\n\t\t\t\tpanic(\"Descriptor.Options called without importing the descriptor package\")\n\t\t\t}\n\t\t\topts = reflect.New(reflect.TypeOf(*p).Elem()).Interface().(pref.ProtoMessage)\n\t\t\tif err := (proto.UnmarshalOptions{\n\t\t\t\tAllowPartial: true,\n\t\t\t\tResolver:     db.TypeResolver,\n\t\t\t}).Unmarshal(b, opts); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t})\n\t\treturn opts\n\t}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/filedesc/desc_list.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 filedesc\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\t\"sort\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/genid\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/descfmt\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype FileImports []pref.FileImport\n\nfunc (p *FileImports) Len() int                            { return len(*p) }\nfunc (p *FileImports) Get(i int) pref.FileImport           { return (*p)[i] }\nfunc (p *FileImports) Format(s fmt.State, r rune)          { descfmt.FormatList(s, r, p) }\nfunc (p *FileImports) ProtoInternal(pragma.DoNotImplement) {}\n\ntype Names struct {\n\tList []pref.Name\n\tonce sync.Once\n\thas  map[pref.Name]int // protected by once\n}\n\nfunc (p *Names) Len() int                            { return len(p.List) }\nfunc (p *Names) Get(i int) pref.Name                 { return p.List[i] }\nfunc (p *Names) Has(s pref.Name) bool                { return p.lazyInit().has[s] > 0 }\nfunc (p *Names) Format(s fmt.State, r rune)          { descfmt.FormatList(s, r, p) }\nfunc (p *Names) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Names) lazyInit() *Names {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.has = make(map[pref.Name]int, len(p.List))\n\t\t\tfor _, s := range p.List {\n\t\t\t\tp.has[s] = p.has[s] + 1\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\n// CheckValid reports any errors with the set of names with an error message\n// that completes the sentence: \"ranges is invalid because it has ...\"\nfunc (p *Names) CheckValid() error {\n\tfor s, n := range p.lazyInit().has {\n\t\tswitch {\n\t\tcase n > 1:\n\t\t\treturn errors.New(\"duplicate name: %q\", s)\n\t\tcase false && !s.IsValid():\n\t\t\t// NOTE: The C++ implementation does not validate the identifier.\n\t\t\t// See https://github.com/protocolbuffers/protobuf/issues/6335.\n\t\t\treturn errors.New(\"invalid name: %q\", s)\n\t\t}\n\t}\n\treturn nil\n}\n\ntype EnumRanges struct {\n\tList   [][2]pref.EnumNumber // start inclusive; end inclusive\n\tonce   sync.Once\n\tsorted [][2]pref.EnumNumber // protected by once\n}\n\nfunc (p *EnumRanges) Len() int                     { return len(p.List) }\nfunc (p *EnumRanges) Get(i int) [2]pref.EnumNumber { return p.List[i] }\nfunc (p *EnumRanges) Has(n pref.EnumNumber) bool {\n\tfor ls := p.lazyInit().sorted; len(ls) > 0; {\n\t\ti := len(ls) / 2\n\t\tswitch r := enumRange(ls[i]); {\n\t\tcase n < r.Start():\n\t\t\tls = ls[:i] // search lower\n\t\tcase n > r.End():\n\t\t\tls = ls[i+1:] // search upper\n\t\tdefault:\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\nfunc (p *EnumRanges) Format(s fmt.State, r rune)          { descfmt.FormatList(s, r, p) }\nfunc (p *EnumRanges) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *EnumRanges) lazyInit() *EnumRanges {\n\tp.once.Do(func() {\n\t\tp.sorted = append(p.sorted, p.List...)\n\t\tsort.Slice(p.sorted, func(i, j int) bool {\n\t\t\treturn p.sorted[i][0] < p.sorted[j][0]\n\t\t})\n\t})\n\treturn p\n}\n\n// CheckValid reports any errors with the set of names with an error message\n// that completes the sentence: \"ranges is invalid because it has ...\"\nfunc (p *EnumRanges) CheckValid() error {\n\tvar rp enumRange\n\tfor i, r := range p.lazyInit().sorted {\n\t\tr := enumRange(r)\n\t\tswitch {\n\t\tcase !(r.Start() <= r.End()):\n\t\t\treturn errors.New(\"invalid range: %v\", r)\n\t\tcase !(rp.End() < r.Start()) && i > 0:\n\t\t\treturn errors.New(\"overlapping ranges: %v with %v\", rp, r)\n\t\t}\n\t\trp = r\n\t}\n\treturn nil\n}\n\ntype enumRange [2]protoreflect.EnumNumber\n\nfunc (r enumRange) Start() protoreflect.EnumNumber { return r[0] } // inclusive\nfunc (r enumRange) End() protoreflect.EnumNumber   { return r[1] } // inclusive\nfunc (r enumRange) String() string {\n\tif r.Start() == r.End() {\n\t\treturn fmt.Sprintf(\"%d\", r.Start())\n\t}\n\treturn fmt.Sprintf(\"%d to %d\", r.Start(), r.End())\n}\n\ntype FieldRanges struct {\n\tList   [][2]pref.FieldNumber // start inclusive; end exclusive\n\tonce   sync.Once\n\tsorted [][2]pref.FieldNumber // protected by once\n}\n\nfunc (p *FieldRanges) Len() int                      { return len(p.List) }\nfunc (p *FieldRanges) Get(i int) [2]pref.FieldNumber { return p.List[i] }\nfunc (p *FieldRanges) Has(n pref.FieldNumber) bool {\n\tfor ls := p.lazyInit().sorted; len(ls) > 0; {\n\t\ti := len(ls) / 2\n\t\tswitch r := fieldRange(ls[i]); {\n\t\tcase n < r.Start():\n\t\t\tls = ls[:i] // search lower\n\t\tcase n > r.End():\n\t\t\tls = ls[i+1:] // search upper\n\t\tdefault:\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\nfunc (p *FieldRanges) Format(s fmt.State, r rune)          { descfmt.FormatList(s, r, p) }\nfunc (p *FieldRanges) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *FieldRanges) lazyInit() *FieldRanges {\n\tp.once.Do(func() {\n\t\tp.sorted = append(p.sorted, p.List...)\n\t\tsort.Slice(p.sorted, func(i, j int) bool {\n\t\t\treturn p.sorted[i][0] < p.sorted[j][0]\n\t\t})\n\t})\n\treturn p\n}\n\n// CheckValid reports any errors with the set of ranges with an error message\n// that completes the sentence: \"ranges is invalid because it has ...\"\nfunc (p *FieldRanges) CheckValid(isMessageSet bool) error {\n\tvar rp fieldRange\n\tfor i, r := range p.lazyInit().sorted {\n\t\tr := fieldRange(r)\n\t\tswitch {\n\t\tcase !isValidFieldNumber(r.Start(), isMessageSet):\n\t\t\treturn errors.New(\"invalid field number: %d\", r.Start())\n\t\tcase !isValidFieldNumber(r.End(), isMessageSet):\n\t\t\treturn errors.New(\"invalid field number: %d\", r.End())\n\t\tcase !(r.Start() <= r.End()):\n\t\t\treturn errors.New(\"invalid range: %v\", r)\n\t\tcase !(rp.End() < r.Start()) && i > 0:\n\t\t\treturn errors.New(\"overlapping ranges: %v with %v\", rp, r)\n\t\t}\n\t\trp = r\n\t}\n\treturn nil\n}\n\n// isValidFieldNumber reports whether the field number is valid.\n// Unlike the FieldNumber.IsValid method, it allows ranges that cover the\n// reserved number range.\nfunc isValidFieldNumber(n protoreflect.FieldNumber, isMessageSet bool) bool {\n\treturn protowire.MinValidNumber <= n && (n <= protowire.MaxValidNumber || isMessageSet)\n}\n\n// CheckOverlap reports an error if p and q overlap.\nfunc (p *FieldRanges) CheckOverlap(q *FieldRanges) error {\n\trps := p.lazyInit().sorted\n\trqs := q.lazyInit().sorted\n\tfor pi, qi := 0, 0; pi < len(rps) && qi < len(rqs); {\n\t\trp := fieldRange(rps[pi])\n\t\trq := fieldRange(rqs[qi])\n\t\tif !(rp.End() < rq.Start() || rq.End() < rp.Start()) {\n\t\t\treturn errors.New(\"overlapping ranges: %v with %v\", rp, rq)\n\t\t}\n\t\tif rp.Start() < rq.Start() {\n\t\t\tpi++\n\t\t} else {\n\t\t\tqi++\n\t\t}\n\t}\n\treturn nil\n}\n\ntype fieldRange [2]protoreflect.FieldNumber\n\nfunc (r fieldRange) Start() protoreflect.FieldNumber { return r[0] }     // inclusive\nfunc (r fieldRange) End() protoreflect.FieldNumber   { return r[1] - 1 } // inclusive\nfunc (r fieldRange) String() string {\n\tif r.Start() == r.End() {\n\t\treturn fmt.Sprintf(\"%d\", r.Start())\n\t}\n\treturn fmt.Sprintf(\"%d to %d\", r.Start(), r.End())\n}\n\ntype FieldNumbers struct {\n\tList []pref.FieldNumber\n\tonce sync.Once\n\thas  map[pref.FieldNumber]struct{} // protected by once\n}\n\nfunc (p *FieldNumbers) Len() int                   { return len(p.List) }\nfunc (p *FieldNumbers) Get(i int) pref.FieldNumber { return p.List[i] }\nfunc (p *FieldNumbers) Has(n pref.FieldNumber) bool {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.has = make(map[pref.FieldNumber]struct{}, len(p.List))\n\t\t\tfor _, n := range p.List {\n\t\t\t\tp.has[n] = struct{}{}\n\t\t\t}\n\t\t}\n\t})\n\t_, ok := p.has[n]\n\treturn ok\n}\nfunc (p *FieldNumbers) Format(s fmt.State, r rune)          { descfmt.FormatList(s, r, p) }\nfunc (p *FieldNumbers) ProtoInternal(pragma.DoNotImplement) {}\n\ntype OneofFields struct {\n\tList   []pref.FieldDescriptor\n\tonce   sync.Once\n\tbyName map[pref.Name]pref.FieldDescriptor        // protected by once\n\tbyJSON map[string]pref.FieldDescriptor           // protected by once\n\tbyText map[string]pref.FieldDescriptor           // protected by once\n\tbyNum  map[pref.FieldNumber]pref.FieldDescriptor // protected by once\n}\n\nfunc (p *OneofFields) Len() int                                         { return len(p.List) }\nfunc (p *OneofFields) Get(i int) pref.FieldDescriptor                   { return p.List[i] }\nfunc (p *OneofFields) ByName(s pref.Name) pref.FieldDescriptor          { return p.lazyInit().byName[s] }\nfunc (p *OneofFields) ByJSONName(s string) pref.FieldDescriptor         { return p.lazyInit().byJSON[s] }\nfunc (p *OneofFields) ByTextName(s string) pref.FieldDescriptor         { return p.lazyInit().byText[s] }\nfunc (p *OneofFields) ByNumber(n pref.FieldNumber) pref.FieldDescriptor { return p.lazyInit().byNum[n] }\nfunc (p *OneofFields) Format(s fmt.State, r rune)                       { descfmt.FormatList(s, r, p) }\nfunc (p *OneofFields) ProtoInternal(pragma.DoNotImplement)              {}\n\nfunc (p *OneofFields) lazyInit() *OneofFields {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[pref.Name]pref.FieldDescriptor, len(p.List))\n\t\t\tp.byJSON = make(map[string]pref.FieldDescriptor, len(p.List))\n\t\t\tp.byText = make(map[string]pref.FieldDescriptor, len(p.List))\n\t\t\tp.byNum = make(map[pref.FieldNumber]pref.FieldDescriptor, len(p.List))\n\t\t\tfor _, f := range p.List {\n\t\t\t\t// Field names and numbers are guaranteed to be unique.\n\t\t\t\tp.byName[f.Name()] = f\n\t\t\t\tp.byJSON[f.JSONName()] = f\n\t\t\t\tp.byText[f.TextName()] = f\n\t\t\t\tp.byNum[f.Number()] = f\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype SourceLocations struct {\n\t// List is a list of SourceLocations.\n\t// The SourceLocation.Next field does not need to be populated\n\t// as it will be lazily populated upon first need.\n\tList []pref.SourceLocation\n\n\t// File is the parent file descriptor that these locations are relative to.\n\t// If non-nil, ByDescriptor verifies that the provided descriptor\n\t// is a child of this file descriptor.\n\tFile pref.FileDescriptor\n\n\tonce   sync.Once\n\tbyPath map[pathKey]int\n}\n\nfunc (p *SourceLocations) Len() int                      { return len(p.List) }\nfunc (p *SourceLocations) Get(i int) pref.SourceLocation { return p.lazyInit().List[i] }\nfunc (p *SourceLocations) byKey(k pathKey) pref.SourceLocation {\n\tif i, ok := p.lazyInit().byPath[k]; ok {\n\t\treturn p.List[i]\n\t}\n\treturn pref.SourceLocation{}\n}\nfunc (p *SourceLocations) ByPath(path pref.SourcePath) pref.SourceLocation {\n\treturn p.byKey(newPathKey(path))\n}\nfunc (p *SourceLocations) ByDescriptor(desc pref.Descriptor) pref.SourceLocation {\n\tif p.File != nil && desc != nil && p.File != desc.ParentFile() {\n\t\treturn pref.SourceLocation{} // mismatching parent files\n\t}\n\tvar pathArr [16]int32\n\tpath := pathArr[:0]\n\tfor {\n\t\tswitch desc.(type) {\n\t\tcase pref.FileDescriptor:\n\t\t\t// Reverse the path since it was constructed in reverse.\n\t\t\tfor i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 {\n\t\t\t\tpath[i], path[j] = path[j], path[i]\n\t\t\t}\n\t\t\treturn p.byKey(newPathKey(path))\n\t\tcase pref.MessageDescriptor:\n\t\t\tpath = append(path, int32(desc.Index()))\n\t\t\tdesc = desc.Parent()\n\t\t\tswitch desc.(type) {\n\t\t\tcase pref.FileDescriptor:\n\t\t\t\tpath = append(path, int32(genid.FileDescriptorProto_MessageType_field_number))\n\t\t\tcase pref.MessageDescriptor:\n\t\t\t\tpath = append(path, int32(genid.DescriptorProto_NestedType_field_number))\n\t\t\tdefault:\n\t\t\t\treturn pref.SourceLocation{}\n\t\t\t}\n\t\tcase pref.FieldDescriptor:\n\t\t\tisExtension := desc.(pref.FieldDescriptor).IsExtension()\n\t\t\tpath = append(path, int32(desc.Index()))\n\t\t\tdesc = desc.Parent()\n\t\t\tif isExtension {\n\t\t\t\tswitch desc.(type) {\n\t\t\t\tcase pref.FileDescriptor:\n\t\t\t\t\tpath = append(path, int32(genid.FileDescriptorProto_Extension_field_number))\n\t\t\t\tcase pref.MessageDescriptor:\n\t\t\t\t\tpath = append(path, int32(genid.DescriptorProto_Extension_field_number))\n\t\t\t\tdefault:\n\t\t\t\t\treturn pref.SourceLocation{}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tswitch desc.(type) {\n\t\t\t\tcase pref.MessageDescriptor:\n\t\t\t\t\tpath = append(path, int32(genid.DescriptorProto_Field_field_number))\n\t\t\t\tdefault:\n\t\t\t\t\treturn pref.SourceLocation{}\n\t\t\t\t}\n\t\t\t}\n\t\tcase pref.OneofDescriptor:\n\t\t\tpath = append(path, int32(desc.Index()))\n\t\t\tdesc = desc.Parent()\n\t\t\tswitch desc.(type) {\n\t\t\tcase pref.MessageDescriptor:\n\t\t\t\tpath = append(path, int32(genid.DescriptorProto_OneofDecl_field_number))\n\t\t\tdefault:\n\t\t\t\treturn pref.SourceLocation{}\n\t\t\t}\n\t\tcase pref.EnumDescriptor:\n\t\t\tpath = append(path, int32(desc.Index()))\n\t\t\tdesc = desc.Parent()\n\t\t\tswitch desc.(type) {\n\t\t\tcase pref.FileDescriptor:\n\t\t\t\tpath = append(path, int32(genid.FileDescriptorProto_EnumType_field_number))\n\t\t\tcase pref.MessageDescriptor:\n\t\t\t\tpath = append(path, int32(genid.DescriptorProto_EnumType_field_number))\n\t\t\tdefault:\n\t\t\t\treturn pref.SourceLocation{}\n\t\t\t}\n\t\tcase pref.EnumValueDescriptor:\n\t\t\tpath = append(path, int32(desc.Index()))\n\t\t\tdesc = desc.Parent()\n\t\t\tswitch desc.(type) {\n\t\t\tcase pref.EnumDescriptor:\n\t\t\t\tpath = append(path, int32(genid.EnumDescriptorProto_Value_field_number))\n\t\t\tdefault:\n\t\t\t\treturn pref.SourceLocation{}\n\t\t\t}\n\t\tcase pref.ServiceDescriptor:\n\t\t\tpath = append(path, int32(desc.Index()))\n\t\t\tdesc = desc.Parent()\n\t\t\tswitch desc.(type) {\n\t\t\tcase pref.FileDescriptor:\n\t\t\t\tpath = append(path, int32(genid.FileDescriptorProto_Service_field_number))\n\t\t\tdefault:\n\t\t\t\treturn pref.SourceLocation{}\n\t\t\t}\n\t\tcase pref.MethodDescriptor:\n\t\t\tpath = append(path, int32(desc.Index()))\n\t\t\tdesc = desc.Parent()\n\t\t\tswitch desc.(type) {\n\t\t\tcase pref.ServiceDescriptor:\n\t\t\t\tpath = append(path, int32(genid.ServiceDescriptorProto_Method_field_number))\n\t\t\tdefault:\n\t\t\t\treturn pref.SourceLocation{}\n\t\t\t}\n\t\tdefault:\n\t\t\treturn pref.SourceLocation{}\n\t\t}\n\t}\n}\nfunc (p *SourceLocations) lazyInit() *SourceLocations {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\t// Collect all the indexes for a given path.\n\t\t\tpathIdxs := make(map[pathKey][]int, len(p.List))\n\t\t\tfor i, l := range p.List {\n\t\t\t\tk := newPathKey(l.Path)\n\t\t\t\tpathIdxs[k] = append(pathIdxs[k], i)\n\t\t\t}\n\n\t\t\t// Update the next index for all locations.\n\t\t\tp.byPath = make(map[pathKey]int, len(p.List))\n\t\t\tfor k, idxs := range pathIdxs {\n\t\t\t\tfor i := 0; i < len(idxs)-1; i++ {\n\t\t\t\t\tp.List[idxs[i]].Next = idxs[i+1]\n\t\t\t\t}\n\t\t\t\tp.List[idxs[len(idxs)-1]].Next = 0\n\t\t\t\tp.byPath[k] = idxs[0] // record the first location for this path\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\nfunc (p *SourceLocations) ProtoInternal(pragma.DoNotImplement) {}\n\n// pathKey is a comparable representation of protoreflect.SourcePath.\ntype pathKey struct {\n\tarr [16]uint8 // first n-1 path segments; last element is the length\n\tstr string    // used if the path does not fit in arr\n}\n\nfunc newPathKey(p pref.SourcePath) (k pathKey) {\n\tif len(p) < len(k.arr) {\n\t\tfor i, ps := range p {\n\t\t\tif ps < 0 || math.MaxUint8 <= ps {\n\t\t\t\treturn pathKey{str: p.String()}\n\t\t\t}\n\t\t\tk.arr[i] = uint8(ps)\n\t\t}\n\t\tk.arr[len(k.arr)-1] = uint8(len(p))\n\t\treturn k\n\t}\n\treturn pathKey{str: p.String()}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.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// Code generated by generate-types. DO NOT EDIT.\n\npackage filedesc\n\nimport (\n\t\"fmt\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/descfmt\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype Enums struct {\n\tList   []Enum\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*Enum // protected by once\n}\n\nfunc (p *Enums) Len() int {\n\treturn len(p.List)\n}\nfunc (p *Enums) Get(i int) protoreflect.EnumDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *Enums) ByName(s protoreflect.Name) protoreflect.EnumDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Enums) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *Enums) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Enums) lazyInit() *Enums {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*Enum, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype EnumValues struct {\n\tList   []EnumValue\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*EnumValue       // protected by once\n\tbyNum  map[protoreflect.EnumNumber]*EnumValue // protected by once\n}\n\nfunc (p *EnumValues) Len() int {\n\treturn len(p.List)\n}\nfunc (p *EnumValues) Get(i int) protoreflect.EnumValueDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *EnumValues) ByName(s protoreflect.Name) protoreflect.EnumValueDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *EnumValues) ByNumber(n protoreflect.EnumNumber) protoreflect.EnumValueDescriptor {\n\tif d := p.lazyInit().byNum[n]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *EnumValues) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *EnumValues) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *EnumValues) lazyInit() *EnumValues {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*EnumValue, len(p.List))\n\t\t\tp.byNum = make(map[protoreflect.EnumNumber]*EnumValue, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t\tif _, ok := p.byNum[d.Number()]; !ok {\n\t\t\t\t\tp.byNum[d.Number()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype Messages struct {\n\tList   []Message\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*Message // protected by once\n}\n\nfunc (p *Messages) Len() int {\n\treturn len(p.List)\n}\nfunc (p *Messages) Get(i int) protoreflect.MessageDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *Messages) ByName(s protoreflect.Name) protoreflect.MessageDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Messages) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *Messages) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Messages) lazyInit() *Messages {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*Message, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype Fields struct {\n\tList   []Field\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*Field        // protected by once\n\tbyJSON map[string]*Field                   // protected by once\n\tbyText map[string]*Field                   // protected by once\n\tbyNum  map[protoreflect.FieldNumber]*Field // protected by once\n}\n\nfunc (p *Fields) Len() int {\n\treturn len(p.List)\n}\nfunc (p *Fields) Get(i int) protoreflect.FieldDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *Fields) ByName(s protoreflect.Name) protoreflect.FieldDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Fields) ByJSONName(s string) protoreflect.FieldDescriptor {\n\tif d := p.lazyInit().byJSON[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Fields) ByTextName(s string) protoreflect.FieldDescriptor {\n\tif d := p.lazyInit().byText[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Fields) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDescriptor {\n\tif d := p.lazyInit().byNum[n]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Fields) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *Fields) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Fields) lazyInit() *Fields {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*Field, len(p.List))\n\t\t\tp.byJSON = make(map[string]*Field, len(p.List))\n\t\t\tp.byText = make(map[string]*Field, len(p.List))\n\t\t\tp.byNum = make(map[protoreflect.FieldNumber]*Field, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t\tif _, ok := p.byJSON[d.JSONName()]; !ok {\n\t\t\t\t\tp.byJSON[d.JSONName()] = d\n\t\t\t\t}\n\t\t\t\tif _, ok := p.byText[d.TextName()]; !ok {\n\t\t\t\t\tp.byText[d.TextName()] = d\n\t\t\t\t}\n\t\t\t\tif _, ok := p.byNum[d.Number()]; !ok {\n\t\t\t\t\tp.byNum[d.Number()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype Oneofs struct {\n\tList   []Oneof\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*Oneof // protected by once\n}\n\nfunc (p *Oneofs) Len() int {\n\treturn len(p.List)\n}\nfunc (p *Oneofs) Get(i int) protoreflect.OneofDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *Oneofs) ByName(s protoreflect.Name) protoreflect.OneofDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Oneofs) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *Oneofs) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Oneofs) lazyInit() *Oneofs {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*Oneof, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype Extensions struct {\n\tList   []Extension\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*Extension // protected by once\n}\n\nfunc (p *Extensions) Len() int {\n\treturn len(p.List)\n}\nfunc (p *Extensions) Get(i int) protoreflect.ExtensionDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *Extensions) ByName(s protoreflect.Name) protoreflect.ExtensionDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Extensions) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *Extensions) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Extensions) lazyInit() *Extensions {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*Extension, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype Services struct {\n\tList   []Service\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*Service // protected by once\n}\n\nfunc (p *Services) Len() int {\n\treturn len(p.List)\n}\nfunc (p *Services) Get(i int) protoreflect.ServiceDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *Services) ByName(s protoreflect.Name) protoreflect.ServiceDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Services) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *Services) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Services) lazyInit() *Services {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*Service, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n\ntype Methods struct {\n\tList   []Method\n\tonce   sync.Once\n\tbyName map[protoreflect.Name]*Method // protected by once\n}\n\nfunc (p *Methods) Len() int {\n\treturn len(p.List)\n}\nfunc (p *Methods) Get(i int) protoreflect.MethodDescriptor {\n\treturn &p.List[i]\n}\nfunc (p *Methods) ByName(s protoreflect.Name) protoreflect.MethodDescriptor {\n\tif d := p.lazyInit().byName[s]; d != nil {\n\t\treturn d\n\t}\n\treturn nil\n}\nfunc (p *Methods) Format(s fmt.State, r rune) {\n\tdescfmt.FormatList(s, r, p)\n}\nfunc (p *Methods) ProtoInternal(pragma.DoNotImplement) {}\nfunc (p *Methods) lazyInit() *Methods {\n\tp.once.Do(func() {\n\t\tif len(p.List) > 0 {\n\t\t\tp.byName = make(map[protoreflect.Name]*Method, len(p.List))\n\t\t\tfor i := range p.List {\n\t\t\t\td := &p.List[i]\n\t\t\t\tif _, ok := p.byName[d.Name()]; !ok {\n\t\t\t\t\tp.byName[d.Name()] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\treturn p\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/filedesc/placeholder.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 filedesc\n\nimport (\n\t\"google.golang.org/protobuf/internal/descopts\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nvar (\n\temptyNames           = new(Names)\n\temptyEnumRanges      = new(EnumRanges)\n\temptyFieldRanges     = new(FieldRanges)\n\temptyFieldNumbers    = new(FieldNumbers)\n\temptySourceLocations = new(SourceLocations)\n\n\temptyFiles      = new(FileImports)\n\temptyMessages   = new(Messages)\n\temptyFields     = new(Fields)\n\temptyOneofs     = new(Oneofs)\n\temptyEnums      = new(Enums)\n\temptyEnumValues = new(EnumValues)\n\temptyExtensions = new(Extensions)\n\temptyServices   = new(Services)\n)\n\n// PlaceholderFile is a placeholder, representing only the file path.\ntype PlaceholderFile string\n\nfunc (f PlaceholderFile) ParentFile() pref.FileDescriptor       { return f }\nfunc (f PlaceholderFile) Parent() pref.Descriptor               { return nil }\nfunc (f PlaceholderFile) Index() int                            { return 0 }\nfunc (f PlaceholderFile) Syntax() pref.Syntax                   { return 0 }\nfunc (f PlaceholderFile) Name() pref.Name                       { return \"\" }\nfunc (f PlaceholderFile) FullName() pref.FullName               { return \"\" }\nfunc (f PlaceholderFile) IsPlaceholder() bool                   { return true }\nfunc (f PlaceholderFile) Options() pref.ProtoMessage            { return descopts.File }\nfunc (f PlaceholderFile) Path() string                          { return string(f) }\nfunc (f PlaceholderFile) Package() pref.FullName                { return \"\" }\nfunc (f PlaceholderFile) Imports() pref.FileImports             { return emptyFiles }\nfunc (f PlaceholderFile) Messages() pref.MessageDescriptors     { return emptyMessages }\nfunc (f PlaceholderFile) Enums() pref.EnumDescriptors           { return emptyEnums }\nfunc (f PlaceholderFile) Extensions() pref.ExtensionDescriptors { return emptyExtensions }\nfunc (f PlaceholderFile) Services() pref.ServiceDescriptors     { return emptyServices }\nfunc (f PlaceholderFile) SourceLocations() pref.SourceLocations { return emptySourceLocations }\nfunc (f PlaceholderFile) ProtoType(pref.FileDescriptor)         { return }\nfunc (f PlaceholderFile) ProtoInternal(pragma.DoNotImplement)   { return }\n\n// PlaceholderEnum is a placeholder, representing only the full name.\ntype PlaceholderEnum pref.FullName\n\nfunc (e PlaceholderEnum) ParentFile() pref.FileDescriptor     { return nil }\nfunc (e PlaceholderEnum) Parent() pref.Descriptor             { return nil }\nfunc (e PlaceholderEnum) Index() int                          { return 0 }\nfunc (e PlaceholderEnum) Syntax() pref.Syntax                 { return 0 }\nfunc (e PlaceholderEnum) Name() pref.Name                     { return pref.FullName(e).Name() }\nfunc (e PlaceholderEnum) FullName() pref.FullName             { return pref.FullName(e) }\nfunc (e PlaceholderEnum) IsPlaceholder() bool                 { return true }\nfunc (e PlaceholderEnum) Options() pref.ProtoMessage          { return descopts.Enum }\nfunc (e PlaceholderEnum) Values() pref.EnumValueDescriptors   { return emptyEnumValues }\nfunc (e PlaceholderEnum) ReservedNames() pref.Names           { return emptyNames }\nfunc (e PlaceholderEnum) ReservedRanges() pref.EnumRanges     { return emptyEnumRanges }\nfunc (e PlaceholderEnum) ProtoType(pref.EnumDescriptor)       { return }\nfunc (e PlaceholderEnum) ProtoInternal(pragma.DoNotImplement) { return }\n\n// PlaceholderEnumValue is a placeholder, representing only the full name.\ntype PlaceholderEnumValue pref.FullName\n\nfunc (e PlaceholderEnumValue) ParentFile() pref.FileDescriptor     { return nil }\nfunc (e PlaceholderEnumValue) Parent() pref.Descriptor             { return nil }\nfunc (e PlaceholderEnumValue) Index() int                          { return 0 }\nfunc (e PlaceholderEnumValue) Syntax() pref.Syntax                 { return 0 }\nfunc (e PlaceholderEnumValue) Name() pref.Name                     { return pref.FullName(e).Name() }\nfunc (e PlaceholderEnumValue) FullName() pref.FullName             { return pref.FullName(e) }\nfunc (e PlaceholderEnumValue) IsPlaceholder() bool                 { return true }\nfunc (e PlaceholderEnumValue) Options() pref.ProtoMessage          { return descopts.EnumValue }\nfunc (e PlaceholderEnumValue) Number() pref.EnumNumber             { return 0 }\nfunc (e PlaceholderEnumValue) ProtoType(pref.EnumValueDescriptor)  { return }\nfunc (e PlaceholderEnumValue) ProtoInternal(pragma.DoNotImplement) { return }\n\n// PlaceholderMessage is a placeholder, representing only the full name.\ntype PlaceholderMessage pref.FullName\n\nfunc (m PlaceholderMessage) ParentFile() pref.FileDescriptor             { return nil }\nfunc (m PlaceholderMessage) Parent() pref.Descriptor                     { return nil }\nfunc (m PlaceholderMessage) Index() int                                  { return 0 }\nfunc (m PlaceholderMessage) Syntax() pref.Syntax                         { return 0 }\nfunc (m PlaceholderMessage) Name() pref.Name                             { return pref.FullName(m).Name() }\nfunc (m PlaceholderMessage) FullName() pref.FullName                     { return pref.FullName(m) }\nfunc (m PlaceholderMessage) IsPlaceholder() bool                         { return true }\nfunc (m PlaceholderMessage) Options() pref.ProtoMessage                  { return descopts.Message }\nfunc (m PlaceholderMessage) IsMapEntry() bool                            { return false }\nfunc (m PlaceholderMessage) Fields() pref.FieldDescriptors               { return emptyFields }\nfunc (m PlaceholderMessage) Oneofs() pref.OneofDescriptors               { return emptyOneofs }\nfunc (m PlaceholderMessage) ReservedNames() pref.Names                   { return emptyNames }\nfunc (m PlaceholderMessage) ReservedRanges() pref.FieldRanges            { return emptyFieldRanges }\nfunc (m PlaceholderMessage) RequiredNumbers() pref.FieldNumbers          { return emptyFieldNumbers }\nfunc (m PlaceholderMessage) ExtensionRanges() pref.FieldRanges           { return emptyFieldRanges }\nfunc (m PlaceholderMessage) ExtensionRangeOptions(int) pref.ProtoMessage { panic(\"index out of range\") }\nfunc (m PlaceholderMessage) Messages() pref.MessageDescriptors           { return emptyMessages }\nfunc (m PlaceholderMessage) Enums() pref.EnumDescriptors                 { return emptyEnums }\nfunc (m PlaceholderMessage) Extensions() pref.ExtensionDescriptors       { return emptyExtensions }\nfunc (m PlaceholderMessage) ProtoType(pref.MessageDescriptor)            { return }\nfunc (m PlaceholderMessage) ProtoInternal(pragma.DoNotImplement)         { return }\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/filetype/build.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 filetype provides functionality for wrapping descriptors\n// with Go type information.\npackage filetype\n\nimport (\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/internal/descopts\"\n\tfdesc \"google.golang.org/protobuf/internal/filedesc\"\n\tpimpl \"google.golang.org/protobuf/internal/impl\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// Builder constructs type descriptors from a raw file descriptor\n// and associated Go types for each enum and message declaration.\n//\n//\n// Flattened Ordering\n//\n// The protobuf type system represents declarations as a tree. Certain nodes in\n// the tree require us to either associate it with a concrete Go type or to\n// resolve a dependency, which is information that must be provided separately\n// since it cannot be derived from the file descriptor alone.\n//\n// However, representing a tree as Go literals is difficult to simply do in a\n// space and time efficient way. Thus, we store them as a flattened list of\n// objects where the serialization order from the tree-based form is important.\n//\n// The \"flattened ordering\" is defined as a tree traversal of all enum, message,\n// extension, and service declarations using the following algorithm:\n//\n//\tdef VisitFileDecls(fd):\n//\t\tfor e in fd.Enums:      yield e\n//\t\tfor m in fd.Messages:   yield m\n//\t\tfor x in fd.Extensions: yield x\n//\t\tfor s in fd.Services:   yield s\n//\t\tfor m in fd.Messages:   yield from VisitMessageDecls(m)\n//\n//\tdef VisitMessageDecls(md):\n//\t\tfor e in md.Enums:      yield e\n//\t\tfor m in md.Messages:   yield m\n//\t\tfor x in md.Extensions: yield x\n//\t\tfor m in md.Messages:   yield from VisitMessageDecls(m)\n//\n// The traversal starts at the root file descriptor and yields each direct\n// declaration within each node before traversing into sub-declarations\n// that children themselves may have.\ntype Builder struct {\n\t// File is the underlying file descriptor builder.\n\tFile fdesc.Builder\n\n\t// GoTypes is a unique set of the Go types for all declarations and\n\t// dependencies. Each type is represented as a zero value of the Go type.\n\t//\n\t// Declarations are Go types generated for enums and messages directly\n\t// declared (not publicly imported) in the proto source file.\n\t// Messages for map entries are accounted for, but represented by nil.\n\t// Enum declarations in \"flattened ordering\" come first, followed by\n\t// message declarations in \"flattened ordering\".\n\t//\n\t// Dependencies are Go types for enums or messages referenced by\n\t// message fields (excluding weak fields), for parent extended messages of\n\t// extension fields, for enums or messages referenced by extension fields,\n\t// and for input and output messages referenced by service methods.\n\t// Dependencies must come after declarations, but the ordering of\n\t// dependencies themselves is unspecified.\n\tGoTypes []interface{}\n\n\t// DependencyIndexes is an ordered list of indexes into GoTypes for the\n\t// dependencies of messages, extensions, or services.\n\t//\n\t// There are 5 sub-lists in \"flattened ordering\" concatenated back-to-back:\n\t//\t0. Message field dependencies: list of the enum or message type\n\t//\treferred to by every message field.\n\t//\t1. Extension field targets: list of the extended parent message of\n\t//\tevery extension.\n\t//\t2. Extension field dependencies: list of the enum or message type\n\t//\treferred to by every extension field.\n\t//\t3. Service method inputs: list of the input message type\n\t//\treferred to by every service method.\n\t//\t4. Service method outputs: list of the output message type\n\t//\treferred to by every service method.\n\t//\n\t// The offset into DependencyIndexes for the start of each sub-list\n\t// is appended to the end in reverse order.\n\tDependencyIndexes []int32\n\n\t// EnumInfos is a list of enum infos in \"flattened ordering\".\n\tEnumInfos []pimpl.EnumInfo\n\n\t// MessageInfos is a list of message infos in \"flattened ordering\".\n\t// If provided, the GoType and PBType for each element is populated.\n\t//\n\t// Requirement: len(MessageInfos) == len(Build.Messages)\n\tMessageInfos []pimpl.MessageInfo\n\n\t// ExtensionInfos is a list of extension infos in \"flattened ordering\".\n\t// Each element is initialized and registered with the protoregistry package.\n\t//\n\t// Requirement: len(LegacyExtensions) == len(Build.Extensions)\n\tExtensionInfos []pimpl.ExtensionInfo\n\n\t// TypeRegistry is the registry to register each type descriptor.\n\t// If nil, it uses protoregistry.GlobalTypes.\n\tTypeRegistry interface {\n\t\tRegisterMessage(pref.MessageType) error\n\t\tRegisterEnum(pref.EnumType) error\n\t\tRegisterExtension(pref.ExtensionType) error\n\t}\n}\n\n// Out is the output of the builder.\ntype Out struct {\n\tFile pref.FileDescriptor\n}\n\nfunc (tb Builder) Build() (out Out) {\n\t// Replace the resolver with one that resolves dependencies by index,\n\t// which is faster and more reliable than relying on the global registry.\n\tif tb.File.FileRegistry == nil {\n\t\ttb.File.FileRegistry = preg.GlobalFiles\n\t}\n\ttb.File.FileRegistry = &resolverByIndex{\n\t\tgoTypes:      tb.GoTypes,\n\t\tdepIdxs:      tb.DependencyIndexes,\n\t\tfileRegistry: tb.File.FileRegistry,\n\t}\n\n\t// Initialize registry if unpopulated.\n\tif tb.TypeRegistry == nil {\n\t\ttb.TypeRegistry = preg.GlobalTypes\n\t}\n\n\tfbOut := tb.File.Build()\n\tout.File = fbOut.File\n\n\t// Process enums.\n\tenumGoTypes := tb.GoTypes[:len(fbOut.Enums)]\n\tif len(tb.EnumInfos) != len(fbOut.Enums) {\n\t\tpanic(\"mismatching enum lengths\")\n\t}\n\tif len(fbOut.Enums) > 0 {\n\t\tfor i := range fbOut.Enums {\n\t\t\ttb.EnumInfos[i] = pimpl.EnumInfo{\n\t\t\t\tGoReflectType: reflect.TypeOf(enumGoTypes[i]),\n\t\t\t\tDesc:          &fbOut.Enums[i],\n\t\t\t}\n\t\t\t// Register enum types.\n\t\t\tif err := tb.TypeRegistry.RegisterEnum(&tb.EnumInfos[i]); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Process messages.\n\tmessageGoTypes := tb.GoTypes[len(fbOut.Enums):][:len(fbOut.Messages)]\n\tif len(tb.MessageInfos) != len(fbOut.Messages) {\n\t\tpanic(\"mismatching message lengths\")\n\t}\n\tif len(fbOut.Messages) > 0 {\n\t\tfor i := range fbOut.Messages {\n\t\t\tif messageGoTypes[i] == nil {\n\t\t\t\tcontinue // skip map entry\n\t\t\t}\n\n\t\t\ttb.MessageInfos[i].GoReflectType = reflect.TypeOf(messageGoTypes[i])\n\t\t\ttb.MessageInfos[i].Desc = &fbOut.Messages[i]\n\n\t\t\t// Register message types.\n\t\t\tif err := tb.TypeRegistry.RegisterMessage(&tb.MessageInfos[i]); err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\n\t\t// As a special-case for descriptor.proto,\n\t\t// locally register concrete message type for the options.\n\t\tif out.File.Path() == \"google/protobuf/descriptor.proto\" && out.File.Package() == \"google.protobuf\" {\n\t\t\tfor i := range fbOut.Messages {\n\t\t\t\tswitch fbOut.Messages[i].Name() {\n\t\t\t\tcase \"FileOptions\":\n\t\t\t\t\tdescopts.File = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"EnumOptions\":\n\t\t\t\t\tdescopts.Enum = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"EnumValueOptions\":\n\t\t\t\t\tdescopts.EnumValue = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"MessageOptions\":\n\t\t\t\t\tdescopts.Message = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"FieldOptions\":\n\t\t\t\t\tdescopts.Field = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"OneofOptions\":\n\t\t\t\t\tdescopts.Oneof = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"ExtensionRangeOptions\":\n\t\t\t\t\tdescopts.ExtensionRange = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"ServiceOptions\":\n\t\t\t\t\tdescopts.Service = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\tcase \"MethodOptions\":\n\t\t\t\t\tdescopts.Method = messageGoTypes[i].(pref.ProtoMessage)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Process extensions.\n\tif len(tb.ExtensionInfos) != len(fbOut.Extensions) {\n\t\tpanic(\"mismatching extension lengths\")\n\t}\n\tvar depIdx int32\n\tfor i := range fbOut.Extensions {\n\t\t// For enum and message kinds, determine the referent Go type so\n\t\t// that we can construct their constructors.\n\t\tconst listExtDeps = 2\n\t\tvar goType reflect.Type\n\t\tswitch fbOut.Extensions[i].L1.Kind {\n\t\tcase pref.EnumKind:\n\t\t\tj := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)\n\t\t\tgoType = reflect.TypeOf(tb.GoTypes[j])\n\t\t\tdepIdx++\n\t\tcase pref.MessageKind, pref.GroupKind:\n\t\t\tj := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)\n\t\t\tgoType = reflect.TypeOf(tb.GoTypes[j])\n\t\t\tdepIdx++\n\t\tdefault:\n\t\t\tgoType = goTypeForPBKind[fbOut.Extensions[i].L1.Kind]\n\t\t}\n\t\tif fbOut.Extensions[i].IsList() {\n\t\t\tgoType = reflect.SliceOf(goType)\n\t\t}\n\n\t\tpimpl.InitExtensionInfo(&tb.ExtensionInfos[i], &fbOut.Extensions[i], goType)\n\n\t\t// Register extension types.\n\t\tif err := tb.TypeRegistry.RegisterExtension(&tb.ExtensionInfos[i]); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\treturn out\n}\n\nvar goTypeForPBKind = map[pref.Kind]reflect.Type{\n\tpref.BoolKind:     reflect.TypeOf(bool(false)),\n\tpref.Int32Kind:    reflect.TypeOf(int32(0)),\n\tpref.Sint32Kind:   reflect.TypeOf(int32(0)),\n\tpref.Sfixed32Kind: reflect.TypeOf(int32(0)),\n\tpref.Int64Kind:    reflect.TypeOf(int64(0)),\n\tpref.Sint64Kind:   reflect.TypeOf(int64(0)),\n\tpref.Sfixed64Kind: reflect.TypeOf(int64(0)),\n\tpref.Uint32Kind:   reflect.TypeOf(uint32(0)),\n\tpref.Fixed32Kind:  reflect.TypeOf(uint32(0)),\n\tpref.Uint64Kind:   reflect.TypeOf(uint64(0)),\n\tpref.Fixed64Kind:  reflect.TypeOf(uint64(0)),\n\tpref.FloatKind:    reflect.TypeOf(float32(0)),\n\tpref.DoubleKind:   reflect.TypeOf(float64(0)),\n\tpref.StringKind:   reflect.TypeOf(string(\"\")),\n\tpref.BytesKind:    reflect.TypeOf([]byte(nil)),\n}\n\ntype depIdxs []int32\n\n// Get retrieves the jth element of the ith sub-list.\nfunc (x depIdxs) Get(i, j int32) int32 {\n\treturn x[x[int32(len(x))-i-1]+j]\n}\n\ntype (\n\tresolverByIndex struct {\n\t\tgoTypes []interface{}\n\t\tdepIdxs depIdxs\n\t\tfileRegistry\n\t}\n\tfileRegistry interface {\n\t\tFindFileByPath(string) (pref.FileDescriptor, error)\n\t\tFindDescriptorByName(pref.FullName) (pref.Descriptor, error)\n\t\tRegisterFile(pref.FileDescriptor) error\n\t}\n)\n\nfunc (r *resolverByIndex) FindEnumByIndex(i, j int32, es []fdesc.Enum, ms []fdesc.Message) pref.EnumDescriptor {\n\tif depIdx := int(r.depIdxs.Get(i, j)); int(depIdx) < len(es)+len(ms) {\n\t\treturn &es[depIdx]\n\t} else {\n\t\treturn pimpl.Export{}.EnumDescriptorOf(r.goTypes[depIdx])\n\t}\n}\n\nfunc (r *resolverByIndex) FindMessageByIndex(i, j int32, es []fdesc.Enum, ms []fdesc.Message) pref.MessageDescriptor {\n\tif depIdx := int(r.depIdxs.Get(i, j)); depIdx < len(es)+len(ms) {\n\t\treturn &ms[depIdx-len(es)]\n\t} else {\n\t\treturn pimpl.Export{}.MessageDescriptorOf(r.goTypes[depIdx])\n\t}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/flags/flags.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 flags provides a set of flags controlled by build tags.\npackage flags\n\n// ProtoLegacy specifies whether to enable support for legacy functionality\n// such as MessageSets, weak fields, and various other obscure behavior\n// that is necessary to maintain backwards compatibility with proto1 or\n// the pre-release variants of proto2 and proto3.\n//\n// This is disabled by default unless built with the \"protolegacy\" tag.\n//\n// WARNING: The compatibility agreement covers nothing provided by this flag.\n// As such, functionality may suddenly be removed or changed at our discretion.\nconst ProtoLegacy = protoLegacy\n\n// LazyUnmarshalExtensions specifies whether to lazily unmarshal extensions.\n//\n// Lazy extension unmarshaling validates the contents of message-valued\n// extension fields at unmarshal time, but defers creating the message\n// structure until the extension is first accessed.\nconst LazyUnmarshalExtensions = ProtoLegacy\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.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// +build !protolegacy\n\npackage flags\n\nconst protoLegacy = false\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.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// +build protolegacy\n\npackage flags\n\nconst protoLegacy = true\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/any_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_any_proto = \"google/protobuf/any.proto\"\n\n// Names for google.protobuf.Any.\nconst (\n\tAny_message_name     protoreflect.Name     = \"Any\"\n\tAny_message_fullname protoreflect.FullName = \"google.protobuf.Any\"\n)\n\n// Field names for google.protobuf.Any.\nconst (\n\tAny_TypeUrl_field_name protoreflect.Name = \"type_url\"\n\tAny_Value_field_name   protoreflect.Name = \"value\"\n\n\tAny_TypeUrl_field_fullname protoreflect.FullName = \"google.protobuf.Any.type_url\"\n\tAny_Value_field_fullname   protoreflect.FullName = \"google.protobuf.Any.value\"\n)\n\n// Field numbers for google.protobuf.Any.\nconst (\n\tAny_TypeUrl_field_number protoreflect.FieldNumber = 1\n\tAny_Value_field_number   protoreflect.FieldNumber = 2\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/api_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_api_proto = \"google/protobuf/api.proto\"\n\n// Names for google.protobuf.Api.\nconst (\n\tApi_message_name     protoreflect.Name     = \"Api\"\n\tApi_message_fullname protoreflect.FullName = \"google.protobuf.Api\"\n)\n\n// Field names for google.protobuf.Api.\nconst (\n\tApi_Name_field_name          protoreflect.Name = \"name\"\n\tApi_Methods_field_name       protoreflect.Name = \"methods\"\n\tApi_Options_field_name       protoreflect.Name = \"options\"\n\tApi_Version_field_name       protoreflect.Name = \"version\"\n\tApi_SourceContext_field_name protoreflect.Name = \"source_context\"\n\tApi_Mixins_field_name        protoreflect.Name = \"mixins\"\n\tApi_Syntax_field_name        protoreflect.Name = \"syntax\"\n\n\tApi_Name_field_fullname          protoreflect.FullName = \"google.protobuf.Api.name\"\n\tApi_Methods_field_fullname       protoreflect.FullName = \"google.protobuf.Api.methods\"\n\tApi_Options_field_fullname       protoreflect.FullName = \"google.protobuf.Api.options\"\n\tApi_Version_field_fullname       protoreflect.FullName = \"google.protobuf.Api.version\"\n\tApi_SourceContext_field_fullname protoreflect.FullName = \"google.protobuf.Api.source_context\"\n\tApi_Mixins_field_fullname        protoreflect.FullName = \"google.protobuf.Api.mixins\"\n\tApi_Syntax_field_fullname        protoreflect.FullName = \"google.protobuf.Api.syntax\"\n)\n\n// Field numbers for google.protobuf.Api.\nconst (\n\tApi_Name_field_number          protoreflect.FieldNumber = 1\n\tApi_Methods_field_number       protoreflect.FieldNumber = 2\n\tApi_Options_field_number       protoreflect.FieldNumber = 3\n\tApi_Version_field_number       protoreflect.FieldNumber = 4\n\tApi_SourceContext_field_number protoreflect.FieldNumber = 5\n\tApi_Mixins_field_number        protoreflect.FieldNumber = 6\n\tApi_Syntax_field_number        protoreflect.FieldNumber = 7\n)\n\n// Names for google.protobuf.Method.\nconst (\n\tMethod_message_name     protoreflect.Name     = \"Method\"\n\tMethod_message_fullname protoreflect.FullName = \"google.protobuf.Method\"\n)\n\n// Field names for google.protobuf.Method.\nconst (\n\tMethod_Name_field_name              protoreflect.Name = \"name\"\n\tMethod_RequestTypeUrl_field_name    protoreflect.Name = \"request_type_url\"\n\tMethod_RequestStreaming_field_name  protoreflect.Name = \"request_streaming\"\n\tMethod_ResponseTypeUrl_field_name   protoreflect.Name = \"response_type_url\"\n\tMethod_ResponseStreaming_field_name protoreflect.Name = \"response_streaming\"\n\tMethod_Options_field_name           protoreflect.Name = \"options\"\n\tMethod_Syntax_field_name            protoreflect.Name = \"syntax\"\n\n\tMethod_Name_field_fullname              protoreflect.FullName = \"google.protobuf.Method.name\"\n\tMethod_RequestTypeUrl_field_fullname    protoreflect.FullName = \"google.protobuf.Method.request_type_url\"\n\tMethod_RequestStreaming_field_fullname  protoreflect.FullName = \"google.protobuf.Method.request_streaming\"\n\tMethod_ResponseTypeUrl_field_fullname   protoreflect.FullName = \"google.protobuf.Method.response_type_url\"\n\tMethod_ResponseStreaming_field_fullname protoreflect.FullName = \"google.protobuf.Method.response_streaming\"\n\tMethod_Options_field_fullname           protoreflect.FullName = \"google.protobuf.Method.options\"\n\tMethod_Syntax_field_fullname            protoreflect.FullName = \"google.protobuf.Method.syntax\"\n)\n\n// Field numbers for google.protobuf.Method.\nconst (\n\tMethod_Name_field_number              protoreflect.FieldNumber = 1\n\tMethod_RequestTypeUrl_field_number    protoreflect.FieldNumber = 2\n\tMethod_RequestStreaming_field_number  protoreflect.FieldNumber = 3\n\tMethod_ResponseTypeUrl_field_number   protoreflect.FieldNumber = 4\n\tMethod_ResponseStreaming_field_number protoreflect.FieldNumber = 5\n\tMethod_Options_field_number           protoreflect.FieldNumber = 6\n\tMethod_Syntax_field_number            protoreflect.FieldNumber = 7\n)\n\n// Names for google.protobuf.Mixin.\nconst (\n\tMixin_message_name     protoreflect.Name     = \"Mixin\"\n\tMixin_message_fullname protoreflect.FullName = \"google.protobuf.Mixin\"\n)\n\n// Field names for google.protobuf.Mixin.\nconst (\n\tMixin_Name_field_name protoreflect.Name = \"name\"\n\tMixin_Root_field_name protoreflect.Name = \"root\"\n\n\tMixin_Name_field_fullname protoreflect.FullName = \"google.protobuf.Mixin.name\"\n\tMixin_Root_field_fullname protoreflect.FullName = \"google.protobuf.Mixin.root\"\n)\n\n// Field numbers for google.protobuf.Mixin.\nconst (\n\tMixin_Name_field_number protoreflect.FieldNumber = 1\n\tMixin_Root_field_number protoreflect.FieldNumber = 2\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_descriptor_proto = \"google/protobuf/descriptor.proto\"\n\n// Names for google.protobuf.FileDescriptorSet.\nconst (\n\tFileDescriptorSet_message_name     protoreflect.Name     = \"FileDescriptorSet\"\n\tFileDescriptorSet_message_fullname protoreflect.FullName = \"google.protobuf.FileDescriptorSet\"\n)\n\n// Field names for google.protobuf.FileDescriptorSet.\nconst (\n\tFileDescriptorSet_File_field_name protoreflect.Name = \"file\"\n\n\tFileDescriptorSet_File_field_fullname protoreflect.FullName = \"google.protobuf.FileDescriptorSet.file\"\n)\n\n// Field numbers for google.protobuf.FileDescriptorSet.\nconst (\n\tFileDescriptorSet_File_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.FileDescriptorProto.\nconst (\n\tFileDescriptorProto_message_name     protoreflect.Name     = \"FileDescriptorProto\"\n\tFileDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.FileDescriptorProto\"\n)\n\n// Field names for google.protobuf.FileDescriptorProto.\nconst (\n\tFileDescriptorProto_Name_field_name             protoreflect.Name = \"name\"\n\tFileDescriptorProto_Package_field_name          protoreflect.Name = \"package\"\n\tFileDescriptorProto_Dependency_field_name       protoreflect.Name = \"dependency\"\n\tFileDescriptorProto_PublicDependency_field_name protoreflect.Name = \"public_dependency\"\n\tFileDescriptorProto_WeakDependency_field_name   protoreflect.Name = \"weak_dependency\"\n\tFileDescriptorProto_MessageType_field_name      protoreflect.Name = \"message_type\"\n\tFileDescriptorProto_EnumType_field_name         protoreflect.Name = \"enum_type\"\n\tFileDescriptorProto_Service_field_name          protoreflect.Name = \"service\"\n\tFileDescriptorProto_Extension_field_name        protoreflect.Name = \"extension\"\n\tFileDescriptorProto_Options_field_name          protoreflect.Name = \"options\"\n\tFileDescriptorProto_SourceCodeInfo_field_name   protoreflect.Name = \"source_code_info\"\n\tFileDescriptorProto_Syntax_field_name           protoreflect.Name = \"syntax\"\n\n\tFileDescriptorProto_Name_field_fullname             protoreflect.FullName = \"google.protobuf.FileDescriptorProto.name\"\n\tFileDescriptorProto_Package_field_fullname          protoreflect.FullName = \"google.protobuf.FileDescriptorProto.package\"\n\tFileDescriptorProto_Dependency_field_fullname       protoreflect.FullName = \"google.protobuf.FileDescriptorProto.dependency\"\n\tFileDescriptorProto_PublicDependency_field_fullname protoreflect.FullName = \"google.protobuf.FileDescriptorProto.public_dependency\"\n\tFileDescriptorProto_WeakDependency_field_fullname   protoreflect.FullName = \"google.protobuf.FileDescriptorProto.weak_dependency\"\n\tFileDescriptorProto_MessageType_field_fullname      protoreflect.FullName = \"google.protobuf.FileDescriptorProto.message_type\"\n\tFileDescriptorProto_EnumType_field_fullname         protoreflect.FullName = \"google.protobuf.FileDescriptorProto.enum_type\"\n\tFileDescriptorProto_Service_field_fullname          protoreflect.FullName = \"google.protobuf.FileDescriptorProto.service\"\n\tFileDescriptorProto_Extension_field_fullname        protoreflect.FullName = \"google.protobuf.FileDescriptorProto.extension\"\n\tFileDescriptorProto_Options_field_fullname          protoreflect.FullName = \"google.protobuf.FileDescriptorProto.options\"\n\tFileDescriptorProto_SourceCodeInfo_field_fullname   protoreflect.FullName = \"google.protobuf.FileDescriptorProto.source_code_info\"\n\tFileDescriptorProto_Syntax_field_fullname           protoreflect.FullName = \"google.protobuf.FileDescriptorProto.syntax\"\n)\n\n// Field numbers for google.protobuf.FileDescriptorProto.\nconst (\n\tFileDescriptorProto_Name_field_number             protoreflect.FieldNumber = 1\n\tFileDescriptorProto_Package_field_number          protoreflect.FieldNumber = 2\n\tFileDescriptorProto_Dependency_field_number       protoreflect.FieldNumber = 3\n\tFileDescriptorProto_PublicDependency_field_number protoreflect.FieldNumber = 10\n\tFileDescriptorProto_WeakDependency_field_number   protoreflect.FieldNumber = 11\n\tFileDescriptorProto_MessageType_field_number      protoreflect.FieldNumber = 4\n\tFileDescriptorProto_EnumType_field_number         protoreflect.FieldNumber = 5\n\tFileDescriptorProto_Service_field_number          protoreflect.FieldNumber = 6\n\tFileDescriptorProto_Extension_field_number        protoreflect.FieldNumber = 7\n\tFileDescriptorProto_Options_field_number          protoreflect.FieldNumber = 8\n\tFileDescriptorProto_SourceCodeInfo_field_number   protoreflect.FieldNumber = 9\n\tFileDescriptorProto_Syntax_field_number           protoreflect.FieldNumber = 12\n)\n\n// Names for google.protobuf.DescriptorProto.\nconst (\n\tDescriptorProto_message_name     protoreflect.Name     = \"DescriptorProto\"\n\tDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.DescriptorProto\"\n)\n\n// Field names for google.protobuf.DescriptorProto.\nconst (\n\tDescriptorProto_Name_field_name           protoreflect.Name = \"name\"\n\tDescriptorProto_Field_field_name          protoreflect.Name = \"field\"\n\tDescriptorProto_Extension_field_name      protoreflect.Name = \"extension\"\n\tDescriptorProto_NestedType_field_name     protoreflect.Name = \"nested_type\"\n\tDescriptorProto_EnumType_field_name       protoreflect.Name = \"enum_type\"\n\tDescriptorProto_ExtensionRange_field_name protoreflect.Name = \"extension_range\"\n\tDescriptorProto_OneofDecl_field_name      protoreflect.Name = \"oneof_decl\"\n\tDescriptorProto_Options_field_name        protoreflect.Name = \"options\"\n\tDescriptorProto_ReservedRange_field_name  protoreflect.Name = \"reserved_range\"\n\tDescriptorProto_ReservedName_field_name   protoreflect.Name = \"reserved_name\"\n\n\tDescriptorProto_Name_field_fullname           protoreflect.FullName = \"google.protobuf.DescriptorProto.name\"\n\tDescriptorProto_Field_field_fullname          protoreflect.FullName = \"google.protobuf.DescriptorProto.field\"\n\tDescriptorProto_Extension_field_fullname      protoreflect.FullName = \"google.protobuf.DescriptorProto.extension\"\n\tDescriptorProto_NestedType_field_fullname     protoreflect.FullName = \"google.protobuf.DescriptorProto.nested_type\"\n\tDescriptorProto_EnumType_field_fullname       protoreflect.FullName = \"google.protobuf.DescriptorProto.enum_type\"\n\tDescriptorProto_ExtensionRange_field_fullname protoreflect.FullName = \"google.protobuf.DescriptorProto.extension_range\"\n\tDescriptorProto_OneofDecl_field_fullname      protoreflect.FullName = \"google.protobuf.DescriptorProto.oneof_decl\"\n\tDescriptorProto_Options_field_fullname        protoreflect.FullName = \"google.protobuf.DescriptorProto.options\"\n\tDescriptorProto_ReservedRange_field_fullname  protoreflect.FullName = \"google.protobuf.DescriptorProto.reserved_range\"\n\tDescriptorProto_ReservedName_field_fullname   protoreflect.FullName = \"google.protobuf.DescriptorProto.reserved_name\"\n)\n\n// Field numbers for google.protobuf.DescriptorProto.\nconst (\n\tDescriptorProto_Name_field_number           protoreflect.FieldNumber = 1\n\tDescriptorProto_Field_field_number          protoreflect.FieldNumber = 2\n\tDescriptorProto_Extension_field_number      protoreflect.FieldNumber = 6\n\tDescriptorProto_NestedType_field_number     protoreflect.FieldNumber = 3\n\tDescriptorProto_EnumType_field_number       protoreflect.FieldNumber = 4\n\tDescriptorProto_ExtensionRange_field_number protoreflect.FieldNumber = 5\n\tDescriptorProto_OneofDecl_field_number      protoreflect.FieldNumber = 8\n\tDescriptorProto_Options_field_number        protoreflect.FieldNumber = 7\n\tDescriptorProto_ReservedRange_field_number  protoreflect.FieldNumber = 9\n\tDescriptorProto_ReservedName_field_number   protoreflect.FieldNumber = 10\n)\n\n// Names for google.protobuf.DescriptorProto.ExtensionRange.\nconst (\n\tDescriptorProto_ExtensionRange_message_name     protoreflect.Name     = \"ExtensionRange\"\n\tDescriptorProto_ExtensionRange_message_fullname protoreflect.FullName = \"google.protobuf.DescriptorProto.ExtensionRange\"\n)\n\n// Field names for google.protobuf.DescriptorProto.ExtensionRange.\nconst (\n\tDescriptorProto_ExtensionRange_Start_field_name   protoreflect.Name = \"start\"\n\tDescriptorProto_ExtensionRange_End_field_name     protoreflect.Name = \"end\"\n\tDescriptorProto_ExtensionRange_Options_field_name protoreflect.Name = \"options\"\n\n\tDescriptorProto_ExtensionRange_Start_field_fullname   protoreflect.FullName = \"google.protobuf.DescriptorProto.ExtensionRange.start\"\n\tDescriptorProto_ExtensionRange_End_field_fullname     protoreflect.FullName = \"google.protobuf.DescriptorProto.ExtensionRange.end\"\n\tDescriptorProto_ExtensionRange_Options_field_fullname protoreflect.FullName = \"google.protobuf.DescriptorProto.ExtensionRange.options\"\n)\n\n// Field numbers for google.protobuf.DescriptorProto.ExtensionRange.\nconst (\n\tDescriptorProto_ExtensionRange_Start_field_number   protoreflect.FieldNumber = 1\n\tDescriptorProto_ExtensionRange_End_field_number     protoreflect.FieldNumber = 2\n\tDescriptorProto_ExtensionRange_Options_field_number protoreflect.FieldNumber = 3\n)\n\n// Names for google.protobuf.DescriptorProto.ReservedRange.\nconst (\n\tDescriptorProto_ReservedRange_message_name     protoreflect.Name     = \"ReservedRange\"\n\tDescriptorProto_ReservedRange_message_fullname protoreflect.FullName = \"google.protobuf.DescriptorProto.ReservedRange\"\n)\n\n// Field names for google.protobuf.DescriptorProto.ReservedRange.\nconst (\n\tDescriptorProto_ReservedRange_Start_field_name protoreflect.Name = \"start\"\n\tDescriptorProto_ReservedRange_End_field_name   protoreflect.Name = \"end\"\n\n\tDescriptorProto_ReservedRange_Start_field_fullname protoreflect.FullName = \"google.protobuf.DescriptorProto.ReservedRange.start\"\n\tDescriptorProto_ReservedRange_End_field_fullname   protoreflect.FullName = \"google.protobuf.DescriptorProto.ReservedRange.end\"\n)\n\n// Field numbers for google.protobuf.DescriptorProto.ReservedRange.\nconst (\n\tDescriptorProto_ReservedRange_Start_field_number protoreflect.FieldNumber = 1\n\tDescriptorProto_ReservedRange_End_field_number   protoreflect.FieldNumber = 2\n)\n\n// Names for google.protobuf.ExtensionRangeOptions.\nconst (\n\tExtensionRangeOptions_message_name     protoreflect.Name     = \"ExtensionRangeOptions\"\n\tExtensionRangeOptions_message_fullname protoreflect.FullName = \"google.protobuf.ExtensionRangeOptions\"\n)\n\n// Field names for google.protobuf.ExtensionRangeOptions.\nconst (\n\tExtensionRangeOptions_UninterpretedOption_field_name protoreflect.Name = \"uninterpreted_option\"\n\n\tExtensionRangeOptions_UninterpretedOption_field_fullname protoreflect.FullName = \"google.protobuf.ExtensionRangeOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.ExtensionRangeOptions.\nconst (\n\tExtensionRangeOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999\n)\n\n// Names for google.protobuf.FieldDescriptorProto.\nconst (\n\tFieldDescriptorProto_message_name     protoreflect.Name     = \"FieldDescriptorProto\"\n\tFieldDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.FieldDescriptorProto\"\n)\n\n// Field names for google.protobuf.FieldDescriptorProto.\nconst (\n\tFieldDescriptorProto_Name_field_name           protoreflect.Name = \"name\"\n\tFieldDescriptorProto_Number_field_name         protoreflect.Name = \"number\"\n\tFieldDescriptorProto_Label_field_name          protoreflect.Name = \"label\"\n\tFieldDescriptorProto_Type_field_name           protoreflect.Name = \"type\"\n\tFieldDescriptorProto_TypeName_field_name       protoreflect.Name = \"type_name\"\n\tFieldDescriptorProto_Extendee_field_name       protoreflect.Name = \"extendee\"\n\tFieldDescriptorProto_DefaultValue_field_name   protoreflect.Name = \"default_value\"\n\tFieldDescriptorProto_OneofIndex_field_name     protoreflect.Name = \"oneof_index\"\n\tFieldDescriptorProto_JsonName_field_name       protoreflect.Name = \"json_name\"\n\tFieldDescriptorProto_Options_field_name        protoreflect.Name = \"options\"\n\tFieldDescriptorProto_Proto3Optional_field_name protoreflect.Name = \"proto3_optional\"\n\n\tFieldDescriptorProto_Name_field_fullname           protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.name\"\n\tFieldDescriptorProto_Number_field_fullname         protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.number\"\n\tFieldDescriptorProto_Label_field_fullname          protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.label\"\n\tFieldDescriptorProto_Type_field_fullname           protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.type\"\n\tFieldDescriptorProto_TypeName_field_fullname       protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.type_name\"\n\tFieldDescriptorProto_Extendee_field_fullname       protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.extendee\"\n\tFieldDescriptorProto_DefaultValue_field_fullname   protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.default_value\"\n\tFieldDescriptorProto_OneofIndex_field_fullname     protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.oneof_index\"\n\tFieldDescriptorProto_JsonName_field_fullname       protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.json_name\"\n\tFieldDescriptorProto_Options_field_fullname        protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.options\"\n\tFieldDescriptorProto_Proto3Optional_field_fullname protoreflect.FullName = \"google.protobuf.FieldDescriptorProto.proto3_optional\"\n)\n\n// Field numbers for google.protobuf.FieldDescriptorProto.\nconst (\n\tFieldDescriptorProto_Name_field_number           protoreflect.FieldNumber = 1\n\tFieldDescriptorProto_Number_field_number         protoreflect.FieldNumber = 3\n\tFieldDescriptorProto_Label_field_number          protoreflect.FieldNumber = 4\n\tFieldDescriptorProto_Type_field_number           protoreflect.FieldNumber = 5\n\tFieldDescriptorProto_TypeName_field_number       protoreflect.FieldNumber = 6\n\tFieldDescriptorProto_Extendee_field_number       protoreflect.FieldNumber = 2\n\tFieldDescriptorProto_DefaultValue_field_number   protoreflect.FieldNumber = 7\n\tFieldDescriptorProto_OneofIndex_field_number     protoreflect.FieldNumber = 9\n\tFieldDescriptorProto_JsonName_field_number       protoreflect.FieldNumber = 10\n\tFieldDescriptorProto_Options_field_number        protoreflect.FieldNumber = 8\n\tFieldDescriptorProto_Proto3Optional_field_number protoreflect.FieldNumber = 17\n)\n\n// Full and short names for google.protobuf.FieldDescriptorProto.Type.\nconst (\n\tFieldDescriptorProto_Type_enum_fullname = \"google.protobuf.FieldDescriptorProto.Type\"\n\tFieldDescriptorProto_Type_enum_name     = \"Type\"\n)\n\n// Full and short names for google.protobuf.FieldDescriptorProto.Label.\nconst (\n\tFieldDescriptorProto_Label_enum_fullname = \"google.protobuf.FieldDescriptorProto.Label\"\n\tFieldDescriptorProto_Label_enum_name     = \"Label\"\n)\n\n// Names for google.protobuf.OneofDescriptorProto.\nconst (\n\tOneofDescriptorProto_message_name     protoreflect.Name     = \"OneofDescriptorProto\"\n\tOneofDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.OneofDescriptorProto\"\n)\n\n// Field names for google.protobuf.OneofDescriptorProto.\nconst (\n\tOneofDescriptorProto_Name_field_name    protoreflect.Name = \"name\"\n\tOneofDescriptorProto_Options_field_name protoreflect.Name = \"options\"\n\n\tOneofDescriptorProto_Name_field_fullname    protoreflect.FullName = \"google.protobuf.OneofDescriptorProto.name\"\n\tOneofDescriptorProto_Options_field_fullname protoreflect.FullName = \"google.protobuf.OneofDescriptorProto.options\"\n)\n\n// Field numbers for google.protobuf.OneofDescriptorProto.\nconst (\n\tOneofDescriptorProto_Name_field_number    protoreflect.FieldNumber = 1\n\tOneofDescriptorProto_Options_field_number protoreflect.FieldNumber = 2\n)\n\n// Names for google.protobuf.EnumDescriptorProto.\nconst (\n\tEnumDescriptorProto_message_name     protoreflect.Name     = \"EnumDescriptorProto\"\n\tEnumDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.EnumDescriptorProto\"\n)\n\n// Field names for google.protobuf.EnumDescriptorProto.\nconst (\n\tEnumDescriptorProto_Name_field_name          protoreflect.Name = \"name\"\n\tEnumDescriptorProto_Value_field_name         protoreflect.Name = \"value\"\n\tEnumDescriptorProto_Options_field_name       protoreflect.Name = \"options\"\n\tEnumDescriptorProto_ReservedRange_field_name protoreflect.Name = \"reserved_range\"\n\tEnumDescriptorProto_ReservedName_field_name  protoreflect.Name = \"reserved_name\"\n\n\tEnumDescriptorProto_Name_field_fullname          protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.name\"\n\tEnumDescriptorProto_Value_field_fullname         protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.value\"\n\tEnumDescriptorProto_Options_field_fullname       protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.options\"\n\tEnumDescriptorProto_ReservedRange_field_fullname protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.reserved_range\"\n\tEnumDescriptorProto_ReservedName_field_fullname  protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.reserved_name\"\n)\n\n// Field numbers for google.protobuf.EnumDescriptorProto.\nconst (\n\tEnumDescriptorProto_Name_field_number          protoreflect.FieldNumber = 1\n\tEnumDescriptorProto_Value_field_number         protoreflect.FieldNumber = 2\n\tEnumDescriptorProto_Options_field_number       protoreflect.FieldNumber = 3\n\tEnumDescriptorProto_ReservedRange_field_number protoreflect.FieldNumber = 4\n\tEnumDescriptorProto_ReservedName_field_number  protoreflect.FieldNumber = 5\n)\n\n// Names for google.protobuf.EnumDescriptorProto.EnumReservedRange.\nconst (\n\tEnumDescriptorProto_EnumReservedRange_message_name     protoreflect.Name     = \"EnumReservedRange\"\n\tEnumDescriptorProto_EnumReservedRange_message_fullname protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.EnumReservedRange\"\n)\n\n// Field names for google.protobuf.EnumDescriptorProto.EnumReservedRange.\nconst (\n\tEnumDescriptorProto_EnumReservedRange_Start_field_name protoreflect.Name = \"start\"\n\tEnumDescriptorProto_EnumReservedRange_End_field_name   protoreflect.Name = \"end\"\n\n\tEnumDescriptorProto_EnumReservedRange_Start_field_fullname protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.EnumReservedRange.start\"\n\tEnumDescriptorProto_EnumReservedRange_End_field_fullname   protoreflect.FullName = \"google.protobuf.EnumDescriptorProto.EnumReservedRange.end\"\n)\n\n// Field numbers for google.protobuf.EnumDescriptorProto.EnumReservedRange.\nconst (\n\tEnumDescriptorProto_EnumReservedRange_Start_field_number protoreflect.FieldNumber = 1\n\tEnumDescriptorProto_EnumReservedRange_End_field_number   protoreflect.FieldNumber = 2\n)\n\n// Names for google.protobuf.EnumValueDescriptorProto.\nconst (\n\tEnumValueDescriptorProto_message_name     protoreflect.Name     = \"EnumValueDescriptorProto\"\n\tEnumValueDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.EnumValueDescriptorProto\"\n)\n\n// Field names for google.protobuf.EnumValueDescriptorProto.\nconst (\n\tEnumValueDescriptorProto_Name_field_name    protoreflect.Name = \"name\"\n\tEnumValueDescriptorProto_Number_field_name  protoreflect.Name = \"number\"\n\tEnumValueDescriptorProto_Options_field_name protoreflect.Name = \"options\"\n\n\tEnumValueDescriptorProto_Name_field_fullname    protoreflect.FullName = \"google.protobuf.EnumValueDescriptorProto.name\"\n\tEnumValueDescriptorProto_Number_field_fullname  protoreflect.FullName = \"google.protobuf.EnumValueDescriptorProto.number\"\n\tEnumValueDescriptorProto_Options_field_fullname protoreflect.FullName = \"google.protobuf.EnumValueDescriptorProto.options\"\n)\n\n// Field numbers for google.protobuf.EnumValueDescriptorProto.\nconst (\n\tEnumValueDescriptorProto_Name_field_number    protoreflect.FieldNumber = 1\n\tEnumValueDescriptorProto_Number_field_number  protoreflect.FieldNumber = 2\n\tEnumValueDescriptorProto_Options_field_number protoreflect.FieldNumber = 3\n)\n\n// Names for google.protobuf.ServiceDescriptorProto.\nconst (\n\tServiceDescriptorProto_message_name     protoreflect.Name     = \"ServiceDescriptorProto\"\n\tServiceDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.ServiceDescriptorProto\"\n)\n\n// Field names for google.protobuf.ServiceDescriptorProto.\nconst (\n\tServiceDescriptorProto_Name_field_name    protoreflect.Name = \"name\"\n\tServiceDescriptorProto_Method_field_name  protoreflect.Name = \"method\"\n\tServiceDescriptorProto_Options_field_name protoreflect.Name = \"options\"\n\n\tServiceDescriptorProto_Name_field_fullname    protoreflect.FullName = \"google.protobuf.ServiceDescriptorProto.name\"\n\tServiceDescriptorProto_Method_field_fullname  protoreflect.FullName = \"google.protobuf.ServiceDescriptorProto.method\"\n\tServiceDescriptorProto_Options_field_fullname protoreflect.FullName = \"google.protobuf.ServiceDescriptorProto.options\"\n)\n\n// Field numbers for google.protobuf.ServiceDescriptorProto.\nconst (\n\tServiceDescriptorProto_Name_field_number    protoreflect.FieldNumber = 1\n\tServiceDescriptorProto_Method_field_number  protoreflect.FieldNumber = 2\n\tServiceDescriptorProto_Options_field_number protoreflect.FieldNumber = 3\n)\n\n// Names for google.protobuf.MethodDescriptorProto.\nconst (\n\tMethodDescriptorProto_message_name     protoreflect.Name     = \"MethodDescriptorProto\"\n\tMethodDescriptorProto_message_fullname protoreflect.FullName = \"google.protobuf.MethodDescriptorProto\"\n)\n\n// Field names for google.protobuf.MethodDescriptorProto.\nconst (\n\tMethodDescriptorProto_Name_field_name            protoreflect.Name = \"name\"\n\tMethodDescriptorProto_InputType_field_name       protoreflect.Name = \"input_type\"\n\tMethodDescriptorProto_OutputType_field_name      protoreflect.Name = \"output_type\"\n\tMethodDescriptorProto_Options_field_name         protoreflect.Name = \"options\"\n\tMethodDescriptorProto_ClientStreaming_field_name protoreflect.Name = \"client_streaming\"\n\tMethodDescriptorProto_ServerStreaming_field_name protoreflect.Name = \"server_streaming\"\n\n\tMethodDescriptorProto_Name_field_fullname            protoreflect.FullName = \"google.protobuf.MethodDescriptorProto.name\"\n\tMethodDescriptorProto_InputType_field_fullname       protoreflect.FullName = \"google.protobuf.MethodDescriptorProto.input_type\"\n\tMethodDescriptorProto_OutputType_field_fullname      protoreflect.FullName = \"google.protobuf.MethodDescriptorProto.output_type\"\n\tMethodDescriptorProto_Options_field_fullname         protoreflect.FullName = \"google.protobuf.MethodDescriptorProto.options\"\n\tMethodDescriptorProto_ClientStreaming_field_fullname protoreflect.FullName = \"google.protobuf.MethodDescriptorProto.client_streaming\"\n\tMethodDescriptorProto_ServerStreaming_field_fullname protoreflect.FullName = \"google.protobuf.MethodDescriptorProto.server_streaming\"\n)\n\n// Field numbers for google.protobuf.MethodDescriptorProto.\nconst (\n\tMethodDescriptorProto_Name_field_number            protoreflect.FieldNumber = 1\n\tMethodDescriptorProto_InputType_field_number       protoreflect.FieldNumber = 2\n\tMethodDescriptorProto_OutputType_field_number      protoreflect.FieldNumber = 3\n\tMethodDescriptorProto_Options_field_number         protoreflect.FieldNumber = 4\n\tMethodDescriptorProto_ClientStreaming_field_number protoreflect.FieldNumber = 5\n\tMethodDescriptorProto_ServerStreaming_field_number protoreflect.FieldNumber = 6\n)\n\n// Names for google.protobuf.FileOptions.\nconst (\n\tFileOptions_message_name     protoreflect.Name     = \"FileOptions\"\n\tFileOptions_message_fullname protoreflect.FullName = \"google.protobuf.FileOptions\"\n)\n\n// Field names for google.protobuf.FileOptions.\nconst (\n\tFileOptions_JavaPackage_field_name               protoreflect.Name = \"java_package\"\n\tFileOptions_JavaOuterClassname_field_name        protoreflect.Name = \"java_outer_classname\"\n\tFileOptions_JavaMultipleFiles_field_name         protoreflect.Name = \"java_multiple_files\"\n\tFileOptions_JavaGenerateEqualsAndHash_field_name protoreflect.Name = \"java_generate_equals_and_hash\"\n\tFileOptions_JavaStringCheckUtf8_field_name       protoreflect.Name = \"java_string_check_utf8\"\n\tFileOptions_OptimizeFor_field_name               protoreflect.Name = \"optimize_for\"\n\tFileOptions_GoPackage_field_name                 protoreflect.Name = \"go_package\"\n\tFileOptions_CcGenericServices_field_name         protoreflect.Name = \"cc_generic_services\"\n\tFileOptions_JavaGenericServices_field_name       protoreflect.Name = \"java_generic_services\"\n\tFileOptions_PyGenericServices_field_name         protoreflect.Name = \"py_generic_services\"\n\tFileOptions_PhpGenericServices_field_name        protoreflect.Name = \"php_generic_services\"\n\tFileOptions_Deprecated_field_name                protoreflect.Name = \"deprecated\"\n\tFileOptions_CcEnableArenas_field_name            protoreflect.Name = \"cc_enable_arenas\"\n\tFileOptions_ObjcClassPrefix_field_name           protoreflect.Name = \"objc_class_prefix\"\n\tFileOptions_CsharpNamespace_field_name           protoreflect.Name = \"csharp_namespace\"\n\tFileOptions_SwiftPrefix_field_name               protoreflect.Name = \"swift_prefix\"\n\tFileOptions_PhpClassPrefix_field_name            protoreflect.Name = \"php_class_prefix\"\n\tFileOptions_PhpNamespace_field_name              protoreflect.Name = \"php_namespace\"\n\tFileOptions_PhpMetadataNamespace_field_name      protoreflect.Name = \"php_metadata_namespace\"\n\tFileOptions_RubyPackage_field_name               protoreflect.Name = \"ruby_package\"\n\tFileOptions_UninterpretedOption_field_name       protoreflect.Name = \"uninterpreted_option\"\n\n\tFileOptions_JavaPackage_field_fullname               protoreflect.FullName = \"google.protobuf.FileOptions.java_package\"\n\tFileOptions_JavaOuterClassname_field_fullname        protoreflect.FullName = \"google.protobuf.FileOptions.java_outer_classname\"\n\tFileOptions_JavaMultipleFiles_field_fullname         protoreflect.FullName = \"google.protobuf.FileOptions.java_multiple_files\"\n\tFileOptions_JavaGenerateEqualsAndHash_field_fullname protoreflect.FullName = \"google.protobuf.FileOptions.java_generate_equals_and_hash\"\n\tFileOptions_JavaStringCheckUtf8_field_fullname       protoreflect.FullName = \"google.protobuf.FileOptions.java_string_check_utf8\"\n\tFileOptions_OptimizeFor_field_fullname               protoreflect.FullName = \"google.protobuf.FileOptions.optimize_for\"\n\tFileOptions_GoPackage_field_fullname                 protoreflect.FullName = \"google.protobuf.FileOptions.go_package\"\n\tFileOptions_CcGenericServices_field_fullname         protoreflect.FullName = \"google.protobuf.FileOptions.cc_generic_services\"\n\tFileOptions_JavaGenericServices_field_fullname       protoreflect.FullName = \"google.protobuf.FileOptions.java_generic_services\"\n\tFileOptions_PyGenericServices_field_fullname         protoreflect.FullName = \"google.protobuf.FileOptions.py_generic_services\"\n\tFileOptions_PhpGenericServices_field_fullname        protoreflect.FullName = \"google.protobuf.FileOptions.php_generic_services\"\n\tFileOptions_Deprecated_field_fullname                protoreflect.FullName = \"google.protobuf.FileOptions.deprecated\"\n\tFileOptions_CcEnableArenas_field_fullname            protoreflect.FullName = \"google.protobuf.FileOptions.cc_enable_arenas\"\n\tFileOptions_ObjcClassPrefix_field_fullname           protoreflect.FullName = \"google.protobuf.FileOptions.objc_class_prefix\"\n\tFileOptions_CsharpNamespace_field_fullname           protoreflect.FullName = \"google.protobuf.FileOptions.csharp_namespace\"\n\tFileOptions_SwiftPrefix_field_fullname               protoreflect.FullName = \"google.protobuf.FileOptions.swift_prefix\"\n\tFileOptions_PhpClassPrefix_field_fullname            protoreflect.FullName = \"google.protobuf.FileOptions.php_class_prefix\"\n\tFileOptions_PhpNamespace_field_fullname              protoreflect.FullName = \"google.protobuf.FileOptions.php_namespace\"\n\tFileOptions_PhpMetadataNamespace_field_fullname      protoreflect.FullName = \"google.protobuf.FileOptions.php_metadata_namespace\"\n\tFileOptions_RubyPackage_field_fullname               protoreflect.FullName = \"google.protobuf.FileOptions.ruby_package\"\n\tFileOptions_UninterpretedOption_field_fullname       protoreflect.FullName = \"google.protobuf.FileOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.FileOptions.\nconst (\n\tFileOptions_JavaPackage_field_number               protoreflect.FieldNumber = 1\n\tFileOptions_JavaOuterClassname_field_number        protoreflect.FieldNumber = 8\n\tFileOptions_JavaMultipleFiles_field_number         protoreflect.FieldNumber = 10\n\tFileOptions_JavaGenerateEqualsAndHash_field_number protoreflect.FieldNumber = 20\n\tFileOptions_JavaStringCheckUtf8_field_number       protoreflect.FieldNumber = 27\n\tFileOptions_OptimizeFor_field_number               protoreflect.FieldNumber = 9\n\tFileOptions_GoPackage_field_number                 protoreflect.FieldNumber = 11\n\tFileOptions_CcGenericServices_field_number         protoreflect.FieldNumber = 16\n\tFileOptions_JavaGenericServices_field_number       protoreflect.FieldNumber = 17\n\tFileOptions_PyGenericServices_field_number         protoreflect.FieldNumber = 18\n\tFileOptions_PhpGenericServices_field_number        protoreflect.FieldNumber = 42\n\tFileOptions_Deprecated_field_number                protoreflect.FieldNumber = 23\n\tFileOptions_CcEnableArenas_field_number            protoreflect.FieldNumber = 31\n\tFileOptions_ObjcClassPrefix_field_number           protoreflect.FieldNumber = 36\n\tFileOptions_CsharpNamespace_field_number           protoreflect.FieldNumber = 37\n\tFileOptions_SwiftPrefix_field_number               protoreflect.FieldNumber = 39\n\tFileOptions_PhpClassPrefix_field_number            protoreflect.FieldNumber = 40\n\tFileOptions_PhpNamespace_field_number              protoreflect.FieldNumber = 41\n\tFileOptions_PhpMetadataNamespace_field_number      protoreflect.FieldNumber = 44\n\tFileOptions_RubyPackage_field_number               protoreflect.FieldNumber = 45\n\tFileOptions_UninterpretedOption_field_number       protoreflect.FieldNumber = 999\n)\n\n// Full and short names for google.protobuf.FileOptions.OptimizeMode.\nconst (\n\tFileOptions_OptimizeMode_enum_fullname = \"google.protobuf.FileOptions.OptimizeMode\"\n\tFileOptions_OptimizeMode_enum_name     = \"OptimizeMode\"\n)\n\n// Names for google.protobuf.MessageOptions.\nconst (\n\tMessageOptions_message_name     protoreflect.Name     = \"MessageOptions\"\n\tMessageOptions_message_fullname protoreflect.FullName = \"google.protobuf.MessageOptions\"\n)\n\n// Field names for google.protobuf.MessageOptions.\nconst (\n\tMessageOptions_MessageSetWireFormat_field_name         protoreflect.Name = \"message_set_wire_format\"\n\tMessageOptions_NoStandardDescriptorAccessor_field_name protoreflect.Name = \"no_standard_descriptor_accessor\"\n\tMessageOptions_Deprecated_field_name                   protoreflect.Name = \"deprecated\"\n\tMessageOptions_MapEntry_field_name                     protoreflect.Name = \"map_entry\"\n\tMessageOptions_UninterpretedOption_field_name          protoreflect.Name = \"uninterpreted_option\"\n\n\tMessageOptions_MessageSetWireFormat_field_fullname         protoreflect.FullName = \"google.protobuf.MessageOptions.message_set_wire_format\"\n\tMessageOptions_NoStandardDescriptorAccessor_field_fullname protoreflect.FullName = \"google.protobuf.MessageOptions.no_standard_descriptor_accessor\"\n\tMessageOptions_Deprecated_field_fullname                   protoreflect.FullName = \"google.protobuf.MessageOptions.deprecated\"\n\tMessageOptions_MapEntry_field_fullname                     protoreflect.FullName = \"google.protobuf.MessageOptions.map_entry\"\n\tMessageOptions_UninterpretedOption_field_fullname          protoreflect.FullName = \"google.protobuf.MessageOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.MessageOptions.\nconst (\n\tMessageOptions_MessageSetWireFormat_field_number         protoreflect.FieldNumber = 1\n\tMessageOptions_NoStandardDescriptorAccessor_field_number protoreflect.FieldNumber = 2\n\tMessageOptions_Deprecated_field_number                   protoreflect.FieldNumber = 3\n\tMessageOptions_MapEntry_field_number                     protoreflect.FieldNumber = 7\n\tMessageOptions_UninterpretedOption_field_number          protoreflect.FieldNumber = 999\n)\n\n// Names for google.protobuf.FieldOptions.\nconst (\n\tFieldOptions_message_name     protoreflect.Name     = \"FieldOptions\"\n\tFieldOptions_message_fullname protoreflect.FullName = \"google.protobuf.FieldOptions\"\n)\n\n// Field names for google.protobuf.FieldOptions.\nconst (\n\tFieldOptions_Ctype_field_name               protoreflect.Name = \"ctype\"\n\tFieldOptions_Packed_field_name              protoreflect.Name = \"packed\"\n\tFieldOptions_Jstype_field_name              protoreflect.Name = \"jstype\"\n\tFieldOptions_Lazy_field_name                protoreflect.Name = \"lazy\"\n\tFieldOptions_Deprecated_field_name          protoreflect.Name = \"deprecated\"\n\tFieldOptions_Weak_field_name                protoreflect.Name = \"weak\"\n\tFieldOptions_UninterpretedOption_field_name protoreflect.Name = \"uninterpreted_option\"\n\n\tFieldOptions_Ctype_field_fullname               protoreflect.FullName = \"google.protobuf.FieldOptions.ctype\"\n\tFieldOptions_Packed_field_fullname              protoreflect.FullName = \"google.protobuf.FieldOptions.packed\"\n\tFieldOptions_Jstype_field_fullname              protoreflect.FullName = \"google.protobuf.FieldOptions.jstype\"\n\tFieldOptions_Lazy_field_fullname                protoreflect.FullName = \"google.protobuf.FieldOptions.lazy\"\n\tFieldOptions_Deprecated_field_fullname          protoreflect.FullName = \"google.protobuf.FieldOptions.deprecated\"\n\tFieldOptions_Weak_field_fullname                protoreflect.FullName = \"google.protobuf.FieldOptions.weak\"\n\tFieldOptions_UninterpretedOption_field_fullname protoreflect.FullName = \"google.protobuf.FieldOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.FieldOptions.\nconst (\n\tFieldOptions_Ctype_field_number               protoreflect.FieldNumber = 1\n\tFieldOptions_Packed_field_number              protoreflect.FieldNumber = 2\n\tFieldOptions_Jstype_field_number              protoreflect.FieldNumber = 6\n\tFieldOptions_Lazy_field_number                protoreflect.FieldNumber = 5\n\tFieldOptions_Deprecated_field_number          protoreflect.FieldNumber = 3\n\tFieldOptions_Weak_field_number                protoreflect.FieldNumber = 10\n\tFieldOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999\n)\n\n// Full and short names for google.protobuf.FieldOptions.CType.\nconst (\n\tFieldOptions_CType_enum_fullname = \"google.protobuf.FieldOptions.CType\"\n\tFieldOptions_CType_enum_name     = \"CType\"\n)\n\n// Full and short names for google.protobuf.FieldOptions.JSType.\nconst (\n\tFieldOptions_JSType_enum_fullname = \"google.protobuf.FieldOptions.JSType\"\n\tFieldOptions_JSType_enum_name     = \"JSType\"\n)\n\n// Names for google.protobuf.OneofOptions.\nconst (\n\tOneofOptions_message_name     protoreflect.Name     = \"OneofOptions\"\n\tOneofOptions_message_fullname protoreflect.FullName = \"google.protobuf.OneofOptions\"\n)\n\n// Field names for google.protobuf.OneofOptions.\nconst (\n\tOneofOptions_UninterpretedOption_field_name protoreflect.Name = \"uninterpreted_option\"\n\n\tOneofOptions_UninterpretedOption_field_fullname protoreflect.FullName = \"google.protobuf.OneofOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.OneofOptions.\nconst (\n\tOneofOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999\n)\n\n// Names for google.protobuf.EnumOptions.\nconst (\n\tEnumOptions_message_name     protoreflect.Name     = \"EnumOptions\"\n\tEnumOptions_message_fullname protoreflect.FullName = \"google.protobuf.EnumOptions\"\n)\n\n// Field names for google.protobuf.EnumOptions.\nconst (\n\tEnumOptions_AllowAlias_field_name          protoreflect.Name = \"allow_alias\"\n\tEnumOptions_Deprecated_field_name          protoreflect.Name = \"deprecated\"\n\tEnumOptions_UninterpretedOption_field_name protoreflect.Name = \"uninterpreted_option\"\n\n\tEnumOptions_AllowAlias_field_fullname          protoreflect.FullName = \"google.protobuf.EnumOptions.allow_alias\"\n\tEnumOptions_Deprecated_field_fullname          protoreflect.FullName = \"google.protobuf.EnumOptions.deprecated\"\n\tEnumOptions_UninterpretedOption_field_fullname protoreflect.FullName = \"google.protobuf.EnumOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.EnumOptions.\nconst (\n\tEnumOptions_AllowAlias_field_number          protoreflect.FieldNumber = 2\n\tEnumOptions_Deprecated_field_number          protoreflect.FieldNumber = 3\n\tEnumOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999\n)\n\n// Names for google.protobuf.EnumValueOptions.\nconst (\n\tEnumValueOptions_message_name     protoreflect.Name     = \"EnumValueOptions\"\n\tEnumValueOptions_message_fullname protoreflect.FullName = \"google.protobuf.EnumValueOptions\"\n)\n\n// Field names for google.protobuf.EnumValueOptions.\nconst (\n\tEnumValueOptions_Deprecated_field_name          protoreflect.Name = \"deprecated\"\n\tEnumValueOptions_UninterpretedOption_field_name protoreflect.Name = \"uninterpreted_option\"\n\n\tEnumValueOptions_Deprecated_field_fullname          protoreflect.FullName = \"google.protobuf.EnumValueOptions.deprecated\"\n\tEnumValueOptions_UninterpretedOption_field_fullname protoreflect.FullName = \"google.protobuf.EnumValueOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.EnumValueOptions.\nconst (\n\tEnumValueOptions_Deprecated_field_number          protoreflect.FieldNumber = 1\n\tEnumValueOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999\n)\n\n// Names for google.protobuf.ServiceOptions.\nconst (\n\tServiceOptions_message_name     protoreflect.Name     = \"ServiceOptions\"\n\tServiceOptions_message_fullname protoreflect.FullName = \"google.protobuf.ServiceOptions\"\n)\n\n// Field names for google.protobuf.ServiceOptions.\nconst (\n\tServiceOptions_Deprecated_field_name          protoreflect.Name = \"deprecated\"\n\tServiceOptions_UninterpretedOption_field_name protoreflect.Name = \"uninterpreted_option\"\n\n\tServiceOptions_Deprecated_field_fullname          protoreflect.FullName = \"google.protobuf.ServiceOptions.deprecated\"\n\tServiceOptions_UninterpretedOption_field_fullname protoreflect.FullName = \"google.protobuf.ServiceOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.ServiceOptions.\nconst (\n\tServiceOptions_Deprecated_field_number          protoreflect.FieldNumber = 33\n\tServiceOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999\n)\n\n// Names for google.protobuf.MethodOptions.\nconst (\n\tMethodOptions_message_name     protoreflect.Name     = \"MethodOptions\"\n\tMethodOptions_message_fullname protoreflect.FullName = \"google.protobuf.MethodOptions\"\n)\n\n// Field names for google.protobuf.MethodOptions.\nconst (\n\tMethodOptions_Deprecated_field_name          protoreflect.Name = \"deprecated\"\n\tMethodOptions_IdempotencyLevel_field_name    protoreflect.Name = \"idempotency_level\"\n\tMethodOptions_UninterpretedOption_field_name protoreflect.Name = \"uninterpreted_option\"\n\n\tMethodOptions_Deprecated_field_fullname          protoreflect.FullName = \"google.protobuf.MethodOptions.deprecated\"\n\tMethodOptions_IdempotencyLevel_field_fullname    protoreflect.FullName = \"google.protobuf.MethodOptions.idempotency_level\"\n\tMethodOptions_UninterpretedOption_field_fullname protoreflect.FullName = \"google.protobuf.MethodOptions.uninterpreted_option\"\n)\n\n// Field numbers for google.protobuf.MethodOptions.\nconst (\n\tMethodOptions_Deprecated_field_number          protoreflect.FieldNumber = 33\n\tMethodOptions_IdempotencyLevel_field_number    protoreflect.FieldNumber = 34\n\tMethodOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999\n)\n\n// Full and short names for google.protobuf.MethodOptions.IdempotencyLevel.\nconst (\n\tMethodOptions_IdempotencyLevel_enum_fullname = \"google.protobuf.MethodOptions.IdempotencyLevel\"\n\tMethodOptions_IdempotencyLevel_enum_name     = \"IdempotencyLevel\"\n)\n\n// Names for google.protobuf.UninterpretedOption.\nconst (\n\tUninterpretedOption_message_name     protoreflect.Name     = \"UninterpretedOption\"\n\tUninterpretedOption_message_fullname protoreflect.FullName = \"google.protobuf.UninterpretedOption\"\n)\n\n// Field names for google.protobuf.UninterpretedOption.\nconst (\n\tUninterpretedOption_Name_field_name             protoreflect.Name = \"name\"\n\tUninterpretedOption_IdentifierValue_field_name  protoreflect.Name = \"identifier_value\"\n\tUninterpretedOption_PositiveIntValue_field_name protoreflect.Name = \"positive_int_value\"\n\tUninterpretedOption_NegativeIntValue_field_name protoreflect.Name = \"negative_int_value\"\n\tUninterpretedOption_DoubleValue_field_name      protoreflect.Name = \"double_value\"\n\tUninterpretedOption_StringValue_field_name      protoreflect.Name = \"string_value\"\n\tUninterpretedOption_AggregateValue_field_name   protoreflect.Name = \"aggregate_value\"\n\n\tUninterpretedOption_Name_field_fullname             protoreflect.FullName = \"google.protobuf.UninterpretedOption.name\"\n\tUninterpretedOption_IdentifierValue_field_fullname  protoreflect.FullName = \"google.protobuf.UninterpretedOption.identifier_value\"\n\tUninterpretedOption_PositiveIntValue_field_fullname protoreflect.FullName = \"google.protobuf.UninterpretedOption.positive_int_value\"\n\tUninterpretedOption_NegativeIntValue_field_fullname protoreflect.FullName = \"google.protobuf.UninterpretedOption.negative_int_value\"\n\tUninterpretedOption_DoubleValue_field_fullname      protoreflect.FullName = \"google.protobuf.UninterpretedOption.double_value\"\n\tUninterpretedOption_StringValue_field_fullname      protoreflect.FullName = \"google.protobuf.UninterpretedOption.string_value\"\n\tUninterpretedOption_AggregateValue_field_fullname   protoreflect.FullName = \"google.protobuf.UninterpretedOption.aggregate_value\"\n)\n\n// Field numbers for google.protobuf.UninterpretedOption.\nconst (\n\tUninterpretedOption_Name_field_number             protoreflect.FieldNumber = 2\n\tUninterpretedOption_IdentifierValue_field_number  protoreflect.FieldNumber = 3\n\tUninterpretedOption_PositiveIntValue_field_number protoreflect.FieldNumber = 4\n\tUninterpretedOption_NegativeIntValue_field_number protoreflect.FieldNumber = 5\n\tUninterpretedOption_DoubleValue_field_number      protoreflect.FieldNumber = 6\n\tUninterpretedOption_StringValue_field_number      protoreflect.FieldNumber = 7\n\tUninterpretedOption_AggregateValue_field_number   protoreflect.FieldNumber = 8\n)\n\n// Names for google.protobuf.UninterpretedOption.NamePart.\nconst (\n\tUninterpretedOption_NamePart_message_name     protoreflect.Name     = \"NamePart\"\n\tUninterpretedOption_NamePart_message_fullname protoreflect.FullName = \"google.protobuf.UninterpretedOption.NamePart\"\n)\n\n// Field names for google.protobuf.UninterpretedOption.NamePart.\nconst (\n\tUninterpretedOption_NamePart_NamePart_field_name    protoreflect.Name = \"name_part\"\n\tUninterpretedOption_NamePart_IsExtension_field_name protoreflect.Name = \"is_extension\"\n\n\tUninterpretedOption_NamePart_NamePart_field_fullname    protoreflect.FullName = \"google.protobuf.UninterpretedOption.NamePart.name_part\"\n\tUninterpretedOption_NamePart_IsExtension_field_fullname protoreflect.FullName = \"google.protobuf.UninterpretedOption.NamePart.is_extension\"\n)\n\n// Field numbers for google.protobuf.UninterpretedOption.NamePart.\nconst (\n\tUninterpretedOption_NamePart_NamePart_field_number    protoreflect.FieldNumber = 1\n\tUninterpretedOption_NamePart_IsExtension_field_number protoreflect.FieldNumber = 2\n)\n\n// Names for google.protobuf.SourceCodeInfo.\nconst (\n\tSourceCodeInfo_message_name     protoreflect.Name     = \"SourceCodeInfo\"\n\tSourceCodeInfo_message_fullname protoreflect.FullName = \"google.protobuf.SourceCodeInfo\"\n)\n\n// Field names for google.protobuf.SourceCodeInfo.\nconst (\n\tSourceCodeInfo_Location_field_name protoreflect.Name = \"location\"\n\n\tSourceCodeInfo_Location_field_fullname protoreflect.FullName = \"google.protobuf.SourceCodeInfo.location\"\n)\n\n// Field numbers for google.protobuf.SourceCodeInfo.\nconst (\n\tSourceCodeInfo_Location_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.SourceCodeInfo.Location.\nconst (\n\tSourceCodeInfo_Location_message_name     protoreflect.Name     = \"Location\"\n\tSourceCodeInfo_Location_message_fullname protoreflect.FullName = \"google.protobuf.SourceCodeInfo.Location\"\n)\n\n// Field names for google.protobuf.SourceCodeInfo.Location.\nconst (\n\tSourceCodeInfo_Location_Path_field_name                    protoreflect.Name = \"path\"\n\tSourceCodeInfo_Location_Span_field_name                    protoreflect.Name = \"span\"\n\tSourceCodeInfo_Location_LeadingComments_field_name         protoreflect.Name = \"leading_comments\"\n\tSourceCodeInfo_Location_TrailingComments_field_name        protoreflect.Name = \"trailing_comments\"\n\tSourceCodeInfo_Location_LeadingDetachedComments_field_name protoreflect.Name = \"leading_detached_comments\"\n\n\tSourceCodeInfo_Location_Path_field_fullname                    protoreflect.FullName = \"google.protobuf.SourceCodeInfo.Location.path\"\n\tSourceCodeInfo_Location_Span_field_fullname                    protoreflect.FullName = \"google.protobuf.SourceCodeInfo.Location.span\"\n\tSourceCodeInfo_Location_LeadingComments_field_fullname         protoreflect.FullName = \"google.protobuf.SourceCodeInfo.Location.leading_comments\"\n\tSourceCodeInfo_Location_TrailingComments_field_fullname        protoreflect.FullName = \"google.protobuf.SourceCodeInfo.Location.trailing_comments\"\n\tSourceCodeInfo_Location_LeadingDetachedComments_field_fullname protoreflect.FullName = \"google.protobuf.SourceCodeInfo.Location.leading_detached_comments\"\n)\n\n// Field numbers for google.protobuf.SourceCodeInfo.Location.\nconst (\n\tSourceCodeInfo_Location_Path_field_number                    protoreflect.FieldNumber = 1\n\tSourceCodeInfo_Location_Span_field_number                    protoreflect.FieldNumber = 2\n\tSourceCodeInfo_Location_LeadingComments_field_number         protoreflect.FieldNumber = 3\n\tSourceCodeInfo_Location_TrailingComments_field_number        protoreflect.FieldNumber = 4\n\tSourceCodeInfo_Location_LeadingDetachedComments_field_number protoreflect.FieldNumber = 6\n)\n\n// Names for google.protobuf.GeneratedCodeInfo.\nconst (\n\tGeneratedCodeInfo_message_name     protoreflect.Name     = \"GeneratedCodeInfo\"\n\tGeneratedCodeInfo_message_fullname protoreflect.FullName = \"google.protobuf.GeneratedCodeInfo\"\n)\n\n// Field names for google.protobuf.GeneratedCodeInfo.\nconst (\n\tGeneratedCodeInfo_Annotation_field_name protoreflect.Name = \"annotation\"\n\n\tGeneratedCodeInfo_Annotation_field_fullname protoreflect.FullName = \"google.protobuf.GeneratedCodeInfo.annotation\"\n)\n\n// Field numbers for google.protobuf.GeneratedCodeInfo.\nconst (\n\tGeneratedCodeInfo_Annotation_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.GeneratedCodeInfo.Annotation.\nconst (\n\tGeneratedCodeInfo_Annotation_message_name     protoreflect.Name     = \"Annotation\"\n\tGeneratedCodeInfo_Annotation_message_fullname protoreflect.FullName = \"google.protobuf.GeneratedCodeInfo.Annotation\"\n)\n\n// Field names for google.protobuf.GeneratedCodeInfo.Annotation.\nconst (\n\tGeneratedCodeInfo_Annotation_Path_field_name       protoreflect.Name = \"path\"\n\tGeneratedCodeInfo_Annotation_SourceFile_field_name protoreflect.Name = \"source_file\"\n\tGeneratedCodeInfo_Annotation_Begin_field_name      protoreflect.Name = \"begin\"\n\tGeneratedCodeInfo_Annotation_End_field_name        protoreflect.Name = \"end\"\n\n\tGeneratedCodeInfo_Annotation_Path_field_fullname       protoreflect.FullName = \"google.protobuf.GeneratedCodeInfo.Annotation.path\"\n\tGeneratedCodeInfo_Annotation_SourceFile_field_fullname protoreflect.FullName = \"google.protobuf.GeneratedCodeInfo.Annotation.source_file\"\n\tGeneratedCodeInfo_Annotation_Begin_field_fullname      protoreflect.FullName = \"google.protobuf.GeneratedCodeInfo.Annotation.begin\"\n\tGeneratedCodeInfo_Annotation_End_field_fullname        protoreflect.FullName = \"google.protobuf.GeneratedCodeInfo.Annotation.end\"\n)\n\n// Field numbers for google.protobuf.GeneratedCodeInfo.Annotation.\nconst (\n\tGeneratedCodeInfo_Annotation_Path_field_number       protoreflect.FieldNumber = 1\n\tGeneratedCodeInfo_Annotation_SourceFile_field_number protoreflect.FieldNumber = 2\n\tGeneratedCodeInfo_Annotation_Begin_field_number      protoreflect.FieldNumber = 3\n\tGeneratedCodeInfo_Annotation_End_field_number        protoreflect.FieldNumber = 4\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/doc.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 genid contains constants for declarations in descriptor.proto\n// and the well-known types.\npackage genid\n\nimport protoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\nconst GoogleProtobuf_package protoreflect.FullName = \"google.protobuf\"\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/duration_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_duration_proto = \"google/protobuf/duration.proto\"\n\n// Names for google.protobuf.Duration.\nconst (\n\tDuration_message_name     protoreflect.Name     = \"Duration\"\n\tDuration_message_fullname protoreflect.FullName = \"google.protobuf.Duration\"\n)\n\n// Field names for google.protobuf.Duration.\nconst (\n\tDuration_Seconds_field_name protoreflect.Name = \"seconds\"\n\tDuration_Nanos_field_name   protoreflect.Name = \"nanos\"\n\n\tDuration_Seconds_field_fullname protoreflect.FullName = \"google.protobuf.Duration.seconds\"\n\tDuration_Nanos_field_fullname   protoreflect.FullName = \"google.protobuf.Duration.nanos\"\n)\n\n// Field numbers for google.protobuf.Duration.\nconst (\n\tDuration_Seconds_field_number protoreflect.FieldNumber = 1\n\tDuration_Nanos_field_number   protoreflect.FieldNumber = 2\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/empty_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_empty_proto = \"google/protobuf/empty.proto\"\n\n// Names for google.protobuf.Empty.\nconst (\n\tEmpty_message_name     protoreflect.Name     = \"Empty\"\n\tEmpty_message_fullname protoreflect.FullName = \"google.protobuf.Empty\"\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_field_mask_proto = \"google/protobuf/field_mask.proto\"\n\n// Names for google.protobuf.FieldMask.\nconst (\n\tFieldMask_message_name     protoreflect.Name     = \"FieldMask\"\n\tFieldMask_message_fullname protoreflect.FullName = \"google.protobuf.FieldMask\"\n)\n\n// Field names for google.protobuf.FieldMask.\nconst (\n\tFieldMask_Paths_field_name protoreflect.Name = \"paths\"\n\n\tFieldMask_Paths_field_fullname protoreflect.FullName = \"google.protobuf.FieldMask.paths\"\n)\n\n// Field numbers for google.protobuf.FieldMask.\nconst (\n\tFieldMask_Paths_field_number protoreflect.FieldNumber = 1\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/goname.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 genid\n\n// Go names of implementation-specific struct fields in generated messages.\nconst (\n\tState_goname = \"state\"\n\n\tSizeCache_goname  = \"sizeCache\"\n\tSizeCacheA_goname = \"XXX_sizecache\"\n\n\tWeakFields_goname  = \"weakFields\"\n\tWeakFieldsA_goname = \"XXX_weak\"\n\n\tUnknownFields_goname  = \"unknownFields\"\n\tUnknownFieldsA_goname = \"XXX_unrecognized\"\n\n\tExtensionFields_goname  = \"extensionFields\"\n\tExtensionFieldsA_goname = \"XXX_InternalExtensions\"\n\tExtensionFieldsB_goname = \"XXX_extensions\"\n\n\tWeakFieldPrefix_goname = \"XXX_weak_\"\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/map_entry.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 genid\n\nimport protoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\n// Generic field names and numbers for synthetic map entry messages.\nconst (\n\tMapEntry_Key_field_name   protoreflect.Name = \"key\"\n\tMapEntry_Value_field_name protoreflect.Name = \"value\"\n\n\tMapEntry_Key_field_number   protoreflect.FieldNumber = 1\n\tMapEntry_Value_field_number protoreflect.FieldNumber = 2\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/source_context_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_source_context_proto = \"google/protobuf/source_context.proto\"\n\n// Names for google.protobuf.SourceContext.\nconst (\n\tSourceContext_message_name     protoreflect.Name     = \"SourceContext\"\n\tSourceContext_message_fullname protoreflect.FullName = \"google.protobuf.SourceContext\"\n)\n\n// Field names for google.protobuf.SourceContext.\nconst (\n\tSourceContext_FileName_field_name protoreflect.Name = \"file_name\"\n\n\tSourceContext_FileName_field_fullname protoreflect.FullName = \"google.protobuf.SourceContext.file_name\"\n)\n\n// Field numbers for google.protobuf.SourceContext.\nconst (\n\tSourceContext_FileName_field_number protoreflect.FieldNumber = 1\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/struct_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_struct_proto = \"google/protobuf/struct.proto\"\n\n// Full and short names for google.protobuf.NullValue.\nconst (\n\tNullValue_enum_fullname = \"google.protobuf.NullValue\"\n\tNullValue_enum_name     = \"NullValue\"\n)\n\n// Names for google.protobuf.Struct.\nconst (\n\tStruct_message_name     protoreflect.Name     = \"Struct\"\n\tStruct_message_fullname protoreflect.FullName = \"google.protobuf.Struct\"\n)\n\n// Field names for google.protobuf.Struct.\nconst (\n\tStruct_Fields_field_name protoreflect.Name = \"fields\"\n\n\tStruct_Fields_field_fullname protoreflect.FullName = \"google.protobuf.Struct.fields\"\n)\n\n// Field numbers for google.protobuf.Struct.\nconst (\n\tStruct_Fields_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.Struct.FieldsEntry.\nconst (\n\tStruct_FieldsEntry_message_name     protoreflect.Name     = \"FieldsEntry\"\n\tStruct_FieldsEntry_message_fullname protoreflect.FullName = \"google.protobuf.Struct.FieldsEntry\"\n)\n\n// Field names for google.protobuf.Struct.FieldsEntry.\nconst (\n\tStruct_FieldsEntry_Key_field_name   protoreflect.Name = \"key\"\n\tStruct_FieldsEntry_Value_field_name protoreflect.Name = \"value\"\n\n\tStruct_FieldsEntry_Key_field_fullname   protoreflect.FullName = \"google.protobuf.Struct.FieldsEntry.key\"\n\tStruct_FieldsEntry_Value_field_fullname protoreflect.FullName = \"google.protobuf.Struct.FieldsEntry.value\"\n)\n\n// Field numbers for google.protobuf.Struct.FieldsEntry.\nconst (\n\tStruct_FieldsEntry_Key_field_number   protoreflect.FieldNumber = 1\n\tStruct_FieldsEntry_Value_field_number protoreflect.FieldNumber = 2\n)\n\n// Names for google.protobuf.Value.\nconst (\n\tValue_message_name     protoreflect.Name     = \"Value\"\n\tValue_message_fullname protoreflect.FullName = \"google.protobuf.Value\"\n)\n\n// Field names for google.protobuf.Value.\nconst (\n\tValue_NullValue_field_name   protoreflect.Name = \"null_value\"\n\tValue_NumberValue_field_name protoreflect.Name = \"number_value\"\n\tValue_StringValue_field_name protoreflect.Name = \"string_value\"\n\tValue_BoolValue_field_name   protoreflect.Name = \"bool_value\"\n\tValue_StructValue_field_name protoreflect.Name = \"struct_value\"\n\tValue_ListValue_field_name   protoreflect.Name = \"list_value\"\n\n\tValue_NullValue_field_fullname   protoreflect.FullName = \"google.protobuf.Value.null_value\"\n\tValue_NumberValue_field_fullname protoreflect.FullName = \"google.protobuf.Value.number_value\"\n\tValue_StringValue_field_fullname protoreflect.FullName = \"google.protobuf.Value.string_value\"\n\tValue_BoolValue_field_fullname   protoreflect.FullName = \"google.protobuf.Value.bool_value\"\n\tValue_StructValue_field_fullname protoreflect.FullName = \"google.protobuf.Value.struct_value\"\n\tValue_ListValue_field_fullname   protoreflect.FullName = \"google.protobuf.Value.list_value\"\n)\n\n// Field numbers for google.protobuf.Value.\nconst (\n\tValue_NullValue_field_number   protoreflect.FieldNumber = 1\n\tValue_NumberValue_field_number protoreflect.FieldNumber = 2\n\tValue_StringValue_field_number protoreflect.FieldNumber = 3\n\tValue_BoolValue_field_number   protoreflect.FieldNumber = 4\n\tValue_StructValue_field_number protoreflect.FieldNumber = 5\n\tValue_ListValue_field_number   protoreflect.FieldNumber = 6\n)\n\n// Oneof names for google.protobuf.Value.\nconst (\n\tValue_Kind_oneof_name protoreflect.Name = \"kind\"\n\n\tValue_Kind_oneof_fullname protoreflect.FullName = \"google.protobuf.Value.kind\"\n)\n\n// Names for google.protobuf.ListValue.\nconst (\n\tListValue_message_name     protoreflect.Name     = \"ListValue\"\n\tListValue_message_fullname protoreflect.FullName = \"google.protobuf.ListValue\"\n)\n\n// Field names for google.protobuf.ListValue.\nconst (\n\tListValue_Values_field_name protoreflect.Name = \"values\"\n\n\tListValue_Values_field_fullname protoreflect.FullName = \"google.protobuf.ListValue.values\"\n)\n\n// Field numbers for google.protobuf.ListValue.\nconst (\n\tListValue_Values_field_number protoreflect.FieldNumber = 1\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_timestamp_proto = \"google/protobuf/timestamp.proto\"\n\n// Names for google.protobuf.Timestamp.\nconst (\n\tTimestamp_message_name     protoreflect.Name     = \"Timestamp\"\n\tTimestamp_message_fullname protoreflect.FullName = \"google.protobuf.Timestamp\"\n)\n\n// Field names for google.protobuf.Timestamp.\nconst (\n\tTimestamp_Seconds_field_name protoreflect.Name = \"seconds\"\n\tTimestamp_Nanos_field_name   protoreflect.Name = \"nanos\"\n\n\tTimestamp_Seconds_field_fullname protoreflect.FullName = \"google.protobuf.Timestamp.seconds\"\n\tTimestamp_Nanos_field_fullname   protoreflect.FullName = \"google.protobuf.Timestamp.nanos\"\n)\n\n// Field numbers for google.protobuf.Timestamp.\nconst (\n\tTimestamp_Seconds_field_number protoreflect.FieldNumber = 1\n\tTimestamp_Nanos_field_number   protoreflect.FieldNumber = 2\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/type_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_type_proto = \"google/protobuf/type.proto\"\n\n// Full and short names for google.protobuf.Syntax.\nconst (\n\tSyntax_enum_fullname = \"google.protobuf.Syntax\"\n\tSyntax_enum_name     = \"Syntax\"\n)\n\n// Names for google.protobuf.Type.\nconst (\n\tType_message_name     protoreflect.Name     = \"Type\"\n\tType_message_fullname protoreflect.FullName = \"google.protobuf.Type\"\n)\n\n// Field names for google.protobuf.Type.\nconst (\n\tType_Name_field_name          protoreflect.Name = \"name\"\n\tType_Fields_field_name        protoreflect.Name = \"fields\"\n\tType_Oneofs_field_name        protoreflect.Name = \"oneofs\"\n\tType_Options_field_name       protoreflect.Name = \"options\"\n\tType_SourceContext_field_name protoreflect.Name = \"source_context\"\n\tType_Syntax_field_name        protoreflect.Name = \"syntax\"\n\n\tType_Name_field_fullname          protoreflect.FullName = \"google.protobuf.Type.name\"\n\tType_Fields_field_fullname        protoreflect.FullName = \"google.protobuf.Type.fields\"\n\tType_Oneofs_field_fullname        protoreflect.FullName = \"google.protobuf.Type.oneofs\"\n\tType_Options_field_fullname       protoreflect.FullName = \"google.protobuf.Type.options\"\n\tType_SourceContext_field_fullname protoreflect.FullName = \"google.protobuf.Type.source_context\"\n\tType_Syntax_field_fullname        protoreflect.FullName = \"google.protobuf.Type.syntax\"\n)\n\n// Field numbers for google.protobuf.Type.\nconst (\n\tType_Name_field_number          protoreflect.FieldNumber = 1\n\tType_Fields_field_number        protoreflect.FieldNumber = 2\n\tType_Oneofs_field_number        protoreflect.FieldNumber = 3\n\tType_Options_field_number       protoreflect.FieldNumber = 4\n\tType_SourceContext_field_number protoreflect.FieldNumber = 5\n\tType_Syntax_field_number        protoreflect.FieldNumber = 6\n)\n\n// Names for google.protobuf.Field.\nconst (\n\tField_message_name     protoreflect.Name     = \"Field\"\n\tField_message_fullname protoreflect.FullName = \"google.protobuf.Field\"\n)\n\n// Field names for google.protobuf.Field.\nconst (\n\tField_Kind_field_name         protoreflect.Name = \"kind\"\n\tField_Cardinality_field_name  protoreflect.Name = \"cardinality\"\n\tField_Number_field_name       protoreflect.Name = \"number\"\n\tField_Name_field_name         protoreflect.Name = \"name\"\n\tField_TypeUrl_field_name      protoreflect.Name = \"type_url\"\n\tField_OneofIndex_field_name   protoreflect.Name = \"oneof_index\"\n\tField_Packed_field_name       protoreflect.Name = \"packed\"\n\tField_Options_field_name      protoreflect.Name = \"options\"\n\tField_JsonName_field_name     protoreflect.Name = \"json_name\"\n\tField_DefaultValue_field_name protoreflect.Name = \"default_value\"\n\n\tField_Kind_field_fullname         protoreflect.FullName = \"google.protobuf.Field.kind\"\n\tField_Cardinality_field_fullname  protoreflect.FullName = \"google.protobuf.Field.cardinality\"\n\tField_Number_field_fullname       protoreflect.FullName = \"google.protobuf.Field.number\"\n\tField_Name_field_fullname         protoreflect.FullName = \"google.protobuf.Field.name\"\n\tField_TypeUrl_field_fullname      protoreflect.FullName = \"google.protobuf.Field.type_url\"\n\tField_OneofIndex_field_fullname   protoreflect.FullName = \"google.protobuf.Field.oneof_index\"\n\tField_Packed_field_fullname       protoreflect.FullName = \"google.protobuf.Field.packed\"\n\tField_Options_field_fullname      protoreflect.FullName = \"google.protobuf.Field.options\"\n\tField_JsonName_field_fullname     protoreflect.FullName = \"google.protobuf.Field.json_name\"\n\tField_DefaultValue_field_fullname protoreflect.FullName = \"google.protobuf.Field.default_value\"\n)\n\n// Field numbers for google.protobuf.Field.\nconst (\n\tField_Kind_field_number         protoreflect.FieldNumber = 1\n\tField_Cardinality_field_number  protoreflect.FieldNumber = 2\n\tField_Number_field_number       protoreflect.FieldNumber = 3\n\tField_Name_field_number         protoreflect.FieldNumber = 4\n\tField_TypeUrl_field_number      protoreflect.FieldNumber = 6\n\tField_OneofIndex_field_number   protoreflect.FieldNumber = 7\n\tField_Packed_field_number       protoreflect.FieldNumber = 8\n\tField_Options_field_number      protoreflect.FieldNumber = 9\n\tField_JsonName_field_number     protoreflect.FieldNumber = 10\n\tField_DefaultValue_field_number protoreflect.FieldNumber = 11\n)\n\n// Full and short names for google.protobuf.Field.Kind.\nconst (\n\tField_Kind_enum_fullname = \"google.protobuf.Field.Kind\"\n\tField_Kind_enum_name     = \"Kind\"\n)\n\n// Full and short names for google.protobuf.Field.Cardinality.\nconst (\n\tField_Cardinality_enum_fullname = \"google.protobuf.Field.Cardinality\"\n\tField_Cardinality_enum_name     = \"Cardinality\"\n)\n\n// Names for google.protobuf.Enum.\nconst (\n\tEnum_message_name     protoreflect.Name     = \"Enum\"\n\tEnum_message_fullname protoreflect.FullName = \"google.protobuf.Enum\"\n)\n\n// Field names for google.protobuf.Enum.\nconst (\n\tEnum_Name_field_name          protoreflect.Name = \"name\"\n\tEnum_Enumvalue_field_name     protoreflect.Name = \"enumvalue\"\n\tEnum_Options_field_name       protoreflect.Name = \"options\"\n\tEnum_SourceContext_field_name protoreflect.Name = \"source_context\"\n\tEnum_Syntax_field_name        protoreflect.Name = \"syntax\"\n\n\tEnum_Name_field_fullname          protoreflect.FullName = \"google.protobuf.Enum.name\"\n\tEnum_Enumvalue_field_fullname     protoreflect.FullName = \"google.protobuf.Enum.enumvalue\"\n\tEnum_Options_field_fullname       protoreflect.FullName = \"google.protobuf.Enum.options\"\n\tEnum_SourceContext_field_fullname protoreflect.FullName = \"google.protobuf.Enum.source_context\"\n\tEnum_Syntax_field_fullname        protoreflect.FullName = \"google.protobuf.Enum.syntax\"\n)\n\n// Field numbers for google.protobuf.Enum.\nconst (\n\tEnum_Name_field_number          protoreflect.FieldNumber = 1\n\tEnum_Enumvalue_field_number     protoreflect.FieldNumber = 2\n\tEnum_Options_field_number       protoreflect.FieldNumber = 3\n\tEnum_SourceContext_field_number protoreflect.FieldNumber = 4\n\tEnum_Syntax_field_number        protoreflect.FieldNumber = 5\n)\n\n// Names for google.protobuf.EnumValue.\nconst (\n\tEnumValue_message_name     protoreflect.Name     = \"EnumValue\"\n\tEnumValue_message_fullname protoreflect.FullName = \"google.protobuf.EnumValue\"\n)\n\n// Field names for google.protobuf.EnumValue.\nconst (\n\tEnumValue_Name_field_name    protoreflect.Name = \"name\"\n\tEnumValue_Number_field_name  protoreflect.Name = \"number\"\n\tEnumValue_Options_field_name protoreflect.Name = \"options\"\n\n\tEnumValue_Name_field_fullname    protoreflect.FullName = \"google.protobuf.EnumValue.name\"\n\tEnumValue_Number_field_fullname  protoreflect.FullName = \"google.protobuf.EnumValue.number\"\n\tEnumValue_Options_field_fullname protoreflect.FullName = \"google.protobuf.EnumValue.options\"\n)\n\n// Field numbers for google.protobuf.EnumValue.\nconst (\n\tEnumValue_Name_field_number    protoreflect.FieldNumber = 1\n\tEnumValue_Number_field_number  protoreflect.FieldNumber = 2\n\tEnumValue_Options_field_number protoreflect.FieldNumber = 3\n)\n\n// Names for google.protobuf.Option.\nconst (\n\tOption_message_name     protoreflect.Name     = \"Option\"\n\tOption_message_fullname protoreflect.FullName = \"google.protobuf.Option\"\n)\n\n// Field names for google.protobuf.Option.\nconst (\n\tOption_Name_field_name  protoreflect.Name = \"name\"\n\tOption_Value_field_name protoreflect.Name = \"value\"\n\n\tOption_Name_field_fullname  protoreflect.FullName = \"google.protobuf.Option.name\"\n\tOption_Value_field_fullname protoreflect.FullName = \"google.protobuf.Option.value\"\n)\n\n// Field numbers for google.protobuf.Option.\nconst (\n\tOption_Name_field_number  protoreflect.FieldNumber = 1\n\tOption_Value_field_number protoreflect.FieldNumber = 2\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/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 genid\n\nimport protoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\n// Generic field name and number for messages in wrappers.proto.\nconst (\n\tWrapperValue_Value_field_name   protoreflect.Name        = \"value\"\n\tWrapperValue_Value_field_number protoreflect.FieldNumber = 1\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage genid\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nconst File_google_protobuf_wrappers_proto = \"google/protobuf/wrappers.proto\"\n\n// Names for google.protobuf.DoubleValue.\nconst (\n\tDoubleValue_message_name     protoreflect.Name     = \"DoubleValue\"\n\tDoubleValue_message_fullname protoreflect.FullName = \"google.protobuf.DoubleValue\"\n)\n\n// Field names for google.protobuf.DoubleValue.\nconst (\n\tDoubleValue_Value_field_name protoreflect.Name = \"value\"\n\n\tDoubleValue_Value_field_fullname protoreflect.FullName = \"google.protobuf.DoubleValue.value\"\n)\n\n// Field numbers for google.protobuf.DoubleValue.\nconst (\n\tDoubleValue_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.FloatValue.\nconst (\n\tFloatValue_message_name     protoreflect.Name     = \"FloatValue\"\n\tFloatValue_message_fullname protoreflect.FullName = \"google.protobuf.FloatValue\"\n)\n\n// Field names for google.protobuf.FloatValue.\nconst (\n\tFloatValue_Value_field_name protoreflect.Name = \"value\"\n\n\tFloatValue_Value_field_fullname protoreflect.FullName = \"google.protobuf.FloatValue.value\"\n)\n\n// Field numbers for google.protobuf.FloatValue.\nconst (\n\tFloatValue_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.Int64Value.\nconst (\n\tInt64Value_message_name     protoreflect.Name     = \"Int64Value\"\n\tInt64Value_message_fullname protoreflect.FullName = \"google.protobuf.Int64Value\"\n)\n\n// Field names for google.protobuf.Int64Value.\nconst (\n\tInt64Value_Value_field_name protoreflect.Name = \"value\"\n\n\tInt64Value_Value_field_fullname protoreflect.FullName = \"google.protobuf.Int64Value.value\"\n)\n\n// Field numbers for google.protobuf.Int64Value.\nconst (\n\tInt64Value_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.UInt64Value.\nconst (\n\tUInt64Value_message_name     protoreflect.Name     = \"UInt64Value\"\n\tUInt64Value_message_fullname protoreflect.FullName = \"google.protobuf.UInt64Value\"\n)\n\n// Field names for google.protobuf.UInt64Value.\nconst (\n\tUInt64Value_Value_field_name protoreflect.Name = \"value\"\n\n\tUInt64Value_Value_field_fullname protoreflect.FullName = \"google.protobuf.UInt64Value.value\"\n)\n\n// Field numbers for google.protobuf.UInt64Value.\nconst (\n\tUInt64Value_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.Int32Value.\nconst (\n\tInt32Value_message_name     protoreflect.Name     = \"Int32Value\"\n\tInt32Value_message_fullname protoreflect.FullName = \"google.protobuf.Int32Value\"\n)\n\n// Field names for google.protobuf.Int32Value.\nconst (\n\tInt32Value_Value_field_name protoreflect.Name = \"value\"\n\n\tInt32Value_Value_field_fullname protoreflect.FullName = \"google.protobuf.Int32Value.value\"\n)\n\n// Field numbers for google.protobuf.Int32Value.\nconst (\n\tInt32Value_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.UInt32Value.\nconst (\n\tUInt32Value_message_name     protoreflect.Name     = \"UInt32Value\"\n\tUInt32Value_message_fullname protoreflect.FullName = \"google.protobuf.UInt32Value\"\n)\n\n// Field names for google.protobuf.UInt32Value.\nconst (\n\tUInt32Value_Value_field_name protoreflect.Name = \"value\"\n\n\tUInt32Value_Value_field_fullname protoreflect.FullName = \"google.protobuf.UInt32Value.value\"\n)\n\n// Field numbers for google.protobuf.UInt32Value.\nconst (\n\tUInt32Value_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.BoolValue.\nconst (\n\tBoolValue_message_name     protoreflect.Name     = \"BoolValue\"\n\tBoolValue_message_fullname protoreflect.FullName = \"google.protobuf.BoolValue\"\n)\n\n// Field names for google.protobuf.BoolValue.\nconst (\n\tBoolValue_Value_field_name protoreflect.Name = \"value\"\n\n\tBoolValue_Value_field_fullname protoreflect.FullName = \"google.protobuf.BoolValue.value\"\n)\n\n// Field numbers for google.protobuf.BoolValue.\nconst (\n\tBoolValue_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.StringValue.\nconst (\n\tStringValue_message_name     protoreflect.Name     = \"StringValue\"\n\tStringValue_message_fullname protoreflect.FullName = \"google.protobuf.StringValue\"\n)\n\n// Field names for google.protobuf.StringValue.\nconst (\n\tStringValue_Value_field_name protoreflect.Name = \"value\"\n\n\tStringValue_Value_field_fullname protoreflect.FullName = \"google.protobuf.StringValue.value\"\n)\n\n// Field numbers for google.protobuf.StringValue.\nconst (\n\tStringValue_Value_field_number protoreflect.FieldNumber = 1\n)\n\n// Names for google.protobuf.BytesValue.\nconst (\n\tBytesValue_message_name     protoreflect.Name     = \"BytesValue\"\n\tBytesValue_message_fullname protoreflect.FullName = \"google.protobuf.BytesValue\"\n)\n\n// Field names for google.protobuf.BytesValue.\nconst (\n\tBytesValue_Value_field_name protoreflect.Name = \"value\"\n\n\tBytesValue_Value_field_fullname protoreflect.FullName = \"google.protobuf.BytesValue.value\"\n)\n\n// Field numbers for google.protobuf.BytesValue.\nconst (\n\tBytesValue_Value_field_number protoreflect.FieldNumber = 1\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/api_export.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n\n\t\"google.golang.org/protobuf/encoding/prototext\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/proto\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// Export is a zero-length named type that exists only to export a set of\n// functions that we do not want to appear in godoc.\ntype Export struct{}\n\n// NewError formats a string according to the format specifier and arguments and\n// returns an error that has a \"proto\" prefix.\nfunc (Export) NewError(f string, x ...interface{}) error {\n\treturn errors.New(f, x...)\n}\n\n// enum is any enum type generated by protoc-gen-go\n// and must be a named int32 type.\ntype enum = interface{}\n\n// EnumOf returns the protoreflect.Enum interface over e.\n// It returns nil if e is nil.\nfunc (Export) EnumOf(e enum) pref.Enum {\n\tswitch e := e.(type) {\n\tcase nil:\n\t\treturn nil\n\tcase pref.Enum:\n\t\treturn e\n\tdefault:\n\t\treturn legacyWrapEnum(reflect.ValueOf(e))\n\t}\n}\n\n// EnumDescriptorOf returns the protoreflect.EnumDescriptor for e.\n// It returns nil if e is nil.\nfunc (Export) EnumDescriptorOf(e enum) pref.EnumDescriptor {\n\tswitch e := e.(type) {\n\tcase nil:\n\t\treturn nil\n\tcase pref.Enum:\n\t\treturn e.Descriptor()\n\tdefault:\n\t\treturn LegacyLoadEnumDesc(reflect.TypeOf(e))\n\t}\n}\n\n// EnumTypeOf returns the protoreflect.EnumType for e.\n// It returns nil if e is nil.\nfunc (Export) EnumTypeOf(e enum) pref.EnumType {\n\tswitch e := e.(type) {\n\tcase nil:\n\t\treturn nil\n\tcase pref.Enum:\n\t\treturn e.Type()\n\tdefault:\n\t\treturn legacyLoadEnumType(reflect.TypeOf(e))\n\t}\n}\n\n// EnumStringOf returns the enum value as a string, either as the name if\n// the number is resolvable, or the number formatted as a string.\nfunc (Export) EnumStringOf(ed pref.EnumDescriptor, n pref.EnumNumber) string {\n\tev := ed.Values().ByNumber(n)\n\tif ev != nil {\n\t\treturn string(ev.Name())\n\t}\n\treturn strconv.Itoa(int(n))\n}\n\n// message is any message type generated by protoc-gen-go\n// and must be a pointer to a named struct type.\ntype message = interface{}\n\n// legacyMessageWrapper wraps a v2 message as a v1 message.\ntype legacyMessageWrapper struct{ m pref.ProtoMessage }\n\nfunc (m legacyMessageWrapper) Reset()         { proto.Reset(m.m) }\nfunc (m legacyMessageWrapper) String() string { return Export{}.MessageStringOf(m.m) }\nfunc (m legacyMessageWrapper) ProtoMessage()  {}\n\n// ProtoMessageV1Of converts either a v1 or v2 message to a v1 message.\n// It returns nil if m is nil.\nfunc (Export) ProtoMessageV1Of(m message) piface.MessageV1 {\n\tswitch mv := m.(type) {\n\tcase nil:\n\t\treturn nil\n\tcase piface.MessageV1:\n\t\treturn mv\n\tcase unwrapper:\n\t\treturn Export{}.ProtoMessageV1Of(mv.protoUnwrap())\n\tcase pref.ProtoMessage:\n\t\treturn legacyMessageWrapper{mv}\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"message %T is neither a v1 or v2 Message\", m))\n\t}\n}\n\nfunc (Export) protoMessageV2Of(m message) pref.ProtoMessage {\n\tswitch mv := m.(type) {\n\tcase nil:\n\t\treturn nil\n\tcase pref.ProtoMessage:\n\t\treturn mv\n\tcase legacyMessageWrapper:\n\t\treturn mv.m\n\tcase piface.MessageV1:\n\t\treturn nil\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"message %T is neither a v1 or v2 Message\", m))\n\t}\n}\n\n// ProtoMessageV2Of converts either a v1 or v2 message to a v2 message.\n// It returns nil if m is nil.\nfunc (Export) ProtoMessageV2Of(m message) pref.ProtoMessage {\n\tif m == nil {\n\t\treturn nil\n\t}\n\tif mv := (Export{}).protoMessageV2Of(m); mv != nil {\n\t\treturn mv\n\t}\n\treturn legacyWrapMessage(reflect.ValueOf(m)).Interface()\n}\n\n// MessageOf returns the protoreflect.Message interface over m.\n// It returns nil if m is nil.\nfunc (Export) MessageOf(m message) pref.Message {\n\tif m == nil {\n\t\treturn nil\n\t}\n\tif mv := (Export{}).protoMessageV2Of(m); mv != nil {\n\t\treturn mv.ProtoReflect()\n\t}\n\treturn legacyWrapMessage(reflect.ValueOf(m))\n}\n\n// MessageDescriptorOf returns the protoreflect.MessageDescriptor for m.\n// It returns nil if m is nil.\nfunc (Export) MessageDescriptorOf(m message) pref.MessageDescriptor {\n\tif m == nil {\n\t\treturn nil\n\t}\n\tif mv := (Export{}).protoMessageV2Of(m); mv != nil {\n\t\treturn mv.ProtoReflect().Descriptor()\n\t}\n\treturn LegacyLoadMessageDesc(reflect.TypeOf(m))\n}\n\n// MessageTypeOf returns the protoreflect.MessageType for m.\n// It returns nil if m is nil.\nfunc (Export) MessageTypeOf(m message) pref.MessageType {\n\tif m == nil {\n\t\treturn nil\n\t}\n\tif mv := (Export{}).protoMessageV2Of(m); mv != nil {\n\t\treturn mv.ProtoReflect().Type()\n\t}\n\treturn legacyLoadMessageType(reflect.TypeOf(m), \"\")\n}\n\n// MessageStringOf returns the message value as a string,\n// which is the message serialized in the protobuf text format.\nfunc (Export) MessageStringOf(m pref.ProtoMessage) string {\n\treturn prototext.MarshalOptions{Multiline: false}.Format(m)\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/checkinit.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 impl\n\nimport (\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/errors\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\nfunc (mi *MessageInfo) checkInitialized(in piface.CheckInitializedInput) (piface.CheckInitializedOutput, error) {\n\tvar p pointer\n\tif ms, ok := in.Message.(*messageState); ok {\n\t\tp = ms.pointer()\n\t} else {\n\t\tp = in.Message.(*messageReflectWrapper).pointer()\n\t}\n\treturn piface.CheckInitializedOutput{}, mi.checkInitializedPointer(p)\n}\n\nfunc (mi *MessageInfo) checkInitializedPointer(p pointer) error {\n\tmi.init()\n\tif !mi.needsInitCheck {\n\t\treturn nil\n\t}\n\tif p.IsNil() {\n\t\tfor _, f := range mi.orderedCoderFields {\n\t\t\tif f.isRequired {\n\t\t\t\treturn errors.RequiredNotSet(string(mi.Desc.Fields().ByNumber(f.num).FullName()))\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\tif mi.extensionOffset.IsValid() {\n\t\te := p.Apply(mi.extensionOffset).Extensions()\n\t\tif err := mi.isInitExtensions(e); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfor _, f := range mi.orderedCoderFields {\n\t\tif !f.isRequired && f.funcs.isInit == nil {\n\t\t\tcontinue\n\t\t}\n\t\tfptr := p.Apply(f.offset)\n\t\tif f.isPointer && fptr.Elem().IsNil() {\n\t\t\tif f.isRequired {\n\t\t\t\treturn errors.RequiredNotSet(string(mi.Desc.Fields().ByNumber(f.num).FullName()))\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif f.funcs.isInit == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif err := f.funcs.isInit(fptr, f); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (mi *MessageInfo) isInitExtensions(ext *map[int32]ExtensionField) error {\n\tif ext == nil {\n\t\treturn nil\n\t}\n\tfor _, x := range *ext {\n\t\tei := getExtensionFieldInfo(x.Type())\n\t\tif ei.funcs.isInit == nil {\n\t\t\tcontinue\n\t\t}\n\t\tv := x.Value()\n\t\tif !v.IsValid() {\n\t\t\tcontinue\n\t\t}\n\t\tif err := ei.funcs.isInit(v); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nvar (\n\tneedsInitCheckMu  sync.Mutex\n\tneedsInitCheckMap sync.Map\n)\n\n// needsInitCheck reports whether a message needs to be checked for partial initialization.\n//\n// It returns true if the message transitively includes any required or extension fields.\nfunc needsInitCheck(md pref.MessageDescriptor) bool {\n\tif v, ok := needsInitCheckMap.Load(md); ok {\n\t\tif has, ok := v.(bool); ok {\n\t\t\treturn has\n\t\t}\n\t}\n\tneedsInitCheckMu.Lock()\n\tdefer needsInitCheckMu.Unlock()\n\treturn needsInitCheckLocked(md)\n}\n\nfunc needsInitCheckLocked(md pref.MessageDescriptor) (has bool) {\n\tif v, ok := needsInitCheckMap.Load(md); ok {\n\t\t// If has is true, we've previously determined that this message\n\t\t// needs init checks.\n\t\t//\n\t\t// If has is false, we've previously determined that it can never\n\t\t// be uninitialized.\n\t\t//\n\t\t// If has is not a bool, we've just encountered a cycle in the\n\t\t// message graph. In this case, it is safe to return false: If\n\t\t// the message does have required fields, we'll detect them later\n\t\t// in the graph traversal.\n\t\thas, ok := v.(bool)\n\t\treturn ok && has\n\t}\n\tneedsInitCheckMap.Store(md, struct{}{}) // avoid cycles while descending into this message\n\tdefer func() {\n\t\tneedsInitCheckMap.Store(md, has)\n\t}()\n\tif md.RequiredNumbers().Len() > 0 {\n\t\treturn true\n\t}\n\tif md.ExtensionRanges().Len() > 0 {\n\t\treturn true\n\t}\n\tfor i := 0; i < md.Fields().Len(); i++ {\n\t\tfd := md.Fields().Get(i)\n\t\t// Map keys are never messages, so just consider the map value.\n\t\tif fd.IsMap() {\n\t\t\tfd = fd.MapValue()\n\t\t}\n\t\tfmd := fd.Message()\n\t\tif fmd != nil && needsInitCheckLocked(fmd) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/codec_extension.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 impl\n\nimport (\n\t\"sync\"\n\t\"sync/atomic\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype extensionFieldInfo struct {\n\twiretag             uint64\n\ttagsize             int\n\tunmarshalNeedsValue bool\n\tfuncs               valueCoderFuncs\n\tvalidation          validationInfo\n}\n\nvar legacyExtensionFieldInfoCache sync.Map // map[protoreflect.ExtensionType]*extensionFieldInfo\n\nfunc getExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo {\n\tif xi, ok := xt.(*ExtensionInfo); ok {\n\t\txi.lazyInit()\n\t\treturn xi.info\n\t}\n\treturn legacyLoadExtensionFieldInfo(xt)\n}\n\n// legacyLoadExtensionFieldInfo dynamically loads a *ExtensionInfo for xt.\nfunc legacyLoadExtensionFieldInfo(xt pref.ExtensionType) *extensionFieldInfo {\n\tif xi, ok := legacyExtensionFieldInfoCache.Load(xt); ok {\n\t\treturn xi.(*extensionFieldInfo)\n\t}\n\te := makeExtensionFieldInfo(xt.TypeDescriptor())\n\tif e, ok := legacyMessageTypeCache.LoadOrStore(xt, e); ok {\n\t\treturn e.(*extensionFieldInfo)\n\t}\n\treturn e\n}\n\nfunc makeExtensionFieldInfo(xd pref.ExtensionDescriptor) *extensionFieldInfo {\n\tvar wiretag uint64\n\tif !xd.IsPacked() {\n\t\twiretag = protowire.EncodeTag(xd.Number(), wireTypes[xd.Kind()])\n\t} else {\n\t\twiretag = protowire.EncodeTag(xd.Number(), protowire.BytesType)\n\t}\n\te := &extensionFieldInfo{\n\t\twiretag: wiretag,\n\t\ttagsize: protowire.SizeVarint(wiretag),\n\t\tfuncs:   encoderFuncsForValue(xd),\n\t}\n\t// Does the unmarshal function need a value passed to it?\n\t// This is true for composite types, where we pass in a message, list, or map to fill in,\n\t// and for enums, where we pass in a prototype value to specify the concrete enum type.\n\tswitch xd.Kind() {\n\tcase pref.MessageKind, pref.GroupKind, pref.EnumKind:\n\t\te.unmarshalNeedsValue = true\n\tdefault:\n\t\tif xd.Cardinality() == pref.Repeated {\n\t\t\te.unmarshalNeedsValue = true\n\t\t}\n\t}\n\treturn e\n}\n\ntype lazyExtensionValue struct {\n\tatomicOnce uint32 // atomically set if value is valid\n\tmu         sync.Mutex\n\txi         *extensionFieldInfo\n\tvalue      pref.Value\n\tb          []byte\n\tfn         func() pref.Value\n}\n\ntype ExtensionField struct {\n\ttyp pref.ExtensionType\n\n\t// value is either the value of GetValue,\n\t// or a *lazyExtensionValue that then returns the value of GetValue.\n\tvalue pref.Value\n\tlazy  *lazyExtensionValue\n}\n\nfunc (f *ExtensionField) appendLazyBytes(xt pref.ExtensionType, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, b []byte) {\n\tif f.lazy == nil {\n\t\tf.lazy = &lazyExtensionValue{xi: xi}\n\t}\n\tf.typ = xt\n\tf.lazy.xi = xi\n\tf.lazy.b = protowire.AppendTag(f.lazy.b, num, wtyp)\n\tf.lazy.b = append(f.lazy.b, b...)\n}\n\nfunc (f *ExtensionField) canLazy(xt pref.ExtensionType) bool {\n\tif f.typ == nil {\n\t\treturn true\n\t}\n\tif f.typ == xt && f.lazy != nil && atomic.LoadUint32(&f.lazy.atomicOnce) == 0 {\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunc (f *ExtensionField) lazyInit() {\n\tf.lazy.mu.Lock()\n\tdefer f.lazy.mu.Unlock()\n\tif atomic.LoadUint32(&f.lazy.atomicOnce) == 1 {\n\t\treturn\n\t}\n\tif f.lazy.xi != nil {\n\t\tb := f.lazy.b\n\t\tval := f.typ.New()\n\t\tfor len(b) > 0 {\n\t\t\tvar tag uint64\n\t\t\tif b[0] < 0x80 {\n\t\t\t\ttag = uint64(b[0])\n\t\t\t\tb = b[1:]\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\ttag = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tb = b[2:]\n\t\t\t} else {\n\t\t\t\tvar n int\n\t\t\t\ttag, n = protowire.ConsumeVarint(b)\n\t\t\t\tif n < 0 {\n\t\t\t\t\tpanic(errors.New(\"bad tag in lazy extension decoding\"))\n\t\t\t\t}\n\t\t\t\tb = b[n:]\n\t\t\t}\n\t\t\tnum := protowire.Number(tag >> 3)\n\t\t\twtyp := protowire.Type(tag & 7)\n\t\t\tvar out unmarshalOutput\n\t\t\tvar err error\n\t\t\tval, out, err = f.lazy.xi.funcs.unmarshal(b, val, num, wtyp, lazyUnmarshalOptions)\n\t\t\tif err != nil {\n\t\t\t\tpanic(errors.New(\"decode failure in lazy extension decoding: %v\", err))\n\t\t\t}\n\t\t\tb = b[out.n:]\n\t\t}\n\t\tf.lazy.value = val\n\t} else {\n\t\tf.lazy.value = f.lazy.fn()\n\t}\n\tf.lazy.xi = nil\n\tf.lazy.fn = nil\n\tf.lazy.b = nil\n\tatomic.StoreUint32(&f.lazy.atomicOnce, 1)\n}\n\n// Set sets the type and value of the extension field.\n// This must not be called concurrently.\nfunc (f *ExtensionField) Set(t pref.ExtensionType, v pref.Value) {\n\tf.typ = t\n\tf.value = v\n\tf.lazy = nil\n}\n\n// SetLazy sets the type and a value that is to be lazily evaluated upon first use.\n// This must not be called concurrently.\nfunc (f *ExtensionField) SetLazy(t pref.ExtensionType, fn func() pref.Value) {\n\tf.typ = t\n\tf.lazy = &lazyExtensionValue{fn: fn}\n}\n\n// Value returns the value of the extension field.\n// This may be called concurrently.\nfunc (f *ExtensionField) Value() pref.Value {\n\tif f.lazy != nil {\n\t\tif atomic.LoadUint32(&f.lazy.atomicOnce) == 0 {\n\t\t\tf.lazyInit()\n\t\t}\n\t\treturn f.lazy.value\n\t}\n\treturn f.value\n}\n\n// Type returns the type of the extension field.\n// This may be called concurrently.\nfunc (f ExtensionField) Type() pref.ExtensionType {\n\treturn f.typ\n}\n\n// IsSet returns whether the extension field is set.\n// This may be called concurrently.\nfunc (f ExtensionField) IsSet() bool {\n\treturn f.typ != nil\n}\n\n// IsLazy reports whether a field is lazily encoded.\n// It is exported for testing.\nfunc IsLazy(m pref.Message, fd pref.FieldDescriptor) bool {\n\tvar mi *MessageInfo\n\tvar p pointer\n\tswitch m := m.(type) {\n\tcase *messageState:\n\t\tmi = m.messageInfo()\n\t\tp = m.pointer()\n\tcase *messageReflectWrapper:\n\t\tmi = m.messageInfo()\n\t\tp = m.pointer()\n\tdefault:\n\t\treturn false\n\t}\n\txd, ok := fd.(pref.ExtensionTypeDescriptor)\n\tif !ok {\n\t\treturn false\n\t}\n\txt := xd.Type()\n\text := mi.extensionMap(p)\n\tif ext == nil {\n\t\treturn false\n\t}\n\tf, ok := (*ext)[int32(fd.Number())]\n\tif !ok {\n\t\treturn false\n\t}\n\treturn f.typ == xt && f.lazy != nil && atomic.LoadUint32(&f.lazy.atomicOnce) == 0\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/codec_field.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/proto\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\ntype errInvalidUTF8 struct{}\n\nfunc (errInvalidUTF8) Error() string     { return \"string field contains invalid UTF-8\" }\nfunc (errInvalidUTF8) InvalidUTF8() bool { return true }\nfunc (errInvalidUTF8) Unwrap() error     { return errors.Error }\n\n// initOneofFieldCoders initializes the fast-path functions for the fields in a oneof.\n//\n// For size, marshal, and isInit operations, functions are set only on the first field\n// in the oneof. The functions are called when the oneof is non-nil, and will dispatch\n// to the appropriate field-specific function as necessary.\n//\n// The unmarshal function is set on each field individually as usual.\nfunc (mi *MessageInfo) initOneofFieldCoders(od pref.OneofDescriptor, si structInfo) {\n\tfs := si.oneofsByName[od.Name()]\n\tft := fs.Type\n\toneofFields := make(map[reflect.Type]*coderFieldInfo)\n\tneedIsInit := false\n\tfields := od.Fields()\n\tfor i, lim := 0, fields.Len(); i < lim; i++ {\n\t\tfd := od.Fields().Get(i)\n\t\tnum := fd.Number()\n\t\t// Make a copy of the original coderFieldInfo for use in unmarshaling.\n\t\t//\n\t\t// oneofFields[oneofType].funcs.marshal is the field-specific marshal function.\n\t\t//\n\t\t// mi.coderFields[num].marshal is set on only the first field in the oneof,\n\t\t// and dispatches to the field-specific marshaler in oneofFields.\n\t\tcf := *mi.coderFields[num]\n\t\tot := si.oneofWrappersByNumber[num]\n\t\tcf.ft = ot.Field(0).Type\n\t\tcf.mi, cf.funcs = fieldCoder(fd, cf.ft)\n\t\toneofFields[ot] = &cf\n\t\tif cf.funcs.isInit != nil {\n\t\t\tneedIsInit = true\n\t\t}\n\t\tmi.coderFields[num].funcs.unmarshal = func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\tvar vw reflect.Value         // pointer to wrapper type\n\t\t\tvi := p.AsValueOf(ft).Elem() // oneof field value of interface kind\n\t\t\tif !vi.IsNil() && !vi.Elem().IsNil() && vi.Elem().Elem().Type() == ot {\n\t\t\t\tvw = vi.Elem()\n\t\t\t} else {\n\t\t\t\tvw = reflect.New(ot)\n\t\t\t}\n\t\t\tout, err := cf.funcs.unmarshal(b, pointerOfValue(vw).Apply(zeroOffset), wtyp, &cf, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn out, err\n\t\t\t}\n\t\t\tvi.Set(vw)\n\t\t\treturn out, nil\n\t\t}\n\t}\n\tgetInfo := func(p pointer) (pointer, *coderFieldInfo) {\n\t\tv := p.AsValueOf(ft).Elem()\n\t\tif v.IsNil() {\n\t\t\treturn pointer{}, nil\n\t\t}\n\t\tv = v.Elem() // interface -> *struct\n\t\tif v.IsNil() {\n\t\t\treturn pointer{}, nil\n\t\t}\n\t\treturn pointerOfValue(v).Apply(zeroOffset), oneofFields[v.Elem().Type()]\n\t}\n\tfirst := mi.coderFields[od.Fields().Get(0).Number()]\n\tfirst.funcs.size = func(p pointer, _ *coderFieldInfo, opts marshalOptions) int {\n\t\tp, info := getInfo(p)\n\t\tif info == nil || info.funcs.size == nil {\n\t\t\treturn 0\n\t\t}\n\t\treturn info.funcs.size(p, info, opts)\n\t}\n\tfirst.funcs.marshal = func(b []byte, p pointer, _ *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\tp, info := getInfo(p)\n\t\tif info == nil || info.funcs.marshal == nil {\n\t\t\treturn b, nil\n\t\t}\n\t\treturn info.funcs.marshal(b, p, info, opts)\n\t}\n\tfirst.funcs.merge = func(dst, src pointer, _ *coderFieldInfo, opts mergeOptions) {\n\t\tsrcp, srcinfo := getInfo(src)\n\t\tif srcinfo == nil || srcinfo.funcs.merge == nil {\n\t\t\treturn\n\t\t}\n\t\tdstp, dstinfo := getInfo(dst)\n\t\tif dstinfo != srcinfo {\n\t\t\tdst.AsValueOf(ft).Elem().Set(reflect.New(src.AsValueOf(ft).Elem().Elem().Elem().Type()))\n\t\t\tdstp = pointerOfValue(dst.AsValueOf(ft).Elem().Elem()).Apply(zeroOffset)\n\t\t}\n\t\tsrcinfo.funcs.merge(dstp, srcp, srcinfo, opts)\n\t}\n\tif needIsInit {\n\t\tfirst.funcs.isInit = func(p pointer, _ *coderFieldInfo) error {\n\t\t\tp, info := getInfo(p)\n\t\t\tif info == nil || info.funcs.isInit == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn info.funcs.isInit(p, info)\n\t\t}\n\t}\n}\n\nfunc makeWeakMessageFieldCoder(fd pref.FieldDescriptor) pointerCoderFuncs {\n\tvar once sync.Once\n\tvar messageType pref.MessageType\n\tlazyInit := func() {\n\t\tonce.Do(func() {\n\t\t\tmessageName := fd.Message().FullName()\n\t\t\tmessageType, _ = preg.GlobalTypes.FindMessageByName(messageName)\n\t\t})\n\t}\n\n\treturn pointerCoderFuncs{\n\t\tsize: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\t\t\tm, ok := p.WeakFields().get(f.num)\n\t\t\tif !ok {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tlazyInit()\n\t\t\tif messageType == nil {\n\t\t\t\tpanic(fmt.Sprintf(\"weak message %v is not linked in\", fd.Message().FullName()))\n\t\t\t}\n\t\t\treturn sizeMessage(m, f.tagsize, opts)\n\t\t},\n\t\tmarshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\t\tm, ok := p.WeakFields().get(f.num)\n\t\t\tif !ok {\n\t\t\t\treturn b, nil\n\t\t\t}\n\t\t\tlazyInit()\n\t\t\tif messageType == nil {\n\t\t\t\tpanic(fmt.Sprintf(\"weak message %v is not linked in\", fd.Message().FullName()))\n\t\t\t}\n\t\t\treturn appendMessage(b, m, f.wiretag, opts)\n\t\t},\n\t\tunmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\tfs := p.WeakFields()\n\t\t\tm, ok := fs.get(f.num)\n\t\t\tif !ok {\n\t\t\t\tlazyInit()\n\t\t\t\tif messageType == nil {\n\t\t\t\t\treturn unmarshalOutput{}, errUnknown\n\t\t\t\t}\n\t\t\t\tm = messageType.New().Interface()\n\t\t\t\tfs.set(f.num, m)\n\t\t\t}\n\t\t\treturn consumeMessage(b, m, wtyp, opts)\n\t\t},\n\t\tisInit: func(p pointer, f *coderFieldInfo) error {\n\t\t\tm, ok := p.WeakFields().get(f.num)\n\t\t\tif !ok {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn proto.CheckInitialized(m)\n\t\t},\n\t\tmerge: func(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {\n\t\t\tsm, ok := src.WeakFields().get(f.num)\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdm, ok := dst.WeakFields().get(f.num)\n\t\t\tif !ok {\n\t\t\t\tlazyInit()\n\t\t\t\tif messageType == nil {\n\t\t\t\t\tpanic(fmt.Sprintf(\"weak message %v is not linked in\", fd.Message().FullName()))\n\t\t\t\t}\n\t\t\t\tdm = messageType.New().Interface()\n\t\t\t\tdst.WeakFields().set(f.num, dm)\n\t\t\t}\n\t\t\topts.Merge(dm, sm)\n\t\t},\n\t}\n}\n\nfunc makeMessageFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {\n\tif mi := getMessageInfo(ft); mi != nil {\n\t\tfuncs := pointerCoderFuncs{\n\t\t\tsize:      sizeMessageInfo,\n\t\t\tmarshal:   appendMessageInfo,\n\t\t\tunmarshal: consumeMessageInfo,\n\t\t\tmerge:     mergeMessage,\n\t\t}\n\t\tif needsInitCheck(mi.Desc) {\n\t\t\tfuncs.isInit = isInitMessageInfo\n\t\t}\n\t\treturn funcs\n\t} else {\n\t\treturn pointerCoderFuncs{\n\t\t\tsize: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\t\t\t\tm := asMessage(p.AsValueOf(ft).Elem())\n\t\t\t\treturn sizeMessage(m, f.tagsize, opts)\n\t\t\t},\n\t\t\tmarshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\t\t\tm := asMessage(p.AsValueOf(ft).Elem())\n\t\t\t\treturn appendMessage(b, m, f.wiretag, opts)\n\t\t\t},\n\t\t\tunmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\t\tmp := p.AsValueOf(ft).Elem()\n\t\t\t\tif mp.IsNil() {\n\t\t\t\t\tmp.Set(reflect.New(ft.Elem()))\n\t\t\t\t}\n\t\t\t\treturn consumeMessage(b, asMessage(mp), wtyp, opts)\n\t\t\t},\n\t\t\tisInit: func(p pointer, f *coderFieldInfo) error {\n\t\t\t\tm := asMessage(p.AsValueOf(ft).Elem())\n\t\t\t\treturn proto.CheckInitialized(m)\n\t\t\t},\n\t\t\tmerge: mergeMessage,\n\t\t}\n\t}\n}\n\nfunc sizeMessageInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\treturn protowire.SizeBytes(f.mi.sizePointer(p.Elem(), opts)) + f.tagsize\n}\n\nfunc appendMessageInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(f.mi.sizePointer(p.Elem(), opts)))\n\treturn f.mi.marshalAppendPointer(b, p.Elem(), opts)\n}\n\nfunc consumeMessageInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tif p.Elem().IsNil() {\n\t\tp.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem())))\n\t}\n\to, err := f.mi.unmarshalPointer(v, p.Elem(), 0, opts)\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tout.n = n\n\tout.initialized = o.initialized\n\treturn out, nil\n}\n\nfunc isInitMessageInfo(p pointer, f *coderFieldInfo) error {\n\treturn f.mi.checkInitializedPointer(p.Elem())\n}\n\nfunc sizeMessage(m proto.Message, tagsize int, _ marshalOptions) int {\n\treturn protowire.SizeBytes(proto.Size(m)) + tagsize\n}\n\nfunc appendMessage(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, uint64(proto.Size(m)))\n\treturn opts.Options().MarshalAppend(b, m)\n}\n\nfunc consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\to, err := opts.Options().UnmarshalState(piface.UnmarshalInput{\n\t\tBuf:     v,\n\t\tMessage: m.ProtoReflect(),\n\t})\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tout.n = n\n\tout.initialized = o.Flags&piface.UnmarshalInitialized != 0\n\treturn out, nil\n}\n\nfunc sizeMessageValue(v pref.Value, tagsize int, opts marshalOptions) int {\n\tm := v.Message().Interface()\n\treturn sizeMessage(m, tagsize, opts)\n}\n\nfunc appendMessageValue(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tm := v.Message().Interface()\n\treturn appendMessage(b, m, wiretag, opts)\n}\n\nfunc consumeMessageValue(b []byte, v pref.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) {\n\tm := v.Message().Interface()\n\tout, err := consumeMessage(b, m, wtyp, opts)\n\treturn v, out, err\n}\n\nfunc isInitMessageValue(v pref.Value) error {\n\tm := v.Message().Interface()\n\treturn proto.CheckInitialized(m)\n}\n\nvar coderMessageValue = valueCoderFuncs{\n\tsize:      sizeMessageValue,\n\tmarshal:   appendMessageValue,\n\tunmarshal: consumeMessageValue,\n\tisInit:    isInitMessageValue,\n\tmerge:     mergeMessageValue,\n}\n\nfunc sizeGroupValue(v pref.Value, tagsize int, opts marshalOptions) int {\n\tm := v.Message().Interface()\n\treturn sizeGroup(m, tagsize, opts)\n}\n\nfunc appendGroupValue(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tm := v.Message().Interface()\n\treturn appendGroup(b, m, wiretag, opts)\n}\n\nfunc consumeGroupValue(b []byte, v pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) {\n\tm := v.Message().Interface()\n\tout, err := consumeGroup(b, m, num, wtyp, opts)\n\treturn v, out, err\n}\n\nvar coderGroupValue = valueCoderFuncs{\n\tsize:      sizeGroupValue,\n\tmarshal:   appendGroupValue,\n\tunmarshal: consumeGroupValue,\n\tisInit:    isInitMessageValue,\n\tmerge:     mergeMessageValue,\n}\n\nfunc makeGroupFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {\n\tnum := fd.Number()\n\tif mi := getMessageInfo(ft); mi != nil {\n\t\tfuncs := pointerCoderFuncs{\n\t\t\tsize:      sizeGroupType,\n\t\t\tmarshal:   appendGroupType,\n\t\t\tunmarshal: consumeGroupType,\n\t\t\tmerge:     mergeMessage,\n\t\t}\n\t\tif needsInitCheck(mi.Desc) {\n\t\t\tfuncs.isInit = isInitMessageInfo\n\t\t}\n\t\treturn funcs\n\t} else {\n\t\treturn pointerCoderFuncs{\n\t\t\tsize: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\t\t\t\tm := asMessage(p.AsValueOf(ft).Elem())\n\t\t\t\treturn sizeGroup(m, f.tagsize, opts)\n\t\t\t},\n\t\t\tmarshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\t\t\tm := asMessage(p.AsValueOf(ft).Elem())\n\t\t\t\treturn appendGroup(b, m, f.wiretag, opts)\n\t\t\t},\n\t\t\tunmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\t\tmp := p.AsValueOf(ft).Elem()\n\t\t\t\tif mp.IsNil() {\n\t\t\t\t\tmp.Set(reflect.New(ft.Elem()))\n\t\t\t\t}\n\t\t\t\treturn consumeGroup(b, asMessage(mp), num, wtyp, opts)\n\t\t\t},\n\t\t\tisInit: func(p pointer, f *coderFieldInfo) error {\n\t\t\t\tm := asMessage(p.AsValueOf(ft).Elem())\n\t\t\t\treturn proto.CheckInitialized(m)\n\t\t\t},\n\t\t\tmerge: mergeMessage,\n\t\t}\n\t}\n}\n\nfunc sizeGroupType(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\treturn 2*f.tagsize + f.mi.sizePointer(p.Elem(), opts)\n}\n\nfunc appendGroupType(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, f.wiretag) // start group\n\tb, err := f.mi.marshalAppendPointer(b, p.Elem(), opts)\n\tb = protowire.AppendVarint(b, f.wiretag+1) // end group\n\treturn b, err\n}\n\nfunc consumeGroupType(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.StartGroupType {\n\t\treturn out, errUnknown\n\t}\n\tif p.Elem().IsNil() {\n\t\tp.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem())))\n\t}\n\treturn f.mi.unmarshalPointer(b, p.Elem(), f.num, opts)\n}\n\nfunc sizeGroup(m proto.Message, tagsize int, _ marshalOptions) int {\n\treturn 2*tagsize + proto.Size(m)\n}\n\nfunc appendGroup(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag) // start group\n\tb, err := opts.Options().MarshalAppend(b, m)\n\tb = protowire.AppendVarint(b, wiretag+1) // end group\n\treturn b, err\n}\n\nfunc consumeGroup(b []byte, m proto.Message, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.StartGroupType {\n\t\treturn out, errUnknown\n\t}\n\tb, n := protowire.ConsumeGroup(num, b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\to, err := opts.Options().UnmarshalState(piface.UnmarshalInput{\n\t\tBuf:     b,\n\t\tMessage: m.ProtoReflect(),\n\t})\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tout.n = n\n\tout.initialized = o.Flags&piface.UnmarshalInitialized != 0\n\treturn out, nil\n}\n\nfunc makeMessageSliceFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {\n\tif mi := getMessageInfo(ft); mi != nil {\n\t\tfuncs := pointerCoderFuncs{\n\t\t\tsize:      sizeMessageSliceInfo,\n\t\t\tmarshal:   appendMessageSliceInfo,\n\t\t\tunmarshal: consumeMessageSliceInfo,\n\t\t\tmerge:     mergeMessageSlice,\n\t\t}\n\t\tif needsInitCheck(mi.Desc) {\n\t\t\tfuncs.isInit = isInitMessageSliceInfo\n\t\t}\n\t\treturn funcs\n\t}\n\treturn pointerCoderFuncs{\n\t\tsize: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\t\t\treturn sizeMessageSlice(p, ft, f.tagsize, opts)\n\t\t},\n\t\tmarshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\t\treturn appendMessageSlice(b, p, f.wiretag, ft, opts)\n\t\t},\n\t\tunmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\treturn consumeMessageSlice(b, p, ft, wtyp, opts)\n\t\t},\n\t\tisInit: func(p pointer, f *coderFieldInfo) error {\n\t\t\treturn isInitMessageSlice(p, ft)\n\t\t},\n\t\tmerge: mergeMessageSlice,\n\t}\n}\n\nfunc sizeMessageSliceInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\ts := p.PointerSlice()\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeBytes(f.mi.sizePointer(v, opts)) + f.tagsize\n\t}\n\treturn n\n}\n\nfunc appendMessageSliceInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := p.PointerSlice()\n\tvar err error\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tsiz := f.mi.sizePointer(v, opts)\n\t\tb = protowire.AppendVarint(b, uint64(siz))\n\t\tb, err = f.mi.marshalAppendPointer(b, v, opts)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\treturn b, nil\n}\n\nfunc consumeMessageSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tm := reflect.New(f.mi.GoReflectType.Elem()).Interface()\n\tmp := pointerOfIface(m)\n\to, err := f.mi.unmarshalPointer(v, mp, 0, opts)\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tp.AppendPointerSlice(mp)\n\tout.n = n\n\tout.initialized = o.initialized\n\treturn out, nil\n}\n\nfunc isInitMessageSliceInfo(p pointer, f *coderFieldInfo) error {\n\ts := p.PointerSlice()\n\tfor _, v := range s {\n\t\tif err := f.mi.checkInitializedPointer(v); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc sizeMessageSlice(p pointer, goType reflect.Type, tagsize int, _ marshalOptions) int {\n\ts := p.PointerSlice()\n\tn := 0\n\tfor _, v := range s {\n\t\tm := asMessage(v.AsValueOf(goType.Elem()))\n\t\tn += protowire.SizeBytes(proto.Size(m)) + tagsize\n\t}\n\treturn n\n}\n\nfunc appendMessageSlice(b []byte, p pointer, wiretag uint64, goType reflect.Type, opts marshalOptions) ([]byte, error) {\n\ts := p.PointerSlice()\n\tvar err error\n\tfor _, v := range s {\n\t\tm := asMessage(v.AsValueOf(goType.Elem()))\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tsiz := proto.Size(m)\n\t\tb = protowire.AppendVarint(b, uint64(siz))\n\t\tb, err = opts.Options().MarshalAppend(b, m)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\treturn b, nil\n}\n\nfunc consumeMessageSlice(b []byte, p pointer, goType reflect.Type, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tmp := reflect.New(goType.Elem())\n\to, err := opts.Options().UnmarshalState(piface.UnmarshalInput{\n\t\tBuf:     v,\n\t\tMessage: asMessage(mp).ProtoReflect(),\n\t})\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tp.AppendPointerSlice(pointerOfValue(mp))\n\tout.n = n\n\tout.initialized = o.Flags&piface.UnmarshalInitialized != 0\n\treturn out, nil\n}\n\nfunc isInitMessageSlice(p pointer, goType reflect.Type) error {\n\ts := p.PointerSlice()\n\tfor _, v := range s {\n\t\tm := asMessage(v.AsValueOf(goType.Elem()))\n\t\tif err := proto.CheckInitialized(m); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// Slices of messages\n\nfunc sizeMessageSliceValue(listv pref.Value, tagsize int, opts marshalOptions) int {\n\tlist := listv.List()\n\tn := 0\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tm := list.Get(i).Message().Interface()\n\t\tn += protowire.SizeBytes(proto.Size(m)) + tagsize\n\t}\n\treturn n\n}\n\nfunc appendMessageSliceValue(b []byte, listv pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tmopts := opts.Options()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tm := list.Get(i).Message().Interface()\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tsiz := proto.Size(m)\n\t\tb = protowire.AppendVarint(b, uint64(siz))\n\t\tvar err error\n\t\tb, err = mopts.MarshalAppend(b, m)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\treturn b, nil\n}\n\nfunc consumeMessageSliceValue(b []byte, listv pref.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp != protowire.BytesType {\n\t\treturn pref.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn pref.Value{}, out, errDecode\n\t}\n\tm := list.NewElement()\n\to, err := opts.Options().UnmarshalState(piface.UnmarshalInput{\n\t\tBuf:     v,\n\t\tMessage: m.Message(),\n\t})\n\tif err != nil {\n\t\treturn pref.Value{}, out, err\n\t}\n\tlist.Append(m)\n\tout.n = n\n\tout.initialized = o.Flags&piface.UnmarshalInitialized != 0\n\treturn listv, out, nil\n}\n\nfunc isInitMessageSliceValue(listv pref.Value) error {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tm := list.Get(i).Message().Interface()\n\t\tif err := proto.CheckInitialized(m); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nvar coderMessageSliceValue = valueCoderFuncs{\n\tsize:      sizeMessageSliceValue,\n\tmarshal:   appendMessageSliceValue,\n\tunmarshal: consumeMessageSliceValue,\n\tisInit:    isInitMessageSliceValue,\n\tmerge:     mergeMessageListValue,\n}\n\nfunc sizeGroupSliceValue(listv pref.Value, tagsize int, opts marshalOptions) int {\n\tlist := listv.List()\n\tn := 0\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tm := list.Get(i).Message().Interface()\n\t\tn += 2*tagsize + proto.Size(m)\n\t}\n\treturn n\n}\n\nfunc appendGroupSliceValue(b []byte, listv pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tmopts := opts.Options()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tm := list.Get(i).Message().Interface()\n\t\tb = protowire.AppendVarint(b, wiretag) // start group\n\t\tvar err error\n\t\tb, err = mopts.MarshalAppend(b, m)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t\tb = protowire.AppendVarint(b, wiretag+1) // end group\n\t}\n\treturn b, nil\n}\n\nfunc consumeGroupSliceValue(b []byte, listv pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp != protowire.StartGroupType {\n\t\treturn pref.Value{}, out, errUnknown\n\t}\n\tb, n := protowire.ConsumeGroup(num, b)\n\tif n < 0 {\n\t\treturn pref.Value{}, out, errDecode\n\t}\n\tm := list.NewElement()\n\to, err := opts.Options().UnmarshalState(piface.UnmarshalInput{\n\t\tBuf:     b,\n\t\tMessage: m.Message(),\n\t})\n\tif err != nil {\n\t\treturn pref.Value{}, out, err\n\t}\n\tlist.Append(m)\n\tout.n = n\n\tout.initialized = o.Flags&piface.UnmarshalInitialized != 0\n\treturn listv, out, nil\n}\n\nvar coderGroupSliceValue = valueCoderFuncs{\n\tsize:      sizeGroupSliceValue,\n\tmarshal:   appendGroupSliceValue,\n\tunmarshal: consumeGroupSliceValue,\n\tisInit:    isInitMessageSliceValue,\n\tmerge:     mergeMessageListValue,\n}\n\nfunc makeGroupSliceFieldCoder(fd pref.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {\n\tnum := fd.Number()\n\tif mi := getMessageInfo(ft); mi != nil {\n\t\tfuncs := pointerCoderFuncs{\n\t\t\tsize:      sizeGroupSliceInfo,\n\t\t\tmarshal:   appendGroupSliceInfo,\n\t\t\tunmarshal: consumeGroupSliceInfo,\n\t\t\tmerge:     mergeMessageSlice,\n\t\t}\n\t\tif needsInitCheck(mi.Desc) {\n\t\t\tfuncs.isInit = isInitMessageSliceInfo\n\t\t}\n\t\treturn funcs\n\t}\n\treturn pointerCoderFuncs{\n\t\tsize: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\t\t\treturn sizeGroupSlice(p, ft, f.tagsize, opts)\n\t\t},\n\t\tmarshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\t\treturn appendGroupSlice(b, p, f.wiretag, ft, opts)\n\t\t},\n\t\tunmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\treturn consumeGroupSlice(b, p, num, wtyp, ft, opts)\n\t\t},\n\t\tisInit: func(p pointer, f *coderFieldInfo) error {\n\t\t\treturn isInitMessageSlice(p, ft)\n\t\t},\n\t\tmerge: mergeMessageSlice,\n\t}\n}\n\nfunc sizeGroupSlice(p pointer, messageType reflect.Type, tagsize int, _ marshalOptions) int {\n\ts := p.PointerSlice()\n\tn := 0\n\tfor _, v := range s {\n\t\tm := asMessage(v.AsValueOf(messageType.Elem()))\n\t\tn += 2*tagsize + proto.Size(m)\n\t}\n\treturn n\n}\n\nfunc appendGroupSlice(b []byte, p pointer, wiretag uint64, messageType reflect.Type, opts marshalOptions) ([]byte, error) {\n\ts := p.PointerSlice()\n\tvar err error\n\tfor _, v := range s {\n\t\tm := asMessage(v.AsValueOf(messageType.Elem()))\n\t\tb = protowire.AppendVarint(b, wiretag) // start group\n\t\tb, err = opts.Options().MarshalAppend(b, m)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t\tb = protowire.AppendVarint(b, wiretag+1) // end group\n\t}\n\treturn b, nil\n}\n\nfunc consumeGroupSlice(b []byte, p pointer, num protowire.Number, wtyp protowire.Type, goType reflect.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.StartGroupType {\n\t\treturn out, errUnknown\n\t}\n\tb, n := protowire.ConsumeGroup(num, b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tmp := reflect.New(goType.Elem())\n\to, err := opts.Options().UnmarshalState(piface.UnmarshalInput{\n\t\tBuf:     b,\n\t\tMessage: asMessage(mp).ProtoReflect(),\n\t})\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tp.AppendPointerSlice(pointerOfValue(mp))\n\tout.n = n\n\tout.initialized = o.Flags&piface.UnmarshalInitialized != 0\n\treturn out, nil\n}\n\nfunc sizeGroupSliceInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\ts := p.PointerSlice()\n\tn := 0\n\tfor _, v := range s {\n\t\tn += 2*f.tagsize + f.mi.sizePointer(v, opts)\n\t}\n\treturn n\n}\n\nfunc appendGroupSliceInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := p.PointerSlice()\n\tvar err error\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag) // start group\n\t\tb, err = f.mi.marshalAppendPointer(b, v, opts)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t\tb = protowire.AppendVarint(b, f.wiretag+1) // end group\n\t}\n\treturn b, nil\n}\n\nfunc consumeGroupSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\tif wtyp != protowire.StartGroupType {\n\t\treturn unmarshalOutput{}, errUnknown\n\t}\n\tm := reflect.New(f.mi.GoReflectType.Elem()).Interface()\n\tmp := pointerOfIface(m)\n\tout, err := f.mi.unmarshalPointer(b, mp, f.num, opts)\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tp.AppendPointerSlice(mp)\n\treturn out, nil\n}\n\nfunc asMessage(v reflect.Value) pref.ProtoMessage {\n\tif m, ok := v.Interface().(pref.ProtoMessage); ok {\n\t\treturn m\n\t}\n\treturn legacyWrapMessage(v).Interface()\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/codec_gen.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// Code generated by generate-types. DO NOT EDIT.\n\npackage impl\n\nimport (\n\t\"math\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// sizeBool returns the size of wire encoding a bool pointer as a Bool.\nfunc sizeBool(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Bool()\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))\n}\n\n// appendBool wire encodes a bool pointer as a Bool.\nfunc appendBool(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Bool()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeBool(v))\n\treturn b, nil\n}\n\n// consumeBool wire decodes a bool pointer as a Bool.\nfunc consumeBool(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Bool() = protowire.DecodeBool(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBool = pointerCoderFuncs{\n\tsize:      sizeBool,\n\tmarshal:   appendBool,\n\tunmarshal: consumeBool,\n\tmerge:     mergeBool,\n}\n\n// sizeBoolNoZero returns the size of wire encoding a bool pointer as a Bool.\n// The zero value is not encoded.\nfunc sizeBoolNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Bool()\n\tif v == false {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))\n}\n\n// appendBoolNoZero wire encodes a bool pointer as a Bool.\n// The zero value is not encoded.\nfunc appendBoolNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Bool()\n\tif v == false {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeBool(v))\n\treturn b, nil\n}\n\nvar coderBoolNoZero = pointerCoderFuncs{\n\tsize:      sizeBoolNoZero,\n\tmarshal:   appendBoolNoZero,\n\tunmarshal: consumeBool,\n\tmerge:     mergeBoolNoZero,\n}\n\n// sizeBoolPtr returns the size of wire encoding a *bool pointer as a Bool.\n// It panics if the pointer is nil.\nfunc sizeBoolPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.BoolPtr()\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))\n}\n\n// appendBoolPtr wire encodes a *bool pointer as a Bool.\n// It panics if the pointer is nil.\nfunc appendBoolPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.BoolPtr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeBool(v))\n\treturn b, nil\n}\n\n// consumeBoolPtr wire decodes a *bool pointer as a Bool.\nfunc consumeBoolPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.BoolPtr()\n\tif *vp == nil {\n\t\t*vp = new(bool)\n\t}\n\t**vp = protowire.DecodeBool(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBoolPtr = pointerCoderFuncs{\n\tsize:      sizeBoolPtr,\n\tmarshal:   appendBoolPtr,\n\tunmarshal: consumeBoolPtr,\n\tmerge:     mergeBoolPtr,\n}\n\n// sizeBoolSlice returns the size of wire encoding a []bool pointer as a repeated Bool.\nfunc sizeBoolSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.BoolSlice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))\n\t}\n\treturn size\n}\n\n// appendBoolSlice encodes a []bool pointer as a repeated Bool.\nfunc appendBoolSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.BoolSlice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeBool(v))\n\t}\n\treturn b, nil\n}\n\n// consumeBoolSlice wire decodes a []bool pointer as a repeated Bool.\nfunc consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.BoolSlice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, protowire.DecodeBool(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, protowire.DecodeBool(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBoolSlice = pointerCoderFuncs{\n\tsize:      sizeBoolSlice,\n\tmarshal:   appendBoolSlice,\n\tunmarshal: consumeBoolSlice,\n\tmerge:     mergeBoolSlice,\n}\n\n// sizeBoolPackedSlice returns the size of wire encoding a []bool pointer as a packed repeated Bool.\nfunc sizeBoolPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.BoolSlice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(protowire.EncodeBool(v))\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendBoolPackedSlice encodes a []bool pointer as a packed repeated Bool.\nfunc appendBoolPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.BoolSlice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(protowire.EncodeBool(v))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, protowire.EncodeBool(v))\n\t}\n\treturn b, nil\n}\n\nvar coderBoolPackedSlice = pointerCoderFuncs{\n\tsize:      sizeBoolPackedSlice,\n\tmarshal:   appendBoolPackedSlice,\n\tunmarshal: consumeBoolSlice,\n\tmerge:     mergeBoolSlice,\n}\n\n// sizeBoolValue returns the size of wire encoding a bool value as a Bool.\nfunc sizeBoolValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool()))\n}\n\n// appendBoolValue encodes a bool value as a Bool.\nfunc appendBoolValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))\n\treturn b, nil\n}\n\n// consumeBoolValue decodes a bool value as a Bool.\nfunc consumeBoolValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfBool(protowire.DecodeBool(v)), out, nil\n}\n\nvar coderBoolValue = valueCoderFuncs{\n\tsize:      sizeBoolValue,\n\tmarshal:   appendBoolValue,\n\tunmarshal: consumeBoolValue,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeBoolSliceValue returns the size of wire encoding a []bool value as a repeated Bool.\nfunc sizeBoolSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool()))\n\t}\n\treturn size\n}\n\n// appendBoolSliceValue encodes a []bool value as a repeated Bool.\nfunc appendBoolSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))\n\t}\n\treturn b, nil\n}\n\n// consumeBoolSliceValue wire decodes a []bool value as a repeated Bool.\nfunc consumeBoolSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderBoolSliceValue = valueCoderFuncs{\n\tsize:      sizeBoolSliceValue,\n\tmarshal:   appendBoolSliceValue,\n\tunmarshal: consumeBoolSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeBoolPackedSliceValue returns the size of wire encoding a []bool value as a packed repeated Bool.\nfunc sizeBoolPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(protowire.EncodeBool(v.Bool()))\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendBoolPackedSliceValue encodes a []bool value as a packed repeated Bool.\nfunc appendBoolPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(protowire.EncodeBool(v.Bool()))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))\n\t}\n\treturn b, nil\n}\n\nvar coderBoolPackedSliceValue = valueCoderFuncs{\n\tsize:      sizeBoolPackedSliceValue,\n\tmarshal:   appendBoolPackedSliceValue,\n\tunmarshal: consumeBoolSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeEnumValue returns the size of wire encoding a  value as a Enum.\nfunc sizeEnumValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(uint64(v.Enum()))\n}\n\n// appendEnumValue encodes a  value as a Enum.\nfunc appendEnumValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, uint64(v.Enum()))\n\treturn b, nil\n}\n\n// consumeEnumValue decodes a  value as a Enum.\nfunc consumeEnumValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), out, nil\n}\n\nvar coderEnumValue = valueCoderFuncs{\n\tsize:      sizeEnumValue,\n\tmarshal:   appendEnumValue,\n\tunmarshal: consumeEnumValue,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeEnumSliceValue returns the size of wire encoding a [] value as a repeated Enum.\nfunc sizeEnumSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(uint64(v.Enum()))\n\t}\n\treturn size\n}\n\n// appendEnumSliceValue encodes a [] value as a repeated Enum.\nfunc appendEnumSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(v.Enum()))\n\t}\n\treturn b, nil\n}\n\n// consumeEnumSliceValue wire decodes a [] value as a repeated Enum.\nfunc consumeEnumSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderEnumSliceValue = valueCoderFuncs{\n\tsize:      sizeEnumSliceValue,\n\tmarshal:   appendEnumSliceValue,\n\tunmarshal: consumeEnumSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeEnumPackedSliceValue returns the size of wire encoding a [] value as a packed repeated Enum.\nfunc sizeEnumPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(v.Enum()))\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendEnumPackedSliceValue encodes a [] value as a packed repeated Enum.\nfunc appendEnumPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(v.Enum()))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, uint64(v.Enum()))\n\t}\n\treturn b, nil\n}\n\nvar coderEnumPackedSliceValue = valueCoderFuncs{\n\tsize:      sizeEnumPackedSliceValue,\n\tmarshal:   appendEnumPackedSliceValue,\n\tunmarshal: consumeEnumSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeInt32 returns the size of wire encoding a int32 pointer as a Int32.\nfunc sizeInt32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int32()\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendInt32 wire encodes a int32 pointer as a Int32.\nfunc appendInt32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int32()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeInt32 wire decodes a int32 pointer as a Int32.\nfunc consumeInt32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Int32() = int32(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderInt32 = pointerCoderFuncs{\n\tsize:      sizeInt32,\n\tmarshal:   appendInt32,\n\tunmarshal: consumeInt32,\n\tmerge:     mergeInt32,\n}\n\n// sizeInt32NoZero returns the size of wire encoding a int32 pointer as a Int32.\n// The zero value is not encoded.\nfunc sizeInt32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int32()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendInt32NoZero wire encodes a int32 pointer as a Int32.\n// The zero value is not encoded.\nfunc appendInt32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int32()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\nvar coderInt32NoZero = pointerCoderFuncs{\n\tsize:      sizeInt32NoZero,\n\tmarshal:   appendInt32NoZero,\n\tunmarshal: consumeInt32,\n\tmerge:     mergeInt32NoZero,\n}\n\n// sizeInt32Ptr returns the size of wire encoding a *int32 pointer as a Int32.\n// It panics if the pointer is nil.\nfunc sizeInt32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.Int32Ptr()\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendInt32Ptr wire encodes a *int32 pointer as a Int32.\n// It panics if the pointer is nil.\nfunc appendInt32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Int32Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeInt32Ptr wire decodes a *int32 pointer as a Int32.\nfunc consumeInt32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Int32Ptr()\n\tif *vp == nil {\n\t\t*vp = new(int32)\n\t}\n\t**vp = int32(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderInt32Ptr = pointerCoderFuncs{\n\tsize:      sizeInt32Ptr,\n\tmarshal:   appendInt32Ptr,\n\tunmarshal: consumeInt32Ptr,\n\tmerge:     mergeInt32Ptr,\n}\n\n// sizeInt32Slice returns the size of wire encoding a []int32 pointer as a repeated Int32.\nfunc sizeInt32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int32Slice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeVarint(uint64(v))\n\t}\n\treturn size\n}\n\n// appendInt32Slice encodes a []int32 pointer as a repeated Int32.\nfunc appendInt32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int32Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\n// consumeInt32Slice wire decodes a []int32 pointer as a repeated Int32.\nfunc consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Int32Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, int32(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, int32(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderInt32Slice = pointerCoderFuncs{\n\tsize:      sizeInt32Slice,\n\tmarshal:   appendInt32Slice,\n\tunmarshal: consumeInt32Slice,\n\tmerge:     mergeInt32Slice,\n}\n\n// sizeInt32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Int32.\nfunc sizeInt32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int32Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(uint64(v))\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendInt32PackedSlice encodes a []int32 pointer as a packed repeated Int32.\nfunc appendInt32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int32Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(uint64(v))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\nvar coderInt32PackedSlice = pointerCoderFuncs{\n\tsize:      sizeInt32PackedSlice,\n\tmarshal:   appendInt32PackedSlice,\n\tunmarshal: consumeInt32Slice,\n\tmerge:     mergeInt32Slice,\n}\n\n// sizeInt32Value returns the size of wire encoding a int32 value as a Int32.\nfunc sizeInt32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(uint64(int32(v.Int())))\n}\n\n// appendInt32Value encodes a int32 value as a Int32.\nfunc appendInt32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, uint64(int32(v.Int())))\n\treturn b, nil\n}\n\n// consumeInt32Value decodes a int32 value as a Int32.\nfunc consumeInt32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfInt32(int32(v)), out, nil\n}\n\nvar coderInt32Value = valueCoderFuncs{\n\tsize:      sizeInt32Value,\n\tmarshal:   appendInt32Value,\n\tunmarshal: consumeInt32Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeInt32SliceValue returns the size of wire encoding a []int32 value as a repeated Int32.\nfunc sizeInt32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(uint64(int32(v.Int())))\n\t}\n\treturn size\n}\n\n// appendInt32SliceValue encodes a []int32 value as a repeated Int32.\nfunc appendInt32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(int32(v.Int())))\n\t}\n\treturn b, nil\n}\n\n// consumeInt32SliceValue wire decodes a []int32 value as a repeated Int32.\nfunc consumeInt32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderInt32SliceValue = valueCoderFuncs{\n\tsize:      sizeInt32SliceValue,\n\tmarshal:   appendInt32SliceValue,\n\tunmarshal: consumeInt32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeInt32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Int32.\nfunc sizeInt32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(int32(v.Int())))\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendInt32PackedSliceValue encodes a []int32 value as a packed repeated Int32.\nfunc appendInt32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(int32(v.Int())))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, uint64(int32(v.Int())))\n\t}\n\treturn b, nil\n}\n\nvar coderInt32PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeInt32PackedSliceValue,\n\tmarshal:   appendInt32PackedSliceValue,\n\tunmarshal: consumeInt32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSint32 returns the size of wire encoding a int32 pointer as a Sint32.\nfunc sizeSint32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int32()\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))\n}\n\n// appendSint32 wire encodes a int32 pointer as a Sint32.\nfunc appendSint32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int32()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))\n\treturn b, nil\n}\n\n// consumeSint32 wire decodes a int32 pointer as a Sint32.\nfunc consumeSint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Int32() = int32(protowire.DecodeZigZag(v & math.MaxUint32))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSint32 = pointerCoderFuncs{\n\tsize:      sizeSint32,\n\tmarshal:   appendSint32,\n\tunmarshal: consumeSint32,\n\tmerge:     mergeInt32,\n}\n\n// sizeSint32NoZero returns the size of wire encoding a int32 pointer as a Sint32.\n// The zero value is not encoded.\nfunc sizeSint32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int32()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))\n}\n\n// appendSint32NoZero wire encodes a int32 pointer as a Sint32.\n// The zero value is not encoded.\nfunc appendSint32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int32()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))\n\treturn b, nil\n}\n\nvar coderSint32NoZero = pointerCoderFuncs{\n\tsize:      sizeSint32NoZero,\n\tmarshal:   appendSint32NoZero,\n\tunmarshal: consumeSint32,\n\tmerge:     mergeInt32NoZero,\n}\n\n// sizeSint32Ptr returns the size of wire encoding a *int32 pointer as a Sint32.\n// It panics if the pointer is nil.\nfunc sizeSint32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.Int32Ptr()\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))\n}\n\n// appendSint32Ptr wire encodes a *int32 pointer as a Sint32.\n// It panics if the pointer is nil.\nfunc appendSint32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Int32Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))\n\treturn b, nil\n}\n\n// consumeSint32Ptr wire decodes a *int32 pointer as a Sint32.\nfunc consumeSint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Int32Ptr()\n\tif *vp == nil {\n\t\t*vp = new(int32)\n\t}\n\t**vp = int32(protowire.DecodeZigZag(v & math.MaxUint32))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSint32Ptr = pointerCoderFuncs{\n\tsize:      sizeSint32Ptr,\n\tmarshal:   appendSint32Ptr,\n\tunmarshal: consumeSint32Ptr,\n\tmerge:     mergeInt32Ptr,\n}\n\n// sizeSint32Slice returns the size of wire encoding a []int32 pointer as a repeated Sint32.\nfunc sizeSint32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int32Slice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))\n\t}\n\treturn size\n}\n\n// appendSint32Slice encodes a []int32 pointer as a repeated Sint32.\nfunc appendSint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int32Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))\n\t}\n\treturn b, nil\n}\n\n// consumeSint32Slice wire decodes a []int32 pointer as a repeated Sint32.\nfunc consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Int32Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, int32(protowire.DecodeZigZag(v&math.MaxUint32)))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, int32(protowire.DecodeZigZag(v&math.MaxUint32)))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSint32Slice = pointerCoderFuncs{\n\tsize:      sizeSint32Slice,\n\tmarshal:   appendSint32Slice,\n\tunmarshal: consumeSint32Slice,\n\tmerge:     mergeInt32Slice,\n}\n\n// sizeSint32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sint32.\nfunc sizeSint32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int32Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendSint32PackedSlice encodes a []int32 pointer as a packed repeated Sint32.\nfunc appendSint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int32Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))\n\t}\n\treturn b, nil\n}\n\nvar coderSint32PackedSlice = pointerCoderFuncs{\n\tsize:      sizeSint32PackedSlice,\n\tmarshal:   appendSint32PackedSlice,\n\tunmarshal: consumeSint32Slice,\n\tmerge:     mergeInt32Slice,\n}\n\n// sizeSint32Value returns the size of wire encoding a int32 value as a Sint32.\nfunc sizeSint32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))\n}\n\n// appendSint32Value encodes a int32 value as a Sint32.\nfunc appendSint32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))\n\treturn b, nil\n}\n\n// consumeSint32Value decodes a int32 value as a Sint32.\nfunc consumeSint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), out, nil\n}\n\nvar coderSint32Value = valueCoderFuncs{\n\tsize:      sizeSint32Value,\n\tmarshal:   appendSint32Value,\n\tunmarshal: consumeSint32Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeSint32SliceValue returns the size of wire encoding a []int32 value as a repeated Sint32.\nfunc sizeSint32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))\n\t}\n\treturn size\n}\n\n// appendSint32SliceValue encodes a []int32 value as a repeated Sint32.\nfunc appendSint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))\n\t}\n\treturn b, nil\n}\n\n// consumeSint32SliceValue wire decodes a []int32 value as a repeated Sint32.\nfunc consumeSint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderSint32SliceValue = valueCoderFuncs{\n\tsize:      sizeSint32SliceValue,\n\tmarshal:   appendSint32SliceValue,\n\tunmarshal: consumeSint32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSint32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Sint32.\nfunc sizeSint32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendSint32PackedSliceValue encodes a []int32 value as a packed repeated Sint32.\nfunc appendSint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))\n\t}\n\treturn b, nil\n}\n\nvar coderSint32PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeSint32PackedSliceValue,\n\tmarshal:   appendSint32PackedSliceValue,\n\tunmarshal: consumeSint32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeUint32 returns the size of wire encoding a uint32 pointer as a Uint32.\nfunc sizeUint32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Uint32()\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendUint32 wire encodes a uint32 pointer as a Uint32.\nfunc appendUint32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint32()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeUint32 wire decodes a uint32 pointer as a Uint32.\nfunc consumeUint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Uint32() = uint32(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderUint32 = pointerCoderFuncs{\n\tsize:      sizeUint32,\n\tmarshal:   appendUint32,\n\tunmarshal: consumeUint32,\n\tmerge:     mergeUint32,\n}\n\n// sizeUint32NoZero returns the size of wire encoding a uint32 pointer as a Uint32.\n// The zero value is not encoded.\nfunc sizeUint32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Uint32()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendUint32NoZero wire encodes a uint32 pointer as a Uint32.\n// The zero value is not encoded.\nfunc appendUint32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint32()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\nvar coderUint32NoZero = pointerCoderFuncs{\n\tsize:      sizeUint32NoZero,\n\tmarshal:   appendUint32NoZero,\n\tunmarshal: consumeUint32,\n\tmerge:     mergeUint32NoZero,\n}\n\n// sizeUint32Ptr returns the size of wire encoding a *uint32 pointer as a Uint32.\n// It panics if the pointer is nil.\nfunc sizeUint32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.Uint32Ptr()\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendUint32Ptr wire encodes a *uint32 pointer as a Uint32.\n// It panics if the pointer is nil.\nfunc appendUint32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Uint32Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeUint32Ptr wire decodes a *uint32 pointer as a Uint32.\nfunc consumeUint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Uint32Ptr()\n\tif *vp == nil {\n\t\t*vp = new(uint32)\n\t}\n\t**vp = uint32(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderUint32Ptr = pointerCoderFuncs{\n\tsize:      sizeUint32Ptr,\n\tmarshal:   appendUint32Ptr,\n\tunmarshal: consumeUint32Ptr,\n\tmerge:     mergeUint32Ptr,\n}\n\n// sizeUint32Slice returns the size of wire encoding a []uint32 pointer as a repeated Uint32.\nfunc sizeUint32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint32Slice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeVarint(uint64(v))\n\t}\n\treturn size\n}\n\n// appendUint32Slice encodes a []uint32 pointer as a repeated Uint32.\nfunc appendUint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint32Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\n// consumeUint32Slice wire decodes a []uint32 pointer as a repeated Uint32.\nfunc consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Uint32Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, uint32(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, uint32(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderUint32Slice = pointerCoderFuncs{\n\tsize:      sizeUint32Slice,\n\tmarshal:   appendUint32Slice,\n\tunmarshal: consumeUint32Slice,\n\tmerge:     mergeUint32Slice,\n}\n\n// sizeUint32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Uint32.\nfunc sizeUint32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint32Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(uint64(v))\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendUint32PackedSlice encodes a []uint32 pointer as a packed repeated Uint32.\nfunc appendUint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint32Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(uint64(v))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\nvar coderUint32PackedSlice = pointerCoderFuncs{\n\tsize:      sizeUint32PackedSlice,\n\tmarshal:   appendUint32PackedSlice,\n\tunmarshal: consumeUint32Slice,\n\tmerge:     mergeUint32Slice,\n}\n\n// sizeUint32Value returns the size of wire encoding a uint32 value as a Uint32.\nfunc sizeUint32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(uint64(uint32(v.Uint())))\n}\n\n// appendUint32Value encodes a uint32 value as a Uint32.\nfunc appendUint32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, uint64(uint32(v.Uint())))\n\treturn b, nil\n}\n\n// consumeUint32Value decodes a uint32 value as a Uint32.\nfunc consumeUint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfUint32(uint32(v)), out, nil\n}\n\nvar coderUint32Value = valueCoderFuncs{\n\tsize:      sizeUint32Value,\n\tmarshal:   appendUint32Value,\n\tunmarshal: consumeUint32Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeUint32SliceValue returns the size of wire encoding a []uint32 value as a repeated Uint32.\nfunc sizeUint32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(uint64(uint32(v.Uint())))\n\t}\n\treturn size\n}\n\n// appendUint32SliceValue encodes a []uint32 value as a repeated Uint32.\nfunc appendUint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(uint32(v.Uint())))\n\t}\n\treturn b, nil\n}\n\n// consumeUint32SliceValue wire decodes a []uint32 value as a repeated Uint32.\nfunc consumeUint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderUint32SliceValue = valueCoderFuncs{\n\tsize:      sizeUint32SliceValue,\n\tmarshal:   appendUint32SliceValue,\n\tunmarshal: consumeUint32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeUint32PackedSliceValue returns the size of wire encoding a []uint32 value as a packed repeated Uint32.\nfunc sizeUint32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(uint32(v.Uint())))\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendUint32PackedSliceValue encodes a []uint32 value as a packed repeated Uint32.\nfunc appendUint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(uint32(v.Uint())))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, uint64(uint32(v.Uint())))\n\t}\n\treturn b, nil\n}\n\nvar coderUint32PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeUint32PackedSliceValue,\n\tmarshal:   appendUint32PackedSliceValue,\n\tunmarshal: consumeUint32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeInt64 returns the size of wire encoding a int64 pointer as a Int64.\nfunc sizeInt64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int64()\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendInt64 wire encodes a int64 pointer as a Int64.\nfunc appendInt64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int64()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeInt64 wire decodes a int64 pointer as a Int64.\nfunc consumeInt64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Int64() = int64(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderInt64 = pointerCoderFuncs{\n\tsize:      sizeInt64,\n\tmarshal:   appendInt64,\n\tunmarshal: consumeInt64,\n\tmerge:     mergeInt64,\n}\n\n// sizeInt64NoZero returns the size of wire encoding a int64 pointer as a Int64.\n// The zero value is not encoded.\nfunc sizeInt64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int64()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendInt64NoZero wire encodes a int64 pointer as a Int64.\n// The zero value is not encoded.\nfunc appendInt64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int64()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\nvar coderInt64NoZero = pointerCoderFuncs{\n\tsize:      sizeInt64NoZero,\n\tmarshal:   appendInt64NoZero,\n\tunmarshal: consumeInt64,\n\tmerge:     mergeInt64NoZero,\n}\n\n// sizeInt64Ptr returns the size of wire encoding a *int64 pointer as a Int64.\n// It panics if the pointer is nil.\nfunc sizeInt64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.Int64Ptr()\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\n// appendInt64Ptr wire encodes a *int64 pointer as a Int64.\n// It panics if the pointer is nil.\nfunc appendInt64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Int64Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeInt64Ptr wire decodes a *int64 pointer as a Int64.\nfunc consumeInt64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Int64Ptr()\n\tif *vp == nil {\n\t\t*vp = new(int64)\n\t}\n\t**vp = int64(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderInt64Ptr = pointerCoderFuncs{\n\tsize:      sizeInt64Ptr,\n\tmarshal:   appendInt64Ptr,\n\tunmarshal: consumeInt64Ptr,\n\tmerge:     mergeInt64Ptr,\n}\n\n// sizeInt64Slice returns the size of wire encoding a []int64 pointer as a repeated Int64.\nfunc sizeInt64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int64Slice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeVarint(uint64(v))\n\t}\n\treturn size\n}\n\n// appendInt64Slice encodes a []int64 pointer as a repeated Int64.\nfunc appendInt64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int64Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\n// consumeInt64Slice wire decodes a []int64 pointer as a repeated Int64.\nfunc consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Int64Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, int64(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, int64(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderInt64Slice = pointerCoderFuncs{\n\tsize:      sizeInt64Slice,\n\tmarshal:   appendInt64Slice,\n\tunmarshal: consumeInt64Slice,\n\tmerge:     mergeInt64Slice,\n}\n\n// sizeInt64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Int64.\nfunc sizeInt64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int64Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(uint64(v))\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendInt64PackedSlice encodes a []int64 pointer as a packed repeated Int64.\nfunc appendInt64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int64Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(uint64(v))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\nvar coderInt64PackedSlice = pointerCoderFuncs{\n\tsize:      sizeInt64PackedSlice,\n\tmarshal:   appendInt64PackedSlice,\n\tunmarshal: consumeInt64Slice,\n\tmerge:     mergeInt64Slice,\n}\n\n// sizeInt64Value returns the size of wire encoding a int64 value as a Int64.\nfunc sizeInt64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(uint64(v.Int()))\n}\n\n// appendInt64Value encodes a int64 value as a Int64.\nfunc appendInt64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, uint64(v.Int()))\n\treturn b, nil\n}\n\n// consumeInt64Value decodes a int64 value as a Int64.\nfunc consumeInt64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfInt64(int64(v)), out, nil\n}\n\nvar coderInt64Value = valueCoderFuncs{\n\tsize:      sizeInt64Value,\n\tmarshal:   appendInt64Value,\n\tunmarshal: consumeInt64Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeInt64SliceValue returns the size of wire encoding a []int64 value as a repeated Int64.\nfunc sizeInt64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(uint64(v.Int()))\n\t}\n\treturn size\n}\n\n// appendInt64SliceValue encodes a []int64 value as a repeated Int64.\nfunc appendInt64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(v.Int()))\n\t}\n\treturn b, nil\n}\n\n// consumeInt64SliceValue wire decodes a []int64 value as a repeated Int64.\nfunc consumeInt64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderInt64SliceValue = valueCoderFuncs{\n\tsize:      sizeInt64SliceValue,\n\tmarshal:   appendInt64SliceValue,\n\tunmarshal: consumeInt64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeInt64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Int64.\nfunc sizeInt64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(v.Int()))\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendInt64PackedSliceValue encodes a []int64 value as a packed repeated Int64.\nfunc appendInt64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(uint64(v.Int()))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, uint64(v.Int()))\n\t}\n\treturn b, nil\n}\n\nvar coderInt64PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeInt64PackedSliceValue,\n\tmarshal:   appendInt64PackedSliceValue,\n\tunmarshal: consumeInt64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSint64 returns the size of wire encoding a int64 pointer as a Sint64.\nfunc sizeSint64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int64()\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))\n}\n\n// appendSint64 wire encodes a int64 pointer as a Sint64.\nfunc appendSint64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int64()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v))\n\treturn b, nil\n}\n\n// consumeSint64 wire decodes a int64 pointer as a Sint64.\nfunc consumeSint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Int64() = protowire.DecodeZigZag(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSint64 = pointerCoderFuncs{\n\tsize:      sizeSint64,\n\tmarshal:   appendSint64,\n\tunmarshal: consumeSint64,\n\tmerge:     mergeInt64,\n}\n\n// sizeSint64NoZero returns the size of wire encoding a int64 pointer as a Sint64.\n// The zero value is not encoded.\nfunc sizeSint64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int64()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))\n}\n\n// appendSint64NoZero wire encodes a int64 pointer as a Sint64.\n// The zero value is not encoded.\nfunc appendSint64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int64()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v))\n\treturn b, nil\n}\n\nvar coderSint64NoZero = pointerCoderFuncs{\n\tsize:      sizeSint64NoZero,\n\tmarshal:   appendSint64NoZero,\n\tunmarshal: consumeSint64,\n\tmerge:     mergeInt64NoZero,\n}\n\n// sizeSint64Ptr returns the size of wire encoding a *int64 pointer as a Sint64.\n// It panics if the pointer is nil.\nfunc sizeSint64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.Int64Ptr()\n\treturn f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))\n}\n\n// appendSint64Ptr wire encodes a *int64 pointer as a Sint64.\n// It panics if the pointer is nil.\nfunc appendSint64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Int64Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v))\n\treturn b, nil\n}\n\n// consumeSint64Ptr wire decodes a *int64 pointer as a Sint64.\nfunc consumeSint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Int64Ptr()\n\tif *vp == nil {\n\t\t*vp = new(int64)\n\t}\n\t**vp = protowire.DecodeZigZag(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSint64Ptr = pointerCoderFuncs{\n\tsize:      sizeSint64Ptr,\n\tmarshal:   appendSint64Ptr,\n\tunmarshal: consumeSint64Ptr,\n\tmerge:     mergeInt64Ptr,\n}\n\n// sizeSint64Slice returns the size of wire encoding a []int64 pointer as a repeated Sint64.\nfunc sizeSint64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int64Slice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))\n\t}\n\treturn size\n}\n\n// appendSint64Slice encodes a []int64 pointer as a repeated Sint64.\nfunc appendSint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int64Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v))\n\t}\n\treturn b, nil\n}\n\n// consumeSint64Slice wire decodes a []int64 pointer as a repeated Sint64.\nfunc consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Int64Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, protowire.DecodeZigZag(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, protowire.DecodeZigZag(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSint64Slice = pointerCoderFuncs{\n\tsize:      sizeSint64Slice,\n\tmarshal:   appendSint64Slice,\n\tunmarshal: consumeSint64Slice,\n\tmerge:     mergeInt64Slice,\n}\n\n// sizeSint64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sint64.\nfunc sizeSint64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int64Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(v))\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendSint64PackedSlice encodes a []int64 pointer as a packed repeated Sint64.\nfunc appendSint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int64Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(v))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v))\n\t}\n\treturn b, nil\n}\n\nvar coderSint64PackedSlice = pointerCoderFuncs{\n\tsize:      sizeSint64PackedSlice,\n\tmarshal:   appendSint64PackedSlice,\n\tunmarshal: consumeSint64Slice,\n\tmerge:     mergeInt64Slice,\n}\n\n// sizeSint64Value returns the size of wire encoding a int64 value as a Sint64.\nfunc sizeSint64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))\n}\n\n// appendSint64Value encodes a int64 value as a Sint64.\nfunc appendSint64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))\n\treturn b, nil\n}\n\n// consumeSint64Value decodes a int64 value as a Sint64.\nfunc consumeSint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), out, nil\n}\n\nvar coderSint64Value = valueCoderFuncs{\n\tsize:      sizeSint64Value,\n\tmarshal:   appendSint64Value,\n\tunmarshal: consumeSint64Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeSint64SliceValue returns the size of wire encoding a []int64 value as a repeated Sint64.\nfunc sizeSint64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))\n\t}\n\treturn size\n}\n\n// appendSint64SliceValue encodes a []int64 value as a repeated Sint64.\nfunc appendSint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))\n\t}\n\treturn b, nil\n}\n\n// consumeSint64SliceValue wire decodes a []int64 value as a repeated Sint64.\nfunc consumeSint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderSint64SliceValue = valueCoderFuncs{\n\tsize:      sizeSint64SliceValue,\n\tmarshal:   appendSint64SliceValue,\n\tunmarshal: consumeSint64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSint64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Sint64.\nfunc sizeSint64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendSint64PackedSliceValue encodes a []int64 value as a packed repeated Sint64.\nfunc appendSint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))\n\t}\n\treturn b, nil\n}\n\nvar coderSint64PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeSint64PackedSliceValue,\n\tmarshal:   appendSint64PackedSliceValue,\n\tunmarshal: consumeSint64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeUint64 returns the size of wire encoding a uint64 pointer as a Uint64.\nfunc sizeUint64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Uint64()\n\treturn f.tagsize + protowire.SizeVarint(v)\n}\n\n// appendUint64 wire encodes a uint64 pointer as a Uint64.\nfunc appendUint64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint64()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, v)\n\treturn b, nil\n}\n\n// consumeUint64 wire decodes a uint64 pointer as a Uint64.\nfunc consumeUint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Uint64() = v\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderUint64 = pointerCoderFuncs{\n\tsize:      sizeUint64,\n\tmarshal:   appendUint64,\n\tunmarshal: consumeUint64,\n\tmerge:     mergeUint64,\n}\n\n// sizeUint64NoZero returns the size of wire encoding a uint64 pointer as a Uint64.\n// The zero value is not encoded.\nfunc sizeUint64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Uint64()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeVarint(v)\n}\n\n// appendUint64NoZero wire encodes a uint64 pointer as a Uint64.\n// The zero value is not encoded.\nfunc appendUint64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint64()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, v)\n\treturn b, nil\n}\n\nvar coderUint64NoZero = pointerCoderFuncs{\n\tsize:      sizeUint64NoZero,\n\tmarshal:   appendUint64NoZero,\n\tunmarshal: consumeUint64,\n\tmerge:     mergeUint64NoZero,\n}\n\n// sizeUint64Ptr returns the size of wire encoding a *uint64 pointer as a Uint64.\n// It panics if the pointer is nil.\nfunc sizeUint64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.Uint64Ptr()\n\treturn f.tagsize + protowire.SizeVarint(v)\n}\n\n// appendUint64Ptr wire encodes a *uint64 pointer as a Uint64.\n// It panics if the pointer is nil.\nfunc appendUint64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Uint64Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, v)\n\treturn b, nil\n}\n\n// consumeUint64Ptr wire decodes a *uint64 pointer as a Uint64.\nfunc consumeUint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Uint64Ptr()\n\tif *vp == nil {\n\t\t*vp = new(uint64)\n\t}\n\t**vp = v\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderUint64Ptr = pointerCoderFuncs{\n\tsize:      sizeUint64Ptr,\n\tmarshal:   appendUint64Ptr,\n\tunmarshal: consumeUint64Ptr,\n\tmerge:     mergeUint64Ptr,\n}\n\n// sizeUint64Slice returns the size of wire encoding a []uint64 pointer as a repeated Uint64.\nfunc sizeUint64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint64Slice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeVarint(v)\n\t}\n\treturn size\n}\n\n// appendUint64Slice encodes a []uint64 pointer as a repeated Uint64.\nfunc appendUint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint64Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, v)\n\t}\n\treturn b, nil\n}\n\n// consumeUint64Slice wire decodes a []uint64 pointer as a repeated Uint64.\nfunc consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Uint64Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, v)\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderUint64Slice = pointerCoderFuncs{\n\tsize:      sizeUint64Slice,\n\tmarshal:   appendUint64Slice,\n\tunmarshal: consumeUint64Slice,\n\tmerge:     mergeUint64Slice,\n}\n\n// sizeUint64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Uint64.\nfunc sizeUint64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint64Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(v)\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendUint64PackedSlice encodes a []uint64 pointer as a packed repeated Uint64.\nfunc appendUint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint64Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor _, v := range s {\n\t\tn += protowire.SizeVarint(v)\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, v)\n\t}\n\treturn b, nil\n}\n\nvar coderUint64PackedSlice = pointerCoderFuncs{\n\tsize:      sizeUint64PackedSlice,\n\tmarshal:   appendUint64PackedSlice,\n\tunmarshal: consumeUint64Slice,\n\tmerge:     mergeUint64Slice,\n}\n\n// sizeUint64Value returns the size of wire encoding a uint64 value as a Uint64.\nfunc sizeUint64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeVarint(v.Uint())\n}\n\n// appendUint64Value encodes a uint64 value as a Uint64.\nfunc appendUint64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendVarint(b, v.Uint())\n\treturn b, nil\n}\n\n// consumeUint64Value decodes a uint64 value as a Uint64.\nfunc consumeUint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfUint64(v), out, nil\n}\n\nvar coderUint64Value = valueCoderFuncs{\n\tsize:      sizeUint64Value,\n\tmarshal:   appendUint64Value,\n\tunmarshal: consumeUint64Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeUint64SliceValue returns the size of wire encoding a []uint64 value as a repeated Uint64.\nfunc sizeUint64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeVarint(v.Uint())\n\t}\n\treturn size\n}\n\n// appendUint64SliceValue encodes a []uint64 value as a repeated Uint64.\nfunc appendUint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendVarint(b, v.Uint())\n\t}\n\treturn b, nil\n}\n\n// consumeUint64SliceValue wire decodes a []uint64 value as a repeated Uint64.\nfunc consumeUint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tvar v uint64\n\t\t\tvar n int\n\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\tv = uint64(b[0])\n\t\t\t\tn = 1\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tn = 2\n\t\t\t} else {\n\t\t\t\tv, n = protowire.ConsumeVarint(b)\n\t\t\t}\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfUint64(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tvar v uint64\n\tvar n int\n\tif len(b) >= 1 && b[0] < 0x80 {\n\t\tv = uint64(b[0])\n\t\tn = 1\n\t} else if len(b) >= 2 && b[1] < 128 {\n\t\tv = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\tn = 2\n\t} else {\n\t\tv, n = protowire.ConsumeVarint(b)\n\t}\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfUint64(v))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderUint64SliceValue = valueCoderFuncs{\n\tsize:      sizeUint64SliceValue,\n\tmarshal:   appendUint64SliceValue,\n\tunmarshal: consumeUint64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeUint64PackedSliceValue returns the size of wire encoding a []uint64 value as a packed repeated Uint64.\nfunc sizeUint64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i, llen := 0, llen; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(v.Uint())\n\t}\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendUint64PackedSliceValue encodes a []uint64 value as a packed repeated Uint64.\nfunc appendUint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tn += protowire.SizeVarint(v.Uint())\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, v.Uint())\n\t}\n\treturn b, nil\n}\n\nvar coderUint64PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeUint64PackedSliceValue,\n\tmarshal:   appendUint64PackedSliceValue,\n\tunmarshal: consumeUint64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSfixed32 returns the size of wire encoding a int32 pointer as a Sfixed32.\nfunc sizeSfixed32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendSfixed32 wire encodes a int32 pointer as a Sfixed32.\nfunc appendSfixed32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int32()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, uint32(v))\n\treturn b, nil\n}\n\n// consumeSfixed32 wire decodes a int32 pointer as a Sfixed32.\nfunc consumeSfixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Int32() = int32(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSfixed32 = pointerCoderFuncs{\n\tsize:      sizeSfixed32,\n\tmarshal:   appendSfixed32,\n\tunmarshal: consumeSfixed32,\n\tmerge:     mergeInt32,\n}\n\n// sizeSfixed32NoZero returns the size of wire encoding a int32 pointer as a Sfixed32.\n// The zero value is not encoded.\nfunc sizeSfixed32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int32()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendSfixed32NoZero wire encodes a int32 pointer as a Sfixed32.\n// The zero value is not encoded.\nfunc appendSfixed32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int32()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, uint32(v))\n\treturn b, nil\n}\n\nvar coderSfixed32NoZero = pointerCoderFuncs{\n\tsize:      sizeSfixed32NoZero,\n\tmarshal:   appendSfixed32NoZero,\n\tunmarshal: consumeSfixed32,\n\tmerge:     mergeInt32NoZero,\n}\n\n// sizeSfixed32Ptr returns the size of wire encoding a *int32 pointer as a Sfixed32.\n// It panics if the pointer is nil.\nfunc sizeSfixed32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendSfixed32Ptr wire encodes a *int32 pointer as a Sfixed32.\n// It panics if the pointer is nil.\nfunc appendSfixed32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Int32Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, uint32(v))\n\treturn b, nil\n}\n\n// consumeSfixed32Ptr wire decodes a *int32 pointer as a Sfixed32.\nfunc consumeSfixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Int32Ptr()\n\tif *vp == nil {\n\t\t*vp = new(int32)\n\t}\n\t**vp = int32(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSfixed32Ptr = pointerCoderFuncs{\n\tsize:      sizeSfixed32Ptr,\n\tmarshal:   appendSfixed32Ptr,\n\tunmarshal: consumeSfixed32Ptr,\n\tmerge:     mergeInt32Ptr,\n}\n\n// sizeSfixed32Slice returns the size of wire encoding a []int32 pointer as a repeated Sfixed32.\nfunc sizeSfixed32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int32Slice()\n\tsize = len(s) * (f.tagsize + protowire.SizeFixed32())\n\treturn size\n}\n\n// appendSfixed32Slice encodes a []int32 pointer as a repeated Sfixed32.\nfunc appendSfixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int32Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendFixed32(b, uint32(v))\n\t}\n\treturn b, nil\n}\n\n// consumeSfixed32Slice wire decodes a []int32 pointer as a repeated Sfixed32.\nfunc consumeSfixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Int32Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed32(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, int32(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, int32(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSfixed32Slice = pointerCoderFuncs{\n\tsize:      sizeSfixed32Slice,\n\tmarshal:   appendSfixed32Slice,\n\tunmarshal: consumeSfixed32Slice,\n\tmerge:     mergeInt32Slice,\n}\n\n// sizeSfixed32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sfixed32.\nfunc sizeSfixed32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int32Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := len(s) * protowire.SizeFixed32()\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendSfixed32PackedSlice encodes a []int32 pointer as a packed repeated Sfixed32.\nfunc appendSfixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int32Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := len(s) * protowire.SizeFixed32()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendFixed32(b, uint32(v))\n\t}\n\treturn b, nil\n}\n\nvar coderSfixed32PackedSlice = pointerCoderFuncs{\n\tsize:      sizeSfixed32PackedSlice,\n\tmarshal:   appendSfixed32PackedSlice,\n\tunmarshal: consumeSfixed32Slice,\n\tmerge:     mergeInt32Slice,\n}\n\n// sizeSfixed32Value returns the size of wire encoding a int32 value as a Sfixed32.\nfunc sizeSfixed32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeFixed32()\n}\n\n// appendSfixed32Value encodes a int32 value as a Sfixed32.\nfunc appendSfixed32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendFixed32(b, uint32(v.Int()))\n\treturn b, nil\n}\n\n// consumeSfixed32Value decodes a int32 value as a Sfixed32.\nfunc consumeSfixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfInt32(int32(v)), out, nil\n}\n\nvar coderSfixed32Value = valueCoderFuncs{\n\tsize:      sizeSfixed32Value,\n\tmarshal:   appendSfixed32Value,\n\tunmarshal: consumeSfixed32Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeSfixed32SliceValue returns the size of wire encoding a []int32 value as a repeated Sfixed32.\nfunc sizeSfixed32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tsize = list.Len() * (tagsize + protowire.SizeFixed32())\n\treturn size\n}\n\n// appendSfixed32SliceValue encodes a []int32 value as a repeated Sfixed32.\nfunc appendSfixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendFixed32(b, uint32(v.Int()))\n\t}\n\treturn b, nil\n}\n\n// consumeSfixed32SliceValue wire decodes a []int32 value as a repeated Sfixed32.\nfunc consumeSfixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed32(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderSfixed32SliceValue = valueCoderFuncs{\n\tsize:      sizeSfixed32SliceValue,\n\tmarshal:   appendSfixed32SliceValue,\n\tunmarshal: consumeSfixed32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSfixed32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Sfixed32.\nfunc sizeSfixed32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := llen * protowire.SizeFixed32()\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendSfixed32PackedSliceValue encodes a []int32 value as a packed repeated Sfixed32.\nfunc appendSfixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := llen * protowire.SizeFixed32()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendFixed32(b, uint32(v.Int()))\n\t}\n\treturn b, nil\n}\n\nvar coderSfixed32PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeSfixed32PackedSliceValue,\n\tmarshal:   appendSfixed32PackedSliceValue,\n\tunmarshal: consumeSfixed32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeFixed32 returns the size of wire encoding a uint32 pointer as a Fixed32.\nfunc sizeFixed32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendFixed32 wire encodes a uint32 pointer as a Fixed32.\nfunc appendFixed32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint32()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, v)\n\treturn b, nil\n}\n\n// consumeFixed32 wire decodes a uint32 pointer as a Fixed32.\nfunc consumeFixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Uint32() = v\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFixed32 = pointerCoderFuncs{\n\tsize:      sizeFixed32,\n\tmarshal:   appendFixed32,\n\tunmarshal: consumeFixed32,\n\tmerge:     mergeUint32,\n}\n\n// sizeFixed32NoZero returns the size of wire encoding a uint32 pointer as a Fixed32.\n// The zero value is not encoded.\nfunc sizeFixed32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Uint32()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendFixed32NoZero wire encodes a uint32 pointer as a Fixed32.\n// The zero value is not encoded.\nfunc appendFixed32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint32()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, v)\n\treturn b, nil\n}\n\nvar coderFixed32NoZero = pointerCoderFuncs{\n\tsize:      sizeFixed32NoZero,\n\tmarshal:   appendFixed32NoZero,\n\tunmarshal: consumeFixed32,\n\tmerge:     mergeUint32NoZero,\n}\n\n// sizeFixed32Ptr returns the size of wire encoding a *uint32 pointer as a Fixed32.\n// It panics if the pointer is nil.\nfunc sizeFixed32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendFixed32Ptr wire encodes a *uint32 pointer as a Fixed32.\n// It panics if the pointer is nil.\nfunc appendFixed32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Uint32Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, v)\n\treturn b, nil\n}\n\n// consumeFixed32Ptr wire decodes a *uint32 pointer as a Fixed32.\nfunc consumeFixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Uint32Ptr()\n\tif *vp == nil {\n\t\t*vp = new(uint32)\n\t}\n\t**vp = v\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFixed32Ptr = pointerCoderFuncs{\n\tsize:      sizeFixed32Ptr,\n\tmarshal:   appendFixed32Ptr,\n\tunmarshal: consumeFixed32Ptr,\n\tmerge:     mergeUint32Ptr,\n}\n\n// sizeFixed32Slice returns the size of wire encoding a []uint32 pointer as a repeated Fixed32.\nfunc sizeFixed32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint32Slice()\n\tsize = len(s) * (f.tagsize + protowire.SizeFixed32())\n\treturn size\n}\n\n// appendFixed32Slice encodes a []uint32 pointer as a repeated Fixed32.\nfunc appendFixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint32Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendFixed32(b, v)\n\t}\n\treturn b, nil\n}\n\n// consumeFixed32Slice wire decodes a []uint32 pointer as a repeated Fixed32.\nfunc consumeFixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Uint32Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed32(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, v)\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFixed32Slice = pointerCoderFuncs{\n\tsize:      sizeFixed32Slice,\n\tmarshal:   appendFixed32Slice,\n\tunmarshal: consumeFixed32Slice,\n\tmerge:     mergeUint32Slice,\n}\n\n// sizeFixed32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Fixed32.\nfunc sizeFixed32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint32Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := len(s) * protowire.SizeFixed32()\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendFixed32PackedSlice encodes a []uint32 pointer as a packed repeated Fixed32.\nfunc appendFixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint32Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := len(s) * protowire.SizeFixed32()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendFixed32(b, v)\n\t}\n\treturn b, nil\n}\n\nvar coderFixed32PackedSlice = pointerCoderFuncs{\n\tsize:      sizeFixed32PackedSlice,\n\tmarshal:   appendFixed32PackedSlice,\n\tunmarshal: consumeFixed32Slice,\n\tmerge:     mergeUint32Slice,\n}\n\n// sizeFixed32Value returns the size of wire encoding a uint32 value as a Fixed32.\nfunc sizeFixed32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeFixed32()\n}\n\n// appendFixed32Value encodes a uint32 value as a Fixed32.\nfunc appendFixed32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendFixed32(b, uint32(v.Uint()))\n\treturn b, nil\n}\n\n// consumeFixed32Value decodes a uint32 value as a Fixed32.\nfunc consumeFixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfUint32(uint32(v)), out, nil\n}\n\nvar coderFixed32Value = valueCoderFuncs{\n\tsize:      sizeFixed32Value,\n\tmarshal:   appendFixed32Value,\n\tunmarshal: consumeFixed32Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeFixed32SliceValue returns the size of wire encoding a []uint32 value as a repeated Fixed32.\nfunc sizeFixed32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tsize = list.Len() * (tagsize + protowire.SizeFixed32())\n\treturn size\n}\n\n// appendFixed32SliceValue encodes a []uint32 value as a repeated Fixed32.\nfunc appendFixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendFixed32(b, uint32(v.Uint()))\n\t}\n\treturn b, nil\n}\n\n// consumeFixed32SliceValue wire decodes a []uint32 value as a repeated Fixed32.\nfunc consumeFixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed32(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderFixed32SliceValue = valueCoderFuncs{\n\tsize:      sizeFixed32SliceValue,\n\tmarshal:   appendFixed32SliceValue,\n\tunmarshal: consumeFixed32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeFixed32PackedSliceValue returns the size of wire encoding a []uint32 value as a packed repeated Fixed32.\nfunc sizeFixed32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := llen * protowire.SizeFixed32()\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendFixed32PackedSliceValue encodes a []uint32 value as a packed repeated Fixed32.\nfunc appendFixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := llen * protowire.SizeFixed32()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendFixed32(b, uint32(v.Uint()))\n\t}\n\treturn b, nil\n}\n\nvar coderFixed32PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeFixed32PackedSliceValue,\n\tmarshal:   appendFixed32PackedSliceValue,\n\tunmarshal: consumeFixed32SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeFloat returns the size of wire encoding a float32 pointer as a Float.\nfunc sizeFloat(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendFloat wire encodes a float32 pointer as a Float.\nfunc appendFloat(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Float32()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, math.Float32bits(v))\n\treturn b, nil\n}\n\n// consumeFloat wire decodes a float32 pointer as a Float.\nfunc consumeFloat(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Float32() = math.Float32frombits(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFloat = pointerCoderFuncs{\n\tsize:      sizeFloat,\n\tmarshal:   appendFloat,\n\tunmarshal: consumeFloat,\n\tmerge:     mergeFloat32,\n}\n\n// sizeFloatNoZero returns the size of wire encoding a float32 pointer as a Float.\n// The zero value is not encoded.\nfunc sizeFloatNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Float32()\n\tif v == 0 && !math.Signbit(float64(v)) {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendFloatNoZero wire encodes a float32 pointer as a Float.\n// The zero value is not encoded.\nfunc appendFloatNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Float32()\n\tif v == 0 && !math.Signbit(float64(v)) {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, math.Float32bits(v))\n\treturn b, nil\n}\n\nvar coderFloatNoZero = pointerCoderFuncs{\n\tsize:      sizeFloatNoZero,\n\tmarshal:   appendFloatNoZero,\n\tunmarshal: consumeFloat,\n\tmerge:     mergeFloat32NoZero,\n}\n\n// sizeFloatPtr returns the size of wire encoding a *float32 pointer as a Float.\n// It panics if the pointer is nil.\nfunc sizeFloatPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\treturn f.tagsize + protowire.SizeFixed32()\n}\n\n// appendFloatPtr wire encodes a *float32 pointer as a Float.\n// It panics if the pointer is nil.\nfunc appendFloatPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Float32Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed32(b, math.Float32bits(v))\n\treturn b, nil\n}\n\n// consumeFloatPtr wire decodes a *float32 pointer as a Float.\nfunc consumeFloatPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Float32Ptr()\n\tif *vp == nil {\n\t\t*vp = new(float32)\n\t}\n\t**vp = math.Float32frombits(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFloatPtr = pointerCoderFuncs{\n\tsize:      sizeFloatPtr,\n\tmarshal:   appendFloatPtr,\n\tunmarshal: consumeFloatPtr,\n\tmerge:     mergeFloat32Ptr,\n}\n\n// sizeFloatSlice returns the size of wire encoding a []float32 pointer as a repeated Float.\nfunc sizeFloatSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Float32Slice()\n\tsize = len(s) * (f.tagsize + protowire.SizeFixed32())\n\treturn size\n}\n\n// appendFloatSlice encodes a []float32 pointer as a repeated Float.\nfunc appendFloatSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Float32Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendFixed32(b, math.Float32bits(v))\n\t}\n\treturn b, nil\n}\n\n// consumeFloatSlice wire decodes a []float32 pointer as a repeated Float.\nfunc consumeFloatSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Float32Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed32(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, math.Float32frombits(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, math.Float32frombits(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFloatSlice = pointerCoderFuncs{\n\tsize:      sizeFloatSlice,\n\tmarshal:   appendFloatSlice,\n\tunmarshal: consumeFloatSlice,\n\tmerge:     mergeFloat32Slice,\n}\n\n// sizeFloatPackedSlice returns the size of wire encoding a []float32 pointer as a packed repeated Float.\nfunc sizeFloatPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Float32Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := len(s) * protowire.SizeFixed32()\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendFloatPackedSlice encodes a []float32 pointer as a packed repeated Float.\nfunc appendFloatPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Float32Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := len(s) * protowire.SizeFixed32()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendFixed32(b, math.Float32bits(v))\n\t}\n\treturn b, nil\n}\n\nvar coderFloatPackedSlice = pointerCoderFuncs{\n\tsize:      sizeFloatPackedSlice,\n\tmarshal:   appendFloatPackedSlice,\n\tunmarshal: consumeFloatSlice,\n\tmerge:     mergeFloat32Slice,\n}\n\n// sizeFloatValue returns the size of wire encoding a float32 value as a Float.\nfunc sizeFloatValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeFixed32()\n}\n\n// appendFloatValue encodes a float32 value as a Float.\nfunc appendFloatValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))\n\treturn b, nil\n}\n\n// consumeFloatValue decodes a float32 value as a Float.\nfunc consumeFloatValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), out, nil\n}\n\nvar coderFloatValue = valueCoderFuncs{\n\tsize:      sizeFloatValue,\n\tmarshal:   appendFloatValue,\n\tunmarshal: consumeFloatValue,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeFloatSliceValue returns the size of wire encoding a []float32 value as a repeated Float.\nfunc sizeFloatSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tsize = list.Len() * (tagsize + protowire.SizeFixed32())\n\treturn size\n}\n\n// appendFloatSliceValue encodes a []float32 value as a repeated Float.\nfunc appendFloatSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))\n\t}\n\treturn b, nil\n}\n\n// consumeFloatSliceValue wire decodes a []float32 value as a repeated Float.\nfunc consumeFloatSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed32(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.Fixed32Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed32(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderFloatSliceValue = valueCoderFuncs{\n\tsize:      sizeFloatSliceValue,\n\tmarshal:   appendFloatSliceValue,\n\tunmarshal: consumeFloatSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeFloatPackedSliceValue returns the size of wire encoding a []float32 value as a packed repeated Float.\nfunc sizeFloatPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := llen * protowire.SizeFixed32()\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendFloatPackedSliceValue encodes a []float32 value as a packed repeated Float.\nfunc appendFloatPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := llen * protowire.SizeFixed32()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))\n\t}\n\treturn b, nil\n}\n\nvar coderFloatPackedSliceValue = valueCoderFuncs{\n\tsize:      sizeFloatPackedSliceValue,\n\tmarshal:   appendFloatPackedSliceValue,\n\tunmarshal: consumeFloatSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSfixed64 returns the size of wire encoding a int64 pointer as a Sfixed64.\nfunc sizeSfixed64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendSfixed64 wire encodes a int64 pointer as a Sfixed64.\nfunc appendSfixed64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int64()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeSfixed64 wire decodes a int64 pointer as a Sfixed64.\nfunc consumeSfixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Int64() = int64(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSfixed64 = pointerCoderFuncs{\n\tsize:      sizeSfixed64,\n\tmarshal:   appendSfixed64,\n\tunmarshal: consumeSfixed64,\n\tmerge:     mergeInt64,\n}\n\n// sizeSfixed64NoZero returns the size of wire encoding a int64 pointer as a Sfixed64.\n// The zero value is not encoded.\nfunc sizeSfixed64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Int64()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendSfixed64NoZero wire encodes a int64 pointer as a Sfixed64.\n// The zero value is not encoded.\nfunc appendSfixed64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Int64()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, uint64(v))\n\treturn b, nil\n}\n\nvar coderSfixed64NoZero = pointerCoderFuncs{\n\tsize:      sizeSfixed64NoZero,\n\tmarshal:   appendSfixed64NoZero,\n\tunmarshal: consumeSfixed64,\n\tmerge:     mergeInt64NoZero,\n}\n\n// sizeSfixed64Ptr returns the size of wire encoding a *int64 pointer as a Sfixed64.\n// It panics if the pointer is nil.\nfunc sizeSfixed64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendSfixed64Ptr wire encodes a *int64 pointer as a Sfixed64.\n// It panics if the pointer is nil.\nfunc appendSfixed64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Int64Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, uint64(v))\n\treturn b, nil\n}\n\n// consumeSfixed64Ptr wire decodes a *int64 pointer as a Sfixed64.\nfunc consumeSfixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Int64Ptr()\n\tif *vp == nil {\n\t\t*vp = new(int64)\n\t}\n\t**vp = int64(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSfixed64Ptr = pointerCoderFuncs{\n\tsize:      sizeSfixed64Ptr,\n\tmarshal:   appendSfixed64Ptr,\n\tunmarshal: consumeSfixed64Ptr,\n\tmerge:     mergeInt64Ptr,\n}\n\n// sizeSfixed64Slice returns the size of wire encoding a []int64 pointer as a repeated Sfixed64.\nfunc sizeSfixed64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int64Slice()\n\tsize = len(s) * (f.tagsize + protowire.SizeFixed64())\n\treturn size\n}\n\n// appendSfixed64Slice encodes a []int64 pointer as a repeated Sfixed64.\nfunc appendSfixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int64Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendFixed64(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\n// consumeSfixed64Slice wire decodes a []int64 pointer as a repeated Sfixed64.\nfunc consumeSfixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Int64Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed64(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, int64(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, int64(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderSfixed64Slice = pointerCoderFuncs{\n\tsize:      sizeSfixed64Slice,\n\tmarshal:   appendSfixed64Slice,\n\tunmarshal: consumeSfixed64Slice,\n\tmerge:     mergeInt64Slice,\n}\n\n// sizeSfixed64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sfixed64.\nfunc sizeSfixed64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Int64Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := len(s) * protowire.SizeFixed64()\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendSfixed64PackedSlice encodes a []int64 pointer as a packed repeated Sfixed64.\nfunc appendSfixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Int64Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := len(s) * protowire.SizeFixed64()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendFixed64(b, uint64(v))\n\t}\n\treturn b, nil\n}\n\nvar coderSfixed64PackedSlice = pointerCoderFuncs{\n\tsize:      sizeSfixed64PackedSlice,\n\tmarshal:   appendSfixed64PackedSlice,\n\tunmarshal: consumeSfixed64Slice,\n\tmerge:     mergeInt64Slice,\n}\n\n// sizeSfixed64Value returns the size of wire encoding a int64 value as a Sfixed64.\nfunc sizeSfixed64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeFixed64()\n}\n\n// appendSfixed64Value encodes a int64 value as a Sfixed64.\nfunc appendSfixed64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendFixed64(b, uint64(v.Int()))\n\treturn b, nil\n}\n\n// consumeSfixed64Value decodes a int64 value as a Sfixed64.\nfunc consumeSfixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfInt64(int64(v)), out, nil\n}\n\nvar coderSfixed64Value = valueCoderFuncs{\n\tsize:      sizeSfixed64Value,\n\tmarshal:   appendSfixed64Value,\n\tunmarshal: consumeSfixed64Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeSfixed64SliceValue returns the size of wire encoding a []int64 value as a repeated Sfixed64.\nfunc sizeSfixed64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tsize = list.Len() * (tagsize + protowire.SizeFixed64())\n\treturn size\n}\n\n// appendSfixed64SliceValue encodes a []int64 value as a repeated Sfixed64.\nfunc appendSfixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendFixed64(b, uint64(v.Int()))\n\t}\n\treturn b, nil\n}\n\n// consumeSfixed64SliceValue wire decodes a []int64 value as a repeated Sfixed64.\nfunc consumeSfixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed64(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderSfixed64SliceValue = valueCoderFuncs{\n\tsize:      sizeSfixed64SliceValue,\n\tmarshal:   appendSfixed64SliceValue,\n\tunmarshal: consumeSfixed64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeSfixed64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Sfixed64.\nfunc sizeSfixed64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := llen * protowire.SizeFixed64()\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendSfixed64PackedSliceValue encodes a []int64 value as a packed repeated Sfixed64.\nfunc appendSfixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := llen * protowire.SizeFixed64()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendFixed64(b, uint64(v.Int()))\n\t}\n\treturn b, nil\n}\n\nvar coderSfixed64PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeSfixed64PackedSliceValue,\n\tmarshal:   appendSfixed64PackedSliceValue,\n\tunmarshal: consumeSfixed64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeFixed64 returns the size of wire encoding a uint64 pointer as a Fixed64.\nfunc sizeFixed64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendFixed64 wire encodes a uint64 pointer as a Fixed64.\nfunc appendFixed64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint64()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, v)\n\treturn b, nil\n}\n\n// consumeFixed64 wire decodes a uint64 pointer as a Fixed64.\nfunc consumeFixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Uint64() = v\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFixed64 = pointerCoderFuncs{\n\tsize:      sizeFixed64,\n\tmarshal:   appendFixed64,\n\tunmarshal: consumeFixed64,\n\tmerge:     mergeUint64,\n}\n\n// sizeFixed64NoZero returns the size of wire encoding a uint64 pointer as a Fixed64.\n// The zero value is not encoded.\nfunc sizeFixed64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Uint64()\n\tif v == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendFixed64NoZero wire encodes a uint64 pointer as a Fixed64.\n// The zero value is not encoded.\nfunc appendFixed64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Uint64()\n\tif v == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, v)\n\treturn b, nil\n}\n\nvar coderFixed64NoZero = pointerCoderFuncs{\n\tsize:      sizeFixed64NoZero,\n\tmarshal:   appendFixed64NoZero,\n\tunmarshal: consumeFixed64,\n\tmerge:     mergeUint64NoZero,\n}\n\n// sizeFixed64Ptr returns the size of wire encoding a *uint64 pointer as a Fixed64.\n// It panics if the pointer is nil.\nfunc sizeFixed64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendFixed64Ptr wire encodes a *uint64 pointer as a Fixed64.\n// It panics if the pointer is nil.\nfunc appendFixed64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Uint64Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, v)\n\treturn b, nil\n}\n\n// consumeFixed64Ptr wire decodes a *uint64 pointer as a Fixed64.\nfunc consumeFixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Uint64Ptr()\n\tif *vp == nil {\n\t\t*vp = new(uint64)\n\t}\n\t**vp = v\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFixed64Ptr = pointerCoderFuncs{\n\tsize:      sizeFixed64Ptr,\n\tmarshal:   appendFixed64Ptr,\n\tunmarshal: consumeFixed64Ptr,\n\tmerge:     mergeUint64Ptr,\n}\n\n// sizeFixed64Slice returns the size of wire encoding a []uint64 pointer as a repeated Fixed64.\nfunc sizeFixed64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint64Slice()\n\tsize = len(s) * (f.tagsize + protowire.SizeFixed64())\n\treturn size\n}\n\n// appendFixed64Slice encodes a []uint64 pointer as a repeated Fixed64.\nfunc appendFixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint64Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendFixed64(b, v)\n\t}\n\treturn b, nil\n}\n\n// consumeFixed64Slice wire decodes a []uint64 pointer as a repeated Fixed64.\nfunc consumeFixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Uint64Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed64(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, v)\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderFixed64Slice = pointerCoderFuncs{\n\tsize:      sizeFixed64Slice,\n\tmarshal:   appendFixed64Slice,\n\tunmarshal: consumeFixed64Slice,\n\tmerge:     mergeUint64Slice,\n}\n\n// sizeFixed64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Fixed64.\nfunc sizeFixed64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Uint64Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := len(s) * protowire.SizeFixed64()\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendFixed64PackedSlice encodes a []uint64 pointer as a packed repeated Fixed64.\nfunc appendFixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Uint64Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := len(s) * protowire.SizeFixed64()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendFixed64(b, v)\n\t}\n\treturn b, nil\n}\n\nvar coderFixed64PackedSlice = pointerCoderFuncs{\n\tsize:      sizeFixed64PackedSlice,\n\tmarshal:   appendFixed64PackedSlice,\n\tunmarshal: consumeFixed64Slice,\n\tmerge:     mergeUint64Slice,\n}\n\n// sizeFixed64Value returns the size of wire encoding a uint64 value as a Fixed64.\nfunc sizeFixed64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeFixed64()\n}\n\n// appendFixed64Value encodes a uint64 value as a Fixed64.\nfunc appendFixed64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendFixed64(b, v.Uint())\n\treturn b, nil\n}\n\n// consumeFixed64Value decodes a uint64 value as a Fixed64.\nfunc consumeFixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfUint64(v), out, nil\n}\n\nvar coderFixed64Value = valueCoderFuncs{\n\tsize:      sizeFixed64Value,\n\tmarshal:   appendFixed64Value,\n\tunmarshal: consumeFixed64Value,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeFixed64SliceValue returns the size of wire encoding a []uint64 value as a repeated Fixed64.\nfunc sizeFixed64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tsize = list.Len() * (tagsize + protowire.SizeFixed64())\n\treturn size\n}\n\n// appendFixed64SliceValue encodes a []uint64 value as a repeated Fixed64.\nfunc appendFixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendFixed64(b, v.Uint())\n\t}\n\treturn b, nil\n}\n\n// consumeFixed64SliceValue wire decodes a []uint64 value as a repeated Fixed64.\nfunc consumeFixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed64(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfUint64(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfUint64(v))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderFixed64SliceValue = valueCoderFuncs{\n\tsize:      sizeFixed64SliceValue,\n\tmarshal:   appendFixed64SliceValue,\n\tunmarshal: consumeFixed64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeFixed64PackedSliceValue returns the size of wire encoding a []uint64 value as a packed repeated Fixed64.\nfunc sizeFixed64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := llen * protowire.SizeFixed64()\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendFixed64PackedSliceValue encodes a []uint64 value as a packed repeated Fixed64.\nfunc appendFixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := llen * protowire.SizeFixed64()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendFixed64(b, v.Uint())\n\t}\n\treturn b, nil\n}\n\nvar coderFixed64PackedSliceValue = valueCoderFuncs{\n\tsize:      sizeFixed64PackedSliceValue,\n\tmarshal:   appendFixed64PackedSliceValue,\n\tunmarshal: consumeFixed64SliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeDouble returns the size of wire encoding a float64 pointer as a Double.\nfunc sizeDouble(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendDouble wire encodes a float64 pointer as a Double.\nfunc appendDouble(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Float64()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, math.Float64bits(v))\n\treturn b, nil\n}\n\n// consumeDouble wire decodes a float64 pointer as a Double.\nfunc consumeDouble(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Float64() = math.Float64frombits(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderDouble = pointerCoderFuncs{\n\tsize:      sizeDouble,\n\tmarshal:   appendDouble,\n\tunmarshal: consumeDouble,\n\tmerge:     mergeFloat64,\n}\n\n// sizeDoubleNoZero returns the size of wire encoding a float64 pointer as a Double.\n// The zero value is not encoded.\nfunc sizeDoubleNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Float64()\n\tif v == 0 && !math.Signbit(float64(v)) {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendDoubleNoZero wire encodes a float64 pointer as a Double.\n// The zero value is not encoded.\nfunc appendDoubleNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Float64()\n\tif v == 0 && !math.Signbit(float64(v)) {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, math.Float64bits(v))\n\treturn b, nil\n}\n\nvar coderDoubleNoZero = pointerCoderFuncs{\n\tsize:      sizeDoubleNoZero,\n\tmarshal:   appendDoubleNoZero,\n\tunmarshal: consumeDouble,\n\tmerge:     mergeFloat64NoZero,\n}\n\n// sizeDoublePtr returns the size of wire encoding a *float64 pointer as a Double.\n// It panics if the pointer is nil.\nfunc sizeDoublePtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\treturn f.tagsize + protowire.SizeFixed64()\n}\n\n// appendDoublePtr wire encodes a *float64 pointer as a Double.\n// It panics if the pointer is nil.\nfunc appendDoublePtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.Float64Ptr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendFixed64(b, math.Float64bits(v))\n\treturn b, nil\n}\n\n// consumeDoublePtr wire decodes a *float64 pointer as a Double.\nfunc consumeDoublePtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.Float64Ptr()\n\tif *vp == nil {\n\t\t*vp = new(float64)\n\t}\n\t**vp = math.Float64frombits(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderDoublePtr = pointerCoderFuncs{\n\tsize:      sizeDoublePtr,\n\tmarshal:   appendDoublePtr,\n\tunmarshal: consumeDoublePtr,\n\tmerge:     mergeFloat64Ptr,\n}\n\n// sizeDoubleSlice returns the size of wire encoding a []float64 pointer as a repeated Double.\nfunc sizeDoubleSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Float64Slice()\n\tsize = len(s) * (f.tagsize + protowire.SizeFixed64())\n\treturn size\n}\n\n// appendDoubleSlice encodes a []float64 pointer as a repeated Double.\nfunc appendDoubleSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Float64Slice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendFixed64(b, math.Float64bits(v))\n\t}\n\treturn b, nil\n}\n\n// consumeDoubleSlice wire decodes a []float64 pointer as a repeated Double.\nfunc consumeDoubleSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.Float64Slice()\n\tif wtyp == protowire.BytesType {\n\t\ts := *sp\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed64(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\ts = append(s, math.Float64frombits(v))\n\t\t\tb = b[n:]\n\t\t}\n\t\t*sp = s\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, math.Float64frombits(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderDoubleSlice = pointerCoderFuncs{\n\tsize:      sizeDoubleSlice,\n\tmarshal:   appendDoubleSlice,\n\tunmarshal: consumeDoubleSlice,\n\tmerge:     mergeFloat64Slice,\n}\n\n// sizeDoublePackedSlice returns the size of wire encoding a []float64 pointer as a packed repeated Double.\nfunc sizeDoublePackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.Float64Slice()\n\tif len(s) == 0 {\n\t\treturn 0\n\t}\n\tn := len(s) * protowire.SizeFixed64()\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\n// appendDoublePackedSlice encodes a []float64 pointer as a packed repeated Double.\nfunc appendDoublePackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.Float64Slice()\n\tif len(s) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := len(s) * protowire.SizeFixed64()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor _, v := range s {\n\t\tb = protowire.AppendFixed64(b, math.Float64bits(v))\n\t}\n\treturn b, nil\n}\n\nvar coderDoublePackedSlice = pointerCoderFuncs{\n\tsize:      sizeDoublePackedSlice,\n\tmarshal:   appendDoublePackedSlice,\n\tunmarshal: consumeDoubleSlice,\n\tmerge:     mergeFloat64Slice,\n}\n\n// sizeDoubleValue returns the size of wire encoding a float64 value as a Double.\nfunc sizeDoubleValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeFixed64()\n}\n\n// appendDoubleValue encodes a float64 value as a Double.\nfunc appendDoubleValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendFixed64(b, math.Float64bits(v.Float()))\n\treturn b, nil\n}\n\n// consumeDoubleValue decodes a float64 value as a Double.\nfunc consumeDoubleValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfFloat64(math.Float64frombits(v)), out, nil\n}\n\nvar coderDoubleValue = valueCoderFuncs{\n\tsize:      sizeDoubleValue,\n\tmarshal:   appendDoubleValue,\n\tunmarshal: consumeDoubleValue,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeDoubleSliceValue returns the size of wire encoding a []float64 value as a repeated Double.\nfunc sizeDoubleSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tsize = list.Len() * (tagsize + protowire.SizeFixed64())\n\treturn size\n}\n\n// appendDoubleSliceValue encodes a []float64 value as a repeated Double.\nfunc appendDoubleSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendFixed64(b, math.Float64bits(v.Float()))\n\t}\n\treturn b, nil\n}\n\n// consumeDoubleSliceValue wire decodes a []float64 value as a repeated Double.\nfunc consumeDoubleSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeFixed64(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn protoreflect.Value{}, out, errDecode\n\t\t\t}\n\t\t\tlist.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn listv, out, nil\n\t}\n\tif wtyp != protowire.Fixed64Type {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeFixed64(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderDoubleSliceValue = valueCoderFuncs{\n\tsize:      sizeDoubleSliceValue,\n\tmarshal:   appendDoubleSliceValue,\n\tunmarshal: consumeDoubleSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeDoublePackedSliceValue returns the size of wire encoding a []float64 value as a packed repeated Double.\nfunc sizeDoublePackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := llen * protowire.SizeFixed64()\n\treturn tagsize + protowire.SizeBytes(n)\n}\n\n// appendDoublePackedSliceValue encodes a []float64 value as a packed repeated Double.\nfunc appendDoublePackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tllen := list.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, wiretag)\n\tn := llen * protowire.SizeFixed64()\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendFixed64(b, math.Float64bits(v.Float()))\n\t}\n\treturn b, nil\n}\n\nvar coderDoublePackedSliceValue = valueCoderFuncs{\n\tsize:      sizeDoublePackedSliceValue,\n\tmarshal:   appendDoublePackedSliceValue,\n\tunmarshal: consumeDoubleSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeString returns the size of wire encoding a string pointer as a String.\nfunc sizeString(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.String()\n\treturn f.tagsize + protowire.SizeBytes(len(v))\n}\n\n// appendString wire encodes a string pointer as a String.\nfunc appendString(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.String()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendString(b, v)\n\treturn b, nil\n}\n\n// consumeString wire decodes a string pointer as a String.\nfunc consumeString(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.String() = string(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderString = pointerCoderFuncs{\n\tsize:      sizeString,\n\tmarshal:   appendString,\n\tunmarshal: consumeString,\n\tmerge:     mergeString,\n}\n\n// appendStringValidateUTF8 wire encodes a string pointer as a String.\nfunc appendStringValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.String()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendString(b, v)\n\tif !utf8.ValidString(v) {\n\t\treturn b, errInvalidUTF8{}\n\t}\n\treturn b, nil\n}\n\n// consumeStringValidateUTF8 wire decodes a string pointer as a String.\nfunc consumeStringValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tif !utf8.Valid(v) {\n\t\treturn out, errInvalidUTF8{}\n\t}\n\t*p.String() = string(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderStringValidateUTF8 = pointerCoderFuncs{\n\tsize:      sizeString,\n\tmarshal:   appendStringValidateUTF8,\n\tunmarshal: consumeStringValidateUTF8,\n\tmerge:     mergeString,\n}\n\n// sizeStringNoZero returns the size of wire encoding a string pointer as a String.\n// The zero value is not encoded.\nfunc sizeStringNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.String()\n\tif len(v) == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeBytes(len(v))\n}\n\n// appendStringNoZero wire encodes a string pointer as a String.\n// The zero value is not encoded.\nfunc appendStringNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.String()\n\tif len(v) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendString(b, v)\n\treturn b, nil\n}\n\nvar coderStringNoZero = pointerCoderFuncs{\n\tsize:      sizeStringNoZero,\n\tmarshal:   appendStringNoZero,\n\tunmarshal: consumeString,\n\tmerge:     mergeStringNoZero,\n}\n\n// appendStringNoZeroValidateUTF8 wire encodes a string pointer as a String.\n// The zero value is not encoded.\nfunc appendStringNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.String()\n\tif len(v) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendString(b, v)\n\tif !utf8.ValidString(v) {\n\t\treturn b, errInvalidUTF8{}\n\t}\n\treturn b, nil\n}\n\nvar coderStringNoZeroValidateUTF8 = pointerCoderFuncs{\n\tsize:      sizeStringNoZero,\n\tmarshal:   appendStringNoZeroValidateUTF8,\n\tunmarshal: consumeStringValidateUTF8,\n\tmerge:     mergeStringNoZero,\n}\n\n// sizeStringPtr returns the size of wire encoding a *string pointer as a String.\n// It panics if the pointer is nil.\nfunc sizeStringPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := **p.StringPtr()\n\treturn f.tagsize + protowire.SizeBytes(len(v))\n}\n\n// appendStringPtr wire encodes a *string pointer as a String.\n// It panics if the pointer is nil.\nfunc appendStringPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.StringPtr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendString(b, v)\n\treturn b, nil\n}\n\n// consumeStringPtr wire decodes a *string pointer as a String.\nfunc consumeStringPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvp := p.StringPtr()\n\tif *vp == nil {\n\t\t*vp = new(string)\n\t}\n\t**vp = string(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderStringPtr = pointerCoderFuncs{\n\tsize:      sizeStringPtr,\n\tmarshal:   appendStringPtr,\n\tunmarshal: consumeStringPtr,\n\tmerge:     mergeStringPtr,\n}\n\n// appendStringPtrValidateUTF8 wire encodes a *string pointer as a String.\n// It panics if the pointer is nil.\nfunc appendStringPtrValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := **p.StringPtr()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendString(b, v)\n\tif !utf8.ValidString(v) {\n\t\treturn b, errInvalidUTF8{}\n\t}\n\treturn b, nil\n}\n\n// consumeStringPtrValidateUTF8 wire decodes a *string pointer as a String.\nfunc consumeStringPtrValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tif !utf8.Valid(v) {\n\t\treturn out, errInvalidUTF8{}\n\t}\n\tvp := p.StringPtr()\n\tif *vp == nil {\n\t\t*vp = new(string)\n\t}\n\t**vp = string(v)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderStringPtrValidateUTF8 = pointerCoderFuncs{\n\tsize:      sizeStringPtr,\n\tmarshal:   appendStringPtrValidateUTF8,\n\tunmarshal: consumeStringPtrValidateUTF8,\n\tmerge:     mergeStringPtr,\n}\n\n// sizeStringSlice returns the size of wire encoding a []string pointer as a repeated String.\nfunc sizeStringSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.StringSlice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeBytes(len(v))\n\t}\n\treturn size\n}\n\n// appendStringSlice encodes a []string pointer as a repeated String.\nfunc appendStringSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.StringSlice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendString(b, v)\n\t}\n\treturn b, nil\n}\n\n// consumeStringSlice wire decodes a []string pointer as a repeated String.\nfunc consumeStringSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.StringSlice()\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, string(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderStringSlice = pointerCoderFuncs{\n\tsize:      sizeStringSlice,\n\tmarshal:   appendStringSlice,\n\tunmarshal: consumeStringSlice,\n\tmerge:     mergeStringSlice,\n}\n\n// appendStringSliceValidateUTF8 encodes a []string pointer as a repeated String.\nfunc appendStringSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.StringSlice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendString(b, v)\n\t\tif !utf8.ValidString(v) {\n\t\t\treturn b, errInvalidUTF8{}\n\t\t}\n\t}\n\treturn b, nil\n}\n\n// consumeStringSliceValidateUTF8 wire decodes a []string pointer as a repeated String.\nfunc consumeStringSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tif !utf8.Valid(v) {\n\t\treturn out, errInvalidUTF8{}\n\t}\n\tsp := p.StringSlice()\n\t*sp = append(*sp, string(v))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderStringSliceValidateUTF8 = pointerCoderFuncs{\n\tsize:      sizeStringSlice,\n\tmarshal:   appendStringSliceValidateUTF8,\n\tunmarshal: consumeStringSliceValidateUTF8,\n\tmerge:     mergeStringSlice,\n}\n\n// sizeStringValue returns the size of wire encoding a string value as a String.\nfunc sizeStringValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeBytes(len(v.String()))\n}\n\n// appendStringValue encodes a string value as a String.\nfunc appendStringValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendString(b, v.String())\n\treturn b, nil\n}\n\n// consumeStringValue decodes a string value as a String.\nfunc consumeStringValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfString(string(v)), out, nil\n}\n\nvar coderStringValue = valueCoderFuncs{\n\tsize:      sizeStringValue,\n\tmarshal:   appendStringValue,\n\tunmarshal: consumeStringValue,\n\tmerge:     mergeScalarValue,\n}\n\n// appendStringValueValidateUTF8 encodes a string value as a String.\nfunc appendStringValueValidateUTF8(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendString(b, v.String())\n\tif !utf8.ValidString(v.String()) {\n\t\treturn b, errInvalidUTF8{}\n\t}\n\treturn b, nil\n}\n\n// consumeStringValueValidateUTF8 decodes a string value as a String.\nfunc consumeStringValueValidateUTF8(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tif !utf8.Valid(v) {\n\t\treturn protoreflect.Value{}, out, errInvalidUTF8{}\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfString(string(v)), out, nil\n}\n\nvar coderStringValueValidateUTF8 = valueCoderFuncs{\n\tsize:      sizeStringValue,\n\tmarshal:   appendStringValueValidateUTF8,\n\tunmarshal: consumeStringValueValidateUTF8,\n\tmerge:     mergeScalarValue,\n}\n\n// sizeStringSliceValue returns the size of wire encoding a []string value as a repeated String.\nfunc sizeStringSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeBytes(len(v.String()))\n\t}\n\treturn size\n}\n\n// appendStringSliceValue encodes a []string value as a repeated String.\nfunc appendStringSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendString(b, v.String())\n\t}\n\treturn b, nil\n}\n\n// consumeStringSliceValue wire decodes a []string value as a repeated String.\nfunc consumeStringSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp != protowire.BytesType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfString(string(v)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderStringSliceValue = valueCoderFuncs{\n\tsize:      sizeStringSliceValue,\n\tmarshal:   appendStringSliceValue,\n\tunmarshal: consumeStringSliceValue,\n\tmerge:     mergeListValue,\n}\n\n// sizeBytes returns the size of wire encoding a []byte pointer as a Bytes.\nfunc sizeBytes(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Bytes()\n\treturn f.tagsize + protowire.SizeBytes(len(v))\n}\n\n// appendBytes wire encodes a []byte pointer as a Bytes.\nfunc appendBytes(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Bytes()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendBytes(b, v)\n\treturn b, nil\n}\n\n// consumeBytes wire decodes a []byte pointer as a Bytes.\nfunc consumeBytes(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Bytes() = append(emptyBuf[:], v...)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBytes = pointerCoderFuncs{\n\tsize:      sizeBytes,\n\tmarshal:   appendBytes,\n\tunmarshal: consumeBytes,\n\tmerge:     mergeBytes,\n}\n\n// appendBytesValidateUTF8 wire encodes a []byte pointer as a Bytes.\nfunc appendBytesValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Bytes()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendBytes(b, v)\n\tif !utf8.Valid(v) {\n\t\treturn b, errInvalidUTF8{}\n\t}\n\treturn b, nil\n}\n\n// consumeBytesValidateUTF8 wire decodes a []byte pointer as a Bytes.\nfunc consumeBytesValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tif !utf8.Valid(v) {\n\t\treturn out, errInvalidUTF8{}\n\t}\n\t*p.Bytes() = append(emptyBuf[:], v...)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBytesValidateUTF8 = pointerCoderFuncs{\n\tsize:      sizeBytes,\n\tmarshal:   appendBytesValidateUTF8,\n\tunmarshal: consumeBytesValidateUTF8,\n\tmerge:     mergeBytes,\n}\n\n// sizeBytesNoZero returns the size of wire encoding a []byte pointer as a Bytes.\n// The zero value is not encoded.\nfunc sizeBytesNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tv := *p.Bytes()\n\tif len(v) == 0 {\n\t\treturn 0\n\t}\n\treturn f.tagsize + protowire.SizeBytes(len(v))\n}\n\n// appendBytesNoZero wire encodes a []byte pointer as a Bytes.\n// The zero value is not encoded.\nfunc appendBytesNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Bytes()\n\tif len(v) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendBytes(b, v)\n\treturn b, nil\n}\n\n// consumeBytesNoZero wire decodes a []byte pointer as a Bytes.\n// The zero value is not decoded.\nfunc consumeBytesNoZero(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*p.Bytes() = append(([]byte)(nil), v...)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBytesNoZero = pointerCoderFuncs{\n\tsize:      sizeBytesNoZero,\n\tmarshal:   appendBytesNoZero,\n\tunmarshal: consumeBytesNoZero,\n\tmerge:     mergeBytesNoZero,\n}\n\n// appendBytesNoZeroValidateUTF8 wire encodes a []byte pointer as a Bytes.\n// The zero value is not encoded.\nfunc appendBytesNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := *p.Bytes()\n\tif len(v) == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendBytes(b, v)\n\tif !utf8.Valid(v) {\n\t\treturn b, errInvalidUTF8{}\n\t}\n\treturn b, nil\n}\n\n// consumeBytesNoZeroValidateUTF8 wire decodes a []byte pointer as a Bytes.\nfunc consumeBytesNoZeroValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tif !utf8.Valid(v) {\n\t\treturn out, errInvalidUTF8{}\n\t}\n\t*p.Bytes() = append(([]byte)(nil), v...)\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBytesNoZeroValidateUTF8 = pointerCoderFuncs{\n\tsize:      sizeBytesNoZero,\n\tmarshal:   appendBytesNoZeroValidateUTF8,\n\tunmarshal: consumeBytesNoZeroValidateUTF8,\n\tmerge:     mergeBytesNoZero,\n}\n\n// sizeBytesSlice returns the size of wire encoding a [][]byte pointer as a repeated Bytes.\nfunc sizeBytesSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := *p.BytesSlice()\n\tfor _, v := range s {\n\t\tsize += f.tagsize + protowire.SizeBytes(len(v))\n\t}\n\treturn size\n}\n\n// appendBytesSlice encodes a [][]byte pointer as a repeated Bytes.\nfunc appendBytesSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.BytesSlice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendBytes(b, v)\n\t}\n\treturn b, nil\n}\n\n// consumeBytesSlice wire decodes a [][]byte pointer as a repeated Bytes.\nfunc consumeBytesSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tsp := p.BytesSlice()\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\t*sp = append(*sp, append(emptyBuf[:], v...))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBytesSlice = pointerCoderFuncs{\n\tsize:      sizeBytesSlice,\n\tmarshal:   appendBytesSlice,\n\tunmarshal: consumeBytesSlice,\n\tmerge:     mergeBytesSlice,\n}\n\n// appendBytesSliceValidateUTF8 encodes a [][]byte pointer as a repeated Bytes.\nfunc appendBytesSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := *p.BytesSlice()\n\tfor _, v := range s {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendBytes(b, v)\n\t\tif !utf8.Valid(v) {\n\t\t\treturn b, errInvalidUTF8{}\n\t\t}\n\t}\n\treturn b, nil\n}\n\n// consumeBytesSliceValidateUTF8 wire decodes a [][]byte pointer as a repeated Bytes.\nfunc consumeBytesSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tif !utf8.Valid(v) {\n\t\treturn out, errInvalidUTF8{}\n\t}\n\tsp := p.BytesSlice()\n\t*sp = append(*sp, append(emptyBuf[:], v...))\n\tout.n = n\n\treturn out, nil\n}\n\nvar coderBytesSliceValidateUTF8 = pointerCoderFuncs{\n\tsize:      sizeBytesSlice,\n\tmarshal:   appendBytesSliceValidateUTF8,\n\tunmarshal: consumeBytesSliceValidateUTF8,\n\tmerge:     mergeBytesSlice,\n}\n\n// sizeBytesValue returns the size of wire encoding a []byte value as a Bytes.\nfunc sizeBytesValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {\n\treturn tagsize + protowire.SizeBytes(len(v.Bytes()))\n}\n\n// appendBytesValue encodes a []byte value as a Bytes.\nfunc appendBytesValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tb = protowire.AppendVarint(b, wiretag)\n\tb = protowire.AppendBytes(b, v.Bytes())\n\treturn b, nil\n}\n\n// consumeBytesValue decodes a []byte value as a Bytes.\nfunc consumeBytesValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tout.n = n\n\treturn protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), out, nil\n}\n\nvar coderBytesValue = valueCoderFuncs{\n\tsize:      sizeBytesValue,\n\tmarshal:   appendBytesValue,\n\tunmarshal: consumeBytesValue,\n\tmerge:     mergeBytesValue,\n}\n\n// sizeBytesSliceValue returns the size of wire encoding a [][]byte value as a repeated Bytes.\nfunc sizeBytesSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tsize += tagsize + protowire.SizeBytes(len(v.Bytes()))\n\t}\n\treturn size\n}\n\n// appendBytesSliceValue encodes a [][]byte value as a repeated Bytes.\nfunc appendBytesSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {\n\tlist := listv.List()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tv := list.Get(i)\n\t\tb = protowire.AppendVarint(b, wiretag)\n\t\tb = protowire.AppendBytes(b, v.Bytes())\n\t}\n\treturn b, nil\n}\n\n// consumeBytesSliceValue wire decodes a [][]byte value as a repeated Bytes.\nfunc consumeBytesSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {\n\tlist := listv.List()\n\tif wtyp != protowire.BytesType {\n\t\treturn protoreflect.Value{}, out, errUnknown\n\t}\n\tv, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn protoreflect.Value{}, out, errDecode\n\t}\n\tlist.Append(protoreflect.ValueOfBytes(append(emptyBuf[:], v...)))\n\tout.n = n\n\treturn listv, out, nil\n}\n\nvar coderBytesSliceValue = valueCoderFuncs{\n\tsize:      sizeBytesSliceValue,\n\tmarshal:   appendBytesSliceValue,\n\tunmarshal: consumeBytesSliceValue,\n\tmerge:     mergeBytesListValue,\n}\n\n// We append to an empty array rather than a nil []byte to get non-nil zero-length byte slices.\nvar emptyBuf [0]byte\n\nvar wireTypes = map[protoreflect.Kind]protowire.Type{\n\tprotoreflect.BoolKind:     protowire.VarintType,\n\tprotoreflect.EnumKind:     protowire.VarintType,\n\tprotoreflect.Int32Kind:    protowire.VarintType,\n\tprotoreflect.Sint32Kind:   protowire.VarintType,\n\tprotoreflect.Uint32Kind:   protowire.VarintType,\n\tprotoreflect.Int64Kind:    protowire.VarintType,\n\tprotoreflect.Sint64Kind:   protowire.VarintType,\n\tprotoreflect.Uint64Kind:   protowire.VarintType,\n\tprotoreflect.Sfixed32Kind: protowire.Fixed32Type,\n\tprotoreflect.Fixed32Kind:  protowire.Fixed32Type,\n\tprotoreflect.FloatKind:    protowire.Fixed32Type,\n\tprotoreflect.Sfixed64Kind: protowire.Fixed64Type,\n\tprotoreflect.Fixed64Kind:  protowire.Fixed64Type,\n\tprotoreflect.DoubleKind:   protowire.Fixed64Type,\n\tprotoreflect.StringKind:   protowire.BytesType,\n\tprotoreflect.BytesKind:    protowire.BytesType,\n\tprotoreflect.MessageKind:  protowire.BytesType,\n\tprotoreflect.GroupKind:    protowire.StartGroupType,\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/codec_map.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 impl\n\nimport (\n\t\"reflect\"\n\t\"sort\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype mapInfo struct {\n\tgoType     reflect.Type\n\tkeyWiretag uint64\n\tvalWiretag uint64\n\tkeyFuncs   valueCoderFuncs\n\tvalFuncs   valueCoderFuncs\n\tkeyZero    pref.Value\n\tkeyKind    pref.Kind\n\tconv       *mapConverter\n}\n\nfunc encoderFuncsForMap(fd pref.FieldDescriptor, ft reflect.Type) (valueMessage *MessageInfo, funcs pointerCoderFuncs) {\n\t// TODO: Consider generating specialized map coders.\n\tkeyField := fd.MapKey()\n\tvalField := fd.MapValue()\n\tkeyWiretag := protowire.EncodeTag(1, wireTypes[keyField.Kind()])\n\tvalWiretag := protowire.EncodeTag(2, wireTypes[valField.Kind()])\n\tkeyFuncs := encoderFuncsForValue(keyField)\n\tvalFuncs := encoderFuncsForValue(valField)\n\tconv := newMapConverter(ft, fd)\n\n\tmapi := &mapInfo{\n\t\tgoType:     ft,\n\t\tkeyWiretag: keyWiretag,\n\t\tvalWiretag: valWiretag,\n\t\tkeyFuncs:   keyFuncs,\n\t\tvalFuncs:   valFuncs,\n\t\tkeyZero:    keyField.Default(),\n\t\tkeyKind:    keyField.Kind(),\n\t\tconv:       conv,\n\t}\n\tif valField.Kind() == pref.MessageKind {\n\t\tvalueMessage = getMessageInfo(ft.Elem())\n\t}\n\n\tfuncs = pointerCoderFuncs{\n\t\tsize: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\t\t\treturn sizeMap(p.AsValueOf(ft).Elem(), mapi, f, opts)\n\t\t},\n\t\tmarshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\t\treturn appendMap(b, p.AsValueOf(ft).Elem(), mapi, f, opts)\n\t\t},\n\t\tunmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\tmp := p.AsValueOf(ft)\n\t\t\tif mp.Elem().IsNil() {\n\t\t\t\tmp.Elem().Set(reflect.MakeMap(mapi.goType))\n\t\t\t}\n\t\t\tif f.mi == nil {\n\t\t\t\treturn consumeMap(b, mp.Elem(), wtyp, mapi, f, opts)\n\t\t\t} else {\n\t\t\t\treturn consumeMapOfMessage(b, mp.Elem(), wtyp, mapi, f, opts)\n\t\t\t}\n\t\t},\n\t}\n\tswitch valField.Kind() {\n\tcase pref.MessageKind:\n\t\tfuncs.merge = mergeMapOfMessage\n\tcase pref.BytesKind:\n\t\tfuncs.merge = mergeMapOfBytes\n\tdefault:\n\t\tfuncs.merge = mergeMap\n\t}\n\tif valFuncs.isInit != nil {\n\t\tfuncs.isInit = func(p pointer, f *coderFieldInfo) error {\n\t\t\treturn isInitMap(p.AsValueOf(ft).Elem(), mapi, f)\n\t\t}\n\t}\n\treturn valueMessage, funcs\n}\n\nconst (\n\tmapKeyTagSize = 1 // field 1, tag size 1.\n\tmapValTagSize = 1 // field 2, tag size 2.\n)\n\nfunc sizeMap(mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) int {\n\tif mapv.Len() == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\titer := mapRange(mapv)\n\tfor iter.Next() {\n\t\tkey := mapi.conv.keyConv.PBValueOf(iter.Key()).MapKey()\n\t\tkeySize := mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)\n\t\tvar valSize int\n\t\tvalue := mapi.conv.valConv.PBValueOf(iter.Value())\n\t\tif f.mi == nil {\n\t\t\tvalSize = mapi.valFuncs.size(value, mapValTagSize, opts)\n\t\t} else {\n\t\t\tp := pointerOfValue(iter.Value())\n\t\t\tvalSize += mapValTagSize\n\t\t\tvalSize += protowire.SizeBytes(f.mi.sizePointer(p, opts))\n\t\t}\n\t\tn += f.tagsize + protowire.SizeBytes(keySize+valSize)\n\t}\n\treturn n\n}\n\nfunc consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tb, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvar (\n\t\tkey = mapi.keyZero\n\t\tval = mapi.conv.valConv.New()\n\t)\n\tfor len(b) > 0 {\n\t\tnum, wtyp, n := protowire.ConsumeTag(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tif num > protowire.MaxValidNumber {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tb = b[n:]\n\t\terr := errUnknown\n\t\tswitch num {\n\t\tcase genid.MapEntry_Key_field_number:\n\t\t\tvar v pref.Value\n\t\t\tvar o unmarshalOutput\n\t\t\tv, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tkey = v\n\t\t\tn = o.n\n\t\tcase genid.MapEntry_Value_field_number:\n\t\t\tvar v pref.Value\n\t\t\tvar o unmarshalOutput\n\t\t\tv, o, err = mapi.valFuncs.unmarshal(b, val, num, wtyp, opts)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tval = v\n\t\t\tn = o.n\n\t\t}\n\t\tif err == errUnknown {\n\t\t\tn = protowire.ConsumeFieldValue(num, wtyp, b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\treturn out, err\n\t\t}\n\t\tb = b[n:]\n\t}\n\tmapv.SetMapIndex(mapi.conv.keyConv.GoValueOf(key), mapi.conv.valConv.GoValueOf(val))\n\tout.n = n\n\treturn out, nil\n}\n\nfunc consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn out, errUnknown\n\t}\n\tb, n := protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tvar (\n\t\tkey = mapi.keyZero\n\t\tval = reflect.New(f.mi.GoReflectType.Elem())\n\t)\n\tfor len(b) > 0 {\n\t\tnum, wtyp, n := protowire.ConsumeTag(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tif num > protowire.MaxValidNumber {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tb = b[n:]\n\t\terr := errUnknown\n\t\tswitch num {\n\t\tcase 1:\n\t\t\tvar v pref.Value\n\t\t\tvar o unmarshalOutput\n\t\t\tv, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tkey = v\n\t\t\tn = o.n\n\t\tcase 2:\n\t\t\tif wtyp != protowire.BytesType {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tvar v []byte\n\t\t\tv, n = protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\tvar o unmarshalOutput\n\t\t\to, err = f.mi.unmarshalPointer(v, pointerOfValue(val), 0, opts)\n\t\t\tif o.initialized {\n\t\t\t\t// Consider this map item initialized so long as we see\n\t\t\t\t// an initialized value.\n\t\t\t\tout.initialized = true\n\t\t\t}\n\t\t}\n\t\tif err == errUnknown {\n\t\t\tn = protowire.ConsumeFieldValue(num, wtyp, b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\treturn out, err\n\t\t}\n\t\tb = b[n:]\n\t}\n\tmapv.SetMapIndex(mapi.conv.keyConv.GoValueOf(key), val)\n\tout.n = n\n\treturn out, nil\n}\n\nfunc appendMapItem(b []byte, keyrv, valrv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tif f.mi == nil {\n\t\tkey := mapi.conv.keyConv.PBValueOf(keyrv).MapKey()\n\t\tval := mapi.conv.valConv.PBValueOf(valrv)\n\t\tsize := 0\n\t\tsize += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)\n\t\tsize += mapi.valFuncs.size(val, mapValTagSize, opts)\n\t\tb = protowire.AppendVarint(b, uint64(size))\n\t\tb, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn mapi.valFuncs.marshal(b, val, mapi.valWiretag, opts)\n\t} else {\n\t\tkey := mapi.conv.keyConv.PBValueOf(keyrv).MapKey()\n\t\tval := pointerOfValue(valrv)\n\t\tvalSize := f.mi.sizePointer(val, opts)\n\t\tsize := 0\n\t\tsize += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)\n\t\tsize += mapValTagSize + protowire.SizeBytes(valSize)\n\t\tb = protowire.AppendVarint(b, uint64(size))\n\t\tb, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tb = protowire.AppendVarint(b, mapi.valWiretag)\n\t\tb = protowire.AppendVarint(b, uint64(valSize))\n\t\treturn f.mi.marshalAppendPointer(b, val, opts)\n\t}\n}\n\nfunc appendMap(b []byte, mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tif mapv.Len() == 0 {\n\t\treturn b, nil\n\t}\n\tif opts.Deterministic() {\n\t\treturn appendMapDeterministic(b, mapv, mapi, f, opts)\n\t}\n\titer := mapRange(mapv)\n\tfor iter.Next() {\n\t\tvar err error\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb, err = appendMapItem(b, iter.Key(), iter.Value(), mapi, f, opts)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\treturn b, nil\n}\n\nfunc appendMapDeterministic(b []byte, mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tkeys := mapv.MapKeys()\n\tsort.Slice(keys, func(i, j int) bool {\n\t\tswitch keys[i].Kind() {\n\t\tcase reflect.Bool:\n\t\t\treturn !keys[i].Bool() && keys[j].Bool()\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\t\treturn keys[i].Int() < keys[j].Int()\n\t\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\t\treturn keys[i].Uint() < keys[j].Uint()\n\t\tcase reflect.Float32, reflect.Float64:\n\t\t\treturn keys[i].Float() < keys[j].Float()\n\t\tcase reflect.String:\n\t\t\treturn keys[i].String() < keys[j].String()\n\t\tdefault:\n\t\t\tpanic(\"invalid kind: \" + keys[i].Kind().String())\n\t\t}\n\t})\n\tfor _, key := range keys {\n\t\tvar err error\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb, err = appendMapItem(b, key, mapv.MapIndex(key), mapi, f, opts)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\treturn b, nil\n}\n\nfunc isInitMap(mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo) error {\n\tif mi := f.mi; mi != nil {\n\t\tmi.init()\n\t\tif !mi.needsInitCheck {\n\t\t\treturn nil\n\t\t}\n\t\titer := mapRange(mapv)\n\t\tfor iter.Next() {\n\t\t\tval := pointerOfValue(iter.Value())\n\t\t\tif err := mi.checkInitializedPointer(val); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t} else {\n\t\titer := mapRange(mapv)\n\t\tfor iter.Next() {\n\t\t\tval := mapi.conv.valConv.PBValueOf(iter.Value())\n\t\t\tif err := mapi.valFuncs.isInit(val); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc mergeMap(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {\n\tdstm := dst.AsValueOf(f.ft).Elem()\n\tsrcm := src.AsValueOf(f.ft).Elem()\n\tif srcm.Len() == 0 {\n\t\treturn\n\t}\n\tif dstm.IsNil() {\n\t\tdstm.Set(reflect.MakeMap(f.ft))\n\t}\n\titer := mapRange(srcm)\n\tfor iter.Next() {\n\t\tdstm.SetMapIndex(iter.Key(), iter.Value())\n\t}\n}\n\nfunc mergeMapOfBytes(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {\n\tdstm := dst.AsValueOf(f.ft).Elem()\n\tsrcm := src.AsValueOf(f.ft).Elem()\n\tif srcm.Len() == 0 {\n\t\treturn\n\t}\n\tif dstm.IsNil() {\n\t\tdstm.Set(reflect.MakeMap(f.ft))\n\t}\n\titer := mapRange(srcm)\n\tfor iter.Next() {\n\t\tdstm.SetMapIndex(iter.Key(), reflect.ValueOf(append(emptyBuf[:], iter.Value().Bytes()...)))\n\t}\n}\n\nfunc mergeMapOfMessage(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {\n\tdstm := dst.AsValueOf(f.ft).Elem()\n\tsrcm := src.AsValueOf(f.ft).Elem()\n\tif srcm.Len() == 0 {\n\t\treturn\n\t}\n\tif dstm.IsNil() {\n\t\tdstm.Set(reflect.MakeMap(f.ft))\n\t}\n\titer := mapRange(srcm)\n\tfor iter.Next() {\n\t\tval := reflect.New(f.ft.Elem().Elem())\n\t\tif f.mi != nil {\n\t\t\tf.mi.mergePointer(pointerOfValue(val), pointerOfValue(iter.Value()), opts)\n\t\t} else {\n\t\t\topts.Merge(asMessage(val), asMessage(iter.Value()))\n\t\t}\n\t\tdstm.SetMapIndex(iter.Key(), val)\n\t}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.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// +build !go1.12\n\npackage impl\n\nimport \"reflect\"\n\ntype mapIter struct {\n\tv    reflect.Value\n\tkeys []reflect.Value\n}\n\n// mapRange provides a less-efficient equivalent to\n// the Go 1.12 reflect.Value.MapRange method.\nfunc mapRange(v reflect.Value) *mapIter {\n\treturn &mapIter{v: v}\n}\n\nfunc (i *mapIter) Next() bool {\n\tif i.keys == nil {\n\t\ti.keys = i.v.MapKeys()\n\t} else {\n\t\ti.keys = i.keys[1:]\n\t}\n\treturn len(i.keys) > 0\n}\n\nfunc (i *mapIter) Key() reflect.Value {\n\treturn i.keys[0]\n}\n\nfunc (i *mapIter) Value() reflect.Value {\n\treturn i.v.MapIndex(i.keys[0])\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.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// +build go1.12\n\npackage impl\n\nimport \"reflect\"\n\nfunc mapRange(v reflect.Value) *reflect.MapIter { return v.MapRange() }\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/codec_message.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"sort\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/order\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// coderMessageInfo contains per-message information used by the fast-path functions.\n// This is a different type from MessageInfo to keep MessageInfo as general-purpose as\n// possible.\ntype coderMessageInfo struct {\n\tmethods piface.Methods\n\n\torderedCoderFields []*coderFieldInfo\n\tdenseCoderFields   []*coderFieldInfo\n\tcoderFields        map[protowire.Number]*coderFieldInfo\n\tsizecacheOffset    offset\n\tunknownOffset      offset\n\tunknownPtrKind     bool\n\textensionOffset    offset\n\tneedsInitCheck     bool\n\tisMessageSet       bool\n\tnumRequiredFields  uint8\n}\n\ntype coderFieldInfo struct {\n\tfuncs      pointerCoderFuncs // fast-path per-field functions\n\tmi         *MessageInfo      // field's message\n\tft         reflect.Type\n\tvalidation validationInfo   // information used by message validation\n\tnum        pref.FieldNumber // field number\n\toffset     offset           // struct field offset\n\twiretag    uint64           // field tag (number + wire type)\n\ttagsize    int              // size of the varint-encoded tag\n\tisPointer  bool             // true if IsNil may be called on the struct field\n\tisRequired bool             // true if field is required\n}\n\nfunc (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {\n\tmi.sizecacheOffset = invalidOffset\n\tmi.unknownOffset = invalidOffset\n\tmi.extensionOffset = invalidOffset\n\n\tif si.sizecacheOffset.IsValid() && si.sizecacheType == sizecacheType {\n\t\tmi.sizecacheOffset = si.sizecacheOffset\n\t}\n\tif si.unknownOffset.IsValid() && (si.unknownType == unknownFieldsAType || si.unknownType == unknownFieldsBType) {\n\t\tmi.unknownOffset = si.unknownOffset\n\t\tmi.unknownPtrKind = si.unknownType.Kind() == reflect.Ptr\n\t}\n\tif si.extensionOffset.IsValid() && si.extensionType == extensionFieldsType {\n\t\tmi.extensionOffset = si.extensionOffset\n\t}\n\n\tmi.coderFields = make(map[protowire.Number]*coderFieldInfo)\n\tfields := mi.Desc.Fields()\n\tpreallocFields := make([]coderFieldInfo, fields.Len())\n\tfor i := 0; i < fields.Len(); i++ {\n\t\tfd := fields.Get(i)\n\n\t\tfs := si.fieldsByNumber[fd.Number()]\n\t\tisOneof := fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic()\n\t\tif isOneof {\n\t\t\tfs = si.oneofsByName[fd.ContainingOneof().Name()]\n\t\t}\n\t\tft := fs.Type\n\t\tvar wiretag uint64\n\t\tif !fd.IsPacked() {\n\t\t\twiretag = protowire.EncodeTag(fd.Number(), wireTypes[fd.Kind()])\n\t\t} else {\n\t\t\twiretag = protowire.EncodeTag(fd.Number(), protowire.BytesType)\n\t\t}\n\t\tvar fieldOffset offset\n\t\tvar funcs pointerCoderFuncs\n\t\tvar childMessage *MessageInfo\n\t\tswitch {\n\t\tcase ft == nil:\n\t\t\t// This never occurs for generated message types.\n\t\t\t// It implies that a hand-crafted type has missing Go fields\n\t\t\t// for specific protobuf message fields.\n\t\t\tfuncs = pointerCoderFuncs{\n\t\t\t\tsize: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {\n\t\t\t\t\treturn 0\n\t\t\t\t},\n\t\t\t\tmarshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\t\t\t\t\treturn nil, nil\n\t\t\t\t},\n\t\t\t\tunmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {\n\t\t\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t\t\t},\n\t\t\t\tisInit: func(p pointer, f *coderFieldInfo) error {\n\t\t\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t\t\t},\n\t\t\t\tmerge: func(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {\n\t\t\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t\t\t},\n\t\t\t}\n\t\tcase isOneof:\n\t\t\tfieldOffset = offsetOf(fs, mi.Exporter)\n\t\tcase fd.IsWeak():\n\t\t\tfieldOffset = si.weakOffset\n\t\t\tfuncs = makeWeakMessageFieldCoder(fd)\n\t\tdefault:\n\t\t\tfieldOffset = offsetOf(fs, mi.Exporter)\n\t\t\tchildMessage, funcs = fieldCoder(fd, ft)\n\t\t}\n\t\tcf := &preallocFields[i]\n\t\t*cf = coderFieldInfo{\n\t\t\tnum:        fd.Number(),\n\t\t\toffset:     fieldOffset,\n\t\t\twiretag:    wiretag,\n\t\t\tft:         ft,\n\t\t\ttagsize:    protowire.SizeVarint(wiretag),\n\t\t\tfuncs:      funcs,\n\t\t\tmi:         childMessage,\n\t\t\tvalidation: newFieldValidationInfo(mi, si, fd, ft),\n\t\t\tisPointer:  fd.Cardinality() == pref.Repeated || fd.HasPresence(),\n\t\t\tisRequired: fd.Cardinality() == pref.Required,\n\t\t}\n\t\tmi.orderedCoderFields = append(mi.orderedCoderFields, cf)\n\t\tmi.coderFields[cf.num] = cf\n\t}\n\tfor i, oneofs := 0, mi.Desc.Oneofs(); i < oneofs.Len(); i++ {\n\t\tif od := oneofs.Get(i); !od.IsSynthetic() {\n\t\t\tmi.initOneofFieldCoders(od, si)\n\t\t}\n\t}\n\tif messageset.IsMessageSet(mi.Desc) {\n\t\tif !mi.extensionOffset.IsValid() {\n\t\t\tpanic(fmt.Sprintf(\"%v: MessageSet with no extensions field\", mi.Desc.FullName()))\n\t\t}\n\t\tif !mi.unknownOffset.IsValid() {\n\t\t\tpanic(fmt.Sprintf(\"%v: MessageSet with no unknown field\", mi.Desc.FullName()))\n\t\t}\n\t\tmi.isMessageSet = true\n\t}\n\tsort.Slice(mi.orderedCoderFields, func(i, j int) bool {\n\t\treturn mi.orderedCoderFields[i].num < mi.orderedCoderFields[j].num\n\t})\n\n\tvar maxDense pref.FieldNumber\n\tfor _, cf := range mi.orderedCoderFields {\n\t\tif cf.num >= 16 && cf.num >= 2*maxDense {\n\t\t\tbreak\n\t\t}\n\t\tmaxDense = cf.num\n\t}\n\tmi.denseCoderFields = make([]*coderFieldInfo, maxDense+1)\n\tfor _, cf := range mi.orderedCoderFields {\n\t\tif int(cf.num) >= len(mi.denseCoderFields) {\n\t\t\tbreak\n\t\t}\n\t\tmi.denseCoderFields[cf.num] = cf\n\t}\n\n\t// To preserve compatibility with historic wire output, marshal oneofs last.\n\tif mi.Desc.Oneofs().Len() > 0 {\n\t\tsort.Slice(mi.orderedCoderFields, func(i, j int) bool {\n\t\t\tfi := fields.ByNumber(mi.orderedCoderFields[i].num)\n\t\t\tfj := fields.ByNumber(mi.orderedCoderFields[j].num)\n\t\t\treturn order.LegacyFieldOrder(fi, fj)\n\t\t})\n\t}\n\n\tmi.needsInitCheck = needsInitCheck(mi.Desc)\n\tif mi.methods.Marshal == nil && mi.methods.Size == nil {\n\t\tmi.methods.Flags |= piface.SupportMarshalDeterministic\n\t\tmi.methods.Marshal = mi.marshal\n\t\tmi.methods.Size = mi.size\n\t}\n\tif mi.methods.Unmarshal == nil {\n\t\tmi.methods.Flags |= piface.SupportUnmarshalDiscardUnknown\n\t\tmi.methods.Unmarshal = mi.unmarshal\n\t}\n\tif mi.methods.CheckInitialized == nil {\n\t\tmi.methods.CheckInitialized = mi.checkInitialized\n\t}\n\tif mi.methods.Merge == nil {\n\t\tmi.methods.Merge = mi.merge\n\t}\n}\n\n// getUnknownBytes returns a *[]byte for the unknown fields.\n// It is the caller's responsibility to check whether the pointer is nil.\n// This function is specially designed to be inlineable.\nfunc (mi *MessageInfo) getUnknownBytes(p pointer) *[]byte {\n\tif mi.unknownPtrKind {\n\t\treturn *p.Apply(mi.unknownOffset).BytesPtr()\n\t} else {\n\t\treturn p.Apply(mi.unknownOffset).Bytes()\n\t}\n}\n\n// mutableUnknownBytes returns a *[]byte for the unknown fields.\n// The returned pointer is guaranteed to not be nil.\nfunc (mi *MessageInfo) mutableUnknownBytes(p pointer) *[]byte {\n\tif mi.unknownPtrKind {\n\t\tbp := p.Apply(mi.unknownOffset).BytesPtr()\n\t\tif *bp == nil {\n\t\t\t*bp = new([]byte)\n\t\t}\n\t\treturn *bp\n\t} else {\n\t\treturn p.Apply(mi.unknownOffset).Bytes()\n\t}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/codec_messageset.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 impl\n\nimport (\n\t\"sort\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n)\n\nfunc sizeMessageSet(mi *MessageInfo, p pointer, opts marshalOptions) (size int) {\n\tif !flags.ProtoLegacy {\n\t\treturn 0\n\t}\n\n\text := *p.Apply(mi.extensionOffset).Extensions()\n\tfor _, x := range ext {\n\t\txi := getExtensionFieldInfo(x.Type())\n\t\tif xi.funcs.size == nil {\n\t\t\tcontinue\n\t\t}\n\t\tnum, _ := protowire.DecodeTag(xi.wiretag)\n\t\tsize += messageset.SizeField(num)\n\t\tsize += xi.funcs.size(x.Value(), protowire.SizeTag(messageset.FieldMessage), opts)\n\t}\n\n\tif u := mi.getUnknownBytes(p); u != nil {\n\t\tsize += messageset.SizeUnknown(*u)\n\t}\n\n\treturn size\n}\n\nfunc marshalMessageSet(mi *MessageInfo, b []byte, p pointer, opts marshalOptions) ([]byte, error) {\n\tif !flags.ProtoLegacy {\n\t\treturn b, errors.New(\"no support for message_set_wire_format\")\n\t}\n\n\text := *p.Apply(mi.extensionOffset).Extensions()\n\tswitch len(ext) {\n\tcase 0:\n\tcase 1:\n\t\t// Fast-path for one extension: Don't bother sorting the keys.\n\t\tfor _, x := range ext {\n\t\t\tvar err error\n\t\t\tb, err = marshalMessageSetField(mi, b, x, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn b, err\n\t\t\t}\n\t\t}\n\tdefault:\n\t\t// Sort the keys to provide a deterministic encoding.\n\t\t// Not sure this is required, but the old code does it.\n\t\tkeys := make([]int, 0, len(ext))\n\t\tfor k := range ext {\n\t\t\tkeys = append(keys, int(k))\n\t\t}\n\t\tsort.Ints(keys)\n\t\tfor _, k := range keys {\n\t\t\tvar err error\n\t\t\tb, err = marshalMessageSetField(mi, b, ext[int32(k)], opts)\n\t\t\tif err != nil {\n\t\t\t\treturn b, err\n\t\t\t}\n\t\t}\n\t}\n\n\tif u := mi.getUnknownBytes(p); u != nil {\n\t\tvar err error\n\t\tb, err = messageset.AppendUnknown(b, *u)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\n\treturn b, nil\n}\n\nfunc marshalMessageSetField(mi *MessageInfo, b []byte, x ExtensionField, opts marshalOptions) ([]byte, error) {\n\txi := getExtensionFieldInfo(x.Type())\n\tnum, _ := protowire.DecodeTag(xi.wiretag)\n\tb = messageset.AppendFieldStart(b, num)\n\tb, err := xi.funcs.marshal(b, x.Value(), protowire.EncodeTag(messageset.FieldMessage, protowire.BytesType), opts)\n\tif err != nil {\n\t\treturn b, err\n\t}\n\tb = messageset.AppendFieldEnd(b)\n\treturn b, nil\n}\n\nfunc unmarshalMessageSet(mi *MessageInfo, b []byte, p pointer, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif !flags.ProtoLegacy {\n\t\treturn out, errors.New(\"no support for message_set_wire_format\")\n\t}\n\n\tep := p.Apply(mi.extensionOffset).Extensions()\n\tif *ep == nil {\n\t\t*ep = make(map[int32]ExtensionField)\n\t}\n\text := *ep\n\tinitialized := true\n\terr = messageset.Unmarshal(b, true, func(num protowire.Number, v []byte) error {\n\t\to, err := mi.unmarshalExtension(v, num, protowire.BytesType, ext, opts)\n\t\tif err == errUnknown {\n\t\t\tu := mi.mutableUnknownBytes(p)\n\t\t\t*u = protowire.AppendTag(*u, num, protowire.BytesType)\n\t\t\t*u = append(*u, v...)\n\t\t\treturn nil\n\t\t}\n\t\tif !o.initialized {\n\t\t\tinitialized = false\n\t\t}\n\t\treturn err\n\t})\n\tout.n = len(b)\n\tout.initialized = initialized\n\treturn out, err\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/codec_reflect.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// +build purego appengine\n\npackage impl\n\nimport (\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n)\n\nfunc sizeEnum(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {\n\tv := p.v.Elem().Int()\n\treturn f.tagsize + protowire.SizeVarint(uint64(v))\n}\n\nfunc appendEnum(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tv := p.v.Elem().Int()\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tb = protowire.AppendVarint(b, uint64(v))\n\treturn b, nil\n}\n\nfunc consumeEnum(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeVarint(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\tp.v.Elem().SetInt(int64(v))\n\tout.n = n\n\treturn out, nil\n}\n\nfunc mergeEnum(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tdst.v.Elem().Set(src.v.Elem())\n}\n\nvar coderEnum = pointerCoderFuncs{\n\tsize:      sizeEnum,\n\tmarshal:   appendEnum,\n\tunmarshal: consumeEnum,\n\tmerge:     mergeEnum,\n}\n\nfunc sizeEnumNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\tif p.v.Elem().Int() == 0 {\n\t\treturn 0\n\t}\n\treturn sizeEnum(p, f, opts)\n}\n\nfunc appendEnumNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\tif p.v.Elem().Int() == 0 {\n\t\treturn b, nil\n\t}\n\treturn appendEnum(b, p, f, opts)\n}\n\nfunc mergeEnumNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tif src.v.Elem().Int() != 0 {\n\t\tdst.v.Elem().Set(src.v.Elem())\n\t}\n}\n\nvar coderEnumNoZero = pointerCoderFuncs{\n\tsize:      sizeEnumNoZero,\n\tmarshal:   appendEnumNoZero,\n\tunmarshal: consumeEnum,\n\tmerge:     mergeEnumNoZero,\n}\n\nfunc sizeEnumPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\treturn sizeEnum(pointer{p.v.Elem()}, f, opts)\n}\n\nfunc appendEnumPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\treturn appendEnum(b, pointer{p.v.Elem()}, f, opts)\n}\n\nfunc consumeEnumPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tif p.v.Elem().IsNil() {\n\t\tp.v.Elem().Set(reflect.New(p.v.Elem().Type().Elem()))\n\t}\n\treturn consumeEnum(b, pointer{p.v.Elem()}, wtyp, f, opts)\n}\n\nfunc mergeEnumPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tif !src.v.Elem().IsNil() {\n\t\tv := reflect.New(dst.v.Type().Elem().Elem())\n\t\tv.Elem().Set(src.v.Elem().Elem())\n\t\tdst.v.Elem().Set(v)\n\t}\n}\n\nvar coderEnumPtr = pointerCoderFuncs{\n\tsize:      sizeEnumPtr,\n\tmarshal:   appendEnumPtr,\n\tunmarshal: consumeEnumPtr,\n\tmerge:     mergeEnumPtr,\n}\n\nfunc sizeEnumSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := p.v.Elem()\n\tfor i, llen := 0, s.Len(); i < llen; i++ {\n\t\tsize += protowire.SizeVarint(uint64(s.Index(i).Int())) + f.tagsize\n\t}\n\treturn size\n}\n\nfunc appendEnumSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := p.v.Elem()\n\tfor i, llen := 0, s.Len(); i < llen; i++ {\n\t\tb = protowire.AppendVarint(b, f.wiretag)\n\t\tb = protowire.AppendVarint(b, uint64(s.Index(i).Int()))\n\t}\n\treturn b, nil\n}\n\nfunc consumeEnumSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\ts := p.v.Elem()\n\tif wtyp == protowire.BytesType {\n\t\tb, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, errDecode\n\t\t}\n\t\tfor len(b) > 0 {\n\t\t\tv, n := protowire.ConsumeVarint(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\trv := reflect.New(s.Type().Elem()).Elem()\n\t\t\trv.SetInt(int64(v))\n\t\t\ts.Set(reflect.Append(s, rv))\n\t\t\tb = b[n:]\n\t\t}\n\t\tout.n = n\n\t\treturn out, nil\n\t}\n\tif wtyp != protowire.VarintType {\n\t\treturn out, errUnknown\n\t}\n\tv, n := protowire.ConsumeVarint(b)\n\tif n < 0 {\n\t\treturn out, errDecode\n\t}\n\trv := reflect.New(s.Type().Elem()).Elem()\n\trv.SetInt(int64(v))\n\ts.Set(reflect.Append(s, rv))\n\tout.n = n\n\treturn out, nil\n}\n\nfunc mergeEnumSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tdst.v.Elem().Set(reflect.AppendSlice(dst.v.Elem(), src.v.Elem()))\n}\n\nvar coderEnumSlice = pointerCoderFuncs{\n\tsize:      sizeEnumSlice,\n\tmarshal:   appendEnumSlice,\n\tunmarshal: consumeEnumSlice,\n\tmerge:     mergeEnumSlice,\n}\n\nfunc sizeEnumPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\n\ts := p.v.Elem()\n\tllen := s.Len()\n\tif llen == 0 {\n\t\treturn 0\n\t}\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tn += protowire.SizeVarint(uint64(s.Index(i).Int()))\n\t}\n\treturn f.tagsize + protowire.SizeBytes(n)\n}\n\nfunc appendEnumPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {\n\ts := p.v.Elem()\n\tllen := s.Len()\n\tif llen == 0 {\n\t\treturn b, nil\n\t}\n\tb = protowire.AppendVarint(b, f.wiretag)\n\tn := 0\n\tfor i := 0; i < llen; i++ {\n\t\tn += protowire.SizeVarint(uint64(s.Index(i).Int()))\n\t}\n\tb = protowire.AppendVarint(b, uint64(n))\n\tfor i := 0; i < llen; i++ {\n\t\tb = protowire.AppendVarint(b, uint64(s.Index(i).Int()))\n\t}\n\treturn b, nil\n}\n\nvar coderEnumPackedSlice = pointerCoderFuncs{\n\tsize:      sizeEnumPackedSlice,\n\tmarshal:   appendEnumPackedSlice,\n\tunmarshal: consumeEnumSlice,\n\tmerge:     mergeEnumSlice,\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/codec_tables.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// pointerCoderFuncs is a set of pointer encoding functions.\ntype pointerCoderFuncs struct {\n\tmi        *MessageInfo\n\tsize      func(p pointer, f *coderFieldInfo, opts marshalOptions) int\n\tmarshal   func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error)\n\tunmarshal func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error)\n\tisInit    func(p pointer, f *coderFieldInfo) error\n\tmerge     func(dst, src pointer, f *coderFieldInfo, opts mergeOptions)\n}\n\n// valueCoderFuncs is a set of protoreflect.Value encoding functions.\ntype valueCoderFuncs struct {\n\tsize      func(v pref.Value, tagsize int, opts marshalOptions) int\n\tmarshal   func(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error)\n\tunmarshal func(b []byte, v pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error)\n\tisInit    func(v pref.Value) error\n\tmerge     func(dst, src pref.Value, opts mergeOptions) pref.Value\n}\n\n// fieldCoder returns pointer functions for a field, used for operating on\n// struct fields.\nfunc fieldCoder(fd pref.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointerCoderFuncs) {\n\tswitch {\n\tcase fd.IsMap():\n\t\treturn encoderFuncsForMap(fd, ft)\n\tcase fd.Cardinality() == pref.Repeated && !fd.IsPacked():\n\t\t// Repeated fields (not packed).\n\t\tif ft.Kind() != reflect.Slice {\n\t\t\tbreak\n\t\t}\n\t\tft := ft.Elem()\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\tif ft.Kind() == reflect.Bool {\n\t\t\t\treturn nil, coderBoolSlice\n\t\t\t}\n\t\tcase pref.EnumKind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderEnumSlice\n\t\t\t}\n\t\tcase pref.Int32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderInt32Slice\n\t\t\t}\n\t\tcase pref.Sint32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSint32Slice\n\t\t\t}\n\t\tcase pref.Uint32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderUint32Slice\n\t\t\t}\n\t\tcase pref.Int64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderInt64Slice\n\t\t\t}\n\t\tcase pref.Sint64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSint64Slice\n\t\t\t}\n\t\tcase pref.Uint64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderUint64Slice\n\t\t\t}\n\t\tcase pref.Sfixed32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSfixed32Slice\n\t\t\t}\n\t\tcase pref.Fixed32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderFixed32Slice\n\t\t\t}\n\t\tcase pref.FloatKind:\n\t\t\tif ft.Kind() == reflect.Float32 {\n\t\t\t\treturn nil, coderFloatSlice\n\t\t\t}\n\t\tcase pref.Sfixed64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSfixed64Slice\n\t\t\t}\n\t\tcase pref.Fixed64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderFixed64Slice\n\t\t\t}\n\t\tcase pref.DoubleKind:\n\t\t\tif ft.Kind() == reflect.Float64 {\n\t\t\t\treturn nil, coderDoubleSlice\n\t\t\t}\n\t\tcase pref.StringKind:\n\t\t\tif ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {\n\t\t\t\treturn nil, coderStringSliceValidateUTF8\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderStringSlice\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 && strs.EnforceUTF8(fd) {\n\t\t\t\treturn nil, coderBytesSliceValidateUTF8\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {\n\t\t\t\treturn nil, coderBytesSlice\n\t\t\t}\n\t\tcase pref.BytesKind:\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderStringSlice\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {\n\t\t\t\treturn nil, coderBytesSlice\n\t\t\t}\n\t\tcase pref.MessageKind:\n\t\t\treturn getMessageInfo(ft), makeMessageSliceFieldCoder(fd, ft)\n\t\tcase pref.GroupKind:\n\t\t\treturn getMessageInfo(ft), makeGroupSliceFieldCoder(fd, ft)\n\t\t}\n\tcase fd.Cardinality() == pref.Repeated && fd.IsPacked():\n\t\t// Packed repeated fields.\n\t\t//\n\t\t// Only repeated fields of primitive numeric types\n\t\t// (Varint, Fixed32, or Fixed64 wire type) can be packed.\n\t\tif ft.Kind() != reflect.Slice {\n\t\t\tbreak\n\t\t}\n\t\tft := ft.Elem()\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\tif ft.Kind() == reflect.Bool {\n\t\t\t\treturn nil, coderBoolPackedSlice\n\t\t\t}\n\t\tcase pref.EnumKind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderEnumPackedSlice\n\t\t\t}\n\t\tcase pref.Int32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderInt32PackedSlice\n\t\t\t}\n\t\tcase pref.Sint32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSint32PackedSlice\n\t\t\t}\n\t\tcase pref.Uint32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderUint32PackedSlice\n\t\t\t}\n\t\tcase pref.Int64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderInt64PackedSlice\n\t\t\t}\n\t\tcase pref.Sint64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSint64PackedSlice\n\t\t\t}\n\t\tcase pref.Uint64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderUint64PackedSlice\n\t\t\t}\n\t\tcase pref.Sfixed32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSfixed32PackedSlice\n\t\t\t}\n\t\tcase pref.Fixed32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderFixed32PackedSlice\n\t\t\t}\n\t\tcase pref.FloatKind:\n\t\t\tif ft.Kind() == reflect.Float32 {\n\t\t\t\treturn nil, coderFloatPackedSlice\n\t\t\t}\n\t\tcase pref.Sfixed64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSfixed64PackedSlice\n\t\t\t}\n\t\tcase pref.Fixed64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderFixed64PackedSlice\n\t\t\t}\n\t\tcase pref.DoubleKind:\n\t\t\tif ft.Kind() == reflect.Float64 {\n\t\t\t\treturn nil, coderDoublePackedSlice\n\t\t\t}\n\t\t}\n\tcase fd.Kind() == pref.MessageKind:\n\t\treturn getMessageInfo(ft), makeMessageFieldCoder(fd, ft)\n\tcase fd.Kind() == pref.GroupKind:\n\t\treturn getMessageInfo(ft), makeGroupFieldCoder(fd, ft)\n\tcase fd.Syntax() == pref.Proto3 && fd.ContainingOneof() == nil:\n\t\t// Populated oneof fields always encode even if set to the zero value,\n\t\t// which normally are not encoded in proto3.\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\tif ft.Kind() == reflect.Bool {\n\t\t\t\treturn nil, coderBoolNoZero\n\t\t\t}\n\t\tcase pref.EnumKind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderEnumNoZero\n\t\t\t}\n\t\tcase pref.Int32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderInt32NoZero\n\t\t\t}\n\t\tcase pref.Sint32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSint32NoZero\n\t\t\t}\n\t\tcase pref.Uint32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderUint32NoZero\n\t\t\t}\n\t\tcase pref.Int64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderInt64NoZero\n\t\t\t}\n\t\tcase pref.Sint64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSint64NoZero\n\t\t\t}\n\t\tcase pref.Uint64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderUint64NoZero\n\t\t\t}\n\t\tcase pref.Sfixed32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSfixed32NoZero\n\t\t\t}\n\t\tcase pref.Fixed32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderFixed32NoZero\n\t\t\t}\n\t\tcase pref.FloatKind:\n\t\t\tif ft.Kind() == reflect.Float32 {\n\t\t\t\treturn nil, coderFloatNoZero\n\t\t\t}\n\t\tcase pref.Sfixed64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSfixed64NoZero\n\t\t\t}\n\t\tcase pref.Fixed64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderFixed64NoZero\n\t\t\t}\n\t\tcase pref.DoubleKind:\n\t\t\tif ft.Kind() == reflect.Float64 {\n\t\t\t\treturn nil, coderDoubleNoZero\n\t\t\t}\n\t\tcase pref.StringKind:\n\t\t\tif ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {\n\t\t\t\treturn nil, coderStringNoZeroValidateUTF8\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderStringNoZero\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 && strs.EnforceUTF8(fd) {\n\t\t\t\treturn nil, coderBytesNoZeroValidateUTF8\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {\n\t\t\t\treturn nil, coderBytesNoZero\n\t\t\t}\n\t\tcase pref.BytesKind:\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderStringNoZero\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {\n\t\t\t\treturn nil, coderBytesNoZero\n\t\t\t}\n\t\t}\n\tcase ft.Kind() == reflect.Ptr:\n\t\tft := ft.Elem()\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\tif ft.Kind() == reflect.Bool {\n\t\t\t\treturn nil, coderBoolPtr\n\t\t\t}\n\t\tcase pref.EnumKind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderEnumPtr\n\t\t\t}\n\t\tcase pref.Int32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderInt32Ptr\n\t\t\t}\n\t\tcase pref.Sint32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSint32Ptr\n\t\t\t}\n\t\tcase pref.Uint32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderUint32Ptr\n\t\t\t}\n\t\tcase pref.Int64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderInt64Ptr\n\t\t\t}\n\t\tcase pref.Sint64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSint64Ptr\n\t\t\t}\n\t\tcase pref.Uint64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderUint64Ptr\n\t\t\t}\n\t\tcase pref.Sfixed32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSfixed32Ptr\n\t\t\t}\n\t\tcase pref.Fixed32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderFixed32Ptr\n\t\t\t}\n\t\tcase pref.FloatKind:\n\t\t\tif ft.Kind() == reflect.Float32 {\n\t\t\t\treturn nil, coderFloatPtr\n\t\t\t}\n\t\tcase pref.Sfixed64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSfixed64Ptr\n\t\t\t}\n\t\tcase pref.Fixed64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderFixed64Ptr\n\t\t\t}\n\t\tcase pref.DoubleKind:\n\t\t\tif ft.Kind() == reflect.Float64 {\n\t\t\t\treturn nil, coderDoublePtr\n\t\t\t}\n\t\tcase pref.StringKind:\n\t\t\tif ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {\n\t\t\t\treturn nil, coderStringPtrValidateUTF8\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderStringPtr\n\t\t\t}\n\t\tcase pref.BytesKind:\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderStringPtr\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\tif ft.Kind() == reflect.Bool {\n\t\t\t\treturn nil, coderBool\n\t\t\t}\n\t\tcase pref.EnumKind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderEnum\n\t\t\t}\n\t\tcase pref.Int32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderInt32\n\t\t\t}\n\t\tcase pref.Sint32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSint32\n\t\t\t}\n\t\tcase pref.Uint32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderUint32\n\t\t\t}\n\t\tcase pref.Int64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderInt64\n\t\t\t}\n\t\tcase pref.Sint64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSint64\n\t\t\t}\n\t\tcase pref.Uint64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderUint64\n\t\t\t}\n\t\tcase pref.Sfixed32Kind:\n\t\t\tif ft.Kind() == reflect.Int32 {\n\t\t\t\treturn nil, coderSfixed32\n\t\t\t}\n\t\tcase pref.Fixed32Kind:\n\t\t\tif ft.Kind() == reflect.Uint32 {\n\t\t\t\treturn nil, coderFixed32\n\t\t\t}\n\t\tcase pref.FloatKind:\n\t\t\tif ft.Kind() == reflect.Float32 {\n\t\t\t\treturn nil, coderFloat\n\t\t\t}\n\t\tcase pref.Sfixed64Kind:\n\t\t\tif ft.Kind() == reflect.Int64 {\n\t\t\t\treturn nil, coderSfixed64\n\t\t\t}\n\t\tcase pref.Fixed64Kind:\n\t\t\tif ft.Kind() == reflect.Uint64 {\n\t\t\t\treturn nil, coderFixed64\n\t\t\t}\n\t\tcase pref.DoubleKind:\n\t\t\tif ft.Kind() == reflect.Float64 {\n\t\t\t\treturn nil, coderDouble\n\t\t\t}\n\t\tcase pref.StringKind:\n\t\t\tif ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {\n\t\t\t\treturn nil, coderStringValidateUTF8\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderString\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 && strs.EnforceUTF8(fd) {\n\t\t\t\treturn nil, coderBytesValidateUTF8\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {\n\t\t\t\treturn nil, coderBytes\n\t\t\t}\n\t\tcase pref.BytesKind:\n\t\t\tif ft.Kind() == reflect.String {\n\t\t\t\treturn nil, coderString\n\t\t\t}\n\t\t\tif ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {\n\t\t\t\treturn nil, coderBytes\n\t\t\t}\n\t\t}\n\t}\n\tpanic(fmt.Sprintf(\"invalid type: no encoder for %v %v %v/%v\", fd.FullName(), fd.Cardinality(), fd.Kind(), ft))\n}\n\n// encoderFuncsForValue returns value functions for a field, used for\n// extension values and map encoding.\nfunc encoderFuncsForValue(fd pref.FieldDescriptor) valueCoderFuncs {\n\tswitch {\n\tcase fd.Cardinality() == pref.Repeated && !fd.IsPacked():\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\treturn coderBoolSliceValue\n\t\tcase pref.EnumKind:\n\t\t\treturn coderEnumSliceValue\n\t\tcase pref.Int32Kind:\n\t\t\treturn coderInt32SliceValue\n\t\tcase pref.Sint32Kind:\n\t\t\treturn coderSint32SliceValue\n\t\tcase pref.Uint32Kind:\n\t\t\treturn coderUint32SliceValue\n\t\tcase pref.Int64Kind:\n\t\t\treturn coderInt64SliceValue\n\t\tcase pref.Sint64Kind:\n\t\t\treturn coderSint64SliceValue\n\t\tcase pref.Uint64Kind:\n\t\t\treturn coderUint64SliceValue\n\t\tcase pref.Sfixed32Kind:\n\t\t\treturn coderSfixed32SliceValue\n\t\tcase pref.Fixed32Kind:\n\t\t\treturn coderFixed32SliceValue\n\t\tcase pref.FloatKind:\n\t\t\treturn coderFloatSliceValue\n\t\tcase pref.Sfixed64Kind:\n\t\t\treturn coderSfixed64SliceValue\n\t\tcase pref.Fixed64Kind:\n\t\t\treturn coderFixed64SliceValue\n\t\tcase pref.DoubleKind:\n\t\t\treturn coderDoubleSliceValue\n\t\tcase pref.StringKind:\n\t\t\t// We don't have a UTF-8 validating coder for repeated string fields.\n\t\t\t// Value coders are used for extensions and maps.\n\t\t\t// Extensions are never proto3, and maps never contain lists.\n\t\t\treturn coderStringSliceValue\n\t\tcase pref.BytesKind:\n\t\t\treturn coderBytesSliceValue\n\t\tcase pref.MessageKind:\n\t\t\treturn coderMessageSliceValue\n\t\tcase pref.GroupKind:\n\t\t\treturn coderGroupSliceValue\n\t\t}\n\tcase fd.Cardinality() == pref.Repeated && fd.IsPacked():\n\t\tswitch fd.Kind() {\n\t\tcase pref.BoolKind:\n\t\t\treturn coderBoolPackedSliceValue\n\t\tcase pref.EnumKind:\n\t\t\treturn coderEnumPackedSliceValue\n\t\tcase pref.Int32Kind:\n\t\t\treturn coderInt32PackedSliceValue\n\t\tcase pref.Sint32Kind:\n\t\t\treturn coderSint32PackedSliceValue\n\t\tcase pref.Uint32Kind:\n\t\t\treturn coderUint32PackedSliceValue\n\t\tcase pref.Int64Kind:\n\t\t\treturn coderInt64PackedSliceValue\n\t\tcase pref.Sint64Kind:\n\t\t\treturn coderSint64PackedSliceValue\n\t\tcase pref.Uint64Kind:\n\t\t\treturn coderUint64PackedSliceValue\n\t\tcase pref.Sfixed32Kind:\n\t\t\treturn coderSfixed32PackedSliceValue\n\t\tcase pref.Fixed32Kind:\n\t\t\treturn coderFixed32PackedSliceValue\n\t\tcase pref.FloatKind:\n\t\t\treturn coderFloatPackedSliceValue\n\t\tcase pref.Sfixed64Kind:\n\t\t\treturn coderSfixed64PackedSliceValue\n\t\tcase pref.Fixed64Kind:\n\t\t\treturn coderFixed64PackedSliceValue\n\t\tcase pref.DoubleKind:\n\t\t\treturn coderDoublePackedSliceValue\n\t\t}\n\tdefault:\n\t\tswitch fd.Kind() {\n\t\tdefault:\n\t\tcase pref.BoolKind:\n\t\t\treturn coderBoolValue\n\t\tcase pref.EnumKind:\n\t\t\treturn coderEnumValue\n\t\tcase pref.Int32Kind:\n\t\t\treturn coderInt32Value\n\t\tcase pref.Sint32Kind:\n\t\t\treturn coderSint32Value\n\t\tcase pref.Uint32Kind:\n\t\t\treturn coderUint32Value\n\t\tcase pref.Int64Kind:\n\t\t\treturn coderInt64Value\n\t\tcase pref.Sint64Kind:\n\t\t\treturn coderSint64Value\n\t\tcase pref.Uint64Kind:\n\t\t\treturn coderUint64Value\n\t\tcase pref.Sfixed32Kind:\n\t\t\treturn coderSfixed32Value\n\t\tcase pref.Fixed32Kind:\n\t\t\treturn coderFixed32Value\n\t\tcase pref.FloatKind:\n\t\t\treturn coderFloatValue\n\t\tcase pref.Sfixed64Kind:\n\t\t\treturn coderSfixed64Value\n\t\tcase pref.Fixed64Kind:\n\t\t\treturn coderFixed64Value\n\t\tcase pref.DoubleKind:\n\t\t\treturn coderDoubleValue\n\t\tcase pref.StringKind:\n\t\t\tif strs.EnforceUTF8(fd) {\n\t\t\t\treturn coderStringValueValidateUTF8\n\t\t\t}\n\t\t\treturn coderStringValue\n\t\tcase pref.BytesKind:\n\t\t\treturn coderBytesValue\n\t\tcase pref.MessageKind:\n\t\t\treturn coderMessageValue\n\t\tcase pref.GroupKind:\n\t\t\treturn coderGroupValue\n\t\t}\n\t}\n\tpanic(fmt.Sprintf(\"invalid field: no encoder for %v %v %v\", fd.FullName(), fd.Cardinality(), fd.Kind()))\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.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// +build !purego,!appengine\n\npackage impl\n\n// When using unsafe pointers, we can just treat enum values as int32s.\n\nvar (\n\tcoderEnumNoZero      = coderInt32NoZero\n\tcoderEnum            = coderInt32\n\tcoderEnumPtr         = coderInt32Ptr\n\tcoderEnumSlice       = coderInt32Slice\n\tcoderEnumPackedSlice = coderInt32PackedSlice\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/convert.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// unwrapper unwraps the value to the underlying value.\n// This is implemented by List and Map.\ntype unwrapper interface {\n\tprotoUnwrap() interface{}\n}\n\n// A Converter coverts to/from Go reflect.Value types and protobuf protoreflect.Value types.\ntype Converter interface {\n\t// PBValueOf converts a reflect.Value to a protoreflect.Value.\n\tPBValueOf(reflect.Value) pref.Value\n\n\t// GoValueOf converts a protoreflect.Value to a reflect.Value.\n\tGoValueOf(pref.Value) reflect.Value\n\n\t// IsValidPB returns whether a protoreflect.Value is compatible with this type.\n\tIsValidPB(pref.Value) bool\n\n\t// IsValidGo returns whether a reflect.Value is compatible with this type.\n\tIsValidGo(reflect.Value) bool\n\n\t// New returns a new field value.\n\t// For scalars, it returns the default value of the field.\n\t// For composite types, it returns a new mutable value.\n\tNew() pref.Value\n\n\t// Zero returns a new field value.\n\t// For scalars, it returns the default value of the field.\n\t// For composite types, it returns an immutable, empty value.\n\tZero() pref.Value\n}\n\n// NewConverter matches a Go type with a protobuf field and returns a Converter\n// that converts between the two. Enums must be a named int32 kind that\n// implements protoreflect.Enum, and messages must be pointer to a named\n// struct type that implements protoreflect.ProtoMessage.\n//\n// This matcher deliberately supports a wider range of Go types than what\n// protoc-gen-go historically generated to be able to automatically wrap some\n// v1 messages generated by other forks of protoc-gen-go.\nfunc NewConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {\n\tswitch {\n\tcase fd.IsList():\n\t\treturn newListConverter(t, fd)\n\tcase fd.IsMap():\n\t\treturn newMapConverter(t, fd)\n\tdefault:\n\t\treturn newSingularConverter(t, fd)\n\t}\n\tpanic(fmt.Sprintf(\"invalid Go type %v for field %v\", t, fd.FullName()))\n}\n\nvar (\n\tboolType    = reflect.TypeOf(bool(false))\n\tint32Type   = reflect.TypeOf(int32(0))\n\tint64Type   = reflect.TypeOf(int64(0))\n\tuint32Type  = reflect.TypeOf(uint32(0))\n\tuint64Type  = reflect.TypeOf(uint64(0))\n\tfloat32Type = reflect.TypeOf(float32(0))\n\tfloat64Type = reflect.TypeOf(float64(0))\n\tstringType  = reflect.TypeOf(string(\"\"))\n\tbytesType   = reflect.TypeOf([]byte(nil))\n\tbyteType    = reflect.TypeOf(byte(0))\n)\n\nvar (\n\tboolZero    = pref.ValueOfBool(false)\n\tint32Zero   = pref.ValueOfInt32(0)\n\tint64Zero   = pref.ValueOfInt64(0)\n\tuint32Zero  = pref.ValueOfUint32(0)\n\tuint64Zero  = pref.ValueOfUint64(0)\n\tfloat32Zero = pref.ValueOfFloat32(0)\n\tfloat64Zero = pref.ValueOfFloat64(0)\n\tstringZero  = pref.ValueOfString(\"\")\n\tbytesZero   = pref.ValueOfBytes(nil)\n)\n\nfunc newSingularConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {\n\tdefVal := func(fd pref.FieldDescriptor, zero pref.Value) pref.Value {\n\t\tif fd.Cardinality() == pref.Repeated {\n\t\t\t// Default isn't defined for repeated fields.\n\t\t\treturn zero\n\t\t}\n\t\treturn fd.Default()\n\t}\n\tswitch fd.Kind() {\n\tcase pref.BoolKind:\n\t\tif t.Kind() == reflect.Bool {\n\t\t\treturn &boolConverter{t, defVal(fd, boolZero)}\n\t\t}\n\tcase pref.Int32Kind, pref.Sint32Kind, pref.Sfixed32Kind:\n\t\tif t.Kind() == reflect.Int32 {\n\t\t\treturn &int32Converter{t, defVal(fd, int32Zero)}\n\t\t}\n\tcase pref.Int64Kind, pref.Sint64Kind, pref.Sfixed64Kind:\n\t\tif t.Kind() == reflect.Int64 {\n\t\t\treturn &int64Converter{t, defVal(fd, int64Zero)}\n\t\t}\n\tcase pref.Uint32Kind, pref.Fixed32Kind:\n\t\tif t.Kind() == reflect.Uint32 {\n\t\t\treturn &uint32Converter{t, defVal(fd, uint32Zero)}\n\t\t}\n\tcase pref.Uint64Kind, pref.Fixed64Kind:\n\t\tif t.Kind() == reflect.Uint64 {\n\t\t\treturn &uint64Converter{t, defVal(fd, uint64Zero)}\n\t\t}\n\tcase pref.FloatKind:\n\t\tif t.Kind() == reflect.Float32 {\n\t\t\treturn &float32Converter{t, defVal(fd, float32Zero)}\n\t\t}\n\tcase pref.DoubleKind:\n\t\tif t.Kind() == reflect.Float64 {\n\t\t\treturn &float64Converter{t, defVal(fd, float64Zero)}\n\t\t}\n\tcase pref.StringKind:\n\t\tif t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {\n\t\t\treturn &stringConverter{t, defVal(fd, stringZero)}\n\t\t}\n\tcase pref.BytesKind:\n\t\tif t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {\n\t\t\treturn &bytesConverter{t, defVal(fd, bytesZero)}\n\t\t}\n\tcase pref.EnumKind:\n\t\t// Handle enums, which must be a named int32 type.\n\t\tif t.Kind() == reflect.Int32 {\n\t\t\treturn newEnumConverter(t, fd)\n\t\t}\n\tcase pref.MessageKind, pref.GroupKind:\n\t\treturn newMessageConverter(t)\n\t}\n\tpanic(fmt.Sprintf(\"invalid Go type %v for field %v\", t, fd.FullName()))\n}\n\ntype boolConverter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *boolConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfBool(v.Bool())\n}\nfunc (c *boolConverter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(v.Bool()).Convert(c.goType)\n}\nfunc (c *boolConverter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(bool)\n\treturn ok\n}\nfunc (c *boolConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *boolConverter) New() pref.Value  { return c.def }\nfunc (c *boolConverter) Zero() pref.Value { return c.def }\n\ntype int32Converter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *int32Converter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfInt32(int32(v.Int()))\n}\nfunc (c *int32Converter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(int32(v.Int())).Convert(c.goType)\n}\nfunc (c *int32Converter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(int32)\n\treturn ok\n}\nfunc (c *int32Converter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *int32Converter) New() pref.Value  { return c.def }\nfunc (c *int32Converter) Zero() pref.Value { return c.def }\n\ntype int64Converter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *int64Converter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfInt64(int64(v.Int()))\n}\nfunc (c *int64Converter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(int64(v.Int())).Convert(c.goType)\n}\nfunc (c *int64Converter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(int64)\n\treturn ok\n}\nfunc (c *int64Converter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *int64Converter) New() pref.Value  { return c.def }\nfunc (c *int64Converter) Zero() pref.Value { return c.def }\n\ntype uint32Converter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *uint32Converter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfUint32(uint32(v.Uint()))\n}\nfunc (c *uint32Converter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(uint32(v.Uint())).Convert(c.goType)\n}\nfunc (c *uint32Converter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(uint32)\n\treturn ok\n}\nfunc (c *uint32Converter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *uint32Converter) New() pref.Value  { return c.def }\nfunc (c *uint32Converter) Zero() pref.Value { return c.def }\n\ntype uint64Converter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *uint64Converter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfUint64(uint64(v.Uint()))\n}\nfunc (c *uint64Converter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(uint64(v.Uint())).Convert(c.goType)\n}\nfunc (c *uint64Converter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(uint64)\n\treturn ok\n}\nfunc (c *uint64Converter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *uint64Converter) New() pref.Value  { return c.def }\nfunc (c *uint64Converter) Zero() pref.Value { return c.def }\n\ntype float32Converter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *float32Converter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfFloat32(float32(v.Float()))\n}\nfunc (c *float32Converter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(float32(v.Float())).Convert(c.goType)\n}\nfunc (c *float32Converter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(float32)\n\treturn ok\n}\nfunc (c *float32Converter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *float32Converter) New() pref.Value  { return c.def }\nfunc (c *float32Converter) Zero() pref.Value { return c.def }\n\ntype float64Converter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *float64Converter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfFloat64(float64(v.Float()))\n}\nfunc (c *float64Converter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(float64(v.Float())).Convert(c.goType)\n}\nfunc (c *float64Converter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(float64)\n\treturn ok\n}\nfunc (c *float64Converter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *float64Converter) New() pref.Value  { return c.def }\nfunc (c *float64Converter) Zero() pref.Value { return c.def }\n\ntype stringConverter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *stringConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfString(v.Convert(stringType).String())\n}\nfunc (c *stringConverter) GoValueOf(v pref.Value) reflect.Value {\n\t// pref.Value.String never panics, so we go through an interface\n\t// conversion here to check the type.\n\ts := v.Interface().(string)\n\tif c.goType.Kind() == reflect.Slice && s == \"\" {\n\t\treturn reflect.Zero(c.goType) // ensure empty string is []byte(nil)\n\t}\n\treturn reflect.ValueOf(s).Convert(c.goType)\n}\nfunc (c *stringConverter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(string)\n\treturn ok\n}\nfunc (c *stringConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *stringConverter) New() pref.Value  { return c.def }\nfunc (c *stringConverter) Zero() pref.Value { return c.def }\n\ntype bytesConverter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc (c *bytesConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\tif c.goType.Kind() == reflect.String && v.Len() == 0 {\n\t\treturn pref.ValueOfBytes(nil) // ensure empty string is []byte(nil)\n\t}\n\treturn pref.ValueOfBytes(v.Convert(bytesType).Bytes())\n}\nfunc (c *bytesConverter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(v.Bytes()).Convert(c.goType)\n}\nfunc (c *bytesConverter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().([]byte)\n\treturn ok\n}\nfunc (c *bytesConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\nfunc (c *bytesConverter) New() pref.Value  { return c.def }\nfunc (c *bytesConverter) Zero() pref.Value { return c.def }\n\ntype enumConverter struct {\n\tgoType reflect.Type\n\tdef    pref.Value\n}\n\nfunc newEnumConverter(goType reflect.Type, fd pref.FieldDescriptor) Converter {\n\tvar def pref.Value\n\tif fd.Cardinality() == pref.Repeated {\n\t\tdef = pref.ValueOfEnum(fd.Enum().Values().Get(0).Number())\n\t} else {\n\t\tdef = fd.Default()\n\t}\n\treturn &enumConverter{goType, def}\n}\n\nfunc (c *enumConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfEnum(pref.EnumNumber(v.Int()))\n}\n\nfunc (c *enumConverter) GoValueOf(v pref.Value) reflect.Value {\n\treturn reflect.ValueOf(v.Enum()).Convert(c.goType)\n}\n\nfunc (c *enumConverter) IsValidPB(v pref.Value) bool {\n\t_, ok := v.Interface().(pref.EnumNumber)\n\treturn ok\n}\n\nfunc (c *enumConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\n\nfunc (c *enumConverter) New() pref.Value {\n\treturn c.def\n}\n\nfunc (c *enumConverter) Zero() pref.Value {\n\treturn c.def\n}\n\ntype messageConverter struct {\n\tgoType reflect.Type\n}\n\nfunc newMessageConverter(goType reflect.Type) Converter {\n\treturn &messageConverter{goType}\n}\n\nfunc (c *messageConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\tif c.isNonPointer() {\n\t\tif v.CanAddr() {\n\t\t\tv = v.Addr() // T => *T\n\t\t} else {\n\t\t\tv = reflect.Zero(reflect.PtrTo(v.Type()))\n\t\t}\n\t}\n\tif m, ok := v.Interface().(pref.ProtoMessage); ok {\n\t\treturn pref.ValueOfMessage(m.ProtoReflect())\n\t}\n\treturn pref.ValueOfMessage(legacyWrapMessage(v))\n}\n\nfunc (c *messageConverter) GoValueOf(v pref.Value) reflect.Value {\n\tm := v.Message()\n\tvar rv reflect.Value\n\tif u, ok := m.(unwrapper); ok {\n\t\trv = reflect.ValueOf(u.protoUnwrap())\n\t} else {\n\t\trv = reflect.ValueOf(m.Interface())\n\t}\n\tif c.isNonPointer() {\n\t\tif rv.Type() != reflect.PtrTo(c.goType) {\n\t\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", rv.Type(), reflect.PtrTo(c.goType)))\n\t\t}\n\t\tif !rv.IsNil() {\n\t\t\trv = rv.Elem() // *T => T\n\t\t} else {\n\t\t\trv = reflect.Zero(rv.Type().Elem())\n\t\t}\n\t}\n\tif rv.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", rv.Type(), c.goType))\n\t}\n\treturn rv\n}\n\nfunc (c *messageConverter) IsValidPB(v pref.Value) bool {\n\tm := v.Message()\n\tvar rv reflect.Value\n\tif u, ok := m.(unwrapper); ok {\n\t\trv = reflect.ValueOf(u.protoUnwrap())\n\t} else {\n\t\trv = reflect.ValueOf(m.Interface())\n\t}\n\tif c.isNonPointer() {\n\t\treturn rv.Type() == reflect.PtrTo(c.goType)\n\t}\n\treturn rv.Type() == c.goType\n}\n\nfunc (c *messageConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\n\nfunc (c *messageConverter) New() pref.Value {\n\tif c.isNonPointer() {\n\t\treturn c.PBValueOf(reflect.New(c.goType).Elem())\n\t}\n\treturn c.PBValueOf(reflect.New(c.goType.Elem()))\n}\n\nfunc (c *messageConverter) Zero() pref.Value {\n\treturn c.PBValueOf(reflect.Zero(c.goType))\n}\n\n// isNonPointer reports whether the type is a non-pointer type.\n// This never occurs for generated message types.\nfunc (c *messageConverter) isNonPointer() bool {\n\treturn c.goType.Kind() != reflect.Ptr\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/convert_list.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nfunc newListConverter(t reflect.Type, fd pref.FieldDescriptor) Converter {\n\tswitch {\n\tcase t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Slice:\n\t\treturn &listPtrConverter{t, newSingularConverter(t.Elem().Elem(), fd)}\n\tcase t.Kind() == reflect.Slice:\n\t\treturn &listConverter{t, newSingularConverter(t.Elem(), fd)}\n\t}\n\tpanic(fmt.Sprintf(\"invalid Go type %v for field %v\", t, fd.FullName()))\n}\n\ntype listConverter struct {\n\tgoType reflect.Type // []T\n\tc      Converter\n}\n\nfunc (c *listConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\tpv := reflect.New(c.goType)\n\tpv.Elem().Set(v)\n\treturn pref.ValueOfList(&listReflect{pv, c.c})\n}\n\nfunc (c *listConverter) GoValueOf(v pref.Value) reflect.Value {\n\trv := v.List().(*listReflect).v\n\tif rv.IsNil() {\n\t\treturn reflect.Zero(c.goType)\n\t}\n\treturn rv.Elem()\n}\n\nfunc (c *listConverter) IsValidPB(v pref.Value) bool {\n\tlist, ok := v.Interface().(*listReflect)\n\tif !ok {\n\t\treturn false\n\t}\n\treturn list.v.Type().Elem() == c.goType\n}\n\nfunc (c *listConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\n\nfunc (c *listConverter) New() pref.Value {\n\treturn pref.ValueOfList(&listReflect{reflect.New(c.goType), c.c})\n}\n\nfunc (c *listConverter) Zero() pref.Value {\n\treturn pref.ValueOfList(&listReflect{reflect.Zero(reflect.PtrTo(c.goType)), c.c})\n}\n\ntype listPtrConverter struct {\n\tgoType reflect.Type // *[]T\n\tc      Converter\n}\n\nfunc (c *listPtrConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfList(&listReflect{v, c.c})\n}\n\nfunc (c *listPtrConverter) GoValueOf(v pref.Value) reflect.Value {\n\treturn v.List().(*listReflect).v\n}\n\nfunc (c *listPtrConverter) IsValidPB(v pref.Value) bool {\n\tlist, ok := v.Interface().(*listReflect)\n\tif !ok {\n\t\treturn false\n\t}\n\treturn list.v.Type() == c.goType\n}\n\nfunc (c *listPtrConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\n\nfunc (c *listPtrConverter) New() pref.Value {\n\treturn c.PBValueOf(reflect.New(c.goType.Elem()))\n}\n\nfunc (c *listPtrConverter) Zero() pref.Value {\n\treturn c.PBValueOf(reflect.Zero(c.goType))\n}\n\ntype listReflect struct {\n\tv    reflect.Value // *[]T\n\tconv Converter\n}\n\nfunc (ls *listReflect) Len() int {\n\tif ls.v.IsNil() {\n\t\treturn 0\n\t}\n\treturn ls.v.Elem().Len()\n}\nfunc (ls *listReflect) Get(i int) pref.Value {\n\treturn ls.conv.PBValueOf(ls.v.Elem().Index(i))\n}\nfunc (ls *listReflect) Set(i int, v pref.Value) {\n\tls.v.Elem().Index(i).Set(ls.conv.GoValueOf(v))\n}\nfunc (ls *listReflect) Append(v pref.Value) {\n\tls.v.Elem().Set(reflect.Append(ls.v.Elem(), ls.conv.GoValueOf(v)))\n}\nfunc (ls *listReflect) AppendMutable() pref.Value {\n\tif _, ok := ls.conv.(*messageConverter); !ok {\n\t\tpanic(\"invalid AppendMutable on list with non-message type\")\n\t}\n\tv := ls.NewElement()\n\tls.Append(v)\n\treturn v\n}\nfunc (ls *listReflect) Truncate(i int) {\n\tls.v.Elem().Set(ls.v.Elem().Slice(0, i))\n}\nfunc (ls *listReflect) NewElement() pref.Value {\n\treturn ls.conv.New()\n}\nfunc (ls *listReflect) IsValid() bool {\n\treturn !ls.v.IsNil()\n}\nfunc (ls *listReflect) protoUnwrap() interface{} {\n\treturn ls.v.Interface()\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/convert_map.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype mapConverter struct {\n\tgoType           reflect.Type // map[K]V\n\tkeyConv, valConv Converter\n}\n\nfunc newMapConverter(t reflect.Type, fd pref.FieldDescriptor) *mapConverter {\n\tif t.Kind() != reflect.Map {\n\t\tpanic(fmt.Sprintf(\"invalid Go type %v for field %v\", t, fd.FullName()))\n\t}\n\treturn &mapConverter{\n\t\tgoType:  t,\n\t\tkeyConv: newSingularConverter(t.Key(), fd.MapKey()),\n\t\tvalConv: newSingularConverter(t.Elem(), fd.MapValue()),\n\t}\n}\n\nfunc (c *mapConverter) PBValueOf(v reflect.Value) pref.Value {\n\tif v.Type() != c.goType {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", v.Type(), c.goType))\n\t}\n\treturn pref.ValueOfMap(&mapReflect{v, c.keyConv, c.valConv})\n}\n\nfunc (c *mapConverter) GoValueOf(v pref.Value) reflect.Value {\n\treturn v.Map().(*mapReflect).v\n}\n\nfunc (c *mapConverter) IsValidPB(v pref.Value) bool {\n\tmapv, ok := v.Interface().(*mapReflect)\n\tif !ok {\n\t\treturn false\n\t}\n\treturn mapv.v.Type() == c.goType\n}\n\nfunc (c *mapConverter) IsValidGo(v reflect.Value) bool {\n\treturn v.IsValid() && v.Type() == c.goType\n}\n\nfunc (c *mapConverter) New() pref.Value {\n\treturn c.PBValueOf(reflect.MakeMap(c.goType))\n}\n\nfunc (c *mapConverter) Zero() pref.Value {\n\treturn c.PBValueOf(reflect.Zero(c.goType))\n}\n\ntype mapReflect struct {\n\tv       reflect.Value // map[K]V\n\tkeyConv Converter\n\tvalConv Converter\n}\n\nfunc (ms *mapReflect) Len() int {\n\treturn ms.v.Len()\n}\nfunc (ms *mapReflect) Has(k pref.MapKey) bool {\n\trk := ms.keyConv.GoValueOf(k.Value())\n\trv := ms.v.MapIndex(rk)\n\treturn rv.IsValid()\n}\nfunc (ms *mapReflect) Get(k pref.MapKey) pref.Value {\n\trk := ms.keyConv.GoValueOf(k.Value())\n\trv := ms.v.MapIndex(rk)\n\tif !rv.IsValid() {\n\t\treturn pref.Value{}\n\t}\n\treturn ms.valConv.PBValueOf(rv)\n}\nfunc (ms *mapReflect) Set(k pref.MapKey, v pref.Value) {\n\trk := ms.keyConv.GoValueOf(k.Value())\n\trv := ms.valConv.GoValueOf(v)\n\tms.v.SetMapIndex(rk, rv)\n}\nfunc (ms *mapReflect) Clear(k pref.MapKey) {\n\trk := ms.keyConv.GoValueOf(k.Value())\n\tms.v.SetMapIndex(rk, reflect.Value{})\n}\nfunc (ms *mapReflect) Mutable(k pref.MapKey) pref.Value {\n\tif _, ok := ms.valConv.(*messageConverter); !ok {\n\t\tpanic(\"invalid Mutable on map with non-message value type\")\n\t}\n\tv := ms.Get(k)\n\tif !v.IsValid() {\n\t\tv = ms.NewValue()\n\t\tms.Set(k, v)\n\t}\n\treturn v\n}\nfunc (ms *mapReflect) Range(f func(pref.MapKey, pref.Value) bool) {\n\titer := mapRange(ms.v)\n\tfor iter.Next() {\n\t\tk := ms.keyConv.PBValueOf(iter.Key()).MapKey()\n\t\tv := ms.valConv.PBValueOf(iter.Value())\n\t\tif !f(k, v) {\n\t\t\treturn\n\t\t}\n\t}\n}\nfunc (ms *mapReflect) NewValue() pref.Value {\n\treturn ms.valConv.New()\n}\nfunc (ms *mapReflect) IsValid() bool {\n\treturn !ms.v.IsNil()\n}\nfunc (ms *mapReflect) protoUnwrap() interface{} {\n\treturn ms.v.Interface()\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/decode.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 impl\n\nimport (\n\t\"math/bits\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\nvar errDecode = errors.New(\"cannot parse invalid wire-format data\")\n\ntype unmarshalOptions struct {\n\tflags    protoiface.UnmarshalInputFlags\n\tresolver interface {\n\t\tFindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)\n\t\tFindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)\n\t}\n}\n\nfunc (o unmarshalOptions) Options() proto.UnmarshalOptions {\n\treturn proto.UnmarshalOptions{\n\t\tMerge:          true,\n\t\tAllowPartial:   true,\n\t\tDiscardUnknown: o.DiscardUnknown(),\n\t\tResolver:       o.resolver,\n\t}\n}\n\nfunc (o unmarshalOptions) DiscardUnknown() bool { return o.flags&piface.UnmarshalDiscardUnknown != 0 }\n\nfunc (o unmarshalOptions) IsDefault() bool {\n\treturn o.flags == 0 && o.resolver == preg.GlobalTypes\n}\n\nvar lazyUnmarshalOptions = unmarshalOptions{\n\tresolver: preg.GlobalTypes,\n}\n\ntype unmarshalOutput struct {\n\tn           int // number of bytes consumed\n\tinitialized bool\n}\n\n// unmarshal is protoreflect.Methods.Unmarshal.\nfunc (mi *MessageInfo) unmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) {\n\tvar p pointer\n\tif ms, ok := in.Message.(*messageState); ok {\n\t\tp = ms.pointer()\n\t} else {\n\t\tp = in.Message.(*messageReflectWrapper).pointer()\n\t}\n\tout, err := mi.unmarshalPointer(in.Buf, p, 0, unmarshalOptions{\n\t\tflags:    in.Flags,\n\t\tresolver: in.Resolver,\n\t})\n\tvar flags piface.UnmarshalOutputFlags\n\tif out.initialized {\n\t\tflags |= piface.UnmarshalInitialized\n\t}\n\treturn piface.UnmarshalOutput{\n\t\tFlags: flags,\n\t}, err\n}\n\n// errUnknown is returned during unmarshaling to indicate a parse error that\n// should result in a field being placed in the unknown fields section (for example,\n// when the wire type doesn't match) as opposed to the entire unmarshal operation\n// failing (for example, when a field extends past the available input).\n//\n// This is a sentinel error which should never be visible to the user.\nvar errUnknown = errors.New(\"unknown\")\n\nfunc (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tmi.init()\n\tif flags.ProtoLegacy && mi.isMessageSet {\n\t\treturn unmarshalMessageSet(mi, b, p, opts)\n\t}\n\tinitialized := true\n\tvar requiredMask uint64\n\tvar exts *map[int32]ExtensionField\n\tstart := len(b)\n\tfor len(b) > 0 {\n\t\t// Parse the tag (field number and wire type).\n\t\tvar tag uint64\n\t\tif b[0] < 0x80 {\n\t\t\ttag = uint64(b[0])\n\t\t\tb = b[1:]\n\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\ttag = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\tb = b[2:]\n\t\t} else {\n\t\t\tvar n int\n\t\t\ttag, n = protowire.ConsumeVarint(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\tb = b[n:]\n\t\t}\n\t\tvar num protowire.Number\n\t\tif n := tag >> 3; n < uint64(protowire.MinValidNumber) || n > uint64(protowire.MaxValidNumber) {\n\t\t\treturn out, errDecode\n\t\t} else {\n\t\t\tnum = protowire.Number(n)\n\t\t}\n\t\twtyp := protowire.Type(tag & 7)\n\n\t\tif wtyp == protowire.EndGroupType {\n\t\t\tif num != groupTag {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\tgroupTag = 0\n\t\t\tbreak\n\t\t}\n\n\t\tvar f *coderFieldInfo\n\t\tif int(num) < len(mi.denseCoderFields) {\n\t\t\tf = mi.denseCoderFields[num]\n\t\t} else {\n\t\t\tf = mi.coderFields[num]\n\t\t}\n\t\tvar n int\n\t\terr := errUnknown\n\t\tswitch {\n\t\tcase f != nil:\n\t\t\tif f.funcs.unmarshal == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tvar o unmarshalOutput\n\t\t\to, err = f.funcs.unmarshal(b, p.Apply(f.offset), wtyp, f, opts)\n\t\t\tn = o.n\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\trequiredMask |= f.validation.requiredBit\n\t\t\tif f.funcs.isInit != nil && !o.initialized {\n\t\t\t\tinitialized = false\n\t\t\t}\n\t\tdefault:\n\t\t\t// Possible extension.\n\t\t\tif exts == nil && mi.extensionOffset.IsValid() {\n\t\t\t\texts = p.Apply(mi.extensionOffset).Extensions()\n\t\t\t\tif *exts == nil {\n\t\t\t\t\t*exts = make(map[int32]ExtensionField)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif exts == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tvar o unmarshalOutput\n\t\t\to, err = mi.unmarshalExtension(b, num, wtyp, *exts, opts)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tn = o.n\n\t\t\tif !o.initialized {\n\t\t\t\tinitialized = false\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\tif err != errUnknown {\n\t\t\t\treturn out, err\n\t\t\t}\n\t\t\tn = protowire.ConsumeFieldValue(num, wtyp, b)\n\t\t\tif n < 0 {\n\t\t\t\treturn out, errDecode\n\t\t\t}\n\t\t\tif !opts.DiscardUnknown() && mi.unknownOffset.IsValid() {\n\t\t\t\tu := mi.mutableUnknownBytes(p)\n\t\t\t\t*u = protowire.AppendTag(*u, num, wtyp)\n\t\t\t\t*u = append(*u, b[:n]...)\n\t\t\t}\n\t\t}\n\t\tb = b[n:]\n\t}\n\tif groupTag != 0 {\n\t\treturn out, errDecode\n\t}\n\tif mi.numRequiredFields > 0 && bits.OnesCount64(requiredMask) != int(mi.numRequiredFields) {\n\t\tinitialized = false\n\t}\n\tif initialized {\n\t\tout.initialized = true\n\t}\n\tout.n = start - len(b)\n\treturn out, nil\n}\n\nfunc (mi *MessageInfo) unmarshalExtension(b []byte, num protowire.Number, wtyp protowire.Type, exts map[int32]ExtensionField, opts unmarshalOptions) (out unmarshalOutput, err error) {\n\tx := exts[int32(num)]\n\txt := x.Type()\n\tif xt == nil {\n\t\tvar err error\n\t\txt, err = opts.resolver.FindExtensionByNumber(mi.Desc.FullName(), num)\n\t\tif err != nil {\n\t\t\tif err == preg.NotFound {\n\t\t\t\treturn out, errUnknown\n\t\t\t}\n\t\t\treturn out, errors.New(\"%v: unable to resolve extension %v: %v\", mi.Desc.FullName(), num, err)\n\t\t}\n\t}\n\txi := getExtensionFieldInfo(xt)\n\tif xi.funcs.unmarshal == nil {\n\t\treturn out, errUnknown\n\t}\n\tif flags.LazyUnmarshalExtensions {\n\t\tif opts.IsDefault() && x.canLazy(xt) {\n\t\t\tout, valid := skipExtension(b, xi, num, wtyp, opts)\n\t\t\tswitch valid {\n\t\t\tcase ValidationValid:\n\t\t\t\tif out.initialized {\n\t\t\t\t\tx.appendLazyBytes(xt, xi, num, wtyp, b[:out.n])\n\t\t\t\t\texts[int32(num)] = x\n\t\t\t\t\treturn out, nil\n\t\t\t\t}\n\t\t\tcase ValidationInvalid:\n\t\t\t\treturn out, errDecode\n\t\t\tcase ValidationUnknown:\n\t\t\t}\n\t\t}\n\t}\n\tival := x.Value()\n\tif !ival.IsValid() && xi.unmarshalNeedsValue {\n\t\t// Create a new message, list, or map value to fill in.\n\t\t// For enums, create a prototype value to let the unmarshal func know the\n\t\t// concrete type.\n\t\tival = xt.New()\n\t}\n\tv, out, err := xi.funcs.unmarshal(b, ival, num, wtyp, opts)\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tif xi.funcs.isInit == nil {\n\t\tout.initialized = true\n\t}\n\tx.Set(xt, v)\n\texts[int32(num)] = x\n\treturn out, nil\n}\n\nfunc skipExtension(b []byte, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, _ ValidationStatus) {\n\tif xi.validation.mi == nil {\n\t\treturn out, ValidationUnknown\n\t}\n\txi.validation.mi.init()\n\tswitch xi.validation.typ {\n\tcase validationTypeMessage:\n\t\tif wtyp != protowire.BytesType {\n\t\t\treturn out, ValidationUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn out, ValidationUnknown\n\t\t}\n\t\tout, st := xi.validation.mi.validate(v, 0, opts)\n\t\tout.n = n\n\t\treturn out, st\n\tcase validationTypeGroup:\n\t\tif wtyp != protowire.StartGroupType {\n\t\t\treturn out, ValidationUnknown\n\t\t}\n\t\tout, st := xi.validation.mi.validate(b, num, opts)\n\t\treturn out, st\n\tdefault:\n\t\treturn out, ValidationUnknown\n\t}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/encode.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 impl\n\nimport (\n\t\"math\"\n\t\"sort\"\n\t\"sync/atomic\"\n\n\t\"google.golang.org/protobuf/internal/flags\"\n\tproto \"google.golang.org/protobuf/proto\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\ntype marshalOptions struct {\n\tflags piface.MarshalInputFlags\n}\n\nfunc (o marshalOptions) Options() proto.MarshalOptions {\n\treturn proto.MarshalOptions{\n\t\tAllowPartial:  true,\n\t\tDeterministic: o.Deterministic(),\n\t\tUseCachedSize: o.UseCachedSize(),\n\t}\n}\n\nfunc (o marshalOptions) Deterministic() bool { return o.flags&piface.MarshalDeterministic != 0 }\nfunc (o marshalOptions) UseCachedSize() bool { return o.flags&piface.MarshalUseCachedSize != 0 }\n\n// size is protoreflect.Methods.Size.\nfunc (mi *MessageInfo) size(in piface.SizeInput) piface.SizeOutput {\n\tvar p pointer\n\tif ms, ok := in.Message.(*messageState); ok {\n\t\tp = ms.pointer()\n\t} else {\n\t\tp = in.Message.(*messageReflectWrapper).pointer()\n\t}\n\tsize := mi.sizePointer(p, marshalOptions{\n\t\tflags: in.Flags,\n\t})\n\treturn piface.SizeOutput{Size: size}\n}\n\nfunc (mi *MessageInfo) sizePointer(p pointer, opts marshalOptions) (size int) {\n\tmi.init()\n\tif p.IsNil() {\n\t\treturn 0\n\t}\n\tif opts.UseCachedSize() && mi.sizecacheOffset.IsValid() {\n\t\tif size := atomic.LoadInt32(p.Apply(mi.sizecacheOffset).Int32()); size >= 0 {\n\t\t\treturn int(size)\n\t\t}\n\t}\n\treturn mi.sizePointerSlow(p, opts)\n}\n\nfunc (mi *MessageInfo) sizePointerSlow(p pointer, opts marshalOptions) (size int) {\n\tif flags.ProtoLegacy && mi.isMessageSet {\n\t\tsize = sizeMessageSet(mi, p, opts)\n\t\tif mi.sizecacheOffset.IsValid() {\n\t\t\tatomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size))\n\t\t}\n\t\treturn size\n\t}\n\tif mi.extensionOffset.IsValid() {\n\t\te := p.Apply(mi.extensionOffset).Extensions()\n\t\tsize += mi.sizeExtensions(e, opts)\n\t}\n\tfor _, f := range mi.orderedCoderFields {\n\t\tif f.funcs.size == nil {\n\t\t\tcontinue\n\t\t}\n\t\tfptr := p.Apply(f.offset)\n\t\tif f.isPointer && fptr.Elem().IsNil() {\n\t\t\tcontinue\n\t\t}\n\t\tsize += f.funcs.size(fptr, f, opts)\n\t}\n\tif mi.unknownOffset.IsValid() {\n\t\tif u := mi.getUnknownBytes(p); u != nil {\n\t\t\tsize += len(*u)\n\t\t}\n\t}\n\tif mi.sizecacheOffset.IsValid() {\n\t\tif size > math.MaxInt32 {\n\t\t\t// The size is too large for the int32 sizecache field.\n\t\t\t// We will need to recompute the size when encoding;\n\t\t\t// unfortunately expensive, but better than invalid output.\n\t\t\tatomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), -1)\n\t\t} else {\n\t\t\tatomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size))\n\t\t}\n\t}\n\treturn size\n}\n\n// marshal is protoreflect.Methods.Marshal.\nfunc (mi *MessageInfo) marshal(in piface.MarshalInput) (out piface.MarshalOutput, err error) {\n\tvar p pointer\n\tif ms, ok := in.Message.(*messageState); ok {\n\t\tp = ms.pointer()\n\t} else {\n\t\tp = in.Message.(*messageReflectWrapper).pointer()\n\t}\n\tb, err := mi.marshalAppendPointer(in.Buf, p, marshalOptions{\n\t\tflags: in.Flags,\n\t})\n\treturn piface.MarshalOutput{Buf: b}, err\n}\n\nfunc (mi *MessageInfo) marshalAppendPointer(b []byte, p pointer, opts marshalOptions) ([]byte, error) {\n\tmi.init()\n\tif p.IsNil() {\n\t\treturn b, nil\n\t}\n\tif flags.ProtoLegacy && mi.isMessageSet {\n\t\treturn marshalMessageSet(mi, b, p, opts)\n\t}\n\tvar err error\n\t// The old marshaler encodes extensions at beginning.\n\tif mi.extensionOffset.IsValid() {\n\t\te := p.Apply(mi.extensionOffset).Extensions()\n\t\t// TODO: Special handling for MessageSet?\n\t\tb, err = mi.appendExtensions(b, e, opts)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\tfor _, f := range mi.orderedCoderFields {\n\t\tif f.funcs.marshal == nil {\n\t\t\tcontinue\n\t\t}\n\t\tfptr := p.Apply(f.offset)\n\t\tif f.isPointer && fptr.Elem().IsNil() {\n\t\t\tcontinue\n\t\t}\n\t\tb, err = f.funcs.marshal(b, fptr, f, opts)\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\tif mi.unknownOffset.IsValid() && !mi.isMessageSet {\n\t\tif u := mi.getUnknownBytes(p); u != nil {\n\t\t\tb = append(b, (*u)...)\n\t\t}\n\t}\n\treturn b, nil\n}\n\nfunc (mi *MessageInfo) sizeExtensions(ext *map[int32]ExtensionField, opts marshalOptions) (n int) {\n\tif ext == nil {\n\t\treturn 0\n\t}\n\tfor _, x := range *ext {\n\t\txi := getExtensionFieldInfo(x.Type())\n\t\tif xi.funcs.size == nil {\n\t\t\tcontinue\n\t\t}\n\t\tn += xi.funcs.size(x.Value(), xi.tagsize, opts)\n\t}\n\treturn n\n}\n\nfunc (mi *MessageInfo) appendExtensions(b []byte, ext *map[int32]ExtensionField, opts marshalOptions) ([]byte, error) {\n\tif ext == nil {\n\t\treturn b, nil\n\t}\n\n\tswitch len(*ext) {\n\tcase 0:\n\t\treturn b, nil\n\tcase 1:\n\t\t// Fast-path for one extension: Don't bother sorting the keys.\n\t\tvar err error\n\t\tfor _, x := range *ext {\n\t\t\txi := getExtensionFieldInfo(x.Type())\n\t\t\tb, err = xi.funcs.marshal(b, x.Value(), xi.wiretag, opts)\n\t\t}\n\t\treturn b, err\n\tdefault:\n\t\t// Sort the keys to provide a deterministic encoding.\n\t\t// Not sure this is required, but the old code does it.\n\t\tkeys := make([]int, 0, len(*ext))\n\t\tfor k := range *ext {\n\t\t\tkeys = append(keys, int(k))\n\t\t}\n\t\tsort.Ints(keys)\n\t\tvar err error\n\t\tfor _, k := range keys {\n\t\t\tx := (*ext)[int32(k)]\n\t\t\txi := getExtensionFieldInfo(x.Type())\n\t\t\tb, err = xi.funcs.marshal(b, x.Value(), xi.wiretag, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn b, err\n\t\t\t}\n\t\t}\n\t\treturn b, nil\n\t}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/enum.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 impl\n\nimport (\n\t\"reflect\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype EnumInfo struct {\n\tGoReflectType reflect.Type // int32 kind\n\tDesc          pref.EnumDescriptor\n}\n\nfunc (t *EnumInfo) New(n pref.EnumNumber) pref.Enum {\n\treturn reflect.ValueOf(n).Convert(t.GoReflectType).Interface().(pref.Enum)\n}\nfunc (t *EnumInfo) Descriptor() pref.EnumDescriptor { return t.Desc }\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/extension.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 impl\n\nimport (\n\t\"reflect\"\n\t\"sync\"\n\t\"sync/atomic\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// ExtensionInfo implements ExtensionType.\n//\n// This type contains a number of exported fields for legacy compatibility.\n// The only non-deprecated use of this type is through the methods of the\n// ExtensionType interface.\ntype ExtensionInfo struct {\n\t// An ExtensionInfo may exist in several stages of initialization.\n\t//\n\t// extensionInfoUninitialized: Some or all of the legacy exported\n\t// fields may be set, but none of the unexported fields have been\n\t// initialized. This is the starting state for an ExtensionInfo\n\t// in legacy generated code.\n\t//\n\t// extensionInfoDescInit: The desc field is set, but other unexported fields\n\t// may not be initialized. Legacy exported fields may or may not be set.\n\t// This is the starting state for an ExtensionInfo in newly generated code.\n\t//\n\t// extensionInfoFullInit: The ExtensionInfo is fully initialized.\n\t// This state is only entered after lazy initialization is complete.\n\tinit uint32\n\tmu   sync.Mutex\n\n\tgoType reflect.Type\n\tdesc   extensionTypeDescriptor\n\tconv   Converter\n\tinfo   *extensionFieldInfo // for fast-path method implementations\n\n\t// ExtendedType is a typed nil-pointer to the parent message type that\n\t// is being extended. It is possible for this to be unpopulated in v2\n\t// since the message may no longer implement the MessageV1 interface.\n\t//\n\t// Deprecated: Use the ExtendedType method instead.\n\tExtendedType piface.MessageV1\n\n\t// ExtensionType is the zero value of the extension type.\n\t//\n\t// For historical reasons, reflect.TypeOf(ExtensionType) and the\n\t// type returned by InterfaceOf may not be identical.\n\t//\n\t// Deprecated: Use InterfaceOf(xt.Zero()) instead.\n\tExtensionType interface{}\n\n\t// Field is the field number of the extension.\n\t//\n\t// Deprecated: Use the Descriptor().Number method instead.\n\tField int32\n\n\t// Name is the fully qualified name of extension.\n\t//\n\t// Deprecated: Use the Descriptor().FullName method instead.\n\tName string\n\n\t// Tag is the protobuf struct tag used in the v1 API.\n\t//\n\t// Deprecated: Do not use.\n\tTag string\n\n\t// Filename is the proto filename in which the extension is defined.\n\t//\n\t// Deprecated: Use Descriptor().ParentFile().Path() instead.\n\tFilename string\n}\n\n// Stages of initialization: See the ExtensionInfo.init field.\nconst (\n\textensionInfoUninitialized = 0\n\textensionInfoDescInit      = 1\n\textensionInfoFullInit      = 2\n)\n\nfunc InitExtensionInfo(xi *ExtensionInfo, xd pref.ExtensionDescriptor, goType reflect.Type) {\n\txi.goType = goType\n\txi.desc = extensionTypeDescriptor{xd, xi}\n\txi.init = extensionInfoDescInit\n}\n\nfunc (xi *ExtensionInfo) New() pref.Value {\n\treturn xi.lazyInit().New()\n}\nfunc (xi *ExtensionInfo) Zero() pref.Value {\n\treturn xi.lazyInit().Zero()\n}\nfunc (xi *ExtensionInfo) ValueOf(v interface{}) pref.Value {\n\treturn xi.lazyInit().PBValueOf(reflect.ValueOf(v))\n}\nfunc (xi *ExtensionInfo) InterfaceOf(v pref.Value) interface{} {\n\treturn xi.lazyInit().GoValueOf(v).Interface()\n}\nfunc (xi *ExtensionInfo) IsValidValue(v pref.Value) bool {\n\treturn xi.lazyInit().IsValidPB(v)\n}\nfunc (xi *ExtensionInfo) IsValidInterface(v interface{}) bool {\n\treturn xi.lazyInit().IsValidGo(reflect.ValueOf(v))\n}\nfunc (xi *ExtensionInfo) TypeDescriptor() pref.ExtensionTypeDescriptor {\n\tif atomic.LoadUint32(&xi.init) < extensionInfoDescInit {\n\t\txi.lazyInitSlow()\n\t}\n\treturn &xi.desc\n}\n\nfunc (xi *ExtensionInfo) lazyInit() Converter {\n\tif atomic.LoadUint32(&xi.init) < extensionInfoFullInit {\n\t\txi.lazyInitSlow()\n\t}\n\treturn xi.conv\n}\n\nfunc (xi *ExtensionInfo) lazyInitSlow() {\n\txi.mu.Lock()\n\tdefer xi.mu.Unlock()\n\n\tif xi.init == extensionInfoFullInit {\n\t\treturn\n\t}\n\tdefer atomic.StoreUint32(&xi.init, extensionInfoFullInit)\n\n\tif xi.desc.ExtensionDescriptor == nil {\n\t\txi.initFromLegacy()\n\t}\n\tif !xi.desc.ExtensionDescriptor.IsPlaceholder() {\n\t\tif xi.ExtensionType == nil {\n\t\t\txi.initToLegacy()\n\t\t}\n\t\txi.conv = NewConverter(xi.goType, xi.desc.ExtensionDescriptor)\n\t\txi.info = makeExtensionFieldInfo(xi.desc.ExtensionDescriptor)\n\t\txi.info.validation = newValidationInfo(xi.desc.ExtensionDescriptor, xi.goType)\n\t}\n}\n\ntype extensionTypeDescriptor struct {\n\tpref.ExtensionDescriptor\n\txi *ExtensionInfo\n}\n\nfunc (xtd *extensionTypeDescriptor) Type() pref.ExtensionType {\n\treturn xtd.xi\n}\nfunc (xtd *extensionTypeDescriptor) Descriptor() pref.ExtensionDescriptor {\n\treturn xtd.ExtensionDescriptor\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/legacy_enum.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// legacyEnumName returns the name of enums used in legacy code.\n// It is neither the protobuf full name nor the qualified Go name,\n// but rather an odd hybrid of both.\nfunc legacyEnumName(ed pref.EnumDescriptor) string {\n\tvar protoPkg string\n\tenumName := string(ed.FullName())\n\tif fd := ed.ParentFile(); fd != nil {\n\t\tprotoPkg = string(fd.Package())\n\t\tenumName = strings.TrimPrefix(enumName, protoPkg+\".\")\n\t}\n\tif protoPkg == \"\" {\n\t\treturn strs.GoCamelCase(enumName)\n\t}\n\treturn protoPkg + \".\" + strs.GoCamelCase(enumName)\n}\n\n// legacyWrapEnum wraps v as a protoreflect.Enum,\n// where v must be a int32 kind and not implement the v2 API already.\nfunc legacyWrapEnum(v reflect.Value) pref.Enum {\n\tet := legacyLoadEnumType(v.Type())\n\treturn et.New(pref.EnumNumber(v.Int()))\n}\n\nvar legacyEnumTypeCache sync.Map // map[reflect.Type]protoreflect.EnumType\n\n// legacyLoadEnumType dynamically loads a protoreflect.EnumType for t,\n// where t must be an int32 kind and not implement the v2 API already.\nfunc legacyLoadEnumType(t reflect.Type) pref.EnumType {\n\t// Fast-path: check if a EnumType is cached for this concrete type.\n\tif et, ok := legacyEnumTypeCache.Load(t); ok {\n\t\treturn et.(pref.EnumType)\n\t}\n\n\t// Slow-path: derive enum descriptor and initialize EnumType.\n\tvar et pref.EnumType\n\ted := LegacyLoadEnumDesc(t)\n\tet = &legacyEnumType{\n\t\tdesc:   ed,\n\t\tgoType: t,\n\t}\n\tif et, ok := legacyEnumTypeCache.LoadOrStore(t, et); ok {\n\t\treturn et.(pref.EnumType)\n\t}\n\treturn et\n}\n\ntype legacyEnumType struct {\n\tdesc   pref.EnumDescriptor\n\tgoType reflect.Type\n\tm      sync.Map // map[protoreflect.EnumNumber]proto.Enum\n}\n\nfunc (t *legacyEnumType) New(n pref.EnumNumber) pref.Enum {\n\tif e, ok := t.m.Load(n); ok {\n\t\treturn e.(pref.Enum)\n\t}\n\te := &legacyEnumWrapper{num: n, pbTyp: t, goTyp: t.goType}\n\tt.m.Store(n, e)\n\treturn e\n}\nfunc (t *legacyEnumType) Descriptor() pref.EnumDescriptor {\n\treturn t.desc\n}\n\ntype legacyEnumWrapper struct {\n\tnum   pref.EnumNumber\n\tpbTyp pref.EnumType\n\tgoTyp reflect.Type\n}\n\nfunc (e *legacyEnumWrapper) Descriptor() pref.EnumDescriptor {\n\treturn e.pbTyp.Descriptor()\n}\nfunc (e *legacyEnumWrapper) Type() pref.EnumType {\n\treturn e.pbTyp\n}\nfunc (e *legacyEnumWrapper) Number() pref.EnumNumber {\n\treturn e.num\n}\nfunc (e *legacyEnumWrapper) ProtoReflect() pref.Enum {\n\treturn e\n}\nfunc (e *legacyEnumWrapper) protoUnwrap() interface{} {\n\tv := reflect.New(e.goTyp).Elem()\n\tv.SetInt(int64(e.num))\n\treturn v.Interface()\n}\n\nvar (\n\t_ pref.Enum = (*legacyEnumWrapper)(nil)\n\t_ unwrapper = (*legacyEnumWrapper)(nil)\n)\n\nvar legacyEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor\n\n// LegacyLoadEnumDesc returns an EnumDescriptor derived from the Go type,\n// which must be an int32 kind and not implement the v2 API already.\n//\n// This is exported for testing purposes.\nfunc LegacyLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {\n\t// Fast-path: check if an EnumDescriptor is cached for this concrete type.\n\tif ed, ok := legacyEnumDescCache.Load(t); ok {\n\t\treturn ed.(pref.EnumDescriptor)\n\t}\n\n\t// Slow-path: initialize EnumDescriptor from the raw descriptor.\n\tev := reflect.Zero(t).Interface()\n\tif _, ok := ev.(pref.Enum); ok {\n\t\tpanic(fmt.Sprintf(\"%v already implements proto.Enum\", t))\n\t}\n\tedV1, ok := ev.(enumV1)\n\tif !ok {\n\t\treturn aberrantLoadEnumDesc(t)\n\t}\n\tb, idxs := edV1.EnumDescriptor()\n\n\tvar ed pref.EnumDescriptor\n\tif len(idxs) == 1 {\n\t\ted = legacyLoadFileDesc(b).Enums().Get(idxs[0])\n\t} else {\n\t\tmd := legacyLoadFileDesc(b).Messages().Get(idxs[0])\n\t\tfor _, i := range idxs[1 : len(idxs)-1] {\n\t\t\tmd = md.Messages().Get(i)\n\t\t}\n\t\ted = md.Enums().Get(idxs[len(idxs)-1])\n\t}\n\tif ed, ok := legacyEnumDescCache.LoadOrStore(t, ed); ok {\n\t\treturn ed.(protoreflect.EnumDescriptor)\n\t}\n\treturn ed\n}\n\nvar aberrantEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor\n\n// aberrantLoadEnumDesc returns an EnumDescriptor derived from the Go type,\n// which must not implement protoreflect.Enum or enumV1.\n//\n// If the type does not implement enumV1, then there is no reliable\n// way to derive the original protobuf type information.\n// We are unable to use the global enum registry since it is\n// unfortunately keyed by the protobuf full name, which we also do not know.\n// Thus, this produces some bogus enum descriptor based on the Go type name.\nfunc aberrantLoadEnumDesc(t reflect.Type) pref.EnumDescriptor {\n\t// Fast-path: check if an EnumDescriptor is cached for this concrete type.\n\tif ed, ok := aberrantEnumDescCache.Load(t); ok {\n\t\treturn ed.(pref.EnumDescriptor)\n\t}\n\n\t// Slow-path: construct a bogus, but unique EnumDescriptor.\n\ted := &filedesc.Enum{L2: new(filedesc.EnumL2)}\n\ted.L0.FullName = AberrantDeriveFullName(t) // e.g., github_com.user.repo.MyEnum\n\ted.L0.ParentFile = filedesc.SurrogateProto3\n\ted.L2.Values.List = append(ed.L2.Values.List, filedesc.EnumValue{})\n\n\t// TODO: Use the presence of a UnmarshalJSON method to determine proto2?\n\n\tvd := &ed.L2.Values.List[0]\n\tvd.L0.FullName = ed.L0.FullName + \"_UNKNOWN\" // e.g., github_com.user.repo.MyEnum_UNKNOWN\n\tvd.L0.ParentFile = ed.L0.ParentFile\n\tvd.L0.Parent = ed\n\n\t// TODO: We could use the String method to obtain some enum value names by\n\t// starting at 0 and print the enum until it produces invalid identifiers.\n\t// An exhaustive query is clearly impractical, but can be best-effort.\n\n\tif ed, ok := aberrantEnumDescCache.LoadOrStore(t, ed); ok {\n\t\treturn ed.(pref.EnumDescriptor)\n\t}\n\treturn ed\n}\n\n// AberrantDeriveFullName derives a fully qualified protobuf name for the given Go type\n// The provided name is not guaranteed to be stable nor universally unique.\n// It should be sufficiently unique within a program.\n//\n// This is exported for testing purposes.\nfunc AberrantDeriveFullName(t reflect.Type) pref.FullName {\n\tsanitize := func(r rune) rune {\n\t\tswitch {\n\t\tcase r == '/':\n\t\t\treturn '.'\n\t\tcase 'a' <= r && r <= 'z', 'A' <= r && r <= 'Z', '0' <= r && r <= '9':\n\t\t\treturn r\n\t\tdefault:\n\t\t\treturn '_'\n\t\t}\n\t}\n\tprefix := strings.Map(sanitize, t.PkgPath())\n\tsuffix := strings.Map(sanitize, t.Name())\n\tif suffix == \"\" {\n\t\tsuffix = fmt.Sprintf(\"UnknownX%X\", reflect.ValueOf(t).Pointer())\n\t}\n\n\tss := append(strings.Split(prefix, \".\"), suffix)\n\tfor i, s := range ss {\n\t\tif s == \"\" || ('0' <= s[0] && s[0] <= '9') {\n\t\t\tss[i] = \"x\" + s\n\t\t}\n\t}\n\treturn pref.FullName(strings.Join(ss, \".\"))\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/legacy_export.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 impl\n\nimport (\n\t\"encoding/binary\"\n\t\"encoding/json\"\n\t\"hash/crc32\"\n\t\"math\"\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/internal/errors\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// These functions exist to support exported APIs in generated protobufs.\n// While these are deprecated, they cannot be removed for compatibility reasons.\n\n// LegacyEnumName returns the name of enums used in legacy code.\nfunc (Export) LegacyEnumName(ed pref.EnumDescriptor) string {\n\treturn legacyEnumName(ed)\n}\n\n// LegacyMessageTypeOf returns the protoreflect.MessageType for m,\n// with name used as the message name if necessary.\nfunc (Export) LegacyMessageTypeOf(m piface.MessageV1, name pref.FullName) pref.MessageType {\n\tif mv := (Export{}).protoMessageV2Of(m); mv != nil {\n\t\treturn mv.ProtoReflect().Type()\n\t}\n\treturn legacyLoadMessageType(reflect.TypeOf(m), name)\n}\n\n// UnmarshalJSONEnum unmarshals an enum from a JSON-encoded input.\n// The input can either be a string representing the enum value by name,\n// or a number representing the enum number itself.\nfunc (Export) UnmarshalJSONEnum(ed pref.EnumDescriptor, b []byte) (pref.EnumNumber, error) {\n\tif b[0] == '\"' {\n\t\tvar name pref.Name\n\t\tif err := json.Unmarshal(b, &name); err != nil {\n\t\t\treturn 0, errors.New(\"invalid input for enum %v: %s\", ed.FullName(), b)\n\t\t}\n\t\tev := ed.Values().ByName(name)\n\t\tif ev == nil {\n\t\t\treturn 0, errors.New(\"invalid value for enum %v: %s\", ed.FullName(), name)\n\t\t}\n\t\treturn ev.Number(), nil\n\t} else {\n\t\tvar num pref.EnumNumber\n\t\tif err := json.Unmarshal(b, &num); err != nil {\n\t\t\treturn 0, errors.New(\"invalid input for enum %v: %s\", ed.FullName(), b)\n\t\t}\n\t\treturn num, nil\n\t}\n}\n\n// CompressGZIP compresses the input as a GZIP-encoded file.\n// The current implementation does no compression.\nfunc (Export) CompressGZIP(in []byte) (out []byte) {\n\t// RFC 1952, section 2.3.1.\n\tvar gzipHeader = [10]byte{0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff}\n\n\t// RFC 1951, section 3.2.4.\n\tvar blockHeader [5]byte\n\tconst maxBlockSize = math.MaxUint16\n\tnumBlocks := 1 + len(in)/maxBlockSize\n\n\t// RFC 1952, section 2.3.1.\n\tvar gzipFooter [8]byte\n\tbinary.LittleEndian.PutUint32(gzipFooter[0:4], crc32.ChecksumIEEE(in))\n\tbinary.LittleEndian.PutUint32(gzipFooter[4:8], uint32(len(in)))\n\n\t// Encode the input without compression using raw DEFLATE blocks.\n\tout = make([]byte, 0, len(gzipHeader)+len(blockHeader)*numBlocks+len(in)+len(gzipFooter))\n\tout = append(out, gzipHeader[:]...)\n\tfor blockHeader[0] == 0 {\n\t\tblockSize := maxBlockSize\n\t\tif blockSize > len(in) {\n\t\t\tblockHeader[0] = 0x01 // final bit per RFC 1951, section 3.2.3.\n\t\t\tblockSize = len(in)\n\t\t}\n\t\tbinary.LittleEndian.PutUint16(blockHeader[1:3], uint16(blockSize)^0x0000)\n\t\tbinary.LittleEndian.PutUint16(blockHeader[3:5], uint16(blockSize)^0xffff)\n\t\tout = append(out, blockHeader[:]...)\n\t\tout = append(out, in[:blockSize]...)\n\t\tin = in[blockSize:]\n\t}\n\tout = append(out, gzipFooter[:]...)\n\treturn out\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/legacy_extension.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 impl\n\nimport (\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/internal/descopts\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\tptag \"google.golang.org/protobuf/internal/encoding/tag\"\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\nfunc (xi *ExtensionInfo) initToLegacy() {\n\txd := xi.desc\n\tvar parent piface.MessageV1\n\tmessageName := xd.ContainingMessage().FullName()\n\tif mt, _ := preg.GlobalTypes.FindMessageByName(messageName); mt != nil {\n\t\t// Create a new parent message and unwrap it if possible.\n\t\tmv := mt.New().Interface()\n\t\tt := reflect.TypeOf(mv)\n\t\tif mv, ok := mv.(unwrapper); ok {\n\t\t\tt = reflect.TypeOf(mv.protoUnwrap())\n\t\t}\n\n\t\t// Check whether the message implements the legacy v1 Message interface.\n\t\tmz := reflect.Zero(t).Interface()\n\t\tif mz, ok := mz.(piface.MessageV1); ok {\n\t\t\tparent = mz\n\t\t}\n\t}\n\n\t// Determine the v1 extension type, which is unfortunately not the same as\n\t// the v2 ExtensionType.GoType.\n\textType := xi.goType\n\tswitch extType.Kind() {\n\tcase reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String:\n\t\textType = reflect.PtrTo(extType) // T -> *T for singular scalar fields\n\t}\n\n\t// Reconstruct the legacy enum full name.\n\tvar enumName string\n\tif xd.Kind() == pref.EnumKind {\n\t\tenumName = legacyEnumName(xd.Enum())\n\t}\n\n\t// Derive the proto file that the extension was declared within.\n\tvar filename string\n\tif fd := xd.ParentFile(); fd != nil {\n\t\tfilename = fd.Path()\n\t}\n\n\t// For MessageSet extensions, the name used is the parent message.\n\tname := xd.FullName()\n\tif messageset.IsMessageSetExtension(xd) {\n\t\tname = name.Parent()\n\t}\n\n\txi.ExtendedType = parent\n\txi.ExtensionType = reflect.Zero(extType).Interface()\n\txi.Field = int32(xd.Number())\n\txi.Name = string(name)\n\txi.Tag = ptag.Marshal(xd, enumName)\n\txi.Filename = filename\n}\n\n// initFromLegacy initializes an ExtensionInfo from\n// the contents of the deprecated exported fields of the type.\nfunc (xi *ExtensionInfo) initFromLegacy() {\n\t// The v1 API returns \"type incomplete\" descriptors where only the\n\t// field number is specified. In such a case, use a placeholder.\n\tif xi.ExtendedType == nil || xi.ExtensionType == nil {\n\t\txd := placeholderExtension{\n\t\t\tname:   pref.FullName(xi.Name),\n\t\t\tnumber: pref.FieldNumber(xi.Field),\n\t\t}\n\t\txi.desc = extensionTypeDescriptor{xd, xi}\n\t\treturn\n\t}\n\n\t// Resolve enum or message dependencies.\n\tvar ed pref.EnumDescriptor\n\tvar md pref.MessageDescriptor\n\tt := reflect.TypeOf(xi.ExtensionType)\n\tisOptional := t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct\n\tisRepeated := t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8\n\tif isOptional || isRepeated {\n\t\tt = t.Elem()\n\t}\n\tswitch v := reflect.Zero(t).Interface().(type) {\n\tcase pref.Enum:\n\t\ted = v.Descriptor()\n\tcase enumV1:\n\t\ted = LegacyLoadEnumDesc(t)\n\tcase pref.ProtoMessage:\n\t\tmd = v.ProtoReflect().Descriptor()\n\tcase messageV1:\n\t\tmd = LegacyLoadMessageDesc(t)\n\t}\n\n\t// Derive basic field information from the struct tag.\n\tvar evs pref.EnumValueDescriptors\n\tif ed != nil {\n\t\tevs = ed.Values()\n\t}\n\tfd := ptag.Unmarshal(xi.Tag, t, evs).(*filedesc.Field)\n\n\t// Construct a v2 ExtensionType.\n\txd := &filedesc.Extension{L2: new(filedesc.ExtensionL2)}\n\txd.L0.ParentFile = filedesc.SurrogateProto2\n\txd.L0.FullName = pref.FullName(xi.Name)\n\txd.L1.Number = pref.FieldNumber(xi.Field)\n\txd.L1.Cardinality = fd.L1.Cardinality\n\txd.L1.Kind = fd.L1.Kind\n\txd.L2.IsPacked = fd.L1.IsPacked\n\txd.L2.Default = fd.L1.Default\n\txd.L1.Extendee = Export{}.MessageDescriptorOf(xi.ExtendedType)\n\txd.L2.Enum = ed\n\txd.L2.Message = md\n\n\t// Derive real extension field name for MessageSets.\n\tif messageset.IsMessageSet(xd.L1.Extendee) && md.FullName() == xd.L0.FullName {\n\t\txd.L0.FullName = xd.L0.FullName.Append(messageset.ExtensionName)\n\t}\n\n\ttt := reflect.TypeOf(xi.ExtensionType)\n\tif isOptional {\n\t\ttt = tt.Elem()\n\t}\n\txi.goType = tt\n\txi.desc = extensionTypeDescriptor{xd, xi}\n}\n\ntype placeholderExtension struct {\n\tname   pref.FullName\n\tnumber pref.FieldNumber\n}\n\nfunc (x placeholderExtension) ParentFile() pref.FileDescriptor            { return nil }\nfunc (x placeholderExtension) Parent() pref.Descriptor                    { return nil }\nfunc (x placeholderExtension) Index() int                                 { return 0 }\nfunc (x placeholderExtension) Syntax() pref.Syntax                        { return 0 }\nfunc (x placeholderExtension) Name() pref.Name                            { return x.name.Name() }\nfunc (x placeholderExtension) FullName() pref.FullName                    { return x.name }\nfunc (x placeholderExtension) IsPlaceholder() bool                        { return true }\nfunc (x placeholderExtension) Options() pref.ProtoMessage                 { return descopts.Field }\nfunc (x placeholderExtension) Number() pref.FieldNumber                   { return x.number }\nfunc (x placeholderExtension) Cardinality() pref.Cardinality              { return 0 }\nfunc (x placeholderExtension) Kind() pref.Kind                            { return 0 }\nfunc (x placeholderExtension) HasJSONName() bool                          { return false }\nfunc (x placeholderExtension) JSONName() string                           { return \"[\" + string(x.name) + \"]\" }\nfunc (x placeholderExtension) TextName() string                           { return \"[\" + string(x.name) + \"]\" }\nfunc (x placeholderExtension) HasPresence() bool                          { return false }\nfunc (x placeholderExtension) HasOptionalKeyword() bool                   { return false }\nfunc (x placeholderExtension) IsExtension() bool                          { return true }\nfunc (x placeholderExtension) IsWeak() bool                               { return false }\nfunc (x placeholderExtension) IsPacked() bool                             { return false }\nfunc (x placeholderExtension) IsList() bool                               { return false }\nfunc (x placeholderExtension) IsMap() bool                                { return false }\nfunc (x placeholderExtension) MapKey() pref.FieldDescriptor               { return nil }\nfunc (x placeholderExtension) MapValue() pref.FieldDescriptor             { return nil }\nfunc (x placeholderExtension) HasDefault() bool                           { return false }\nfunc (x placeholderExtension) Default() pref.Value                        { return pref.Value{} }\nfunc (x placeholderExtension) DefaultEnumValue() pref.EnumValueDescriptor { return nil }\nfunc (x placeholderExtension) ContainingOneof() pref.OneofDescriptor      { return nil }\nfunc (x placeholderExtension) ContainingMessage() pref.MessageDescriptor  { return nil }\nfunc (x placeholderExtension) Enum() pref.EnumDescriptor                  { return nil }\nfunc (x placeholderExtension) Message() pref.MessageDescriptor            { return nil }\nfunc (x placeholderExtension) ProtoType(pref.FieldDescriptor)             { return }\nfunc (x placeholderExtension) ProtoInternal(pragma.DoNotImplement)        { return }\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/legacy_file.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 impl\n\nimport (\n\t\"bytes\"\n\t\"compress/gzip\"\n\t\"io/ioutil\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// Every enum and message type generated by protoc-gen-go since commit 2fc053c5\n// on February 25th, 2016 has had a method to get the raw descriptor.\n// Types that were not generated by protoc-gen-go or were generated prior\n// to that version are not supported.\n//\n// The []byte returned is the encoded form of a FileDescriptorProto message\n// compressed using GZIP. The []int is the path from the top-level file\n// to the specific message or enum declaration.\ntype (\n\tenumV1 interface {\n\t\tEnumDescriptor() ([]byte, []int)\n\t}\n\tmessageV1 interface {\n\t\tDescriptor() ([]byte, []int)\n\t}\n)\n\nvar legacyFileDescCache sync.Map // map[*byte]protoreflect.FileDescriptor\n\n// legacyLoadFileDesc unmarshals b as a compressed FileDescriptorProto message.\n//\n// This assumes that b is immutable and that b does not refer to part of a\n// concatenated series of GZIP files (which would require shenanigans that\n// rely on the concatenation properties of both protobufs and GZIP).\n// File descriptors generated by protoc-gen-go do not rely on that property.\nfunc legacyLoadFileDesc(b []byte) protoreflect.FileDescriptor {\n\t// Fast-path: check whether we already have a cached file descriptor.\n\tif fd, ok := legacyFileDescCache.Load(&b[0]); ok {\n\t\treturn fd.(protoreflect.FileDescriptor)\n\t}\n\n\t// Slow-path: decompress and unmarshal the file descriptor proto.\n\tzr, err := gzip.NewReader(bytes.NewReader(b))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tb2, err := ioutil.ReadAll(zr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfd := filedesc.Builder{\n\t\tRawDescriptor: b2,\n\t\tFileRegistry:  resolverOnly{protoregistry.GlobalFiles}, // do not register back to global registry\n\t}.Build().File\n\tif fd, ok := legacyFileDescCache.LoadOrStore(&b[0], fd); ok {\n\t\treturn fd.(protoreflect.FileDescriptor)\n\t}\n\treturn fd\n}\n\ntype resolverOnly struct {\n\treg *protoregistry.Files\n}\n\nfunc (r resolverOnly) FindFileByPath(path string) (protoreflect.FileDescriptor, error) {\n\treturn r.reg.FindFileByPath(path)\n}\nfunc (r resolverOnly) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) {\n\treturn r.reg.FindDescriptorByName(name)\n}\nfunc (resolverOnly) RegisterFile(protoreflect.FileDescriptor) error {\n\treturn nil\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/legacy_message.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/descopts\"\n\tptag \"google.golang.org/protobuf/internal/encoding/tag\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// legacyWrapMessage wraps v as a protoreflect.Message,\n// where v must be a *struct kind and not implement the v2 API already.\nfunc legacyWrapMessage(v reflect.Value) pref.Message {\n\tt := v.Type()\n\tif t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {\n\t\treturn aberrantMessage{v: v}\n\t}\n\tmt := legacyLoadMessageInfo(t, \"\")\n\treturn mt.MessageOf(v.Interface())\n}\n\n// legacyLoadMessageType dynamically loads a protoreflect.Type for t,\n// where t must be not implement the v2 API already.\n// The provided name is used if it cannot be determined from the message.\nfunc legacyLoadMessageType(t reflect.Type, name pref.FullName) protoreflect.MessageType {\n\tif t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {\n\t\treturn aberrantMessageType{t}\n\t}\n\treturn legacyLoadMessageInfo(t, name)\n}\n\nvar legacyMessageTypeCache sync.Map // map[reflect.Type]*MessageInfo\n\n// legacyLoadMessageInfo dynamically loads a *MessageInfo for t,\n// where t must be a *struct kind and not implement the v2 API already.\n// The provided name is used if it cannot be determined from the message.\nfunc legacyLoadMessageInfo(t reflect.Type, name pref.FullName) *MessageInfo {\n\t// Fast-path: check if a MessageInfo is cached for this concrete type.\n\tif mt, ok := legacyMessageTypeCache.Load(t); ok {\n\t\treturn mt.(*MessageInfo)\n\t}\n\n\t// Slow-path: derive message descriptor and initialize MessageInfo.\n\tmi := &MessageInfo{\n\t\tDesc:          legacyLoadMessageDesc(t, name),\n\t\tGoReflectType: t,\n\t}\n\n\tvar hasMarshal, hasUnmarshal bool\n\tv := reflect.Zero(t).Interface()\n\tif _, hasMarshal = v.(legacyMarshaler); hasMarshal {\n\t\tmi.methods.Marshal = legacyMarshal\n\n\t\t// We have no way to tell whether the type's Marshal method\n\t\t// supports deterministic serialization or not, but this\n\t\t// preserves the v1 implementation's behavior of always\n\t\t// calling Marshal methods when present.\n\t\tmi.methods.Flags |= piface.SupportMarshalDeterministic\n\t}\n\tif _, hasUnmarshal = v.(legacyUnmarshaler); hasUnmarshal {\n\t\tmi.methods.Unmarshal = legacyUnmarshal\n\t}\n\tif _, hasMerge := v.(legacyMerger); hasMerge || (hasMarshal && hasUnmarshal) {\n\t\tmi.methods.Merge = legacyMerge\n\t}\n\n\tif mi, ok := legacyMessageTypeCache.LoadOrStore(t, mi); ok {\n\t\treturn mi.(*MessageInfo)\n\t}\n\treturn mi\n}\n\nvar legacyMessageDescCache sync.Map // map[reflect.Type]protoreflect.MessageDescriptor\n\n// LegacyLoadMessageDesc returns an MessageDescriptor derived from the Go type,\n// which should be a *struct kind and must not implement the v2 API already.\n//\n// This is exported for testing purposes.\nfunc LegacyLoadMessageDesc(t reflect.Type) pref.MessageDescriptor {\n\treturn legacyLoadMessageDesc(t, \"\")\n}\nfunc legacyLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescriptor {\n\t// Fast-path: check if a MessageDescriptor is cached for this concrete type.\n\tif mi, ok := legacyMessageDescCache.Load(t); ok {\n\t\treturn mi.(pref.MessageDescriptor)\n\t}\n\n\t// Slow-path: initialize MessageDescriptor from the raw descriptor.\n\tmv := reflect.Zero(t).Interface()\n\tif _, ok := mv.(pref.ProtoMessage); ok {\n\t\tpanic(fmt.Sprintf(\"%v already implements proto.Message\", t))\n\t}\n\tmdV1, ok := mv.(messageV1)\n\tif !ok {\n\t\treturn aberrantLoadMessageDesc(t, name)\n\t}\n\n\t// If this is a dynamic message type where there isn't a 1-1 mapping between\n\t// Go and protobuf types, calling the Descriptor method on the zero value of\n\t// the message type isn't likely to work. If it panics, swallow the panic and\n\t// continue as if the Descriptor method wasn't present.\n\tb, idxs := func() ([]byte, []int) {\n\t\tdefer func() {\n\t\t\trecover()\n\t\t}()\n\t\treturn mdV1.Descriptor()\n\t}()\n\tif b == nil {\n\t\treturn aberrantLoadMessageDesc(t, name)\n\t}\n\n\t// If the Go type has no fields, then this might be a proto3 empty message\n\t// from before the size cache was added. If there are any fields, check to\n\t// see that at least one of them looks like something we generated.\n\tif t.Elem().Kind() == reflect.Struct {\n\t\tif nfield := t.Elem().NumField(); nfield > 0 {\n\t\t\thasProtoField := false\n\t\t\tfor i := 0; i < nfield; i++ {\n\t\t\t\tf := t.Elem().Field(i)\n\t\t\t\tif f.Tag.Get(\"protobuf\") != \"\" || f.Tag.Get(\"protobuf_oneof\") != \"\" || strings.HasPrefix(f.Name, \"XXX_\") {\n\t\t\t\t\thasProtoField = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !hasProtoField {\n\t\t\t\treturn aberrantLoadMessageDesc(t, name)\n\t\t\t}\n\t\t}\n\t}\n\n\tmd := legacyLoadFileDesc(b).Messages().Get(idxs[0])\n\tfor _, i := range idxs[1:] {\n\t\tmd = md.Messages().Get(i)\n\t}\n\tif name != \"\" && md.FullName() != name {\n\t\tpanic(fmt.Sprintf(\"mismatching message name: got %v, want %v\", md.FullName(), name))\n\t}\n\tif md, ok := legacyMessageDescCache.LoadOrStore(t, md); ok {\n\t\treturn md.(protoreflect.MessageDescriptor)\n\t}\n\treturn md\n}\n\nvar (\n\taberrantMessageDescLock  sync.Mutex\n\taberrantMessageDescCache map[reflect.Type]protoreflect.MessageDescriptor\n)\n\n// aberrantLoadMessageDesc returns an MessageDescriptor derived from the Go type,\n// which must not implement protoreflect.ProtoMessage or messageV1.\n//\n// This is a best-effort derivation of the message descriptor using the protobuf\n// tags on the struct fields.\nfunc aberrantLoadMessageDesc(t reflect.Type, name pref.FullName) pref.MessageDescriptor {\n\taberrantMessageDescLock.Lock()\n\tdefer aberrantMessageDescLock.Unlock()\n\tif aberrantMessageDescCache == nil {\n\t\taberrantMessageDescCache = make(map[reflect.Type]protoreflect.MessageDescriptor)\n\t}\n\treturn aberrantLoadMessageDescReentrant(t, name)\n}\nfunc aberrantLoadMessageDescReentrant(t reflect.Type, name pref.FullName) pref.MessageDescriptor {\n\t// Fast-path: check if an MessageDescriptor is cached for this concrete type.\n\tif md, ok := aberrantMessageDescCache[t]; ok {\n\t\treturn md\n\t}\n\n\t// Slow-path: construct a descriptor from the Go struct type (best-effort).\n\t// Cache the MessageDescriptor early on so that we can resolve internal\n\t// cyclic references.\n\tmd := &filedesc.Message{L2: new(filedesc.MessageL2)}\n\tmd.L0.FullName = aberrantDeriveMessageName(t, name)\n\tmd.L0.ParentFile = filedesc.SurrogateProto2\n\taberrantMessageDescCache[t] = md\n\n\tif t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {\n\t\treturn md\n\t}\n\n\t// Try to determine if the message is using proto3 by checking scalars.\n\tfor i := 0; i < t.Elem().NumField(); i++ {\n\t\tf := t.Elem().Field(i)\n\t\tif tag := f.Tag.Get(\"protobuf\"); tag != \"\" {\n\t\t\tswitch f.Type.Kind() {\n\t\t\tcase reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String:\n\t\t\t\tmd.L0.ParentFile = filedesc.SurrogateProto3\n\t\t\t}\n\t\t\tfor _, s := range strings.Split(tag, \",\") {\n\t\t\t\tif s == \"proto3\" {\n\t\t\t\t\tmd.L0.ParentFile = filedesc.SurrogateProto3\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Obtain a list of oneof wrapper types.\n\tvar oneofWrappers []reflect.Type\n\tfor _, method := range []string{\"XXX_OneofFuncs\", \"XXX_OneofWrappers\"} {\n\t\tif fn, ok := t.MethodByName(method); ok {\n\t\t\tfor _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {\n\t\t\t\tif vs, ok := v.Interface().([]interface{}); ok {\n\t\t\t\t\tfor _, v := range vs {\n\t\t\t\t\t\toneofWrappers = append(oneofWrappers, reflect.TypeOf(v))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Obtain a list of the extension ranges.\n\tif fn, ok := t.MethodByName(\"ExtensionRangeArray\"); ok {\n\t\tvs := fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0]\n\t\tfor i := 0; i < vs.Len(); i++ {\n\t\t\tv := vs.Index(i)\n\t\t\tmd.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, [2]pref.FieldNumber{\n\t\t\t\tpref.FieldNumber(v.FieldByName(\"Start\").Int()),\n\t\t\t\tpref.FieldNumber(v.FieldByName(\"End\").Int() + 1),\n\t\t\t})\n\t\t\tmd.L2.ExtensionRangeOptions = append(md.L2.ExtensionRangeOptions, nil)\n\t\t}\n\t}\n\n\t// Derive the message fields by inspecting the struct fields.\n\tfor i := 0; i < t.Elem().NumField(); i++ {\n\t\tf := t.Elem().Field(i)\n\t\tif tag := f.Tag.Get(\"protobuf\"); tag != \"\" {\n\t\t\ttagKey := f.Tag.Get(\"protobuf_key\")\n\t\t\ttagVal := f.Tag.Get(\"protobuf_val\")\n\t\t\taberrantAppendField(md, f.Type, tag, tagKey, tagVal)\n\t\t}\n\t\tif tag := f.Tag.Get(\"protobuf_oneof\"); tag != \"\" {\n\t\t\tn := len(md.L2.Oneofs.List)\n\t\t\tmd.L2.Oneofs.List = append(md.L2.Oneofs.List, filedesc.Oneof{})\n\t\t\tod := &md.L2.Oneofs.List[n]\n\t\t\tod.L0.FullName = md.FullName().Append(pref.Name(tag))\n\t\t\tod.L0.ParentFile = md.L0.ParentFile\n\t\t\tod.L0.Parent = md\n\t\t\tod.L0.Index = n\n\n\t\t\tfor _, t := range oneofWrappers {\n\t\t\t\tif t.Implements(f.Type) {\n\t\t\t\t\tf := t.Elem().Field(0)\n\t\t\t\t\tif tag := f.Tag.Get(\"protobuf\"); tag != \"\" {\n\t\t\t\t\t\taberrantAppendField(md, f.Type, tag, \"\", \"\")\n\t\t\t\t\t\tfd := &md.L2.Fields.List[len(md.L2.Fields.List)-1]\n\t\t\t\t\t\tfd.L1.ContainingOneof = od\n\t\t\t\t\t\tod.L1.Fields.List = append(od.L1.Fields.List, fd)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn md\n}\n\nfunc aberrantDeriveMessageName(t reflect.Type, name pref.FullName) pref.FullName {\n\tif name.IsValid() {\n\t\treturn name\n\t}\n\tfunc() {\n\t\tdefer func() { recover() }() // swallow possible nil panics\n\t\tif m, ok := reflect.Zero(t).Interface().(interface{ XXX_MessageName() string }); ok {\n\t\t\tname = pref.FullName(m.XXX_MessageName())\n\t\t}\n\t}()\n\tif name.IsValid() {\n\t\treturn name\n\t}\n\tif t.Kind() == reflect.Ptr {\n\t\tt = t.Elem()\n\t}\n\treturn AberrantDeriveFullName(t)\n}\n\nfunc aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey, tagVal string) {\n\tt := goType\n\tisOptional := t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct\n\tisRepeated := t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8\n\tif isOptional || isRepeated {\n\t\tt = t.Elem()\n\t}\n\tfd := ptag.Unmarshal(tag, t, placeholderEnumValues{}).(*filedesc.Field)\n\n\t// Append field descriptor to the message.\n\tn := len(md.L2.Fields.List)\n\tmd.L2.Fields.List = append(md.L2.Fields.List, *fd)\n\tfd = &md.L2.Fields.List[n]\n\tfd.L0.FullName = md.FullName().Append(fd.Name())\n\tfd.L0.ParentFile = md.L0.ParentFile\n\tfd.L0.Parent = md\n\tfd.L0.Index = n\n\n\tif fd.L1.IsWeak || fd.L1.HasPacked {\n\t\tfd.L1.Options = func() pref.ProtoMessage {\n\t\t\topts := descopts.Field.ProtoReflect().New()\n\t\t\tif fd.L1.IsWeak {\n\t\t\t\topts.Set(opts.Descriptor().Fields().ByName(\"weak\"), protoreflect.ValueOfBool(true))\n\t\t\t}\n\t\t\tif fd.L1.HasPacked {\n\t\t\t\topts.Set(opts.Descriptor().Fields().ByName(\"packed\"), protoreflect.ValueOfBool(fd.L1.IsPacked))\n\t\t\t}\n\t\t\treturn opts.Interface()\n\t\t}\n\t}\n\n\t// Populate Enum and Message.\n\tif fd.Enum() == nil && fd.Kind() == pref.EnumKind {\n\t\tswitch v := reflect.Zero(t).Interface().(type) {\n\t\tcase pref.Enum:\n\t\t\tfd.L1.Enum = v.Descriptor()\n\t\tdefault:\n\t\t\tfd.L1.Enum = LegacyLoadEnumDesc(t)\n\t\t}\n\t}\n\tif fd.Message() == nil && (fd.Kind() == pref.MessageKind || fd.Kind() == pref.GroupKind) {\n\t\tswitch v := reflect.Zero(t).Interface().(type) {\n\t\tcase pref.ProtoMessage:\n\t\t\tfd.L1.Message = v.ProtoReflect().Descriptor()\n\t\tcase messageV1:\n\t\t\tfd.L1.Message = LegacyLoadMessageDesc(t)\n\t\tdefault:\n\t\t\tif t.Kind() == reflect.Map {\n\t\t\t\tn := len(md.L1.Messages.List)\n\t\t\t\tmd.L1.Messages.List = append(md.L1.Messages.List, filedesc.Message{L2: new(filedesc.MessageL2)})\n\t\t\t\tmd2 := &md.L1.Messages.List[n]\n\t\t\t\tmd2.L0.FullName = md.FullName().Append(pref.Name(strs.MapEntryName(string(fd.Name()))))\n\t\t\t\tmd2.L0.ParentFile = md.L0.ParentFile\n\t\t\t\tmd2.L0.Parent = md\n\t\t\t\tmd2.L0.Index = n\n\n\t\t\t\tmd2.L1.IsMapEntry = true\n\t\t\t\tmd2.L2.Options = func() pref.ProtoMessage {\n\t\t\t\t\topts := descopts.Message.ProtoReflect().New()\n\t\t\t\t\topts.Set(opts.Descriptor().Fields().ByName(\"map_entry\"), protoreflect.ValueOfBool(true))\n\t\t\t\t\treturn opts.Interface()\n\t\t\t\t}\n\n\t\t\t\taberrantAppendField(md2, t.Key(), tagKey, \"\", \"\")\n\t\t\t\taberrantAppendField(md2, t.Elem(), tagVal, \"\", \"\")\n\n\t\t\t\tfd.L1.Message = md2\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfd.L1.Message = aberrantLoadMessageDescReentrant(t, \"\")\n\t\t}\n\t}\n}\n\ntype placeholderEnumValues struct {\n\tprotoreflect.EnumValueDescriptors\n}\n\nfunc (placeholderEnumValues) ByNumber(n pref.EnumNumber) pref.EnumValueDescriptor {\n\treturn filedesc.PlaceholderEnumValue(pref.FullName(fmt.Sprintf(\"UNKNOWN_%d\", n)))\n}\n\n// legacyMarshaler is the proto.Marshaler interface superseded by protoiface.Methoder.\ntype legacyMarshaler interface {\n\tMarshal() ([]byte, error)\n}\n\n// legacyUnmarshaler is the proto.Unmarshaler interface superseded by protoiface.Methoder.\ntype legacyUnmarshaler interface {\n\tUnmarshal([]byte) error\n}\n\n// legacyMerger is the proto.Merger interface superseded by protoiface.Methoder.\ntype legacyMerger interface {\n\tMerge(protoiface.MessageV1)\n}\n\nvar aberrantProtoMethods = &piface.Methods{\n\tMarshal:   legacyMarshal,\n\tUnmarshal: legacyUnmarshal,\n\tMerge:     legacyMerge,\n\n\t// We have no way to tell whether the type's Marshal method\n\t// supports deterministic serialization or not, but this\n\t// preserves the v1 implementation's behavior of always\n\t// calling Marshal methods when present.\n\tFlags: piface.SupportMarshalDeterministic,\n}\n\nfunc legacyMarshal(in piface.MarshalInput) (piface.MarshalOutput, error) {\n\tv := in.Message.(unwrapper).protoUnwrap()\n\tmarshaler, ok := v.(legacyMarshaler)\n\tif !ok {\n\t\treturn piface.MarshalOutput{}, errors.New(\"%T does not implement Marshal\", v)\n\t}\n\tout, err := marshaler.Marshal()\n\tif in.Buf != nil {\n\t\tout = append(in.Buf, out...)\n\t}\n\treturn piface.MarshalOutput{\n\t\tBuf: out,\n\t}, err\n}\n\nfunc legacyUnmarshal(in piface.UnmarshalInput) (piface.UnmarshalOutput, error) {\n\tv := in.Message.(unwrapper).protoUnwrap()\n\tunmarshaler, ok := v.(legacyUnmarshaler)\n\tif !ok {\n\t\treturn piface.UnmarshalOutput{}, errors.New(\"%T does not implement Unmarshal\", v)\n\t}\n\treturn piface.UnmarshalOutput{}, unmarshaler.Unmarshal(in.Buf)\n}\n\nfunc legacyMerge(in piface.MergeInput) piface.MergeOutput {\n\t// Check whether this supports the legacy merger.\n\tdstv := in.Destination.(unwrapper).protoUnwrap()\n\tmerger, ok := dstv.(legacyMerger)\n\tif ok {\n\t\tmerger.Merge(Export{}.ProtoMessageV1Of(in.Source))\n\t\treturn piface.MergeOutput{Flags: piface.MergeComplete}\n\t}\n\n\t// If legacy merger is unavailable, implement merge in terms of\n\t// a marshal and unmarshal operation.\n\tsrcv := in.Source.(unwrapper).protoUnwrap()\n\tmarshaler, ok := srcv.(legacyMarshaler)\n\tif !ok {\n\t\treturn piface.MergeOutput{}\n\t}\n\tdstv = in.Destination.(unwrapper).protoUnwrap()\n\tunmarshaler, ok := dstv.(legacyUnmarshaler)\n\tif !ok {\n\t\treturn piface.MergeOutput{}\n\t}\n\tb, err := marshaler.Marshal()\n\tif err != nil {\n\t\treturn piface.MergeOutput{}\n\t}\n\terr = unmarshaler.Unmarshal(b)\n\tif err != nil {\n\t\treturn piface.MergeOutput{}\n\t}\n\treturn piface.MergeOutput{Flags: piface.MergeComplete}\n}\n\n// aberrantMessageType implements MessageType for all types other than pointer-to-struct.\ntype aberrantMessageType struct {\n\tt reflect.Type\n}\n\nfunc (mt aberrantMessageType) New() pref.Message {\n\tif mt.t.Kind() == reflect.Ptr {\n\t\treturn aberrantMessage{reflect.New(mt.t.Elem())}\n\t}\n\treturn aberrantMessage{reflect.Zero(mt.t)}\n}\nfunc (mt aberrantMessageType) Zero() pref.Message {\n\treturn aberrantMessage{reflect.Zero(mt.t)}\n}\nfunc (mt aberrantMessageType) GoType() reflect.Type {\n\treturn mt.t\n}\nfunc (mt aberrantMessageType) Descriptor() pref.MessageDescriptor {\n\treturn LegacyLoadMessageDesc(mt.t)\n}\n\n// aberrantMessage implements Message for all types other than pointer-to-struct.\n//\n// When the underlying type implements legacyMarshaler or legacyUnmarshaler,\n// the aberrant Message can be marshaled or unmarshaled. Otherwise, there is\n// not much that can be done with values of this type.\ntype aberrantMessage struct {\n\tv reflect.Value\n}\n\n// Reset implements the v1 proto.Message.Reset method.\nfunc (m aberrantMessage) Reset() {\n\tif mr, ok := m.v.Interface().(interface{ Reset() }); ok {\n\t\tmr.Reset()\n\t\treturn\n\t}\n\tif m.v.Kind() == reflect.Ptr && !m.v.IsNil() {\n\t\tm.v.Elem().Set(reflect.Zero(m.v.Type().Elem()))\n\t}\n}\n\nfunc (m aberrantMessage) ProtoReflect() pref.Message {\n\treturn m\n}\n\nfunc (m aberrantMessage) Descriptor() pref.MessageDescriptor {\n\treturn LegacyLoadMessageDesc(m.v.Type())\n}\nfunc (m aberrantMessage) Type() pref.MessageType {\n\treturn aberrantMessageType{m.v.Type()}\n}\nfunc (m aberrantMessage) New() pref.Message {\n\tif m.v.Type().Kind() == reflect.Ptr {\n\t\treturn aberrantMessage{reflect.New(m.v.Type().Elem())}\n\t}\n\treturn aberrantMessage{reflect.Zero(m.v.Type())}\n}\nfunc (m aberrantMessage) Interface() pref.ProtoMessage {\n\treturn m\n}\nfunc (m aberrantMessage) Range(f func(pref.FieldDescriptor, pref.Value) bool) {\n\treturn\n}\nfunc (m aberrantMessage) Has(pref.FieldDescriptor) bool {\n\treturn false\n}\nfunc (m aberrantMessage) Clear(pref.FieldDescriptor) {\n\tpanic(\"invalid Message.Clear on \" + string(m.Descriptor().FullName()))\n}\nfunc (m aberrantMessage) Get(fd pref.FieldDescriptor) pref.Value {\n\tif fd.Default().IsValid() {\n\t\treturn fd.Default()\n\t}\n\tpanic(\"invalid Message.Get on \" + string(m.Descriptor().FullName()))\n}\nfunc (m aberrantMessage) Set(pref.FieldDescriptor, pref.Value) {\n\tpanic(\"invalid Message.Set on \" + string(m.Descriptor().FullName()))\n}\nfunc (m aberrantMessage) Mutable(pref.FieldDescriptor) pref.Value {\n\tpanic(\"invalid Message.Mutable on \" + string(m.Descriptor().FullName()))\n}\nfunc (m aberrantMessage) NewField(pref.FieldDescriptor) pref.Value {\n\tpanic(\"invalid Message.NewField on \" + string(m.Descriptor().FullName()))\n}\nfunc (m aberrantMessage) WhichOneof(pref.OneofDescriptor) pref.FieldDescriptor {\n\tpanic(\"invalid Message.WhichOneof descriptor on \" + string(m.Descriptor().FullName()))\n}\nfunc (m aberrantMessage) GetUnknown() pref.RawFields {\n\treturn nil\n}\nfunc (m aberrantMessage) SetUnknown(pref.RawFields) {\n\t// SetUnknown discards its input on messages which don't support unknown field storage.\n}\nfunc (m aberrantMessage) IsValid() bool {\n\tif m.v.Kind() == reflect.Ptr {\n\t\treturn !m.v.IsNil()\n\t}\n\treturn false\n}\nfunc (m aberrantMessage) ProtoMethods() *piface.Methods {\n\treturn aberrantProtoMethods\n}\nfunc (m aberrantMessage) protoUnwrap() interface{} {\n\treturn m.v.Interface()\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/merge.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/proto\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\ntype mergeOptions struct{}\n\nfunc (o mergeOptions) Merge(dst, src proto.Message) {\n\tproto.Merge(dst, src)\n}\n\n// merge is protoreflect.Methods.Merge.\nfunc (mi *MessageInfo) merge(in piface.MergeInput) piface.MergeOutput {\n\tdp, ok := mi.getPointer(in.Destination)\n\tif !ok {\n\t\treturn piface.MergeOutput{}\n\t}\n\tsp, ok := mi.getPointer(in.Source)\n\tif !ok {\n\t\treturn piface.MergeOutput{}\n\t}\n\tmi.mergePointer(dp, sp, mergeOptions{})\n\treturn piface.MergeOutput{Flags: piface.MergeComplete}\n}\n\nfunc (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) {\n\tmi.init()\n\tif dst.IsNil() {\n\t\tpanic(fmt.Sprintf(\"invalid value: merging into nil message\"))\n\t}\n\tif src.IsNil() {\n\t\treturn\n\t}\n\tfor _, f := range mi.orderedCoderFields {\n\t\tif f.funcs.merge == nil {\n\t\t\tcontinue\n\t\t}\n\t\tsfptr := src.Apply(f.offset)\n\t\tif f.isPointer && sfptr.Elem().IsNil() {\n\t\t\tcontinue\n\t\t}\n\t\tf.funcs.merge(dst.Apply(f.offset), sfptr, f, opts)\n\t}\n\tif mi.extensionOffset.IsValid() {\n\t\tsext := src.Apply(mi.extensionOffset).Extensions()\n\t\tdext := dst.Apply(mi.extensionOffset).Extensions()\n\t\tif *dext == nil {\n\t\t\t*dext = make(map[int32]ExtensionField)\n\t\t}\n\t\tfor num, sx := range *sext {\n\t\t\txt := sx.Type()\n\t\t\txi := getExtensionFieldInfo(xt)\n\t\t\tif xi.funcs.merge == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdx := (*dext)[num]\n\t\t\tvar dv pref.Value\n\t\t\tif dx.Type() == sx.Type() {\n\t\t\t\tdv = dx.Value()\n\t\t\t}\n\t\t\tif !dv.IsValid() && xi.unmarshalNeedsValue {\n\t\t\t\tdv = xt.New()\n\t\t\t}\n\t\t\tdv = xi.funcs.merge(dv, sx.Value(), opts)\n\t\t\tdx.Set(sx.Type(), dv)\n\t\t\t(*dext)[num] = dx\n\t\t}\n\t}\n\tif mi.unknownOffset.IsValid() {\n\t\tsu := mi.getUnknownBytes(src)\n\t\tif su != nil && len(*su) > 0 {\n\t\t\tdu := mi.mutableUnknownBytes(dst)\n\t\t\t*du = append(*du, *su...)\n\t\t}\n\t}\n}\n\nfunc mergeScalarValue(dst, src pref.Value, opts mergeOptions) pref.Value {\n\treturn src\n}\n\nfunc mergeBytesValue(dst, src pref.Value, opts mergeOptions) pref.Value {\n\treturn pref.ValueOfBytes(append(emptyBuf[:], src.Bytes()...))\n}\n\nfunc mergeListValue(dst, src pref.Value, opts mergeOptions) pref.Value {\n\tdstl := dst.List()\n\tsrcl := src.List()\n\tfor i, llen := 0, srcl.Len(); i < llen; i++ {\n\t\tdstl.Append(srcl.Get(i))\n\t}\n\treturn dst\n}\n\nfunc mergeBytesListValue(dst, src pref.Value, opts mergeOptions) pref.Value {\n\tdstl := dst.List()\n\tsrcl := src.List()\n\tfor i, llen := 0, srcl.Len(); i < llen; i++ {\n\t\tsb := srcl.Get(i).Bytes()\n\t\tdb := append(emptyBuf[:], sb...)\n\t\tdstl.Append(pref.ValueOfBytes(db))\n\t}\n\treturn dst\n}\n\nfunc mergeMessageListValue(dst, src pref.Value, opts mergeOptions) pref.Value {\n\tdstl := dst.List()\n\tsrcl := src.List()\n\tfor i, llen := 0, srcl.Len(); i < llen; i++ {\n\t\tsm := srcl.Get(i).Message()\n\t\tdm := proto.Clone(sm.Interface()).ProtoReflect()\n\t\tdstl.Append(pref.ValueOfMessage(dm))\n\t}\n\treturn dst\n}\n\nfunc mergeMessageValue(dst, src pref.Value, opts mergeOptions) pref.Value {\n\topts.Merge(dst.Message().Interface(), src.Message().Interface())\n\treturn dst\n}\n\nfunc mergeMessage(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {\n\tif f.mi != nil {\n\t\tif dst.Elem().IsNil() {\n\t\t\tdst.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem())))\n\t\t}\n\t\tf.mi.mergePointer(dst.Elem(), src.Elem(), opts)\n\t} else {\n\t\tdm := dst.AsValueOf(f.ft).Elem()\n\t\tsm := src.AsValueOf(f.ft).Elem()\n\t\tif dm.IsNil() {\n\t\t\tdm.Set(reflect.New(f.ft.Elem()))\n\t\t}\n\t\topts.Merge(asMessage(dm), asMessage(sm))\n\t}\n}\n\nfunc mergeMessageSlice(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {\n\tfor _, sp := range src.PointerSlice() {\n\t\tdm := reflect.New(f.ft.Elem().Elem())\n\t\tif f.mi != nil {\n\t\t\tf.mi.mergePointer(pointerOfValue(dm), sp, opts)\n\t\t} else {\n\t\t\topts.Merge(asMessage(dm), asMessage(sp.AsValueOf(f.ft.Elem().Elem())))\n\t\t}\n\t\tdst.AppendPointerSlice(pointerOfValue(dm))\n\t}\n}\n\nfunc mergeBytes(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Bytes() = append(emptyBuf[:], *src.Bytes()...)\n}\n\nfunc mergeBytesNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Bytes()\n\tif len(v) > 0 {\n\t\t*dst.Bytes() = append(emptyBuf[:], v...)\n\t}\n}\n\nfunc mergeBytesSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.BytesSlice()\n\tfor _, v := range *src.BytesSlice() {\n\t\t*ds = append(*ds, append(emptyBuf[:], v...))\n\t}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/merge_gen.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// Code generated by generate-types. DO NOT EDIT.\n\npackage impl\n\nimport ()\n\nfunc mergeBool(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Bool() = *src.Bool()\n}\n\nfunc mergeBoolNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Bool()\n\tif v != false {\n\t\t*dst.Bool() = v\n\t}\n}\n\nfunc mergeBoolPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.BoolPtr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.BoolPtr() = &v\n\t}\n}\n\nfunc mergeBoolSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.BoolSlice()\n\tss := src.BoolSlice()\n\t*ds = append(*ds, *ss...)\n}\n\nfunc mergeInt32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Int32() = *src.Int32()\n}\n\nfunc mergeInt32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Int32()\n\tif v != 0 {\n\t\t*dst.Int32() = v\n\t}\n}\n\nfunc mergeInt32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.Int32Ptr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.Int32Ptr() = &v\n\t}\n}\n\nfunc mergeInt32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.Int32Slice()\n\tss := src.Int32Slice()\n\t*ds = append(*ds, *ss...)\n}\n\nfunc mergeUint32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Uint32() = *src.Uint32()\n}\n\nfunc mergeUint32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Uint32()\n\tif v != 0 {\n\t\t*dst.Uint32() = v\n\t}\n}\n\nfunc mergeUint32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.Uint32Ptr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.Uint32Ptr() = &v\n\t}\n}\n\nfunc mergeUint32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.Uint32Slice()\n\tss := src.Uint32Slice()\n\t*ds = append(*ds, *ss...)\n}\n\nfunc mergeInt64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Int64() = *src.Int64()\n}\n\nfunc mergeInt64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Int64()\n\tif v != 0 {\n\t\t*dst.Int64() = v\n\t}\n}\n\nfunc mergeInt64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.Int64Ptr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.Int64Ptr() = &v\n\t}\n}\n\nfunc mergeInt64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.Int64Slice()\n\tss := src.Int64Slice()\n\t*ds = append(*ds, *ss...)\n}\n\nfunc mergeUint64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Uint64() = *src.Uint64()\n}\n\nfunc mergeUint64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Uint64()\n\tif v != 0 {\n\t\t*dst.Uint64() = v\n\t}\n}\n\nfunc mergeUint64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.Uint64Ptr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.Uint64Ptr() = &v\n\t}\n}\n\nfunc mergeUint64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.Uint64Slice()\n\tss := src.Uint64Slice()\n\t*ds = append(*ds, *ss...)\n}\n\nfunc mergeFloat32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Float32() = *src.Float32()\n}\n\nfunc mergeFloat32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Float32()\n\tif v != 0 {\n\t\t*dst.Float32() = v\n\t}\n}\n\nfunc mergeFloat32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.Float32Ptr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.Float32Ptr() = &v\n\t}\n}\n\nfunc mergeFloat32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.Float32Slice()\n\tss := src.Float32Slice()\n\t*ds = append(*ds, *ss...)\n}\n\nfunc mergeFloat64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.Float64() = *src.Float64()\n}\n\nfunc mergeFloat64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.Float64()\n\tif v != 0 {\n\t\t*dst.Float64() = v\n\t}\n}\n\nfunc mergeFloat64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.Float64Ptr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.Float64Ptr() = &v\n\t}\n}\n\nfunc mergeFloat64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.Float64Slice()\n\tss := src.Float64Slice()\n\t*ds = append(*ds, *ss...)\n}\n\nfunc mergeString(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\t*dst.String() = *src.String()\n}\n\nfunc mergeStringNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tv := *src.String()\n\tif v != \"\" {\n\t\t*dst.String() = v\n\t}\n}\n\nfunc mergeStringPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tp := *src.StringPtr()\n\tif p != nil {\n\t\tv := *p\n\t\t*dst.StringPtr() = &v\n\t}\n}\n\nfunc mergeStringSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {\n\tds := dst.StringSlice()\n\tss := src.StringSlice()\n\t*ds = append(*ds, *ss...)\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/message.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\t\"sync\"\n\t\"sync/atomic\"\n\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// MessageInfo provides protobuf related functionality for a given Go type\n// that represents a message. A given instance of MessageInfo is tied to\n// exactly one Go type, which must be a pointer to a struct type.\n//\n// The exported fields must be populated before any methods are called\n// and cannot be mutated after set.\ntype MessageInfo struct {\n\t// GoReflectType is the underlying message Go type and must be populated.\n\tGoReflectType reflect.Type // pointer to struct\n\n\t// Desc is the underlying message descriptor type and must be populated.\n\tDesc pref.MessageDescriptor\n\n\t// Exporter must be provided in a purego environment in order to provide\n\t// access to unexported fields.\n\tExporter exporter\n\n\t// OneofWrappers is list of pointers to oneof wrapper struct types.\n\tOneofWrappers []interface{}\n\n\tinitMu   sync.Mutex // protects all unexported fields\n\tinitDone uint32\n\n\treflectMessageInfo // for reflection implementation\n\tcoderMessageInfo   // for fast-path method implementations\n}\n\n// exporter is a function that returns a reference to the ith field of v,\n// where v is a pointer to a struct. It returns nil if it does not support\n// exporting the requested field (e.g., already exported).\ntype exporter func(v interface{}, i int) interface{}\n\n// getMessageInfo returns the MessageInfo for any message type that\n// is generated by our implementation of protoc-gen-go (for v2 and on).\n// If it is unable to obtain a MessageInfo, it returns nil.\nfunc getMessageInfo(mt reflect.Type) *MessageInfo {\n\tm, ok := reflect.Zero(mt).Interface().(pref.ProtoMessage)\n\tif !ok {\n\t\treturn nil\n\t}\n\tmr, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *MessageInfo })\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn mr.ProtoMessageInfo()\n}\n\nfunc (mi *MessageInfo) init() {\n\t// This function is called in the hot path. Inline the sync.Once logic,\n\t// since allocating a closure for Once.Do is expensive.\n\t// Keep init small to ensure that it can be inlined.\n\tif atomic.LoadUint32(&mi.initDone) == 0 {\n\t\tmi.initOnce()\n\t}\n}\n\nfunc (mi *MessageInfo) initOnce() {\n\tmi.initMu.Lock()\n\tdefer mi.initMu.Unlock()\n\tif mi.initDone == 1 {\n\t\treturn\n\t}\n\n\tt := mi.GoReflectType\n\tif t.Kind() != reflect.Ptr && t.Elem().Kind() != reflect.Struct {\n\t\tpanic(fmt.Sprintf(\"got %v, want *struct kind\", t))\n\t}\n\tt = t.Elem()\n\n\tsi := mi.makeStructInfo(t)\n\tmi.makeReflectFuncs(t, si)\n\tmi.makeCoderMethods(t, si)\n\n\tatomic.StoreUint32(&mi.initDone, 1)\n}\n\n// getPointer returns the pointer for a message, which should be of\n// the type of the MessageInfo. If the message is of a different type,\n// it returns ok==false.\nfunc (mi *MessageInfo) getPointer(m pref.Message) (p pointer, ok bool) {\n\tswitch m := m.(type) {\n\tcase *messageState:\n\t\treturn m.pointer(), m.messageInfo() == mi\n\tcase *messageReflectWrapper:\n\t\treturn m.pointer(), m.messageInfo() == mi\n\t}\n\treturn pointer{}, false\n}\n\ntype (\n\tSizeCache       = int32\n\tWeakFields      = map[int32]protoreflect.ProtoMessage\n\tUnknownFields   = unknownFieldsA // TODO: switch to unknownFieldsB\n\tunknownFieldsA  = []byte\n\tunknownFieldsB  = *[]byte\n\tExtensionFields = map[int32]ExtensionField\n)\n\nvar (\n\tsizecacheType       = reflect.TypeOf(SizeCache(0))\n\tweakFieldsType      = reflect.TypeOf(WeakFields(nil))\n\tunknownFieldsAType  = reflect.TypeOf(unknownFieldsA(nil))\n\tunknownFieldsBType  = reflect.TypeOf(unknownFieldsB(nil))\n\textensionFieldsType = reflect.TypeOf(ExtensionFields(nil))\n)\n\ntype structInfo struct {\n\tsizecacheOffset offset\n\tsizecacheType   reflect.Type\n\tweakOffset      offset\n\tweakType        reflect.Type\n\tunknownOffset   offset\n\tunknownType     reflect.Type\n\textensionOffset offset\n\textensionType   reflect.Type\n\n\tfieldsByNumber        map[pref.FieldNumber]reflect.StructField\n\toneofsByName          map[pref.Name]reflect.StructField\n\toneofWrappersByType   map[reflect.Type]pref.FieldNumber\n\toneofWrappersByNumber map[pref.FieldNumber]reflect.Type\n}\n\nfunc (mi *MessageInfo) makeStructInfo(t reflect.Type) structInfo {\n\tsi := structInfo{\n\t\tsizecacheOffset: invalidOffset,\n\t\tweakOffset:      invalidOffset,\n\t\tunknownOffset:   invalidOffset,\n\t\textensionOffset: invalidOffset,\n\n\t\tfieldsByNumber:        map[pref.FieldNumber]reflect.StructField{},\n\t\toneofsByName:          map[pref.Name]reflect.StructField{},\n\t\toneofWrappersByType:   map[reflect.Type]pref.FieldNumber{},\n\t\toneofWrappersByNumber: map[pref.FieldNumber]reflect.Type{},\n\t}\n\nfieldLoop:\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tswitch f := t.Field(i); f.Name {\n\t\tcase genid.SizeCache_goname, genid.SizeCacheA_goname:\n\t\t\tif f.Type == sizecacheType {\n\t\t\t\tsi.sizecacheOffset = offsetOf(f, mi.Exporter)\n\t\t\t\tsi.sizecacheType = f.Type\n\t\t\t}\n\t\tcase genid.WeakFields_goname, genid.WeakFieldsA_goname:\n\t\t\tif f.Type == weakFieldsType {\n\t\t\t\tsi.weakOffset = offsetOf(f, mi.Exporter)\n\t\t\t\tsi.weakType = f.Type\n\t\t\t}\n\t\tcase genid.UnknownFields_goname, genid.UnknownFieldsA_goname:\n\t\t\tif f.Type == unknownFieldsAType || f.Type == unknownFieldsBType {\n\t\t\t\tsi.unknownOffset = offsetOf(f, mi.Exporter)\n\t\t\t\tsi.unknownType = f.Type\n\t\t\t}\n\t\tcase genid.ExtensionFields_goname, genid.ExtensionFieldsA_goname, genid.ExtensionFieldsB_goname:\n\t\t\tif f.Type == extensionFieldsType {\n\t\t\t\tsi.extensionOffset = offsetOf(f, mi.Exporter)\n\t\t\t\tsi.extensionType = f.Type\n\t\t\t}\n\t\tdefault:\n\t\t\tfor _, s := range strings.Split(f.Tag.Get(\"protobuf\"), \",\") {\n\t\t\t\tif len(s) > 0 && strings.Trim(s, \"0123456789\") == \"\" {\n\t\t\t\t\tn, _ := strconv.ParseUint(s, 10, 64)\n\t\t\t\t\tsi.fieldsByNumber[pref.FieldNumber(n)] = f\n\t\t\t\t\tcontinue fieldLoop\n\t\t\t\t}\n\t\t\t}\n\t\t\tif s := f.Tag.Get(\"protobuf_oneof\"); len(s) > 0 {\n\t\t\t\tsi.oneofsByName[pref.Name(s)] = f\n\t\t\t\tcontinue fieldLoop\n\t\t\t}\n\t\t}\n\t}\n\n\t// Derive a mapping of oneof wrappers to fields.\n\toneofWrappers := mi.OneofWrappers\n\tfor _, method := range []string{\"XXX_OneofFuncs\", \"XXX_OneofWrappers\"} {\n\t\tif fn, ok := reflect.PtrTo(t).MethodByName(method); ok {\n\t\t\tfor _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {\n\t\t\t\tif vs, ok := v.Interface().([]interface{}); ok {\n\t\t\t\t\toneofWrappers = vs\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfor _, v := range oneofWrappers {\n\t\ttf := reflect.TypeOf(v).Elem()\n\t\tf := tf.Field(0)\n\t\tfor _, s := range strings.Split(f.Tag.Get(\"protobuf\"), \",\") {\n\t\t\tif len(s) > 0 && strings.Trim(s, \"0123456789\") == \"\" {\n\t\t\t\tn, _ := strconv.ParseUint(s, 10, 64)\n\t\t\t\tsi.oneofWrappersByType[tf] = pref.FieldNumber(n)\n\t\t\t\tsi.oneofWrappersByNumber[pref.FieldNumber(n)] = tf\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn si\n}\n\nfunc (mi *MessageInfo) New() protoreflect.Message {\n\treturn mi.MessageOf(reflect.New(mi.GoReflectType.Elem()).Interface())\n}\nfunc (mi *MessageInfo) Zero() protoreflect.Message {\n\treturn mi.MessageOf(reflect.Zero(mi.GoReflectType).Interface())\n}\nfunc (mi *MessageInfo) Descriptor() protoreflect.MessageDescriptor {\n\treturn mi.Desc\n}\nfunc (mi *MessageInfo) Enum(i int) protoreflect.EnumType {\n\tmi.init()\n\tfd := mi.Desc.Fields().Get(i)\n\treturn Export{}.EnumTypeOf(mi.fieldTypes[fd.Number()])\n}\nfunc (mi *MessageInfo) Message(i int) protoreflect.MessageType {\n\tmi.init()\n\tfd := mi.Desc.Fields().Get(i)\n\tswitch {\n\tcase fd.IsWeak():\n\t\tmt, _ := preg.GlobalTypes.FindMessageByName(fd.Message().FullName())\n\t\treturn mt\n\tcase fd.IsMap():\n\t\treturn mapEntryType{fd.Message(), mi.fieldTypes[fd.Number()]}\n\tdefault:\n\t\treturn Export{}.MessageTypeOf(mi.fieldTypes[fd.Number()])\n\t}\n}\n\ntype mapEntryType struct {\n\tdesc    protoreflect.MessageDescriptor\n\tvalType interface{} // zero value of enum or message type\n}\n\nfunc (mt mapEntryType) New() protoreflect.Message {\n\treturn nil\n}\nfunc (mt mapEntryType) Zero() protoreflect.Message {\n\treturn nil\n}\nfunc (mt mapEntryType) Descriptor() protoreflect.MessageDescriptor {\n\treturn mt.desc\n}\nfunc (mt mapEntryType) Enum(i int) protoreflect.EnumType {\n\tfd := mt.desc.Fields().Get(i)\n\tif fd.Enum() == nil {\n\t\treturn nil\n\t}\n\treturn Export{}.EnumTypeOf(mt.valType)\n}\nfunc (mt mapEntryType) Message(i int) protoreflect.MessageType {\n\tfd := mt.desc.Fields().Get(i)\n\tif fd.Message() == nil {\n\t\treturn nil\n\t}\n\treturn Export{}.MessageTypeOf(mt.valType)\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/message_reflect.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 impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/internal/detrand\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype reflectMessageInfo struct {\n\tfields map[pref.FieldNumber]*fieldInfo\n\toneofs map[pref.Name]*oneofInfo\n\n\t// fieldTypes contains the zero value of an enum or message field.\n\t// For lists, it contains the element type.\n\t// For maps, it contains the entry value type.\n\tfieldTypes map[pref.FieldNumber]interface{}\n\n\t// denseFields is a subset of fields where:\n\t//\t0 < fieldDesc.Number() < len(denseFields)\n\t// It provides faster access to the fieldInfo, but may be incomplete.\n\tdenseFields []*fieldInfo\n\n\t// rangeInfos is a list of all fields (not belonging to a oneof) and oneofs.\n\trangeInfos []interface{} // either *fieldInfo or *oneofInfo\n\n\tgetUnknown   func(pointer) pref.RawFields\n\tsetUnknown   func(pointer, pref.RawFields)\n\textensionMap func(pointer) *extensionMap\n\n\tnilMessage atomicNilMessage\n}\n\n// makeReflectFuncs generates the set of functions to support reflection.\nfunc (mi *MessageInfo) makeReflectFuncs(t reflect.Type, si structInfo) {\n\tmi.makeKnownFieldsFunc(si)\n\tmi.makeUnknownFieldsFunc(t, si)\n\tmi.makeExtensionFieldsFunc(t, si)\n\tmi.makeFieldTypes(si)\n}\n\n// makeKnownFieldsFunc generates functions for operations that can be performed\n// on each protobuf message field. It takes in a reflect.Type representing the\n// Go struct and matches message fields with struct fields.\n//\n// This code assumes that the struct is well-formed and panics if there are\n// any discrepancies.\nfunc (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) {\n\tmi.fields = map[pref.FieldNumber]*fieldInfo{}\n\tmd := mi.Desc\n\tfds := md.Fields()\n\tfor i := 0; i < fds.Len(); i++ {\n\t\tfd := fds.Get(i)\n\t\tfs := si.fieldsByNumber[fd.Number()]\n\t\tisOneof := fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic()\n\t\tif isOneof {\n\t\t\tfs = si.oneofsByName[fd.ContainingOneof().Name()]\n\t\t}\n\t\tvar fi fieldInfo\n\t\tswitch {\n\t\tcase fs.Type == nil:\n\t\t\tfi = fieldInfoForMissing(fd) // never occurs for officially generated message types\n\t\tcase isOneof:\n\t\t\tfi = fieldInfoForOneof(fd, fs, mi.Exporter, si.oneofWrappersByNumber[fd.Number()])\n\t\tcase fd.IsMap():\n\t\t\tfi = fieldInfoForMap(fd, fs, mi.Exporter)\n\t\tcase fd.IsList():\n\t\t\tfi = fieldInfoForList(fd, fs, mi.Exporter)\n\t\tcase fd.IsWeak():\n\t\t\tfi = fieldInfoForWeakMessage(fd, si.weakOffset)\n\t\tcase fd.Message() != nil:\n\t\t\tfi = fieldInfoForMessage(fd, fs, mi.Exporter)\n\t\tdefault:\n\t\t\tfi = fieldInfoForScalar(fd, fs, mi.Exporter)\n\t\t}\n\t\tmi.fields[fd.Number()] = &fi\n\t}\n\n\tmi.oneofs = map[pref.Name]*oneofInfo{}\n\tfor i := 0; i < md.Oneofs().Len(); i++ {\n\t\tod := md.Oneofs().Get(i)\n\t\tmi.oneofs[od.Name()] = makeOneofInfo(od, si, mi.Exporter)\n\t}\n\n\tmi.denseFields = make([]*fieldInfo, fds.Len()*2)\n\tfor i := 0; i < fds.Len(); i++ {\n\t\tif fd := fds.Get(i); int(fd.Number()) < len(mi.denseFields) {\n\t\t\tmi.denseFields[fd.Number()] = mi.fields[fd.Number()]\n\t\t}\n\t}\n\n\tfor i := 0; i < fds.Len(); {\n\t\tfd := fds.Get(i)\n\t\tif od := fd.ContainingOneof(); od != nil && !od.IsSynthetic() {\n\t\t\tmi.rangeInfos = append(mi.rangeInfos, mi.oneofs[od.Name()])\n\t\t\ti += od.Fields().Len()\n\t\t} else {\n\t\t\tmi.rangeInfos = append(mi.rangeInfos, mi.fields[fd.Number()])\n\t\t\ti++\n\t\t}\n\t}\n\n\t// Introduce instability to iteration order, but keep it deterministic.\n\tif len(mi.rangeInfos) > 1 && detrand.Bool() {\n\t\ti := detrand.Intn(len(mi.rangeInfos) - 1)\n\t\tmi.rangeInfos[i], mi.rangeInfos[i+1] = mi.rangeInfos[i+1], mi.rangeInfos[i]\n\t}\n}\n\nfunc (mi *MessageInfo) makeUnknownFieldsFunc(t reflect.Type, si structInfo) {\n\tswitch {\n\tcase si.unknownOffset.IsValid() && si.unknownType == unknownFieldsAType:\n\t\t// Handle as []byte.\n\t\tmi.getUnknown = func(p pointer) pref.RawFields {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn *p.Apply(mi.unknownOffset).Bytes()\n\t\t}\n\t\tmi.setUnknown = func(p pointer, b pref.RawFields) {\n\t\t\tif p.IsNil() {\n\t\t\t\tpanic(\"invalid SetUnknown on nil Message\")\n\t\t\t}\n\t\t\t*p.Apply(mi.unknownOffset).Bytes() = b\n\t\t}\n\tcase si.unknownOffset.IsValid() && si.unknownType == unknownFieldsBType:\n\t\t// Handle as *[]byte.\n\t\tmi.getUnknown = func(p pointer) pref.RawFields {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tbp := p.Apply(mi.unknownOffset).BytesPtr()\n\t\t\tif *bp == nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn **bp\n\t\t}\n\t\tmi.setUnknown = func(p pointer, b pref.RawFields) {\n\t\t\tif p.IsNil() {\n\t\t\t\tpanic(\"invalid SetUnknown on nil Message\")\n\t\t\t}\n\t\t\tbp := p.Apply(mi.unknownOffset).BytesPtr()\n\t\t\tif *bp == nil {\n\t\t\t\t*bp = new([]byte)\n\t\t\t}\n\t\t\t**bp = b\n\t\t}\n\tdefault:\n\t\tmi.getUnknown = func(pointer) pref.RawFields {\n\t\t\treturn nil\n\t\t}\n\t\tmi.setUnknown = func(p pointer, _ pref.RawFields) {\n\t\t\tif p.IsNil() {\n\t\t\t\tpanic(\"invalid SetUnknown on nil Message\")\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc (mi *MessageInfo) makeExtensionFieldsFunc(t reflect.Type, si structInfo) {\n\tif si.extensionOffset.IsValid() {\n\t\tmi.extensionMap = func(p pointer) *extensionMap {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn (*extensionMap)(nil)\n\t\t\t}\n\t\t\tv := p.Apply(si.extensionOffset).AsValueOf(extensionFieldsType)\n\t\t\treturn (*extensionMap)(v.Interface().(*map[int32]ExtensionField))\n\t\t}\n\t} else {\n\t\tmi.extensionMap = func(pointer) *extensionMap {\n\t\t\treturn (*extensionMap)(nil)\n\t\t}\n\t}\n}\nfunc (mi *MessageInfo) makeFieldTypes(si structInfo) {\n\tmd := mi.Desc\n\tfds := md.Fields()\n\tfor i := 0; i < fds.Len(); i++ {\n\t\tvar ft reflect.Type\n\t\tfd := fds.Get(i)\n\t\tfs := si.fieldsByNumber[fd.Number()]\n\t\tisOneof := fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic()\n\t\tif isOneof {\n\t\t\tfs = si.oneofsByName[fd.ContainingOneof().Name()]\n\t\t}\n\t\tvar isMessage bool\n\t\tswitch {\n\t\tcase fs.Type == nil:\n\t\t\tcontinue // never occurs for officially generated message types\n\t\tcase isOneof:\n\t\t\tif fd.Enum() != nil || fd.Message() != nil {\n\t\t\t\tft = si.oneofWrappersByNumber[fd.Number()].Field(0).Type\n\t\t\t}\n\t\tcase fd.IsMap():\n\t\t\tif fd.MapValue().Enum() != nil || fd.MapValue().Message() != nil {\n\t\t\t\tft = fs.Type.Elem()\n\t\t\t}\n\t\t\tisMessage = fd.MapValue().Message() != nil\n\t\tcase fd.IsList():\n\t\t\tif fd.Enum() != nil || fd.Message() != nil {\n\t\t\t\tft = fs.Type.Elem()\n\t\t\t}\n\t\t\tisMessage = fd.Message() != nil\n\t\tcase fd.Enum() != nil:\n\t\t\tft = fs.Type\n\t\t\tif fd.HasPresence() && ft.Kind() == reflect.Ptr {\n\t\t\t\tft = ft.Elem()\n\t\t\t}\n\t\tcase fd.Message() != nil:\n\t\t\tft = fs.Type\n\t\t\tif fd.IsWeak() {\n\t\t\t\tft = nil\n\t\t\t}\n\t\t\tisMessage = true\n\t\t}\n\t\tif isMessage && ft != nil && ft.Kind() != reflect.Ptr {\n\t\t\tft = reflect.PtrTo(ft) // never occurs for officially generated message types\n\t\t}\n\t\tif ft != nil {\n\t\t\tif mi.fieldTypes == nil {\n\t\t\t\tmi.fieldTypes = make(map[pref.FieldNumber]interface{})\n\t\t\t}\n\t\t\tmi.fieldTypes[fd.Number()] = reflect.Zero(ft).Interface()\n\t\t}\n\t}\n}\n\ntype extensionMap map[int32]ExtensionField\n\nfunc (m *extensionMap) Range(f func(pref.FieldDescriptor, pref.Value) bool) {\n\tif m != nil {\n\t\tfor _, x := range *m {\n\t\t\txd := x.Type().TypeDescriptor()\n\t\t\tv := x.Value()\n\t\t\tif xd.IsList() && v.List().Len() == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !f(xd, v) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}\nfunc (m *extensionMap) Has(xt pref.ExtensionType) (ok bool) {\n\tif m == nil {\n\t\treturn false\n\t}\n\txd := xt.TypeDescriptor()\n\tx, ok := (*m)[int32(xd.Number())]\n\tif !ok {\n\t\treturn false\n\t}\n\tswitch {\n\tcase xd.IsList():\n\t\treturn x.Value().List().Len() > 0\n\tcase xd.IsMap():\n\t\treturn x.Value().Map().Len() > 0\n\tcase xd.Message() != nil:\n\t\treturn x.Value().Message().IsValid()\n\t}\n\treturn true\n}\nfunc (m *extensionMap) Clear(xt pref.ExtensionType) {\n\tdelete(*m, int32(xt.TypeDescriptor().Number()))\n}\nfunc (m *extensionMap) Get(xt pref.ExtensionType) pref.Value {\n\txd := xt.TypeDescriptor()\n\tif m != nil {\n\t\tif x, ok := (*m)[int32(xd.Number())]; ok {\n\t\t\treturn x.Value()\n\t\t}\n\t}\n\treturn xt.Zero()\n}\nfunc (m *extensionMap) Set(xt pref.ExtensionType, v pref.Value) {\n\txd := xt.TypeDescriptor()\n\tisValid := true\n\tswitch {\n\tcase !xt.IsValidValue(v):\n\t\tisValid = false\n\tcase xd.IsList():\n\t\tisValid = v.List().IsValid()\n\tcase xd.IsMap():\n\t\tisValid = v.Map().IsValid()\n\tcase xd.Message() != nil:\n\t\tisValid = v.Message().IsValid()\n\t}\n\tif !isValid {\n\t\tpanic(fmt.Sprintf(\"%v: assigning invalid value\", xt.TypeDescriptor().FullName()))\n\t}\n\n\tif *m == nil {\n\t\t*m = make(map[int32]ExtensionField)\n\t}\n\tvar x ExtensionField\n\tx.Set(xt, v)\n\t(*m)[int32(xd.Number())] = x\n}\nfunc (m *extensionMap) Mutable(xt pref.ExtensionType) pref.Value {\n\txd := xt.TypeDescriptor()\n\tif xd.Kind() != pref.MessageKind && xd.Kind() != pref.GroupKind && !xd.IsList() && !xd.IsMap() {\n\t\tpanic(\"invalid Mutable on field with non-composite type\")\n\t}\n\tif x, ok := (*m)[int32(xd.Number())]; ok {\n\t\treturn x.Value()\n\t}\n\tv := xt.New()\n\tm.Set(xt, v)\n\treturn v\n}\n\n// MessageState is a data structure that is nested as the first field in a\n// concrete message. It provides a way to implement the ProtoReflect method\n// in an allocation-free way without needing to have a shadow Go type generated\n// for every message type. This technique only works using unsafe.\n//\n//\n// Example generated code:\n//\n//\ttype M struct {\n//\t\tstate protoimpl.MessageState\n//\n//\t\tField1 int32\n//\t\tField2 string\n//\t\tField3 *BarMessage\n//\t\t...\n//\t}\n//\n//\tfunc (m *M) ProtoReflect() protoreflect.Message {\n//\t\tmi := &file_fizz_buzz_proto_msgInfos[5]\n//\t\tif protoimpl.UnsafeEnabled && m != nil {\n//\t\t\tms := protoimpl.X.MessageStateOf(Pointer(m))\n//\t\t\tif ms.LoadMessageInfo() == nil {\n//\t\t\t\tms.StoreMessageInfo(mi)\n//\t\t\t}\n//\t\t\treturn ms\n//\t\t}\n//\t\treturn mi.MessageOf(m)\n//\t}\n//\n// The MessageState type holds a *MessageInfo, which must be atomically set to\n// the message info associated with a given message instance.\n// By unsafely converting a *M into a *MessageState, the MessageState object\n// has access to all the information needed to implement protobuf reflection.\n// It has access to the message info as its first field, and a pointer to the\n// MessageState is identical to a pointer to the concrete message value.\n//\n//\n// Requirements:\n//\t• The type M must implement protoreflect.ProtoMessage.\n//\t• The address of m must not be nil.\n//\t• The address of m and the address of m.state must be equal,\n//\teven though they are different Go types.\ntype MessageState struct {\n\tpragma.NoUnkeyedLiterals\n\tpragma.DoNotCompare\n\tpragma.DoNotCopy\n\n\tatomicMessageInfo *MessageInfo\n}\n\ntype messageState MessageState\n\nvar (\n\t_ pref.Message = (*messageState)(nil)\n\t_ unwrapper    = (*messageState)(nil)\n)\n\n// messageDataType is a tuple of a pointer to the message data and\n// a pointer to the message type. It is a generalized way of providing a\n// reflective view over a message instance. The disadvantage of this approach\n// is the need to allocate this tuple of 16B.\ntype messageDataType struct {\n\tp  pointer\n\tmi *MessageInfo\n}\n\ntype (\n\tmessageReflectWrapper messageDataType\n\tmessageIfaceWrapper   messageDataType\n)\n\nvar (\n\t_ pref.Message      = (*messageReflectWrapper)(nil)\n\t_ unwrapper         = (*messageReflectWrapper)(nil)\n\t_ pref.ProtoMessage = (*messageIfaceWrapper)(nil)\n\t_ unwrapper         = (*messageIfaceWrapper)(nil)\n)\n\n// MessageOf returns a reflective view over a message. The input must be a\n// pointer to a named Go struct. If the provided type has a ProtoReflect method,\n// it must be implemented by calling this method.\nfunc (mi *MessageInfo) MessageOf(m interface{}) pref.Message {\n\tif reflect.TypeOf(m) != mi.GoReflectType {\n\t\tpanic(fmt.Sprintf(\"type mismatch: got %T, want %v\", m, mi.GoReflectType))\n\t}\n\tp := pointerOfIface(m)\n\tif p.IsNil() {\n\t\treturn mi.nilMessage.Init(mi)\n\t}\n\treturn &messageReflectWrapper{p, mi}\n}\n\nfunc (m *messageReflectWrapper) pointer() pointer          { return m.p }\nfunc (m *messageReflectWrapper) messageInfo() *MessageInfo { return m.mi }\n\n// Reset implements the v1 proto.Message.Reset method.\nfunc (m *messageIfaceWrapper) Reset() {\n\tif mr, ok := m.protoUnwrap().(interface{ Reset() }); ok {\n\t\tmr.Reset()\n\t\treturn\n\t}\n\trv := reflect.ValueOf(m.protoUnwrap())\n\tif rv.Kind() == reflect.Ptr && !rv.IsNil() {\n\t\trv.Elem().Set(reflect.Zero(rv.Type().Elem()))\n\t}\n}\nfunc (m *messageIfaceWrapper) ProtoReflect() pref.Message {\n\treturn (*messageReflectWrapper)(m)\n}\nfunc (m *messageIfaceWrapper) protoUnwrap() interface{} {\n\treturn m.p.AsIfaceOf(m.mi.GoReflectType.Elem())\n}\n\n// checkField verifies that the provided field descriptor is valid.\n// Exactly one of the returned values is populated.\nfunc (mi *MessageInfo) checkField(fd pref.FieldDescriptor) (*fieldInfo, pref.ExtensionType) {\n\tvar fi *fieldInfo\n\tif n := fd.Number(); 0 < n && int(n) < len(mi.denseFields) {\n\t\tfi = mi.denseFields[n]\n\t} else {\n\t\tfi = mi.fields[n]\n\t}\n\tif fi != nil {\n\t\tif fi.fieldDesc != fd {\n\t\t\tif got, want := fd.FullName(), fi.fieldDesc.FullName(); got != want {\n\t\t\t\tpanic(fmt.Sprintf(\"mismatching field: got %v, want %v\", got, want))\n\t\t\t}\n\t\t\tpanic(fmt.Sprintf(\"mismatching field: %v\", fd.FullName()))\n\t\t}\n\t\treturn fi, nil\n\t}\n\n\tif fd.IsExtension() {\n\t\tif got, want := fd.ContainingMessage().FullName(), mi.Desc.FullName(); got != want {\n\t\t\t// TODO: Should this be exact containing message descriptor match?\n\t\t\tpanic(fmt.Sprintf(\"extension %v has mismatching containing message: got %v, want %v\", fd.FullName(), got, want))\n\t\t}\n\t\tif !mi.Desc.ExtensionRanges().Has(fd.Number()) {\n\t\t\tpanic(fmt.Sprintf(\"extension %v extends %v outside the extension range\", fd.FullName(), mi.Desc.FullName()))\n\t\t}\n\t\txtd, ok := fd.(pref.ExtensionTypeDescriptor)\n\t\tif !ok {\n\t\t\tpanic(fmt.Sprintf(\"extension %v does not implement protoreflect.ExtensionTypeDescriptor\", fd.FullName()))\n\t\t}\n\t\treturn nil, xtd.Type()\n\t}\n\tpanic(fmt.Sprintf(\"field %v is invalid\", fd.FullName()))\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.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 impl\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\t\"reflect\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/flags\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\ntype fieldInfo struct {\n\tfieldDesc pref.FieldDescriptor\n\n\t// These fields are used for protobuf reflection support.\n\thas        func(pointer) bool\n\tclear      func(pointer)\n\tget        func(pointer) pref.Value\n\tset        func(pointer, pref.Value)\n\tmutable    func(pointer) pref.Value\n\tnewMessage func() pref.Message\n\tnewField   func() pref.Value\n}\n\nfunc fieldInfoForMissing(fd pref.FieldDescriptor) fieldInfo {\n\t// This never occurs for generated message types.\n\t// It implies that a hand-crafted type has missing Go fields\n\t// for specific protobuf message fields.\n\treturn fieldInfo{\n\t\tfieldDesc: fd,\n\t\thas: func(p pointer) bool {\n\t\t\treturn false\n\t\t},\n\t\tclear: func(p pointer) {\n\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t},\n\t\tget: func(p pointer) pref.Value {\n\t\t\treturn fd.Default()\n\t\t},\n\t\tset: func(p pointer, v pref.Value) {\n\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t},\n\t\tmutable: func(p pointer) pref.Value {\n\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t},\n\t\tnewMessage: func() pref.Message {\n\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t},\n\t\tnewField: func() pref.Value {\n\t\t\tif v := fd.Default(); v.IsValid() {\n\t\t\t\treturn v\n\t\t\t}\n\t\t\tpanic(\"missing Go struct field for \" + string(fd.FullName()))\n\t\t},\n\t}\n}\n\nfunc fieldInfoForOneof(fd pref.FieldDescriptor, fs reflect.StructField, x exporter, ot reflect.Type) fieldInfo {\n\tft := fs.Type\n\tif ft.Kind() != reflect.Interface {\n\t\tpanic(fmt.Sprintf(\"field %v has invalid type: got %v, want interface kind\", fd.FullName(), ft))\n\t}\n\tif ot.Kind() != reflect.Struct {\n\t\tpanic(fmt.Sprintf(\"field %v has invalid type: got %v, want struct kind\", fd.FullName(), ot))\n\t}\n\tif !reflect.PtrTo(ot).Implements(ft) {\n\t\tpanic(fmt.Sprintf(\"field %v has invalid type: %v does not implement %v\", fd.FullName(), ot, ft))\n\t}\n\tconv := NewConverter(ot.Field(0).Type, fd)\n\tisMessage := fd.Message() != nil\n\n\t// TODO: Implement unsafe fast path?\n\tfieldOffset := offsetOf(fs, x)\n\treturn fieldInfo{\n\t\t// NOTE: The logic below intentionally assumes that oneof fields are\n\t\t// well-formatted. That is, the oneof interface never contains a\n\t\t// typed nil pointer to one of the wrapper structs.\n\n\t\tfieldDesc: fd,\n\t\thas: func(p pointer) bool {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\t\tclear: func(p pointer) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.IsNil() || rv.Elem().Type().Elem() != ot {\n\t\t\t\t// NOTE: We intentionally don't check for rv.Elem().IsNil()\n\t\t\t\t// so that (*OneofWrapperType)(nil) gets cleared to nil.\n\t\t\t\treturn\n\t\t\t}\n\t\t\trv.Set(reflect.Zero(rv.Type()))\n\t\t},\n\t\tget: func(p pointer) pref.Value {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\trv = rv.Elem().Elem().Field(0)\n\t\t\treturn conv.PBValueOf(rv)\n\t\t},\n\t\tset: func(p pointer, v pref.Value) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {\n\t\t\t\trv.Set(reflect.New(ot))\n\t\t\t}\n\t\t\trv = rv.Elem().Elem().Field(0)\n\t\t\trv.Set(conv.GoValueOf(v))\n\t\t},\n\t\tmutable: func(p pointer) pref.Value {\n\t\t\tif !isMessage {\n\t\t\t\tpanic(fmt.Sprintf(\"field %v with invalid Mutable call on field with non-composite type\", fd.FullName()))\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {\n\t\t\t\trv.Set(reflect.New(ot))\n\t\t\t}\n\t\t\trv = rv.Elem().Elem().Field(0)\n\t\t\tif rv.Kind() == reflect.Ptr && rv.IsNil() {\n\t\t\t\trv.Set(conv.GoValueOf(pref.ValueOfMessage(conv.New().Message())))\n\t\t\t}\n\t\t\treturn conv.PBValueOf(rv)\n\t\t},\n\t\tnewMessage: func() pref.Message {\n\t\t\treturn conv.New().Message()\n\t\t},\n\t\tnewField: func() pref.Value {\n\t\t\treturn conv.New()\n\t\t},\n\t}\n}\n\nfunc fieldInfoForMap(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {\n\tft := fs.Type\n\tif ft.Kind() != reflect.Map {\n\t\tpanic(fmt.Sprintf(\"field %v has invalid type: got %v, want map kind\", fd.FullName(), ft))\n\t}\n\tconv := NewConverter(ft, fd)\n\n\t// TODO: Implement unsafe fast path?\n\tfieldOffset := offsetOf(fs, x)\n\treturn fieldInfo{\n\t\tfieldDesc: fd,\n\t\thas: func(p pointer) bool {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\treturn rv.Len() > 0\n\t\t},\n\t\tclear: func(p pointer) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\trv.Set(reflect.Zero(rv.Type()))\n\t\t},\n\t\tget: func(p pointer) pref.Value {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.Len() == 0 {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\treturn conv.PBValueOf(rv)\n\t\t},\n\t\tset: func(p pointer, v pref.Value) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tpv := conv.GoValueOf(v)\n\t\t\tif pv.IsNil() {\n\t\t\t\tpanic(fmt.Sprintf(\"map field %v cannot be set with read-only value\", fd.FullName()))\n\t\t\t}\n\t\t\trv.Set(pv)\n\t\t},\n\t\tmutable: func(p pointer) pref.Value {\n\t\t\tv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif v.IsNil() {\n\t\t\t\tv.Set(reflect.MakeMap(fs.Type))\n\t\t\t}\n\t\t\treturn conv.PBValueOf(v)\n\t\t},\n\t\tnewField: func() pref.Value {\n\t\t\treturn conv.New()\n\t\t},\n\t}\n}\n\nfunc fieldInfoForList(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {\n\tft := fs.Type\n\tif ft.Kind() != reflect.Slice {\n\t\tpanic(fmt.Sprintf(\"field %v has invalid type: got %v, want slice kind\", fd.FullName(), ft))\n\t}\n\tconv := NewConverter(reflect.PtrTo(ft), fd)\n\n\t// TODO: Implement unsafe fast path?\n\tfieldOffset := offsetOf(fs, x)\n\treturn fieldInfo{\n\t\tfieldDesc: fd,\n\t\thas: func(p pointer) bool {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\treturn rv.Len() > 0\n\t\t},\n\t\tclear: func(p pointer) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\trv.Set(reflect.Zero(rv.Type()))\n\t\t},\n\t\tget: func(p pointer) pref.Value {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type)\n\t\t\tif rv.Elem().Len() == 0 {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\treturn conv.PBValueOf(rv)\n\t\t},\n\t\tset: func(p pointer, v pref.Value) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tpv := conv.GoValueOf(v)\n\t\t\tif pv.IsNil() {\n\t\t\t\tpanic(fmt.Sprintf(\"list field %v cannot be set with read-only value\", fd.FullName()))\n\t\t\t}\n\t\t\trv.Set(pv.Elem())\n\t\t},\n\t\tmutable: func(p pointer) pref.Value {\n\t\t\tv := p.Apply(fieldOffset).AsValueOf(fs.Type)\n\t\t\treturn conv.PBValueOf(v)\n\t\t},\n\t\tnewField: func() pref.Value {\n\t\t\treturn conv.New()\n\t\t},\n\t}\n}\n\nvar (\n\tnilBytes   = reflect.ValueOf([]byte(nil))\n\temptyBytes = reflect.ValueOf([]byte{})\n)\n\nfunc fieldInfoForScalar(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {\n\tft := fs.Type\n\tnullable := fd.HasPresence()\n\tisBytes := ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8\n\tif nullable {\n\t\tif ft.Kind() != reflect.Ptr && ft.Kind() != reflect.Slice {\n\t\t\t// This never occurs for generated message types.\n\t\t\t// Despite the protobuf type system specifying presence,\n\t\t\t// the Go field type cannot represent it.\n\t\t\tnullable = false\n\t\t}\n\t\tif ft.Kind() == reflect.Ptr {\n\t\t\tft = ft.Elem()\n\t\t}\n\t}\n\tconv := NewConverter(ft, fd)\n\n\t// TODO: Implement unsafe fast path?\n\tfieldOffset := offsetOf(fs, x)\n\treturn fieldInfo{\n\t\tfieldDesc: fd,\n\t\thas: func(p pointer) bool {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif nullable {\n\t\t\t\treturn !rv.IsNil()\n\t\t\t}\n\t\t\tswitch rv.Kind() {\n\t\t\tcase reflect.Bool:\n\t\t\t\treturn rv.Bool()\n\t\t\tcase reflect.Int32, reflect.Int64:\n\t\t\t\treturn rv.Int() != 0\n\t\t\tcase reflect.Uint32, reflect.Uint64:\n\t\t\t\treturn rv.Uint() != 0\n\t\t\tcase reflect.Float32, reflect.Float64:\n\t\t\t\treturn rv.Float() != 0 || math.Signbit(rv.Float())\n\t\t\tcase reflect.String, reflect.Slice:\n\t\t\t\treturn rv.Len() > 0\n\t\t\tdefault:\n\t\t\t\tpanic(fmt.Sprintf(\"field %v has invalid type: %v\", fd.FullName(), rv.Type())) // should never happen\n\t\t\t}\n\t\t},\n\t\tclear: func(p pointer) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\trv.Set(reflect.Zero(rv.Type()))\n\t\t},\n\t\tget: func(p pointer) pref.Value {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif nullable {\n\t\t\t\tif rv.IsNil() {\n\t\t\t\t\treturn conv.Zero()\n\t\t\t\t}\n\t\t\t\tif rv.Kind() == reflect.Ptr {\n\t\t\t\t\trv = rv.Elem()\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn conv.PBValueOf(rv)\n\t\t},\n\t\tset: func(p pointer, v pref.Value) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif nullable && rv.Kind() == reflect.Ptr {\n\t\t\t\tif rv.IsNil() {\n\t\t\t\t\trv.Set(reflect.New(ft))\n\t\t\t\t}\n\t\t\t\trv = rv.Elem()\n\t\t\t}\n\t\t\trv.Set(conv.GoValueOf(v))\n\t\t\tif isBytes && rv.Len() == 0 {\n\t\t\t\tif nullable {\n\t\t\t\t\trv.Set(emptyBytes) // preserve presence\n\t\t\t\t} else {\n\t\t\t\t\trv.Set(nilBytes) // do not preserve presence\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tnewField: func() pref.Value {\n\t\t\treturn conv.New()\n\t\t},\n\t}\n}\n\nfunc fieldInfoForWeakMessage(fd pref.FieldDescriptor, weakOffset offset) fieldInfo {\n\tif !flags.ProtoLegacy {\n\t\tpanic(\"no support for proto1 weak fields\")\n\t}\n\n\tvar once sync.Once\n\tvar messageType pref.MessageType\n\tlazyInit := func() {\n\t\tonce.Do(func() {\n\t\t\tmessageName := fd.Message().FullName()\n\t\t\tmessageType, _ = preg.GlobalTypes.FindMessageByName(messageName)\n\t\t\tif messageType == nil {\n\t\t\t\tpanic(fmt.Sprintf(\"weak message %v for field %v is not linked in\", messageName, fd.FullName()))\n\t\t\t}\n\t\t})\n\t}\n\n\tnum := fd.Number()\n\treturn fieldInfo{\n\t\tfieldDesc: fd,\n\t\thas: func(p pointer) bool {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\t_, ok := p.Apply(weakOffset).WeakFields().get(num)\n\t\t\treturn ok\n\t\t},\n\t\tclear: func(p pointer) {\n\t\t\tp.Apply(weakOffset).WeakFields().clear(num)\n\t\t},\n\t\tget: func(p pointer) pref.Value {\n\t\t\tlazyInit()\n\t\t\tif p.IsNil() {\n\t\t\t\treturn pref.ValueOfMessage(messageType.Zero())\n\t\t\t}\n\t\t\tm, ok := p.Apply(weakOffset).WeakFields().get(num)\n\t\t\tif !ok {\n\t\t\t\treturn pref.ValueOfMessage(messageType.Zero())\n\t\t\t}\n\t\t\treturn pref.ValueOfMessage(m.ProtoReflect())\n\t\t},\n\t\tset: func(p pointer, v pref.Value) {\n\t\t\tlazyInit()\n\t\t\tm := v.Message()\n\t\t\tif m.Descriptor() != messageType.Descriptor() {\n\t\t\t\tif got, want := m.Descriptor().FullName(), messageType.Descriptor().FullName(); got != want {\n\t\t\t\t\tpanic(fmt.Sprintf(\"field %v has mismatching message descriptor: got %v, want %v\", fd.FullName(), got, want))\n\t\t\t\t}\n\t\t\t\tpanic(fmt.Sprintf(\"field %v has mismatching message descriptor: %v\", fd.FullName(), m.Descriptor().FullName()))\n\t\t\t}\n\t\t\tp.Apply(weakOffset).WeakFields().set(num, m.Interface())\n\t\t},\n\t\tmutable: func(p pointer) pref.Value {\n\t\t\tlazyInit()\n\t\t\tfs := p.Apply(weakOffset).WeakFields()\n\t\t\tm, ok := fs.get(num)\n\t\t\tif !ok {\n\t\t\t\tm = messageType.New().Interface()\n\t\t\t\tfs.set(num, m)\n\t\t\t}\n\t\t\treturn pref.ValueOfMessage(m.ProtoReflect())\n\t\t},\n\t\tnewMessage: func() pref.Message {\n\t\t\tlazyInit()\n\t\t\treturn messageType.New()\n\t\t},\n\t\tnewField: func() pref.Value {\n\t\t\tlazyInit()\n\t\t\treturn pref.ValueOfMessage(messageType.New())\n\t\t},\n\t}\n}\n\nfunc fieldInfoForMessage(fd pref.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {\n\tft := fs.Type\n\tconv := NewConverter(ft, fd)\n\n\t// TODO: Implement unsafe fast path?\n\tfieldOffset := offsetOf(fs, x)\n\treturn fieldInfo{\n\t\tfieldDesc: fd,\n\t\thas: func(p pointer) bool {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif fs.Type.Kind() != reflect.Ptr {\n\t\t\t\treturn !isZero(rv)\n\t\t\t}\n\t\t\treturn !rv.IsNil()\n\t\t},\n\t\tclear: func(p pointer) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\trv.Set(reflect.Zero(rv.Type()))\n\t\t},\n\t\tget: func(p pointer) pref.Value {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn conv.Zero()\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\treturn conv.PBValueOf(rv)\n\t\t},\n\t\tset: func(p pointer, v pref.Value) {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\trv.Set(conv.GoValueOf(v))\n\t\t\tif fs.Type.Kind() == reflect.Ptr && rv.IsNil() {\n\t\t\t\tpanic(fmt.Sprintf(\"field %v has invalid nil pointer\", fd.FullName()))\n\t\t\t}\n\t\t},\n\t\tmutable: func(p pointer) pref.Value {\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif fs.Type.Kind() == reflect.Ptr && rv.IsNil() {\n\t\t\t\trv.Set(conv.GoValueOf(conv.New()))\n\t\t\t}\n\t\t\treturn conv.PBValueOf(rv)\n\t\t},\n\t\tnewMessage: func() pref.Message {\n\t\t\treturn conv.New().Message()\n\t\t},\n\t\tnewField: func() pref.Value {\n\t\t\treturn conv.New()\n\t\t},\n\t}\n}\n\ntype oneofInfo struct {\n\toneofDesc pref.OneofDescriptor\n\twhich     func(pointer) pref.FieldNumber\n}\n\nfunc makeOneofInfo(od pref.OneofDescriptor, si structInfo, x exporter) *oneofInfo {\n\toi := &oneofInfo{oneofDesc: od}\n\tif od.IsSynthetic() {\n\t\tfs := si.fieldsByNumber[od.Fields().Get(0).Number()]\n\t\tfieldOffset := offsetOf(fs, x)\n\t\toi.which = func(p pointer) pref.FieldNumber {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.IsNil() { // valid on either *T or []byte\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\treturn od.Fields().Get(0).Number()\n\t\t}\n\t} else {\n\t\tfs := si.oneofsByName[od.Name()]\n\t\tfieldOffset := offsetOf(fs, x)\n\t\toi.which = func(p pointer) pref.FieldNumber {\n\t\t\tif p.IsNil() {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\trv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()\n\t\t\tif rv.IsNil() {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\trv = rv.Elem()\n\t\t\tif rv.IsNil() {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\treturn si.oneofWrappersByType[rv.Type().Elem()]\n\t\t}\n\t}\n\treturn oi\n}\n\n// isZero is identical to reflect.Value.IsZero.\n// TODO: Remove this when Go1.13 is the minimally supported Go version.\nfunc isZero(v reflect.Value) bool {\n\tswitch v.Kind() {\n\tcase reflect.Bool:\n\t\treturn !v.Bool()\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn v.Int() == 0\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn v.Uint() == 0\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn math.Float64bits(v.Float()) == 0\n\tcase reflect.Complex64, reflect.Complex128:\n\t\tc := v.Complex()\n\t\treturn math.Float64bits(real(c)) == 0 && math.Float64bits(imag(c)) == 0\n\tcase reflect.Array:\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tif !isZero(v.Index(i)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\tcase reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice, reflect.UnsafePointer:\n\t\treturn v.IsNil()\n\tcase reflect.String:\n\t\treturn v.Len() == 0\n\tcase reflect.Struct:\n\t\tfor i := 0; i < v.NumField(); i++ {\n\t\t\tif !isZero(v.Field(i)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\tdefault:\n\t\tpanic(&reflect.ValueError{\"reflect.Value.IsZero\", v.Kind()})\n\t}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.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// Code generated by generate-types. DO NOT EDIT.\n\npackage impl\n\nimport (\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n)\n\nfunc (m *messageState) Descriptor() protoreflect.MessageDescriptor {\n\treturn m.messageInfo().Desc\n}\nfunc (m *messageState) Type() protoreflect.MessageType {\n\treturn m.messageInfo()\n}\nfunc (m *messageState) New() protoreflect.Message {\n\treturn m.messageInfo().New()\n}\nfunc (m *messageState) Interface() protoreflect.ProtoMessage {\n\treturn m.protoUnwrap().(protoreflect.ProtoMessage)\n}\nfunc (m *messageState) protoUnwrap() interface{} {\n\treturn m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())\n}\nfunc (m *messageState) ProtoMethods() *protoiface.Methods {\n\tm.messageInfo().init()\n\treturn &m.messageInfo().methods\n}\n\n// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code\n// to be able to retrieve a v2 MessageInfo struct.\n//\n// WARNING: This method is exempt from the compatibility promise and\n// may be removed in the future without warning.\nfunc (m *messageState) ProtoMessageInfo() *MessageInfo {\n\treturn m.messageInfo()\n}\n\nfunc (m *messageState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {\n\tm.messageInfo().init()\n\tfor _, ri := range m.messageInfo().rangeInfos {\n\t\tswitch ri := ri.(type) {\n\t\tcase *fieldInfo:\n\t\t\tif ri.has(m.pointer()) {\n\t\t\t\tif !f(ri.fieldDesc, ri.get(m.pointer())) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\tcase *oneofInfo:\n\t\t\tif n := ri.which(m.pointer()); n > 0 {\n\t\t\t\tfi := m.messageInfo().fields[n]\n\t\t\t\tif !f(fi.fieldDesc, fi.get(m.pointer())) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tm.messageInfo().extensionMap(m.pointer()).Range(f)\n}\nfunc (m *messageState) Has(fd protoreflect.FieldDescriptor) bool {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.has(m.pointer())\n\t} else {\n\t\treturn m.messageInfo().extensionMap(m.pointer()).Has(xt)\n\t}\n}\nfunc (m *messageState) Clear(fd protoreflect.FieldDescriptor) {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\tfi.clear(m.pointer())\n\t} else {\n\t\tm.messageInfo().extensionMap(m.pointer()).Clear(xt)\n\t}\n}\nfunc (m *messageState) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.get(m.pointer())\n\t} else {\n\t\treturn m.messageInfo().extensionMap(m.pointer()).Get(xt)\n\t}\n}\nfunc (m *messageState) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\tfi.set(m.pointer(), v)\n\t} else {\n\t\tm.messageInfo().extensionMap(m.pointer()).Set(xt, v)\n\t}\n}\nfunc (m *messageState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.mutable(m.pointer())\n\t} else {\n\t\treturn m.messageInfo().extensionMap(m.pointer()).Mutable(xt)\n\t}\n}\nfunc (m *messageState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.newField()\n\t} else {\n\t\treturn xt.New()\n\t}\n}\nfunc (m *messageState) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {\n\tm.messageInfo().init()\n\tif oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {\n\t\treturn od.Fields().ByNumber(oi.which(m.pointer()))\n\t}\n\tpanic(\"invalid oneof descriptor \" + string(od.FullName()) + \" for message \" + string(m.Descriptor().FullName()))\n}\nfunc (m *messageState) GetUnknown() protoreflect.RawFields {\n\tm.messageInfo().init()\n\treturn m.messageInfo().getUnknown(m.pointer())\n}\nfunc (m *messageState) SetUnknown(b protoreflect.RawFields) {\n\tm.messageInfo().init()\n\tm.messageInfo().setUnknown(m.pointer(), b)\n}\nfunc (m *messageState) IsValid() bool {\n\treturn !m.pointer().IsNil()\n}\n\nfunc (m *messageReflectWrapper) Descriptor() protoreflect.MessageDescriptor {\n\treturn m.messageInfo().Desc\n}\nfunc (m *messageReflectWrapper) Type() protoreflect.MessageType {\n\treturn m.messageInfo()\n}\nfunc (m *messageReflectWrapper) New() protoreflect.Message {\n\treturn m.messageInfo().New()\n}\nfunc (m *messageReflectWrapper) Interface() protoreflect.ProtoMessage {\n\tif m, ok := m.protoUnwrap().(protoreflect.ProtoMessage); ok {\n\t\treturn m\n\t}\n\treturn (*messageIfaceWrapper)(m)\n}\nfunc (m *messageReflectWrapper) protoUnwrap() interface{} {\n\treturn m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())\n}\nfunc (m *messageReflectWrapper) ProtoMethods() *protoiface.Methods {\n\tm.messageInfo().init()\n\treturn &m.messageInfo().methods\n}\n\n// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code\n// to be able to retrieve a v2 MessageInfo struct.\n//\n// WARNING: This method is exempt from the compatibility promise and\n// may be removed in the future without warning.\nfunc (m *messageReflectWrapper) ProtoMessageInfo() *MessageInfo {\n\treturn m.messageInfo()\n}\n\nfunc (m *messageReflectWrapper) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {\n\tm.messageInfo().init()\n\tfor _, ri := range m.messageInfo().rangeInfos {\n\t\tswitch ri := ri.(type) {\n\t\tcase *fieldInfo:\n\t\t\tif ri.has(m.pointer()) {\n\t\t\t\tif !f(ri.fieldDesc, ri.get(m.pointer())) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\tcase *oneofInfo:\n\t\t\tif n := ri.which(m.pointer()); n > 0 {\n\t\t\t\tfi := m.messageInfo().fields[n]\n\t\t\t\tif !f(fi.fieldDesc, fi.get(m.pointer())) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tm.messageInfo().extensionMap(m.pointer()).Range(f)\n}\nfunc (m *messageReflectWrapper) Has(fd protoreflect.FieldDescriptor) bool {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.has(m.pointer())\n\t} else {\n\t\treturn m.messageInfo().extensionMap(m.pointer()).Has(xt)\n\t}\n}\nfunc (m *messageReflectWrapper) Clear(fd protoreflect.FieldDescriptor) {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\tfi.clear(m.pointer())\n\t} else {\n\t\tm.messageInfo().extensionMap(m.pointer()).Clear(xt)\n\t}\n}\nfunc (m *messageReflectWrapper) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.get(m.pointer())\n\t} else {\n\t\treturn m.messageInfo().extensionMap(m.pointer()).Get(xt)\n\t}\n}\nfunc (m *messageReflectWrapper) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\tfi.set(m.pointer(), v)\n\t} else {\n\t\tm.messageInfo().extensionMap(m.pointer()).Set(xt, v)\n\t}\n}\nfunc (m *messageReflectWrapper) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.mutable(m.pointer())\n\t} else {\n\t\treturn m.messageInfo().extensionMap(m.pointer()).Mutable(xt)\n\t}\n}\nfunc (m *messageReflectWrapper) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {\n\tm.messageInfo().init()\n\tif fi, xt := m.messageInfo().checkField(fd); fi != nil {\n\t\treturn fi.newField()\n\t} else {\n\t\treturn xt.New()\n\t}\n}\nfunc (m *messageReflectWrapper) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {\n\tm.messageInfo().init()\n\tif oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {\n\t\treturn od.Fields().ByNumber(oi.which(m.pointer()))\n\t}\n\tpanic(\"invalid oneof descriptor \" + string(od.FullName()) + \" for message \" + string(m.Descriptor().FullName()))\n}\nfunc (m *messageReflectWrapper) GetUnknown() protoreflect.RawFields {\n\tm.messageInfo().init()\n\treturn m.messageInfo().getUnknown(m.pointer())\n}\nfunc (m *messageReflectWrapper) SetUnknown(b protoreflect.RawFields) {\n\tm.messageInfo().init()\n\tm.messageInfo().setUnknown(m.pointer(), b)\n}\nfunc (m *messageReflectWrapper) IsValid() bool {\n\treturn !m.pointer().IsNil()\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.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// +build purego appengine\n\npackage impl\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"sync\"\n)\n\nconst UnsafeEnabled = false\n\n// Pointer is an opaque pointer type.\ntype Pointer interface{}\n\n// offset represents the offset to a struct field, accessible from a pointer.\n// The offset is the field index into a struct.\ntype offset struct {\n\tindex  int\n\texport exporter\n}\n\n// offsetOf returns a field offset for the struct field.\nfunc offsetOf(f reflect.StructField, x exporter) offset {\n\tif len(f.Index) != 1 {\n\t\tpanic(\"embedded structs are not supported\")\n\t}\n\tif f.PkgPath == \"\" {\n\t\treturn offset{index: f.Index[0]} // field is already exported\n\t}\n\tif x == nil {\n\t\tpanic(\"exporter must be provided for unexported field\")\n\t}\n\treturn offset{index: f.Index[0], export: x}\n}\n\n// IsValid reports whether the offset is valid.\nfunc (f offset) IsValid() bool { return f.index >= 0 }\n\n// invalidOffset is an invalid field offset.\nvar invalidOffset = offset{index: -1}\n\n// zeroOffset is a noop when calling pointer.Apply.\nvar zeroOffset = offset{index: 0}\n\n// pointer is an abstract representation of a pointer to a struct or field.\ntype pointer struct{ v reflect.Value }\n\n// pointerOf returns p as a pointer.\nfunc pointerOf(p Pointer) pointer {\n\treturn pointerOfIface(p)\n}\n\n// pointerOfValue returns v as a pointer.\nfunc pointerOfValue(v reflect.Value) pointer {\n\treturn pointer{v: v}\n}\n\n// pointerOfIface returns the pointer portion of an interface.\nfunc pointerOfIface(v interface{}) pointer {\n\treturn pointer{v: reflect.ValueOf(v)}\n}\n\n// IsNil reports whether the pointer is nil.\nfunc (p pointer) IsNil() bool {\n\treturn p.v.IsNil()\n}\n\n// Apply adds an offset to the pointer to derive a new pointer\n// to a specified field. The current pointer must be pointing at a struct.\nfunc (p pointer) Apply(f offset) pointer {\n\tif f.export != nil {\n\t\tif v := reflect.ValueOf(f.export(p.v.Interface(), f.index)); v.IsValid() {\n\t\t\treturn pointer{v: v}\n\t\t}\n\t}\n\treturn pointer{v: p.v.Elem().Field(f.index).Addr()}\n}\n\n// AsValueOf treats p as a pointer to an object of type t and returns the value.\n// It is equivalent to reflect.ValueOf(p.AsIfaceOf(t))\nfunc (p pointer) AsValueOf(t reflect.Type) reflect.Value {\n\tif got := p.v.Type().Elem(); got != t {\n\t\tpanic(fmt.Sprintf(\"invalid type: got %v, want %v\", got, t))\n\t}\n\treturn p.v\n}\n\n// AsIfaceOf treats p as a pointer to an object of type t and returns the value.\n// It is equivalent to p.AsValueOf(t).Interface()\nfunc (p pointer) AsIfaceOf(t reflect.Type) interface{} {\n\treturn p.AsValueOf(t).Interface()\n}\n\nfunc (p pointer) Bool() *bool              { return p.v.Interface().(*bool) }\nfunc (p pointer) BoolPtr() **bool          { return p.v.Interface().(**bool) }\nfunc (p pointer) BoolSlice() *[]bool       { return p.v.Interface().(*[]bool) }\nfunc (p pointer) Int32() *int32            { return p.v.Interface().(*int32) }\nfunc (p pointer) Int32Ptr() **int32        { return p.v.Interface().(**int32) }\nfunc (p pointer) Int32Slice() *[]int32     { return p.v.Interface().(*[]int32) }\nfunc (p pointer) Int64() *int64            { return p.v.Interface().(*int64) }\nfunc (p pointer) Int64Ptr() **int64        { return p.v.Interface().(**int64) }\nfunc (p pointer) Int64Slice() *[]int64     { return p.v.Interface().(*[]int64) }\nfunc (p pointer) Uint32() *uint32          { return p.v.Interface().(*uint32) }\nfunc (p pointer) Uint32Ptr() **uint32      { return p.v.Interface().(**uint32) }\nfunc (p pointer) Uint32Slice() *[]uint32   { return p.v.Interface().(*[]uint32) }\nfunc (p pointer) Uint64() *uint64          { return p.v.Interface().(*uint64) }\nfunc (p pointer) Uint64Ptr() **uint64      { return p.v.Interface().(**uint64) }\nfunc (p pointer) Uint64Slice() *[]uint64   { return p.v.Interface().(*[]uint64) }\nfunc (p pointer) Float32() *float32        { return p.v.Interface().(*float32) }\nfunc (p pointer) Float32Ptr() **float32    { return p.v.Interface().(**float32) }\nfunc (p pointer) Float32Slice() *[]float32 { return p.v.Interface().(*[]float32) }\nfunc (p pointer) Float64() *float64        { return p.v.Interface().(*float64) }\nfunc (p pointer) Float64Ptr() **float64    { return p.v.Interface().(**float64) }\nfunc (p pointer) Float64Slice() *[]float64 { return p.v.Interface().(*[]float64) }\nfunc (p pointer) String() *string          { return p.v.Interface().(*string) }\nfunc (p pointer) StringPtr() **string      { return p.v.Interface().(**string) }\nfunc (p pointer) StringSlice() *[]string   { return p.v.Interface().(*[]string) }\nfunc (p pointer) Bytes() *[]byte           { return p.v.Interface().(*[]byte) }\nfunc (p pointer) BytesPtr() **[]byte       { return p.v.Interface().(**[]byte) }\nfunc (p pointer) BytesSlice() *[][]byte    { return p.v.Interface().(*[][]byte) }\nfunc (p pointer) WeakFields() *weakFields  { return (*weakFields)(p.v.Interface().(*WeakFields)) }\nfunc (p pointer) Extensions() *map[int32]ExtensionField {\n\treturn p.v.Interface().(*map[int32]ExtensionField)\n}\n\nfunc (p pointer) Elem() pointer {\n\treturn pointer{v: p.v.Elem()}\n}\n\n// PointerSlice copies []*T from p as a new []pointer.\n// This behavior differs from the implementation in pointer_unsafe.go.\nfunc (p pointer) PointerSlice() []pointer {\n\t// TODO: reconsider this\n\tif p.v.IsNil() {\n\t\treturn nil\n\t}\n\tn := p.v.Elem().Len()\n\ts := make([]pointer, n)\n\tfor i := 0; i < n; i++ {\n\t\ts[i] = pointer{v: p.v.Elem().Index(i)}\n\t}\n\treturn s\n}\n\n// AppendPointerSlice appends v to p, which must be a []*T.\nfunc (p pointer) AppendPointerSlice(v pointer) {\n\tsp := p.v.Elem()\n\tsp.Set(reflect.Append(sp, v.v))\n}\n\n// SetPointer sets *p to v.\nfunc (p pointer) SetPointer(v pointer) {\n\tp.v.Elem().Set(v.v)\n}\n\nfunc (Export) MessageStateOf(p Pointer) *messageState     { panic(\"not supported\") }\nfunc (ms *messageState) pointer() pointer                 { panic(\"not supported\") }\nfunc (ms *messageState) messageInfo() *MessageInfo        { panic(\"not supported\") }\nfunc (ms *messageState) LoadMessageInfo() *MessageInfo    { panic(\"not supported\") }\nfunc (ms *messageState) StoreMessageInfo(mi *MessageInfo) { panic(\"not supported\") }\n\ntype atomicNilMessage struct {\n\tonce sync.Once\n\tm    messageReflectWrapper\n}\n\nfunc (m *atomicNilMessage) Init(mi *MessageInfo) *messageReflectWrapper {\n\tm.once.Do(func() {\n\t\tm.m.p = pointerOfIface(reflect.Zero(mi.GoReflectType).Interface())\n\t\tm.m.mi = mi\n\t})\n\treturn &m.m\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.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// +build !purego,!appengine\n\npackage impl\n\nimport (\n\t\"reflect\"\n\t\"sync/atomic\"\n\t\"unsafe\"\n)\n\nconst UnsafeEnabled = true\n\n// Pointer is an opaque pointer type.\ntype Pointer unsafe.Pointer\n\n// offset represents the offset to a struct field, accessible from a pointer.\n// The offset is the byte offset to the field from the start of the struct.\ntype offset uintptr\n\n// offsetOf returns a field offset for the struct field.\nfunc offsetOf(f reflect.StructField, x exporter) offset {\n\treturn offset(f.Offset)\n}\n\n// IsValid reports whether the offset is valid.\nfunc (f offset) IsValid() bool { return f != invalidOffset }\n\n// invalidOffset is an invalid field offset.\nvar invalidOffset = ^offset(0)\n\n// zeroOffset is a noop when calling pointer.Apply.\nvar zeroOffset = offset(0)\n\n// pointer is a pointer to a message struct or field.\ntype pointer struct{ p unsafe.Pointer }\n\n// pointerOf returns p as a pointer.\nfunc pointerOf(p Pointer) pointer {\n\treturn pointer{p: unsafe.Pointer(p)}\n}\n\n// pointerOfValue returns v as a pointer.\nfunc pointerOfValue(v reflect.Value) pointer {\n\treturn pointer{p: unsafe.Pointer(v.Pointer())}\n}\n\n// pointerOfIface returns the pointer portion of an interface.\nfunc pointerOfIface(v interface{}) pointer {\n\ttype ifaceHeader struct {\n\t\tType unsafe.Pointer\n\t\tData unsafe.Pointer\n\t}\n\treturn pointer{p: (*ifaceHeader)(unsafe.Pointer(&v)).Data}\n}\n\n// IsNil reports whether the pointer is nil.\nfunc (p pointer) IsNil() bool {\n\treturn p.p == nil\n}\n\n// Apply adds an offset to the pointer to derive a new pointer\n// to a specified field. The pointer must be valid and pointing at a struct.\nfunc (p pointer) Apply(f offset) pointer {\n\tif p.IsNil() {\n\t\tpanic(\"invalid nil pointer\")\n\t}\n\treturn pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))}\n}\n\n// AsValueOf treats p as a pointer to an object of type t and returns the value.\n// It is equivalent to reflect.ValueOf(p.AsIfaceOf(t))\nfunc (p pointer) AsValueOf(t reflect.Type) reflect.Value {\n\treturn reflect.NewAt(t, p.p)\n}\n\n// AsIfaceOf treats p as a pointer to an object of type t and returns the value.\n// It is equivalent to p.AsValueOf(t).Interface()\nfunc (p pointer) AsIfaceOf(t reflect.Type) interface{} {\n\t// TODO: Use tricky unsafe magic to directly create ifaceHeader.\n\treturn p.AsValueOf(t).Interface()\n}\n\nfunc (p pointer) Bool() *bool                           { return (*bool)(p.p) }\nfunc (p pointer) BoolPtr() **bool                       { return (**bool)(p.p) }\nfunc (p pointer) BoolSlice() *[]bool                    { return (*[]bool)(p.p) }\nfunc (p pointer) Int32() *int32                         { return (*int32)(p.p) }\nfunc (p pointer) Int32Ptr() **int32                     { return (**int32)(p.p) }\nfunc (p pointer) Int32Slice() *[]int32                  { return (*[]int32)(p.p) }\nfunc (p pointer) Int64() *int64                         { return (*int64)(p.p) }\nfunc (p pointer) Int64Ptr() **int64                     { return (**int64)(p.p) }\nfunc (p pointer) Int64Slice() *[]int64                  { return (*[]int64)(p.p) }\nfunc (p pointer) Uint32() *uint32                       { return (*uint32)(p.p) }\nfunc (p pointer) Uint32Ptr() **uint32                   { return (**uint32)(p.p) }\nfunc (p pointer) Uint32Slice() *[]uint32                { return (*[]uint32)(p.p) }\nfunc (p pointer) Uint64() *uint64                       { return (*uint64)(p.p) }\nfunc (p pointer) Uint64Ptr() **uint64                   { return (**uint64)(p.p) }\nfunc (p pointer) Uint64Slice() *[]uint64                { return (*[]uint64)(p.p) }\nfunc (p pointer) Float32() *float32                     { return (*float32)(p.p) }\nfunc (p pointer) Float32Ptr() **float32                 { return (**float32)(p.p) }\nfunc (p pointer) Float32Slice() *[]float32              { return (*[]float32)(p.p) }\nfunc (p pointer) Float64() *float64                     { return (*float64)(p.p) }\nfunc (p pointer) Float64Ptr() **float64                 { return (**float64)(p.p) }\nfunc (p pointer) Float64Slice() *[]float64              { return (*[]float64)(p.p) }\nfunc (p pointer) String() *string                       { return (*string)(p.p) }\nfunc (p pointer) StringPtr() **string                   { return (**string)(p.p) }\nfunc (p pointer) StringSlice() *[]string                { return (*[]string)(p.p) }\nfunc (p pointer) Bytes() *[]byte                        { return (*[]byte)(p.p) }\nfunc (p pointer) BytesPtr() **[]byte                    { return (**[]byte)(p.p) }\nfunc (p pointer) BytesSlice() *[][]byte                 { return (*[][]byte)(p.p) }\nfunc (p pointer) WeakFields() *weakFields               { return (*weakFields)(p.p) }\nfunc (p pointer) Extensions() *map[int32]ExtensionField { return (*map[int32]ExtensionField)(p.p) }\n\nfunc (p pointer) Elem() pointer {\n\treturn pointer{p: *(*unsafe.Pointer)(p.p)}\n}\n\n// PointerSlice loads []*T from p as a []pointer.\n// The value returned is aliased with the original slice.\n// This behavior differs from the implementation in pointer_reflect.go.\nfunc (p pointer) PointerSlice() []pointer {\n\t// Super-tricky - p should point to a []*T where T is a\n\t// message type. We load it as []pointer.\n\treturn *(*[]pointer)(p.p)\n}\n\n// AppendPointerSlice appends v to p, which must be a []*T.\nfunc (p pointer) AppendPointerSlice(v pointer) {\n\t*(*[]pointer)(p.p) = append(*(*[]pointer)(p.p), v)\n}\n\n// SetPointer sets *p to v.\nfunc (p pointer) SetPointer(v pointer) {\n\t*(*unsafe.Pointer)(p.p) = (unsafe.Pointer)(v.p)\n}\n\n// Static check that MessageState does not exceed the size of a pointer.\nconst _ = uint(unsafe.Sizeof(unsafe.Pointer(nil)) - unsafe.Sizeof(MessageState{}))\n\nfunc (Export) MessageStateOf(p Pointer) *messageState {\n\t// Super-tricky - see documentation on MessageState.\n\treturn (*messageState)(unsafe.Pointer(p))\n}\nfunc (ms *messageState) pointer() pointer {\n\t// Super-tricky - see documentation on MessageState.\n\treturn pointer{p: unsafe.Pointer(ms)}\n}\nfunc (ms *messageState) messageInfo() *MessageInfo {\n\tmi := ms.LoadMessageInfo()\n\tif mi == nil {\n\t\tpanic(\"invalid nil message info; this suggests memory corruption due to a race or shallow copy on the message struct\")\n\t}\n\treturn mi\n}\nfunc (ms *messageState) LoadMessageInfo() *MessageInfo {\n\treturn (*MessageInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&ms.atomicMessageInfo))))\n}\nfunc (ms *messageState) StoreMessageInfo(mi *MessageInfo) {\n\tatomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&ms.atomicMessageInfo)), unsafe.Pointer(mi))\n}\n\ntype atomicNilMessage struct{ p unsafe.Pointer } // p is a *messageReflectWrapper\n\nfunc (m *atomicNilMessage) Init(mi *MessageInfo) *messageReflectWrapper {\n\tif p := atomic.LoadPointer(&m.p); p != nil {\n\t\treturn (*messageReflectWrapper)(p)\n\t}\n\tw := &messageReflectWrapper{mi: mi}\n\tatomic.CompareAndSwapPointer(&m.p, nil, (unsafe.Pointer)(w))\n\treturn (*messageReflectWrapper)(atomic.LoadPointer(&m.p))\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/validate.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 impl\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\t\"math/bits\"\n\t\"reflect\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\tpreg \"google.golang.org/protobuf/reflect/protoregistry\"\n\tpiface \"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// ValidationStatus is the result of validating the wire-format encoding of a message.\ntype ValidationStatus int\n\nconst (\n\t// ValidationUnknown indicates that unmarshaling the message might succeed or fail.\n\t// The validator was unable to render a judgement.\n\t//\n\t// The only causes of this status are an aberrant message type appearing somewhere\n\t// in the message or a failure in the extension resolver.\n\tValidationUnknown ValidationStatus = iota + 1\n\n\t// ValidationInvalid indicates that unmarshaling the message will fail.\n\tValidationInvalid\n\n\t// ValidationValid indicates that unmarshaling the message will succeed.\n\tValidationValid\n)\n\nfunc (v ValidationStatus) String() string {\n\tswitch v {\n\tcase ValidationUnknown:\n\t\treturn \"ValidationUnknown\"\n\tcase ValidationInvalid:\n\t\treturn \"ValidationInvalid\"\n\tcase ValidationValid:\n\t\treturn \"ValidationValid\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"ValidationStatus(%d)\", int(v))\n\t}\n}\n\n// Validate determines whether the contents of the buffer are a valid wire encoding\n// of the message type.\n//\n// This function is exposed for testing.\nfunc Validate(mt pref.MessageType, in piface.UnmarshalInput) (out piface.UnmarshalOutput, _ ValidationStatus) {\n\tmi, ok := mt.(*MessageInfo)\n\tif !ok {\n\t\treturn out, ValidationUnknown\n\t}\n\tif in.Resolver == nil {\n\t\tin.Resolver = preg.GlobalTypes\n\t}\n\to, st := mi.validate(in.Buf, 0, unmarshalOptions{\n\t\tflags:    in.Flags,\n\t\tresolver: in.Resolver,\n\t})\n\tif o.initialized {\n\t\tout.Flags |= piface.UnmarshalInitialized\n\t}\n\treturn out, st\n}\n\ntype validationInfo struct {\n\tmi               *MessageInfo\n\ttyp              validationType\n\tkeyType, valType validationType\n\n\t// For non-required fields, requiredBit is 0.\n\t//\n\t// For required fields, requiredBit's nth bit is set, where n is a\n\t// unique index in the range [0, MessageInfo.numRequiredFields).\n\t//\n\t// If there are more than 64 required fields, requiredBit is 0.\n\trequiredBit uint64\n}\n\ntype validationType uint8\n\nconst (\n\tvalidationTypeOther validationType = iota\n\tvalidationTypeMessage\n\tvalidationTypeGroup\n\tvalidationTypeMap\n\tvalidationTypeRepeatedVarint\n\tvalidationTypeRepeatedFixed32\n\tvalidationTypeRepeatedFixed64\n\tvalidationTypeVarint\n\tvalidationTypeFixed32\n\tvalidationTypeFixed64\n\tvalidationTypeBytes\n\tvalidationTypeUTF8String\n\tvalidationTypeMessageSetItem\n)\n\nfunc newFieldValidationInfo(mi *MessageInfo, si structInfo, fd pref.FieldDescriptor, ft reflect.Type) validationInfo {\n\tvar vi validationInfo\n\tswitch {\n\tcase fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():\n\t\tswitch fd.Kind() {\n\t\tcase pref.MessageKind:\n\t\t\tvi.typ = validationTypeMessage\n\t\t\tif ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {\n\t\t\t\tvi.mi = getMessageInfo(ot.Field(0).Type)\n\t\t\t}\n\t\tcase pref.GroupKind:\n\t\t\tvi.typ = validationTypeGroup\n\t\t\tif ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {\n\t\t\t\tvi.mi = getMessageInfo(ot.Field(0).Type)\n\t\t\t}\n\t\tcase pref.StringKind:\n\t\t\tif strs.EnforceUTF8(fd) {\n\t\t\t\tvi.typ = validationTypeUTF8String\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tvi = newValidationInfo(fd, ft)\n\t}\n\tif fd.Cardinality() == pref.Required {\n\t\t// Avoid overflow. The required field check is done with a 64-bit mask, with\n\t\t// any message containing more than 64 required fields always reported as\n\t\t// potentially uninitialized, so it is not important to get a precise count\n\t\t// of the required fields past 64.\n\t\tif mi.numRequiredFields < math.MaxUint8 {\n\t\t\tmi.numRequiredFields++\n\t\t\tvi.requiredBit = 1 << (mi.numRequiredFields - 1)\n\t\t}\n\t}\n\treturn vi\n}\n\nfunc newValidationInfo(fd pref.FieldDescriptor, ft reflect.Type) validationInfo {\n\tvar vi validationInfo\n\tswitch {\n\tcase fd.IsList():\n\t\tswitch fd.Kind() {\n\t\tcase pref.MessageKind:\n\t\t\tvi.typ = validationTypeMessage\n\t\t\tif ft.Kind() == reflect.Slice {\n\t\t\t\tvi.mi = getMessageInfo(ft.Elem())\n\t\t\t}\n\t\tcase pref.GroupKind:\n\t\t\tvi.typ = validationTypeGroup\n\t\t\tif ft.Kind() == reflect.Slice {\n\t\t\t\tvi.mi = getMessageInfo(ft.Elem())\n\t\t\t}\n\t\tcase pref.StringKind:\n\t\t\tvi.typ = validationTypeBytes\n\t\t\tif strs.EnforceUTF8(fd) {\n\t\t\t\tvi.typ = validationTypeUTF8String\n\t\t\t}\n\t\tdefault:\n\t\t\tswitch wireTypes[fd.Kind()] {\n\t\t\tcase protowire.VarintType:\n\t\t\t\tvi.typ = validationTypeRepeatedVarint\n\t\t\tcase protowire.Fixed32Type:\n\t\t\t\tvi.typ = validationTypeRepeatedFixed32\n\t\t\tcase protowire.Fixed64Type:\n\t\t\t\tvi.typ = validationTypeRepeatedFixed64\n\t\t\t}\n\t\t}\n\tcase fd.IsMap():\n\t\tvi.typ = validationTypeMap\n\t\tswitch fd.MapKey().Kind() {\n\t\tcase pref.StringKind:\n\t\t\tif strs.EnforceUTF8(fd) {\n\t\t\t\tvi.keyType = validationTypeUTF8String\n\t\t\t}\n\t\t}\n\t\tswitch fd.MapValue().Kind() {\n\t\tcase pref.MessageKind:\n\t\t\tvi.valType = validationTypeMessage\n\t\t\tif ft.Kind() == reflect.Map {\n\t\t\t\tvi.mi = getMessageInfo(ft.Elem())\n\t\t\t}\n\t\tcase pref.StringKind:\n\t\t\tif strs.EnforceUTF8(fd) {\n\t\t\t\tvi.valType = validationTypeUTF8String\n\t\t\t}\n\t\t}\n\tdefault:\n\t\tswitch fd.Kind() {\n\t\tcase pref.MessageKind:\n\t\t\tvi.typ = validationTypeMessage\n\t\t\tif !fd.IsWeak() {\n\t\t\t\tvi.mi = getMessageInfo(ft)\n\t\t\t}\n\t\tcase pref.GroupKind:\n\t\t\tvi.typ = validationTypeGroup\n\t\t\tvi.mi = getMessageInfo(ft)\n\t\tcase pref.StringKind:\n\t\t\tvi.typ = validationTypeBytes\n\t\t\tif strs.EnforceUTF8(fd) {\n\t\t\t\tvi.typ = validationTypeUTF8String\n\t\t\t}\n\t\tdefault:\n\t\t\tswitch wireTypes[fd.Kind()] {\n\t\t\tcase protowire.VarintType:\n\t\t\t\tvi.typ = validationTypeVarint\n\t\t\tcase protowire.Fixed32Type:\n\t\t\t\tvi.typ = validationTypeFixed32\n\t\t\tcase protowire.Fixed64Type:\n\t\t\t\tvi.typ = validationTypeFixed64\n\t\t\tcase protowire.BytesType:\n\t\t\t\tvi.typ = validationTypeBytes\n\t\t\t}\n\t\t}\n\t}\n\treturn vi\n}\n\nfunc (mi *MessageInfo) validate(b []byte, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, result ValidationStatus) {\n\tmi.init()\n\ttype validationState struct {\n\t\ttyp              validationType\n\t\tkeyType, valType validationType\n\t\tendGroup         protowire.Number\n\t\tmi               *MessageInfo\n\t\ttail             []byte\n\t\trequiredMask     uint64\n\t}\n\n\t// Pre-allocate some slots to avoid repeated slice reallocation.\n\tstates := make([]validationState, 0, 16)\n\tstates = append(states, validationState{\n\t\ttyp: validationTypeMessage,\n\t\tmi:  mi,\n\t})\n\tif groupTag > 0 {\n\t\tstates[0].typ = validationTypeGroup\n\t\tstates[0].endGroup = groupTag\n\t}\n\tinitialized := true\n\tstart := len(b)\nState:\n\tfor len(states) > 0 {\n\t\tst := &states[len(states)-1]\n\t\tfor len(b) > 0 {\n\t\t\t// Parse the tag (field number and wire type).\n\t\t\tvar tag uint64\n\t\t\tif b[0] < 0x80 {\n\t\t\t\ttag = uint64(b[0])\n\t\t\t\tb = b[1:]\n\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\ttag = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\tb = b[2:]\n\t\t\t} else {\n\t\t\t\tvar n int\n\t\t\t\ttag, n = protowire.ConsumeVarint(b)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t}\n\t\t\t\tb = b[n:]\n\t\t\t}\n\t\t\tvar num protowire.Number\n\t\t\tif n := tag >> 3; n < uint64(protowire.MinValidNumber) || n > uint64(protowire.MaxValidNumber) {\n\t\t\t\treturn out, ValidationInvalid\n\t\t\t} else {\n\t\t\t\tnum = protowire.Number(n)\n\t\t\t}\n\t\t\twtyp := protowire.Type(tag & 7)\n\n\t\t\tif wtyp == protowire.EndGroupType {\n\t\t\t\tif st.endGroup == num {\n\t\t\t\t\tgoto PopState\n\t\t\t\t}\n\t\t\t\treturn out, ValidationInvalid\n\t\t\t}\n\t\t\tvar vi validationInfo\n\t\t\tswitch {\n\t\t\tcase st.typ == validationTypeMap:\n\t\t\t\tswitch num {\n\t\t\t\tcase genid.MapEntry_Key_field_number:\n\t\t\t\t\tvi.typ = st.keyType\n\t\t\t\tcase genid.MapEntry_Value_field_number:\n\t\t\t\t\tvi.typ = st.valType\n\t\t\t\t\tvi.mi = st.mi\n\t\t\t\t\tvi.requiredBit = 1\n\t\t\t\t}\n\t\t\tcase flags.ProtoLegacy && st.mi.isMessageSet:\n\t\t\t\tswitch num {\n\t\t\t\tcase messageset.FieldItem:\n\t\t\t\t\tvi.typ = validationTypeMessageSetItem\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tvar f *coderFieldInfo\n\t\t\t\tif int(num) < len(st.mi.denseCoderFields) {\n\t\t\t\t\tf = st.mi.denseCoderFields[num]\n\t\t\t\t} else {\n\t\t\t\t\tf = st.mi.coderFields[num]\n\t\t\t\t}\n\t\t\t\tif f != nil {\n\t\t\t\t\tvi = f.validation\n\t\t\t\t\tif vi.typ == validationTypeMessage && vi.mi == nil {\n\t\t\t\t\t\t// Probable weak field.\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// TODO: Consider storing the results of this lookup somewhere\n\t\t\t\t\t\t// rather than recomputing it on every validation.\n\t\t\t\t\t\tfd := st.mi.Desc.Fields().ByNumber(num)\n\t\t\t\t\t\tif fd == nil || !fd.IsWeak() {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmessageName := fd.Message().FullName()\n\t\t\t\t\t\tmessageType, err := preg.GlobalTypes.FindMessageByName(messageName)\n\t\t\t\t\t\tswitch err {\n\t\t\t\t\t\tcase nil:\n\t\t\t\t\t\t\tvi.mi, _ = messageType.(*MessageInfo)\n\t\t\t\t\t\tcase preg.NotFound:\n\t\t\t\t\t\t\tvi.typ = validationTypeBytes\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn out, ValidationUnknown\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\t// Possible extension field.\n\t\t\t\t//\n\t\t\t\t// TODO: We should return ValidationUnknown when:\n\t\t\t\t//   1. The resolver is not frozen. (More extensions may be added to it.)\n\t\t\t\t//   2. The resolver returns preg.NotFound.\n\t\t\t\t// In this case, a type added to the resolver in the future could cause\n\t\t\t\t// unmarshaling to begin failing. Supporting this requires some way to\n\t\t\t\t// determine if the resolver is frozen.\n\t\t\t\txt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), num)\n\t\t\t\tif err != nil && err != preg.NotFound {\n\t\t\t\t\treturn out, ValidationUnknown\n\t\t\t\t}\n\t\t\t\tif err == nil {\n\t\t\t\t\tvi = getExtensionFieldInfo(xt).validation\n\t\t\t\t}\n\t\t\t}\n\t\t\tif vi.requiredBit != 0 {\n\t\t\t\t// Check that the field has a compatible wire type.\n\t\t\t\t// We only need to consider non-repeated field types,\n\t\t\t\t// since repeated fields (and maps) can never be required.\n\t\t\t\tok := false\n\t\t\t\tswitch vi.typ {\n\t\t\t\tcase validationTypeVarint:\n\t\t\t\t\tok = wtyp == protowire.VarintType\n\t\t\t\tcase validationTypeFixed32:\n\t\t\t\t\tok = wtyp == protowire.Fixed32Type\n\t\t\t\tcase validationTypeFixed64:\n\t\t\t\t\tok = wtyp == protowire.Fixed64Type\n\t\t\t\tcase validationTypeBytes, validationTypeUTF8String, validationTypeMessage:\n\t\t\t\t\tok = wtyp == protowire.BytesType\n\t\t\t\tcase validationTypeGroup:\n\t\t\t\t\tok = wtyp == protowire.StartGroupType\n\t\t\t\t}\n\t\t\t\tif ok {\n\t\t\t\t\tst.requiredMask |= vi.requiredBit\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tswitch wtyp {\n\t\t\tcase protowire.VarintType:\n\t\t\t\tif len(b) >= 10 {\n\t\t\t\t\tswitch {\n\t\t\t\t\tcase b[0] < 0x80:\n\t\t\t\t\t\tb = b[1:]\n\t\t\t\t\tcase b[1] < 0x80:\n\t\t\t\t\t\tb = b[2:]\n\t\t\t\t\tcase b[2] < 0x80:\n\t\t\t\t\t\tb = b[3:]\n\t\t\t\t\tcase b[3] < 0x80:\n\t\t\t\t\t\tb = b[4:]\n\t\t\t\t\tcase b[4] < 0x80:\n\t\t\t\t\t\tb = b[5:]\n\t\t\t\t\tcase b[5] < 0x80:\n\t\t\t\t\t\tb = b[6:]\n\t\t\t\t\tcase b[6] < 0x80:\n\t\t\t\t\t\tb = b[7:]\n\t\t\t\t\tcase b[7] < 0x80:\n\t\t\t\t\t\tb = b[8:]\n\t\t\t\t\tcase b[8] < 0x80:\n\t\t\t\t\t\tb = b[9:]\n\t\t\t\t\tcase b[9] < 0x80 && b[9] < 2:\n\t\t\t\t\t\tb = b[10:]\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tswitch {\n\t\t\t\t\tcase len(b) > 0 && b[0] < 0x80:\n\t\t\t\t\t\tb = b[1:]\n\t\t\t\t\tcase len(b) > 1 && b[1] < 0x80:\n\t\t\t\t\t\tb = b[2:]\n\t\t\t\t\tcase len(b) > 2 && b[2] < 0x80:\n\t\t\t\t\t\tb = b[3:]\n\t\t\t\t\tcase len(b) > 3 && b[3] < 0x80:\n\t\t\t\t\t\tb = b[4:]\n\t\t\t\t\tcase len(b) > 4 && b[4] < 0x80:\n\t\t\t\t\t\tb = b[5:]\n\t\t\t\t\tcase len(b) > 5 && b[5] < 0x80:\n\t\t\t\t\t\tb = b[6:]\n\t\t\t\t\tcase len(b) > 6 && b[6] < 0x80:\n\t\t\t\t\t\tb = b[7:]\n\t\t\t\t\tcase len(b) > 7 && b[7] < 0x80:\n\t\t\t\t\t\tb = b[8:]\n\t\t\t\t\tcase len(b) > 8 && b[8] < 0x80:\n\t\t\t\t\t\tb = b[9:]\n\t\t\t\t\tcase len(b) > 9 && b[9] < 2:\n\t\t\t\t\t\tb = b[10:]\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue State\n\t\t\tcase protowire.BytesType:\n\t\t\t\tvar size uint64\n\t\t\t\tif len(b) >= 1 && b[0] < 0x80 {\n\t\t\t\t\tsize = uint64(b[0])\n\t\t\t\t\tb = b[1:]\n\t\t\t\t} else if len(b) >= 2 && b[1] < 128 {\n\t\t\t\t\tsize = uint64(b[0]&0x7f) + uint64(b[1])<<7\n\t\t\t\t\tb = b[2:]\n\t\t\t\t} else {\n\t\t\t\t\tvar n int\n\t\t\t\t\tsize, n = protowire.ConsumeVarint(b)\n\t\t\t\t\tif n < 0 {\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\t\tb = b[n:]\n\t\t\t\t}\n\t\t\t\tif size > uint64(len(b)) {\n\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t}\n\t\t\t\tv := b[:size]\n\t\t\t\tb = b[size:]\n\t\t\t\tswitch vi.typ {\n\t\t\t\tcase validationTypeMessage:\n\t\t\t\t\tif vi.mi == nil {\n\t\t\t\t\t\treturn out, ValidationUnknown\n\t\t\t\t\t}\n\t\t\t\t\tvi.mi.init()\n\t\t\t\t\tfallthrough\n\t\t\t\tcase validationTypeMap:\n\t\t\t\t\tif vi.mi != nil {\n\t\t\t\t\t\tvi.mi.init()\n\t\t\t\t\t}\n\t\t\t\t\tstates = append(states, validationState{\n\t\t\t\t\t\ttyp:     vi.typ,\n\t\t\t\t\t\tkeyType: vi.keyType,\n\t\t\t\t\t\tvalType: vi.valType,\n\t\t\t\t\t\tmi:      vi.mi,\n\t\t\t\t\t\ttail:    b,\n\t\t\t\t\t})\n\t\t\t\t\tb = v\n\t\t\t\t\tcontinue State\n\t\t\t\tcase validationTypeRepeatedVarint:\n\t\t\t\t\t// Packed field.\n\t\t\t\t\tfor len(v) > 0 {\n\t\t\t\t\t\t_, n := protowire.ConsumeVarint(v)\n\t\t\t\t\t\tif n < 0 {\n\t\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t\t}\n\t\t\t\t\t\tv = v[n:]\n\t\t\t\t\t}\n\t\t\t\tcase validationTypeRepeatedFixed32:\n\t\t\t\t\t// Packed field.\n\t\t\t\t\tif len(v)%4 != 0 {\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\tcase validationTypeRepeatedFixed64:\n\t\t\t\t\t// Packed field.\n\t\t\t\t\tif len(v)%8 != 0 {\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\tcase validationTypeUTF8String:\n\t\t\t\t\tif !utf8.Valid(v) {\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase protowire.Fixed32Type:\n\t\t\t\tif len(b) < 4 {\n\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t}\n\t\t\t\tb = b[4:]\n\t\t\tcase protowire.Fixed64Type:\n\t\t\t\tif len(b) < 8 {\n\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t}\n\t\t\t\tb = b[8:]\n\t\t\tcase protowire.StartGroupType:\n\t\t\t\tswitch {\n\t\t\t\tcase vi.typ == validationTypeGroup:\n\t\t\t\t\tif vi.mi == nil {\n\t\t\t\t\t\treturn out, ValidationUnknown\n\t\t\t\t\t}\n\t\t\t\t\tvi.mi.init()\n\t\t\t\t\tstates = append(states, validationState{\n\t\t\t\t\t\ttyp:      validationTypeGroup,\n\t\t\t\t\t\tmi:       vi.mi,\n\t\t\t\t\t\tendGroup: num,\n\t\t\t\t\t})\n\t\t\t\t\tcontinue State\n\t\t\t\tcase flags.ProtoLegacy && vi.typ == validationTypeMessageSetItem:\n\t\t\t\t\ttypeid, v, n, err := messageset.ConsumeFieldValue(b, false)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\t\txt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), typeid)\n\t\t\t\t\tswitch {\n\t\t\t\t\tcase err == preg.NotFound:\n\t\t\t\t\t\tb = b[n:]\n\t\t\t\t\tcase err != nil:\n\t\t\t\t\t\treturn out, ValidationUnknown\n\t\t\t\t\tdefault:\n\t\t\t\t\t\txvi := getExtensionFieldInfo(xt).validation\n\t\t\t\t\t\tif xvi.mi != nil {\n\t\t\t\t\t\t\txvi.mi.init()\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstates = append(states, validationState{\n\t\t\t\t\t\t\ttyp:  xvi.typ,\n\t\t\t\t\t\t\tmi:   xvi.mi,\n\t\t\t\t\t\t\ttail: b[n:],\n\t\t\t\t\t\t})\n\t\t\t\t\t\tb = v\n\t\t\t\t\t\tcontinue State\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tn := protowire.ConsumeFieldValue(num, wtyp, b)\n\t\t\t\t\tif n < 0 {\n\t\t\t\t\t\treturn out, ValidationInvalid\n\t\t\t\t\t}\n\t\t\t\t\tb = b[n:]\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn out, ValidationInvalid\n\t\t\t}\n\t\t}\n\t\tif st.endGroup != 0 {\n\t\t\treturn out, ValidationInvalid\n\t\t}\n\t\tif len(b) != 0 {\n\t\t\treturn out, ValidationInvalid\n\t\t}\n\t\tb = st.tail\n\tPopState:\n\t\tnumRequiredFields := 0\n\t\tswitch st.typ {\n\t\tcase validationTypeMessage, validationTypeGroup:\n\t\t\tnumRequiredFields = int(st.mi.numRequiredFields)\n\t\tcase validationTypeMap:\n\t\t\t// If this is a map field with a message value that contains\n\t\t\t// required fields, require that the value be present.\n\t\t\tif st.mi != nil && st.mi.numRequiredFields > 0 {\n\t\t\t\tnumRequiredFields = 1\n\t\t\t}\n\t\t}\n\t\t// If there are more than 64 required fields, this check will\n\t\t// always fail and we will report that the message is potentially\n\t\t// uninitialized.\n\t\tif numRequiredFields > 0 && bits.OnesCount64(st.requiredMask) != numRequiredFields {\n\t\t\tinitialized = false\n\t\t}\n\t\tstates = states[:len(states)-1]\n\t}\n\tout.n = start - len(b)\n\tif initialized {\n\t\tout.initialized = true\n\t}\n\treturn out, ValidationValid\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/impl/weak.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 impl\n\nimport (\n\t\"fmt\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\n// weakFields adds methods to the exported WeakFields type for internal use.\n//\n// The exported type is an alias to an unnamed type, so methods can't be\n// defined directly on it.\ntype weakFields WeakFields\n\nfunc (w weakFields) get(num pref.FieldNumber) (pref.ProtoMessage, bool) {\n\tm, ok := w[int32(num)]\n\treturn m, ok\n}\n\nfunc (w *weakFields) set(num pref.FieldNumber, m pref.ProtoMessage) {\n\tif *w == nil {\n\t\t*w = make(weakFields)\n\t}\n\t(*w)[int32(num)] = m\n}\n\nfunc (w *weakFields) clear(num pref.FieldNumber) {\n\tdelete(*w, int32(num))\n}\n\nfunc (Export) HasWeak(w WeakFields, num pref.FieldNumber) bool {\n\t_, ok := w[int32(num)]\n\treturn ok\n}\n\nfunc (Export) ClearWeak(w *WeakFields, num pref.FieldNumber) {\n\tdelete(*w, int32(num))\n}\n\nfunc (Export) GetWeak(w WeakFields, num pref.FieldNumber, name pref.FullName) pref.ProtoMessage {\n\tif m, ok := w[int32(num)]; ok {\n\t\treturn m\n\t}\n\tmt, _ := protoregistry.GlobalTypes.FindMessageByName(name)\n\tif mt == nil {\n\t\tpanic(fmt.Sprintf(\"message %v for weak field is not linked in\", name))\n\t}\n\treturn mt.Zero().Interface()\n}\n\nfunc (Export) SetWeak(w *WeakFields, num pref.FieldNumber, name pref.FullName, m pref.ProtoMessage) {\n\tif m != nil {\n\t\tmt, _ := protoregistry.GlobalTypes.FindMessageByName(name)\n\t\tif mt == nil {\n\t\t\tpanic(fmt.Sprintf(\"message %v for weak field is not linked in\", name))\n\t\t}\n\t\tif mt != m.ProtoReflect().Type() {\n\t\t\tpanic(fmt.Sprintf(\"invalid message type for weak field: got %T, want %T\", m, mt.Zero().Interface()))\n\t\t}\n\t}\n\tif m == nil || !m.ProtoReflect().IsValid() {\n\t\tdelete(*w, int32(num))\n\t\treturn\n\t}\n\tif *w == nil {\n\t\t*w = make(weakFields)\n\t}\n\t(*w)[int32(num)] = m\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/order/order.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 order\n\nimport (\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// FieldOrder specifies the ordering to visit message fields.\n// It is a function that reports whether x is ordered before y.\ntype FieldOrder func(x, y pref.FieldDescriptor) bool\n\nvar (\n\t// AnyFieldOrder specifies no specific field ordering.\n\tAnyFieldOrder FieldOrder = nil\n\n\t// LegacyFieldOrder sorts fields in the same ordering as emitted by\n\t// wire serialization in the github.com/golang/protobuf implementation.\n\tLegacyFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {\n\t\tox, oy := x.ContainingOneof(), y.ContainingOneof()\n\t\tinOneof := func(od pref.OneofDescriptor) bool {\n\t\t\treturn od != nil && !od.IsSynthetic()\n\t\t}\n\n\t\t// Extension fields sort before non-extension fields.\n\t\tif x.IsExtension() != y.IsExtension() {\n\t\t\treturn x.IsExtension() && !y.IsExtension()\n\t\t}\n\t\t// Fields not within a oneof sort before those within a oneof.\n\t\tif inOneof(ox) != inOneof(oy) {\n\t\t\treturn !inOneof(ox) && inOneof(oy)\n\t\t}\n\t\t// Fields in disjoint oneof sets are sorted by declaration index.\n\t\tif ox != nil && oy != nil && ox != oy {\n\t\t\treturn ox.Index() < oy.Index()\n\t\t}\n\t\t// Fields sorted by field number.\n\t\treturn x.Number() < y.Number()\n\t}\n\n\t// NumberFieldOrder sorts fields by their field number.\n\tNumberFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {\n\t\treturn x.Number() < y.Number()\n\t}\n\n\t// IndexNameFieldOrder sorts non-extension fields before extension fields.\n\t// Non-extensions are sorted according to their declaration index.\n\t// Extensions are sorted according to their full name.\n\tIndexNameFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {\n\t\t// Non-extension fields sort before extension fields.\n\t\tif x.IsExtension() != y.IsExtension() {\n\t\t\treturn !x.IsExtension() && y.IsExtension()\n\t\t}\n\t\t// Extensions sorted by fullname.\n\t\tif x.IsExtension() && y.IsExtension() {\n\t\t\treturn x.FullName() < y.FullName()\n\t\t}\n\t\t// Non-extensions sorted by declaration index.\n\t\treturn x.Index() < y.Index()\n\t}\n)\n\n// KeyOrder specifies the ordering to visit map entries.\n// It is a function that reports whether x is ordered before y.\ntype KeyOrder func(x, y pref.MapKey) bool\n\nvar (\n\t// AnyKeyOrder specifies no specific key ordering.\n\tAnyKeyOrder KeyOrder = nil\n\n\t// GenericKeyOrder sorts false before true, numeric keys in ascending order,\n\t// and strings in lexicographical ordering according to UTF-8 codepoints.\n\tGenericKeyOrder KeyOrder = func(x, y pref.MapKey) bool {\n\t\tswitch x.Interface().(type) {\n\t\tcase bool:\n\t\t\treturn !x.Bool() && y.Bool()\n\t\tcase int32, int64:\n\t\t\treturn x.Int() < y.Int()\n\t\tcase uint32, uint64:\n\t\t\treturn x.Uint() < y.Uint()\n\t\tcase string:\n\t\t\treturn x.String() < y.String()\n\t\tdefault:\n\t\t\tpanic(\"invalid map key type\")\n\t\t}\n\t}\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/order/range.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\n// Package order provides ordered access to messages and maps.\npackage order\n\nimport (\n\t\"sort\"\n\t\"sync\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype messageField struct {\n\tfd pref.FieldDescriptor\n\tv  pref.Value\n}\n\nvar messageFieldPool = sync.Pool{\n\tNew: func() interface{} { return new([]messageField) },\n}\n\ntype (\n\t// FieldRnger is an interface for visiting all fields in a message.\n\t// The protoreflect.Message type implements this interface.\n\tFieldRanger interface{ Range(VisitField) }\n\t// VisitField is called everytime a message field is visited.\n\tVisitField = func(pref.FieldDescriptor, pref.Value) bool\n)\n\n// RangeFields iterates over the fields of fs according to the specified order.\nfunc RangeFields(fs FieldRanger, less FieldOrder, fn VisitField) {\n\tif less == nil {\n\t\tfs.Range(fn)\n\t\treturn\n\t}\n\n\t// Obtain a pre-allocated scratch buffer.\n\tp := messageFieldPool.Get().(*[]messageField)\n\tfields := (*p)[:0]\n\tdefer func() {\n\t\tif cap(fields) < 1024 {\n\t\t\t*p = fields\n\t\t\tmessageFieldPool.Put(p)\n\t\t}\n\t}()\n\n\t// Collect all fields in the message and sort them.\n\tfs.Range(func(fd pref.FieldDescriptor, v pref.Value) bool {\n\t\tfields = append(fields, messageField{fd, v})\n\t\treturn true\n\t})\n\tsort.Slice(fields, func(i, j int) bool {\n\t\treturn less(fields[i].fd, fields[j].fd)\n\t})\n\n\t// Visit the fields in the specified ordering.\n\tfor _, f := range fields {\n\t\tif !fn(f.fd, f.v) {\n\t\t\treturn\n\t\t}\n\t}\n}\n\ntype mapEntry struct {\n\tk pref.MapKey\n\tv pref.Value\n}\n\nvar mapEntryPool = sync.Pool{\n\tNew: func() interface{} { return new([]mapEntry) },\n}\n\ntype (\n\t// EntryRanger is an interface for visiting all fields in a message.\n\t// The protoreflect.Map type implements this interface.\n\tEntryRanger interface{ Range(VisitEntry) }\n\t// VisitEntry is called everytime a map entry is visited.\n\tVisitEntry = func(pref.MapKey, pref.Value) bool\n)\n\n// RangeEntries iterates over the entries of es according to the specified order.\nfunc RangeEntries(es EntryRanger, less KeyOrder, fn VisitEntry) {\n\tif less == nil {\n\t\tes.Range(fn)\n\t\treturn\n\t}\n\n\t// Obtain a pre-allocated scratch buffer.\n\tp := mapEntryPool.Get().(*[]mapEntry)\n\tentries := (*p)[:0]\n\tdefer func() {\n\t\tif cap(entries) < 1024 {\n\t\t\t*p = entries\n\t\t\tmapEntryPool.Put(p)\n\t\t}\n\t}()\n\n\t// Collect all entries in the map and sort them.\n\tes.Range(func(k pref.MapKey, v pref.Value) bool {\n\t\tentries = append(entries, mapEntry{k, v})\n\t\treturn true\n\t})\n\tsort.Slice(entries, func(i, j int) bool {\n\t\treturn less(entries[i].k, entries[j].k)\n\t})\n\n\t// Visit the entries in the specified ordering.\n\tfor _, e := range entries {\n\t\tif !fn(e.k, e.v) {\n\t\t\treturn\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/pragma/pragma.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 pragma provides types that can be embedded into a struct to\n// statically enforce or prevent certain language properties.\npackage pragma\n\nimport \"sync\"\n\n// NoUnkeyedLiterals can be embedded in a struct to prevent unkeyed literals.\ntype NoUnkeyedLiterals struct{}\n\n// DoNotImplement can be embedded in an interface to prevent trivial\n// implementations of the interface.\n//\n// This is useful to prevent unauthorized implementations of an interface\n// so that it can be extended in the future for any protobuf language changes.\ntype DoNotImplement interface{ ProtoInternal(DoNotImplement) }\n\n// DoNotCompare can be embedded in a struct to prevent comparability.\ntype DoNotCompare [0]func()\n\n// DoNotCopy can be embedded in a struct to help prevent shallow copies.\n// This does not rely on a Go language feature, but rather a special case\n// within the vet checker.\n//\n// See https://golang.org/issues/8005.\ntype DoNotCopy [0]sync.Mutex\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/set/ints.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 set provides simple set data structures for uint64s.\npackage set\n\nimport \"math/bits\"\n\n// int64s represents a set of integers within the range of 0..63.\ntype int64s uint64\n\nfunc (bs *int64s) Len() int {\n\treturn bits.OnesCount64(uint64(*bs))\n}\nfunc (bs *int64s) Has(n uint64) bool {\n\treturn uint64(*bs)&(uint64(1)<<n) > 0\n}\nfunc (bs *int64s) Set(n uint64) {\n\t*(*uint64)(bs) |= uint64(1) << n\n}\nfunc (bs *int64s) Clear(n uint64) {\n\t*(*uint64)(bs) &^= uint64(1) << n\n}\n\n// Ints represents a set of integers within the range of 0..math.MaxUint64.\ntype Ints struct {\n\tlo int64s\n\thi map[uint64]struct{}\n}\n\nfunc (bs *Ints) Len() int {\n\treturn bs.lo.Len() + len(bs.hi)\n}\nfunc (bs *Ints) Has(n uint64) bool {\n\tif n < 64 {\n\t\treturn bs.lo.Has(n)\n\t}\n\t_, ok := bs.hi[n]\n\treturn ok\n}\nfunc (bs *Ints) Set(n uint64) {\n\tif n < 64 {\n\t\tbs.lo.Set(n)\n\t\treturn\n\t}\n\tif bs.hi == nil {\n\t\tbs.hi = make(map[uint64]struct{})\n\t}\n\tbs.hi[n] = struct{}{}\n}\nfunc (bs *Ints) Clear(n uint64) {\n\tif n < 64 {\n\t\tbs.lo.Clear(n)\n\t\treturn\n\t}\n\tdelete(bs.hi, n)\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/strs/strings.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 strs provides string manipulation functionality specific to protobuf.\npackage strs\n\nimport (\n\t\"go/token\"\n\t\"strings\"\n\t\"unicode\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// EnforceUTF8 reports whether to enforce strict UTF-8 validation.\nfunc EnforceUTF8(fd protoreflect.FieldDescriptor) bool {\n\tif flags.ProtoLegacy {\n\t\tif fd, ok := fd.(interface{ EnforceUTF8() bool }); ok {\n\t\t\treturn fd.EnforceUTF8()\n\t\t}\n\t}\n\treturn fd.Syntax() == protoreflect.Proto3\n}\n\n// GoCamelCase camel-cases a protobuf name for use as a Go identifier.\n//\n// If there is an interior underscore followed by a lower case letter,\n// drop the underscore and convert the letter to upper case.\nfunc GoCamelCase(s string) string {\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\tvar b []byte\n\tfor i := 0; i < len(s); i++ {\n\t\tc := s[i]\n\t\tswitch {\n\t\tcase c == '.' && i+1 < len(s) && isASCIILower(s[i+1]):\n\t\t\t// Skip over '.' in \".{{lowercase}}\".\n\t\tcase c == '.':\n\t\t\tb = append(b, '_') // convert '.' to '_'\n\t\tcase c == '_' && (i == 0 || s[i-1] == '.'):\n\t\t\t// Convert initial '_' to ensure we start with a capital letter.\n\t\t\t// Do the same for '_' after '.' to match historic behavior.\n\t\t\tb = append(b, 'X') // convert '_' to 'X'\n\t\tcase c == '_' && i+1 < len(s) && isASCIILower(s[i+1]):\n\t\t\t// Skip over '_' in \"_{{lowercase}}\".\n\t\tcase isASCIIDigit(c):\n\t\t\tb = append(b, c)\n\t\tdefault:\n\t\t\t// Assume we have a letter now - if not, it's a bogus identifier.\n\t\t\t// The next word is a sequence of characters that must start upper case.\n\t\t\tif isASCIILower(c) {\n\t\t\t\tc -= 'a' - 'A' // convert lowercase to uppercase\n\t\t\t}\n\t\t\tb = append(b, c)\n\n\t\t\t// Accept lower case sequence that follows.\n\t\t\tfor ; i+1 < len(s) && isASCIILower(s[i+1]); i++ {\n\t\t\t\tb = append(b, s[i+1])\n\t\t\t}\n\t\t}\n\t}\n\treturn string(b)\n}\n\n// GoSanitized converts a string to a valid Go identifier.\nfunc GoSanitized(s string) string {\n\t// Sanitize the input to the set of valid characters,\n\t// which must be '_' or be in the Unicode L or N categories.\n\ts = strings.Map(func(r rune) rune {\n\t\tif unicode.IsLetter(r) || unicode.IsDigit(r) {\n\t\t\treturn r\n\t\t}\n\t\treturn '_'\n\t}, s)\n\n\t// Prepend '_' in the event of a Go keyword conflict or if\n\t// the identifier is invalid (does not start in the Unicode L category).\n\tr, _ := utf8.DecodeRuneInString(s)\n\tif token.Lookup(s).IsKeyword() || !unicode.IsLetter(r) {\n\t\treturn \"_\" + s\n\t}\n\treturn s\n}\n\n// JSONCamelCase converts a snake_case identifier to a camelCase identifier,\n// according to the protobuf JSON specification.\nfunc JSONCamelCase(s string) string {\n\tvar b []byte\n\tvar wasUnderscore bool\n\tfor i := 0; i < len(s); i++ { // proto identifiers are always ASCII\n\t\tc := s[i]\n\t\tif c != '_' {\n\t\t\tif wasUnderscore && isASCIILower(c) {\n\t\t\t\tc -= 'a' - 'A' // convert to uppercase\n\t\t\t}\n\t\t\tb = append(b, c)\n\t\t}\n\t\twasUnderscore = c == '_'\n\t}\n\treturn string(b)\n}\n\n// JSONSnakeCase converts a camelCase identifier to a snake_case identifier,\n// according to the protobuf JSON specification.\nfunc JSONSnakeCase(s string) string {\n\tvar b []byte\n\tfor i := 0; i < len(s); i++ { // proto identifiers are always ASCII\n\t\tc := s[i]\n\t\tif isASCIIUpper(c) {\n\t\t\tb = append(b, '_')\n\t\t\tc += 'a' - 'A' // convert to lowercase\n\t\t}\n\t\tb = append(b, c)\n\t}\n\treturn string(b)\n}\n\n// MapEntryName derives the name of the map entry message given the field name.\n// See protoc v3.8.0: src/google/protobuf/descriptor.cc:254-276,6057\nfunc MapEntryName(s string) string {\n\tvar b []byte\n\tupperNext := true\n\tfor _, c := range s {\n\t\tswitch {\n\t\tcase c == '_':\n\t\t\tupperNext = true\n\t\tcase upperNext:\n\t\t\tb = append(b, byte(unicode.ToUpper(c)))\n\t\t\tupperNext = false\n\t\tdefault:\n\t\t\tb = append(b, byte(c))\n\t\t}\n\t}\n\tb = append(b, \"Entry\"...)\n\treturn string(b)\n}\n\n// EnumValueName derives the camel-cased enum value name.\n// See protoc v3.8.0: src/google/protobuf/descriptor.cc:297-313\nfunc EnumValueName(s string) string {\n\tvar b []byte\n\tupperNext := true\n\tfor _, c := range s {\n\t\tswitch {\n\t\tcase c == '_':\n\t\t\tupperNext = true\n\t\tcase upperNext:\n\t\t\tb = append(b, byte(unicode.ToUpper(c)))\n\t\t\tupperNext = false\n\t\tdefault:\n\t\t\tb = append(b, byte(unicode.ToLower(c)))\n\t\t\tupperNext = false\n\t\t}\n\t}\n\treturn string(b)\n}\n\n// TrimEnumPrefix trims the enum name prefix from an enum value name,\n// where the prefix is all lowercase without underscores.\n// See protoc v3.8.0: src/google/protobuf/descriptor.cc:330-375\nfunc TrimEnumPrefix(s, prefix string) string {\n\ts0 := s // original input\n\tfor len(s) > 0 && len(prefix) > 0 {\n\t\tif s[0] == '_' {\n\t\t\ts = s[1:]\n\t\t\tcontinue\n\t\t}\n\t\tif unicode.ToLower(rune(s[0])) != rune(prefix[0]) {\n\t\t\treturn s0 // no prefix match\n\t\t}\n\t\ts, prefix = s[1:], prefix[1:]\n\t}\n\tif len(prefix) > 0 {\n\t\treturn s0 // no prefix match\n\t}\n\ts = strings.TrimLeft(s, \"_\")\n\tif len(s) == 0 {\n\t\treturn s0 // avoid returning empty string\n\t}\n\treturn s\n}\n\nfunc isASCIILower(c byte) bool {\n\treturn 'a' <= c && c <= 'z'\n}\nfunc isASCIIUpper(c byte) bool {\n\treturn 'A' <= c && c <= 'Z'\n}\nfunc isASCIIDigit(c byte) bool {\n\treturn '0' <= c && c <= '9'\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/strs/strings_pure.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// +build purego appengine\n\npackage strs\n\nimport pref \"google.golang.org/protobuf/reflect/protoreflect\"\n\nfunc UnsafeString(b []byte) string {\n\treturn string(b)\n}\n\nfunc UnsafeBytes(s string) []byte {\n\treturn []byte(s)\n}\n\ntype Builder struct{}\n\nfunc (*Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.FullName {\n\treturn prefix.Append(name)\n}\n\nfunc (*Builder) MakeString(b []byte) string {\n\treturn string(b)\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.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// +build !purego,!appengine\n\npackage strs\n\nimport (\n\t\"unsafe\"\n\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\ntype (\n\tstringHeader struct {\n\t\tData unsafe.Pointer\n\t\tLen  int\n\t}\n\tsliceHeader struct {\n\t\tData unsafe.Pointer\n\t\tLen  int\n\t\tCap  int\n\t}\n)\n\n// UnsafeString returns an unsafe string reference of b.\n// The caller must treat the input slice as immutable.\n//\n// WARNING: Use carefully. The returned result must not leak to the end user\n// unless the input slice is provably immutable.\nfunc UnsafeString(b []byte) (s string) {\n\tsrc := (*sliceHeader)(unsafe.Pointer(&b))\n\tdst := (*stringHeader)(unsafe.Pointer(&s))\n\tdst.Data = src.Data\n\tdst.Len = src.Len\n\treturn s\n}\n\n// UnsafeBytes returns an unsafe bytes slice reference of s.\n// The caller must treat returned slice as immutable.\n//\n// WARNING: Use carefully. The returned result must not leak to the end user.\nfunc UnsafeBytes(s string) (b []byte) {\n\tsrc := (*stringHeader)(unsafe.Pointer(&s))\n\tdst := (*sliceHeader)(unsafe.Pointer(&b))\n\tdst.Data = src.Data\n\tdst.Len = src.Len\n\tdst.Cap = src.Len\n\treturn b\n}\n\n// Builder builds a set of strings with shared lifetime.\n// This differs from strings.Builder, which is for building a single string.\ntype Builder struct {\n\tbuf []byte\n}\n\n// AppendFullName is equivalent to protoreflect.FullName.Append,\n// but optimized for large batches where each name has a shared lifetime.\nfunc (sb *Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.FullName {\n\tn := len(prefix) + len(\".\") + len(name)\n\tif len(prefix) == 0 {\n\t\tn -= len(\".\")\n\t}\n\tsb.grow(n)\n\tsb.buf = append(sb.buf, prefix...)\n\tsb.buf = append(sb.buf, '.')\n\tsb.buf = append(sb.buf, name...)\n\treturn pref.FullName(sb.last(n))\n}\n\n// MakeString is equivalent to string(b), but optimized for large batches\n// with a shared lifetime.\nfunc (sb *Builder) MakeString(b []byte) string {\n\tsb.grow(len(b))\n\tsb.buf = append(sb.buf, b...)\n\treturn sb.last(len(b))\n}\n\nfunc (sb *Builder) grow(n int) {\n\tif cap(sb.buf)-len(sb.buf) >= n {\n\t\treturn\n\t}\n\n\t// Unlike strings.Builder, we do not need to copy over the contents\n\t// of the old buffer since our builder provides no API for\n\t// retrieving previously created strings.\n\tsb.buf = make([]byte, 2*(cap(sb.buf)+n))\n}\n\nfunc (sb *Builder) last(n int) string {\n\treturn UnsafeString(sb.buf[len(sb.buf)-n:])\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/internal/version/version.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 version records versioning information about this module.\npackage version\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n)\n\n// These constants determine the current version of this module.\n//\n//\n// For our release process, we enforce the following rules:\n//\t* Tagged releases use a tag that is identical to String.\n//\t* Tagged releases never reference a commit where the String\n//\tcontains \"devel\".\n//\t* The set of all commits in this repository where String\n//\tdoes not contain \"devel\" must have a unique String.\n//\n//\n// Steps for tagging a new release:\n//\t1. Create a new CL.\n//\n//\t2. Update Minor, Patch, and/or PreRelease as necessary.\n//\tPreRelease must not contain the string \"devel\".\n//\n//\t3. Since the last released minor version, have there been any changes to\n//\tgenerator that relies on new functionality in the runtime?\n//\tIf yes, then increment RequiredGenerated.\n//\n//\t4. Since the last released minor version, have there been any changes to\n//\tthe runtime that removes support for old .pb.go source code?\n//\tIf yes, then increment SupportMinimum.\n//\n//\t5. Send out the CL for review and submit it.\n//\tNote that the next CL in step 8 must be submitted after this CL\n//\twithout any other CLs in-between.\n//\n//\t6. Tag a new version, where the tag is is the current String.\n//\n//\t7. Write release notes for all notable changes\n//\tbetween this release and the last release.\n//\n//\t8. Create a new CL.\n//\n//\t9. Update PreRelease to include the string \"devel\".\n//\tFor example: \"\" -> \"devel\" or \"rc.1\" -> \"rc.1.devel\"\n//\n//\t10. Send out the CL for review and submit it.\nconst (\n\tMajor      = 1\n\tMinor      = 26\n\tPatch      = 0\n\tPreRelease = \"\"\n)\n\n// String formats the version string for this module in semver format.\n//\n// Examples:\n//\tv1.20.1\n//\tv1.21.0-rc.1\nfunc String() string {\n\tv := fmt.Sprintf(\"v%d.%d.%d\", Major, Minor, Patch)\n\tif PreRelease != \"\" {\n\t\tv += \"-\" + PreRelease\n\n\t\t// TODO: Add metadata about the commit or build hash.\n\t\t// See https://golang.org/issue/29814\n\t\t// See https://golang.org/issue/33533\n\t\tvar metadata string\n\t\tif strings.Contains(PreRelease, \"devel\") && metadata != \"\" {\n\t\t\tv += \"+\" + metadata\n\t\t}\n\t}\n\treturn v\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/checkinit.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/internal/errors\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// CheckInitialized returns an error if any required fields in m are not set.\nfunc CheckInitialized(m Message) error {\n\t// Treat a nil message interface as an \"untyped\" empty message,\n\t// which we assume to have no required fields.\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\treturn checkInitialized(m.ProtoReflect())\n}\n\n// CheckInitialized returns an error if any required fields in m are not set.\nfunc checkInitialized(m protoreflect.Message) error {\n\tif methods := protoMethods(m); methods != nil && methods.CheckInitialized != nil {\n\t\t_, err := methods.CheckInitialized(protoiface.CheckInitializedInput{\n\t\t\tMessage: m,\n\t\t})\n\t\treturn err\n\t}\n\treturn checkInitializedSlow(m)\n}\n\nfunc checkInitializedSlow(m protoreflect.Message) error {\n\tmd := m.Descriptor()\n\tfds := md.Fields()\n\tfor i, nums := 0, md.RequiredNumbers(); i < nums.Len(); i++ {\n\t\tfd := fds.ByNumber(nums.Get(i))\n\t\tif !m.Has(fd) {\n\t\t\treturn errors.RequiredNotSet(string(fd.FullName()))\n\t\t}\n\t}\n\tvar err error\n\tm.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tswitch {\n\t\tcase fd.IsList():\n\t\t\tif fd.Message() == nil {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tfor i, list := 0, v.List(); i < list.Len() && err == nil; i++ {\n\t\t\t\terr = checkInitialized(list.Get(i).Message())\n\t\t\t}\n\t\tcase fd.IsMap():\n\t\t\tif fd.MapValue().Message() == nil {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tv.Map().Range(func(key protoreflect.MapKey, v protoreflect.Value) bool {\n\t\t\t\terr = checkInitialized(v.Message())\n\t\t\t\treturn err == nil\n\t\t\t})\n\t\tdefault:\n\t\t\tif fd.Message() == nil {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\terr = checkInitialized(v.Message())\n\t\t}\n\t\treturn err == nil\n\t})\n\treturn err\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/decode.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\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/internal/genid\"\n\t\"google.golang.org/protobuf/internal/pragma\"\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)\n\n// UnmarshalOptions configures the unmarshaler.\n//\n// Example usage:\n//   err := UnmarshalOptions{DiscardUnknown: true}.Unmarshal(b, m)\ntype UnmarshalOptions struct {\n\tpragma.NoUnkeyedLiterals\n\n\t// Merge merges the input into the destination message.\n\t// The default behavior is to always reset the message before unmarshaling,\n\t// unless Merge is specified.\n\tMerge bool\n\n\t// AllowPartial accepts input for messages that will result in missing\n\t// required fields. If AllowPartial is false (the default), Unmarshal will\n\t// return an error if there are any missing required fields.\n\tAllowPartial bool\n\n\t// If DiscardUnknown is set, unknown fields are ignored.\n\tDiscardUnknown bool\n\n\t// Resolver is used for looking up types when unmarshaling extension fields.\n\t// If nil, this defaults to using protoregistry.GlobalTypes.\n\tResolver interface {\n\t\tFindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)\n\t\tFindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)\n\t}\n}\n\n// Unmarshal parses the wire-format message in b and places the result in m.\n// The provided message must be mutable (e.g., a non-nil pointer to a message).\nfunc Unmarshal(b []byte, m Message) error {\n\t_, err := UnmarshalOptions{}.unmarshal(b, m.ProtoReflect())\n\treturn err\n}\n\n// Unmarshal parses the wire-format message in b and places the result in m.\n// The provided message must be mutable (e.g., a non-nil pointer to a message).\nfunc (o UnmarshalOptions) Unmarshal(b []byte, m Message) error {\n\t_, err := o.unmarshal(b, m.ProtoReflect())\n\treturn err\n}\n\n// UnmarshalState parses a wire-format message and places the result in m.\n//\n// This method permits fine-grained control over the unmarshaler.\n// Most users should use Unmarshal instead.\nfunc (o UnmarshalOptions) UnmarshalState(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {\n\treturn o.unmarshal(in.Buf, in.Message)\n}\n\n// unmarshal is a centralized function that all unmarshal operations go through.\n// For profiling purposes, avoid changing the name of this function or\n// introducing other code paths for unmarshal that do not go through this.\nfunc (o UnmarshalOptions) unmarshal(b []byte, m protoreflect.Message) (out protoiface.UnmarshalOutput, err error) {\n\tif o.Resolver == nil {\n\t\to.Resolver = protoregistry.GlobalTypes\n\t}\n\tif !o.Merge {\n\t\tReset(m.Interface())\n\t}\n\tallowPartial := o.AllowPartial\n\to.Merge = true\n\to.AllowPartial = true\n\tmethods := protoMethods(m)\n\tif methods != nil && methods.Unmarshal != nil &&\n\t\t!(o.DiscardUnknown && methods.Flags&protoiface.SupportUnmarshalDiscardUnknown == 0) {\n\t\tin := protoiface.UnmarshalInput{\n\t\t\tMessage:  m,\n\t\t\tBuf:      b,\n\t\t\tResolver: o.Resolver,\n\t\t}\n\t\tif o.DiscardUnknown {\n\t\t\tin.Flags |= protoiface.UnmarshalDiscardUnknown\n\t\t}\n\t\tout, err = methods.Unmarshal(in)\n\t} else {\n\t\terr = o.unmarshalMessageSlow(b, m)\n\t}\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tif allowPartial || (out.Flags&protoiface.UnmarshalInitialized != 0) {\n\t\treturn out, nil\n\t}\n\treturn out, checkInitialized(m)\n}\n\nfunc (o UnmarshalOptions) unmarshalMessage(b []byte, m protoreflect.Message) error {\n\t_, err := o.unmarshal(b, m)\n\treturn err\n}\n\nfunc (o UnmarshalOptions) unmarshalMessageSlow(b []byte, m protoreflect.Message) error {\n\tmd := m.Descriptor()\n\tif messageset.IsMessageSet(md) {\n\t\treturn o.unmarshalMessageSet(b, m)\n\t}\n\tfields := md.Fields()\n\tfor len(b) > 0 {\n\t\t// Parse the tag (field number and wire type).\n\t\tnum, wtyp, tagLen := protowire.ConsumeTag(b)\n\t\tif tagLen < 0 {\n\t\t\treturn errDecode\n\t\t}\n\t\tif num > protowire.MaxValidNumber {\n\t\t\treturn errDecode\n\t\t}\n\n\t\t// Find the field descriptor for this field number.\n\t\tfd := fields.ByNumber(num)\n\t\tif fd == nil && md.ExtensionRanges().Has(num) {\n\t\t\textType, err := o.Resolver.FindExtensionByNumber(md.FullName(), num)\n\t\t\tif err != nil && err != protoregistry.NotFound {\n\t\t\t\treturn errors.New(\"%v: unable to resolve extension %v: %v\", md.FullName(), num, err)\n\t\t\t}\n\t\t\tif extType != nil {\n\t\t\t\tfd = extType.TypeDescriptor()\n\t\t\t}\n\t\t}\n\t\tvar err error\n\t\tif fd == nil {\n\t\t\terr = errUnknown\n\t\t} else if flags.ProtoLegacy {\n\t\t\tif fd.IsWeak() && fd.Message().IsPlaceholder() {\n\t\t\t\terr = errUnknown // weak referent is not linked in\n\t\t\t}\n\t\t}\n\n\t\t// Parse the field value.\n\t\tvar valLen int\n\t\tswitch {\n\t\tcase err != nil:\n\t\tcase fd.IsList():\n\t\t\tvalLen, err = o.unmarshalList(b[tagLen:], wtyp, m.Mutable(fd).List(), fd)\n\t\tcase fd.IsMap():\n\t\t\tvalLen, err = o.unmarshalMap(b[tagLen:], wtyp, m.Mutable(fd).Map(), fd)\n\t\tdefault:\n\t\t\tvalLen, err = o.unmarshalSingular(b[tagLen:], wtyp, m, fd)\n\t\t}\n\t\tif err != nil {\n\t\t\tif err != errUnknown {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tvalLen = protowire.ConsumeFieldValue(num, wtyp, b[tagLen:])\n\t\t\tif valLen < 0 {\n\t\t\t\treturn errDecode\n\t\t\t}\n\t\t\tif !o.DiscardUnknown {\n\t\t\t\tm.SetUnknown(append(m.GetUnknown(), b[:tagLen+valLen]...))\n\t\t\t}\n\t\t}\n\t\tb = b[tagLen+valLen:]\n\t}\n\treturn nil\n}\n\nfunc (o UnmarshalOptions) unmarshalSingular(b []byte, wtyp protowire.Type, m protoreflect.Message, fd protoreflect.FieldDescriptor) (n int, err error) {\n\tv, n, err := o.unmarshalScalar(b, wtyp, fd)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tswitch fd.Kind() {\n\tcase protoreflect.GroupKind, protoreflect.MessageKind:\n\t\tm2 := m.Mutable(fd).Message()\n\t\tif err := o.unmarshalMessage(v.Bytes(), m2); err != nil {\n\t\t\treturn n, err\n\t\t}\n\tdefault:\n\t\t// Non-message scalars replace the previous value.\n\t\tm.Set(fd, v)\n\t}\n\treturn n, nil\n}\n\nfunc (o UnmarshalOptions) unmarshalMap(b []byte, wtyp protowire.Type, mapv protoreflect.Map, fd protoreflect.FieldDescriptor) (n int, err error) {\n\tif wtyp != protowire.BytesType {\n\t\treturn 0, errUnknown\n\t}\n\tb, n = protowire.ConsumeBytes(b)\n\tif n < 0 {\n\t\treturn 0, errDecode\n\t}\n\tvar (\n\t\tkeyField = fd.MapKey()\n\t\tvalField = fd.MapValue()\n\t\tkey      protoreflect.Value\n\t\tval      protoreflect.Value\n\t\thaveKey  bool\n\t\thaveVal  bool\n\t)\n\tswitch valField.Kind() {\n\tcase protoreflect.GroupKind, protoreflect.MessageKind:\n\t\tval = mapv.NewValue()\n\t}\n\t// Map entries are represented as a two-element message with fields\n\t// containing the key and value.\n\tfor len(b) > 0 {\n\t\tnum, wtyp, n := protowire.ConsumeTag(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tif num > protowire.MaxValidNumber {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tb = b[n:]\n\t\terr = errUnknown\n\t\tswitch num {\n\t\tcase genid.MapEntry_Key_field_number:\n\t\t\tkey, n, err = o.unmarshalScalar(b, wtyp, keyField)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\thaveKey = true\n\t\tcase genid.MapEntry_Value_field_number:\n\t\t\tvar v protoreflect.Value\n\t\t\tv, n, err = o.unmarshalScalar(b, wtyp, valField)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tswitch valField.Kind() {\n\t\t\tcase protoreflect.GroupKind, protoreflect.MessageKind:\n\t\t\t\tif err := o.unmarshalMessage(v.Bytes(), val.Message()); err != nil {\n\t\t\t\t\treturn 0, err\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tval = v\n\t\t\t}\n\t\t\thaveVal = true\n\t\t}\n\t\tif err == errUnknown {\n\t\t\tn = protowire.ConsumeFieldValue(num, wtyp, b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tb = b[n:]\n\t}\n\t// Every map entry should have entries for key and value, but this is not strictly required.\n\tif !haveKey {\n\t\tkey = keyField.Default()\n\t}\n\tif !haveVal {\n\t\tswitch valField.Kind() {\n\t\tcase protoreflect.GroupKind, protoreflect.MessageKind:\n\t\tdefault:\n\t\t\tval = valField.Default()\n\t\t}\n\t}\n\tmapv.Set(key.MapKey(), val)\n\treturn n, nil\n}\n\n// errUnknown is used internally to indicate fields which should be added\n// to the unknown field set of a message. It is never returned from an exported\n// function.\nvar errUnknown = errors.New(\"BUG: internal error (unknown)\")\n\nvar errDecode = errors.New(\"cannot parse invalid wire-format data\")\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/decode_gen.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// Code generated by generate-types. DO NOT EDIT.\n\npackage proto\n\nimport (\n\t\"math\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// unmarshalScalar decodes a value of the given kind.\n//\n// Message values are decoded into a []byte which aliases the input data.\nfunc (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd protoreflect.FieldDescriptor) (val protoreflect.Value, n int, err error) {\n\tswitch fd.Kind() {\n\tcase protoreflect.BoolKind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfBool(protowire.DecodeBool(v)), n, nil\n\tcase protoreflect.EnumKind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), n, nil\n\tcase protoreflect.Int32Kind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfInt32(int32(v)), n, nil\n\tcase protoreflect.Sint32Kind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), n, nil\n\tcase protoreflect.Uint32Kind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfUint32(uint32(v)), n, nil\n\tcase protoreflect.Int64Kind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfInt64(int64(v)), n, nil\n\tcase protoreflect.Sint64Kind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), n, nil\n\tcase protoreflect.Uint64Kind:\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfUint64(v), n, nil\n\tcase protoreflect.Sfixed32Kind:\n\t\tif wtyp != protowire.Fixed32Type {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed32(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfInt32(int32(v)), n, nil\n\tcase protoreflect.Fixed32Kind:\n\t\tif wtyp != protowire.Fixed32Type {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed32(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfUint32(uint32(v)), n, nil\n\tcase protoreflect.FloatKind:\n\t\tif wtyp != protowire.Fixed32Type {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed32(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), n, nil\n\tcase protoreflect.Sfixed64Kind:\n\t\tif wtyp != protowire.Fixed64Type {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed64(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfInt64(int64(v)), n, nil\n\tcase protoreflect.Fixed64Kind:\n\t\tif wtyp != protowire.Fixed64Type {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed64(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfUint64(v), n, nil\n\tcase protoreflect.DoubleKind:\n\t\tif wtyp != protowire.Fixed64Type {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed64(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfFloat64(math.Float64frombits(v)), n, nil\n\tcase protoreflect.StringKind:\n\t\tif wtyp != protowire.BytesType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\tif strs.EnforceUTF8(fd) && !utf8.Valid(v) {\n\t\t\treturn protoreflect.Value{}, 0, errors.InvalidUTF8(string(fd.FullName()))\n\t\t}\n\t\treturn protoreflect.ValueOfString(string(v)), n, nil\n\tcase protoreflect.BytesKind:\n\t\tif wtyp != protowire.BytesType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), n, nil\n\tcase protoreflect.MessageKind:\n\t\tif wtyp != protowire.BytesType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfBytes(v), n, nil\n\tcase protoreflect.GroupKind:\n\t\tif wtyp != protowire.StartGroupType {\n\t\t\treturn val, 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeGroup(fd.Number(), b)\n\t\tif n < 0 {\n\t\t\treturn val, 0, errDecode\n\t\t}\n\t\treturn protoreflect.ValueOfBytes(v), n, nil\n\tdefault:\n\t\treturn val, 0, errUnknown\n\t}\n}\n\nfunc (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list protoreflect.List, fd protoreflect.FieldDescriptor) (n int, err error) {\n\tswitch fd.Kind() {\n\tcase protoreflect.BoolKind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))\n\t\treturn n, nil\n\tcase protoreflect.EnumKind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))\n\t\treturn n, nil\n\tcase protoreflect.Int32Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\t\treturn n, nil\n\tcase protoreflect.Sint32Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))\n\t\treturn n, nil\n\tcase protoreflect.Uint32Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\t\treturn n, nil\n\tcase protoreflect.Int64Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\t\treturn n, nil\n\tcase protoreflect.Sint64Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))\n\t\treturn n, nil\n\tcase protoreflect.Uint64Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeVarint(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfUint64(v))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.VarintType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeVarint(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfUint64(v))\n\t\treturn n, nil\n\tcase protoreflect.Sfixed32Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeFixed32(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.Fixed32Type {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed32(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfInt32(int32(v)))\n\t\treturn n, nil\n\tcase protoreflect.Fixed32Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeFixed32(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.Fixed32Type {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed32(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfUint32(uint32(v)))\n\t\treturn n, nil\n\tcase protoreflect.FloatKind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeFixed32(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.Fixed32Type {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed32(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))\n\t\treturn n, nil\n\tcase protoreflect.Sfixed64Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeFixed64(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.Fixed64Type {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed64(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfInt64(int64(v)))\n\t\treturn n, nil\n\tcase protoreflect.Fixed64Kind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeFixed64(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfUint64(v))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.Fixed64Type {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed64(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfUint64(v))\n\t\treturn n, nil\n\tcase protoreflect.DoubleKind:\n\t\tif wtyp == protowire.BytesType {\n\t\t\tbuf, n := protowire.ConsumeBytes(b)\n\t\t\tif n < 0 {\n\t\t\t\treturn 0, errDecode\n\t\t\t}\n\t\t\tfor len(buf) > 0 {\n\t\t\t\tv, n := protowire.ConsumeFixed64(buf)\n\t\t\t\tif n < 0 {\n\t\t\t\t\treturn 0, errDecode\n\t\t\t\t}\n\t\t\t\tbuf = buf[n:]\n\t\t\t\tlist.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))\n\t\t\t}\n\t\t\treturn n, nil\n\t\t}\n\t\tif wtyp != protowire.Fixed64Type {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeFixed64(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))\n\t\treturn n, nil\n\tcase protoreflect.StringKind:\n\t\tif wtyp != protowire.BytesType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tif strs.EnforceUTF8(fd) && !utf8.Valid(v) {\n\t\t\treturn 0, errors.InvalidUTF8(string(fd.FullName()))\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfString(string(v)))\n\t\treturn n, nil\n\tcase protoreflect.BytesKind:\n\t\tif wtyp != protowire.BytesType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tlist.Append(protoreflect.ValueOfBytes(append(emptyBuf[:], v...)))\n\t\treturn n, nil\n\tcase protoreflect.MessageKind:\n\t\tif wtyp != protowire.BytesType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeBytes(b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tm := list.NewElement()\n\t\tif err := o.unmarshalMessage(v, m.Message()); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tlist.Append(m)\n\t\treturn n, nil\n\tcase protoreflect.GroupKind:\n\t\tif wtyp != protowire.StartGroupType {\n\t\t\treturn 0, errUnknown\n\t\t}\n\t\tv, n := protowire.ConsumeGroup(fd.Number(), b)\n\t\tif n < 0 {\n\t\t\treturn 0, errDecode\n\t\t}\n\t\tm := list.NewElement()\n\t\tif err := o.unmarshalMessage(v, m.Message()); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tlist.Append(m)\n\t\treturn n, nil\n\tdefault:\n\t\treturn 0, errUnknown\n\t}\n}\n\n// We append to an empty array rather than a nil []byte to get non-nil zero-length byte slices.\nvar emptyBuf [0]byte\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/doc.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 functions operating on protocol buffer messages.\n//\n// For documentation on protocol buffers in general, see:\n//\n//   https://developers.google.com/protocol-buffers\n//\n// For a tutorial on using protocol buffers with Go, see:\n//\n//   https://developers.google.com/protocol-buffers/docs/gotutorial\n//\n// For a guide to generated Go protocol buffer code, see:\n//\n//   https://developers.google.com/protocol-buffers/docs/reference/go-generated\n//\n//\n// Binary serialization\n//\n// This package contains functions to convert to and from the wire format,\n// an efficient binary serialization of protocol buffers.\n//\n// • Size reports the size of a message in the wire format.\n//\n// • Marshal converts a message to the wire format.\n// The MarshalOptions type provides more control over wire marshaling.\n//\n// • Unmarshal converts a message from the wire format.\n// The UnmarshalOptions type provides more control over wire unmarshaling.\n//\n//\n// Basic message operations\n//\n// • Clone makes a deep copy of a message.\n//\n// • Merge merges the content of a message into another.\n//\n// • Equal compares two messages. For more control over comparisons\n// and detailed reporting of differences, see package\n// \"google.golang.org/protobuf/testing/protocmp\".\n//\n// • Reset clears the content of a message.\n//\n// • CheckInitialized reports whether all required fields in a message are set.\n//\n//\n// Optional scalar constructors\n//\n// The API for some generated messages represents optional scalar fields\n// as pointers to a value. For example, an optional string field has the\n// Go type *string.\n//\n// • Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, and String\n// take a value and return a pointer to a new instance of it,\n// to simplify construction of optional field values.\n//\n// Generated enum types usually have an Enum method which performs the\n// same operation.\n//\n// Optional scalar fields are only supported in proto2.\n//\n//\n// Extension accessors\n//\n// • HasExtension, GetExtension, SetExtension, and ClearExtension\n// access extension field values in a protocol buffer message.\n//\n// Extension fields are only supported in proto2.\n//\n//\n// Related packages\n//\n// • Package \"google.golang.org/protobuf/encoding/protojson\" converts messages to\n// and from JSON.\n//\n// • Package \"google.golang.org/protobuf/encoding/prototext\" converts messages to\n// and from the text format.\n//\n// • Package \"google.golang.org/protobuf/reflect/protoreflect\" provides a\n// reflection interface for protocol buffer data types.\n//\n// • Package \"google.golang.org/protobuf/testing/protocmp\" provides features\n// to compare protocol buffer messages with the \"github.com/google/go-cmp/cmp\"\n// package.\n//\n// • Package \"google.golang.org/protobuf/types/dynamicpb\" provides a dynamic\n// message type, suitable for working with messages where the protocol buffer\n// type is only known at runtime.\n//\n// This module contains additional packages for more specialized use cases.\n// Consult the individual package documentation for details.\npackage proto\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/encode.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/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/order\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// MarshalOptions configures the marshaler.\n//\n// Example usage:\n//   b, err := MarshalOptions{Deterministic: true}.Marshal(m)\ntype MarshalOptions struct {\n\tpragma.NoUnkeyedLiterals\n\n\t// AllowPartial allows messages that have missing required fields to marshal\n\t// without returning an error. If AllowPartial is false (the default),\n\t// Marshal will return an error if there are any missing required fields.\n\tAllowPartial bool\n\n\t// Deterministic controls whether the same message will always be\n\t// serialized to the same bytes within the same binary.\n\t//\n\t// Setting this option guarantees that repeated serialization of\n\t// the same message will return the same bytes, and that different\n\t// processes of the same binary (which may be executing on different\n\t// machines) will serialize equal messages to the same bytes.\n\t// It has no effect on the resulting size of the encoded message compared\n\t// to a non-deterministic marshal.\n\t//\n\t// Note that the deterministic serialization is NOT canonical across\n\t// languages. It is not guaranteed to remain stable over time. It is\n\t// unstable across different builds with schema changes due to unknown\n\t// fields. Users who need canonical serialization (e.g., persistent\n\t// storage in a canonical form, fingerprinting, etc.) must define\n\t// their own canonicalization specification and implement their own\n\t// serializer rather than relying on this API.\n\t//\n\t// If deterministic serialization is requested, map entries will be\n\t// sorted by keys in lexographical order. This is an implementation\n\t// detail and subject to change.\n\tDeterministic bool\n\n\t// UseCachedSize indicates that the result of a previous Size call\n\t// may be reused.\n\t//\n\t// Setting this option asserts that:\n\t//\n\t// 1. Size has previously been called on this message with identical\n\t// options (except for UseCachedSize itself).\n\t//\n\t// 2. The message and all its submessages have not changed in any\n\t// way since the Size call.\n\t//\n\t// If either of these invariants is violated,\n\t// the results are undefined and may include panics or corrupted output.\n\t//\n\t// Implementations MAY take this option into account to provide\n\t// better performance, but there is no guarantee that they will do so.\n\t// There is absolutely no guarantee that Size followed by Marshal with\n\t// UseCachedSize set will perform equivalently to Marshal alone.\n\tUseCachedSize bool\n}\n\n// Marshal returns the wire-format encoding of m.\nfunc Marshal(m Message) ([]byte, error) {\n\t// Treat nil message interface as an empty message; nothing to output.\n\tif m == nil {\n\t\treturn nil, nil\n\t}\n\n\tout, err := MarshalOptions{}.marshal(nil, m.ProtoReflect())\n\tif len(out.Buf) == 0 && err == nil {\n\t\tout.Buf = emptyBytesForMessage(m)\n\t}\n\treturn out.Buf, err\n}\n\n// Marshal returns the wire-format encoding of m.\nfunc (o MarshalOptions) Marshal(m Message) ([]byte, error) {\n\t// Treat nil message interface as an empty message; nothing to output.\n\tif m == nil {\n\t\treturn nil, nil\n\t}\n\n\tout, err := o.marshal(nil, m.ProtoReflect())\n\tif len(out.Buf) == 0 && err == nil {\n\t\tout.Buf = emptyBytesForMessage(m)\n\t}\n\treturn out.Buf, err\n}\n\n// emptyBytesForMessage returns a nil buffer if and only if m is invalid,\n// otherwise it returns a non-nil empty buffer.\n//\n// This is to assist the edge-case where user-code does the following:\n//\tm1.OptionalBytes, _ = proto.Marshal(m2)\n// where they expect the proto2 \"optional_bytes\" field to be populated\n// if any only if m2 is a valid message.\nfunc emptyBytesForMessage(m Message) []byte {\n\tif m == nil || !m.ProtoReflect().IsValid() {\n\t\treturn nil\n\t}\n\treturn emptyBuf[:]\n}\n\n// MarshalAppend appends the wire-format encoding of m to b,\n// returning the result.\nfunc (o MarshalOptions) MarshalAppend(b []byte, m Message) ([]byte, error) {\n\t// Treat nil message interface as an empty message; nothing to append.\n\tif m == nil {\n\t\treturn b, nil\n\t}\n\n\tout, err := o.marshal(b, m.ProtoReflect())\n\treturn out.Buf, err\n}\n\n// MarshalState returns the wire-format encoding of a message.\n//\n// This method permits fine-grained control over the marshaler.\n// Most users should use Marshal instead.\nfunc (o MarshalOptions) MarshalState(in protoiface.MarshalInput) (protoiface.MarshalOutput, error) {\n\treturn o.marshal(in.Buf, in.Message)\n}\n\n// marshal is a centralized function that all marshal operations go through.\n// For profiling purposes, avoid changing the name of this function or\n// introducing other code paths for marshal that do not go through this.\nfunc (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoiface.MarshalOutput, err error) {\n\tallowPartial := o.AllowPartial\n\to.AllowPartial = true\n\tif methods := protoMethods(m); methods != nil && methods.Marshal != nil &&\n\t\t!(o.Deterministic && methods.Flags&protoiface.SupportMarshalDeterministic == 0) {\n\t\tin := protoiface.MarshalInput{\n\t\t\tMessage: m,\n\t\t\tBuf:     b,\n\t\t}\n\t\tif o.Deterministic {\n\t\t\tin.Flags |= protoiface.MarshalDeterministic\n\t\t}\n\t\tif o.UseCachedSize {\n\t\t\tin.Flags |= protoiface.MarshalUseCachedSize\n\t\t}\n\t\tif methods.Size != nil {\n\t\t\tsout := methods.Size(protoiface.SizeInput{\n\t\t\t\tMessage: m,\n\t\t\t\tFlags:   in.Flags,\n\t\t\t})\n\t\t\tif cap(b) < len(b)+sout.Size {\n\t\t\t\tin.Buf = make([]byte, len(b), growcap(cap(b), len(b)+sout.Size))\n\t\t\t\tcopy(in.Buf, b)\n\t\t\t}\n\t\t\tin.Flags |= protoiface.MarshalUseCachedSize\n\t\t}\n\t\tout, err = methods.Marshal(in)\n\t} else {\n\t\tout.Buf, err = o.marshalMessageSlow(b, m)\n\t}\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tif allowPartial {\n\t\treturn out, nil\n\t}\n\treturn out, checkInitialized(m)\n}\n\nfunc (o MarshalOptions) marshalMessage(b []byte, m protoreflect.Message) ([]byte, error) {\n\tout, err := o.marshal(b, m)\n\treturn out.Buf, err\n}\n\n// growcap scales up the capacity of a slice.\n//\n// Given a slice with a current capacity of oldcap and a desired\n// capacity of wantcap, growcap returns a new capacity >= wantcap.\n//\n// The algorithm is mostly identical to the one used by append as of Go 1.14.\nfunc growcap(oldcap, wantcap int) (newcap int) {\n\tif wantcap > oldcap*2 {\n\t\tnewcap = wantcap\n\t} else if oldcap < 1024 {\n\t\t// The Go 1.14 runtime takes this case when len(s) < 1024,\n\t\t// not when cap(s) < 1024. The difference doesn't seem\n\t\t// significant here.\n\t\tnewcap = oldcap * 2\n\t} else {\n\t\tnewcap = oldcap\n\t\tfor 0 < newcap && newcap < wantcap {\n\t\t\tnewcap += newcap / 4\n\t\t}\n\t\tif newcap <= 0 {\n\t\t\tnewcap = wantcap\n\t\t}\n\t}\n\treturn newcap\n}\n\nfunc (o MarshalOptions) marshalMessageSlow(b []byte, m protoreflect.Message) ([]byte, error) {\n\tif messageset.IsMessageSet(m.Descriptor()) {\n\t\treturn o.marshalMessageSet(b, m)\n\t}\n\tfieldOrder := order.AnyFieldOrder\n\tif o.Deterministic {\n\t\t// TODO: This should use a more natural ordering like NumberFieldOrder,\n\t\t// but doing so breaks golden tests that make invalid assumption about\n\t\t// output stability of this implementation.\n\t\tfieldOrder = order.LegacyFieldOrder\n\t}\n\tvar err error\n\torder.RangeFields(m, fieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tb, err = o.marshalField(b, fd, v)\n\t\treturn err == nil\n\t})\n\tif err != nil {\n\t\treturn b, err\n\t}\n\tb = append(b, m.GetUnknown()...)\n\treturn b, nil\n}\n\nfunc (o MarshalOptions) marshalField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) {\n\tswitch {\n\tcase fd.IsList():\n\t\treturn o.marshalList(b, fd, value.List())\n\tcase fd.IsMap():\n\t\treturn o.marshalMap(b, fd, value.Map())\n\tdefault:\n\t\tb = protowire.AppendTag(b, fd.Number(), wireTypes[fd.Kind()])\n\t\treturn o.marshalSingular(b, fd, value)\n\t}\n}\n\nfunc (o MarshalOptions) marshalList(b []byte, fd protoreflect.FieldDescriptor, list protoreflect.List) ([]byte, error) {\n\tif fd.IsPacked() && list.Len() > 0 {\n\t\tb = protowire.AppendTag(b, fd.Number(), protowire.BytesType)\n\t\tb, pos := appendSpeculativeLength(b)\n\t\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\t\tvar err error\n\t\t\tb, err = o.marshalSingular(b, fd, list.Get(i))\n\t\t\tif err != nil {\n\t\t\t\treturn b, err\n\t\t\t}\n\t\t}\n\t\tb = finishSpeculativeLength(b, pos)\n\t\treturn b, nil\n\t}\n\n\tkind := fd.Kind()\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tvar err error\n\t\tb = protowire.AppendTag(b, fd.Number(), wireTypes[kind])\n\t\tb, err = o.marshalSingular(b, fd, list.Get(i))\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t}\n\treturn b, nil\n}\n\nfunc (o MarshalOptions) marshalMap(b []byte, fd protoreflect.FieldDescriptor, mapv protoreflect.Map) ([]byte, error) {\n\tkeyf := fd.MapKey()\n\tvalf := fd.MapValue()\n\tkeyOrder := order.AnyKeyOrder\n\tif o.Deterministic {\n\t\tkeyOrder = order.GenericKeyOrder\n\t}\n\tvar err error\n\torder.RangeEntries(mapv, keyOrder, func(key protoreflect.MapKey, value protoreflect.Value) bool {\n\t\tb = protowire.AppendTag(b, fd.Number(), protowire.BytesType)\n\t\tvar pos int\n\t\tb, pos = appendSpeculativeLength(b)\n\n\t\tb, err = o.marshalField(b, keyf, key.Value())\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tb, err = o.marshalField(b, valf, value)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tb = finishSpeculativeLength(b, pos)\n\t\treturn true\n\t})\n\treturn b, err\n}\n\n// When encoding length-prefixed fields, we speculatively set aside some number of bytes\n// for the length, encode the data, and then encode the length (shifting the data if necessary\n// to make room).\nconst speculativeLength = 1\n\nfunc appendSpeculativeLength(b []byte) ([]byte, int) {\n\tpos := len(b)\n\tb = append(b, \"\\x00\\x00\\x00\\x00\"[:speculativeLength]...)\n\treturn b, pos\n}\n\nfunc finishSpeculativeLength(b []byte, pos int) []byte {\n\tmlen := len(b) - pos - speculativeLength\n\tmsiz := protowire.SizeVarint(uint64(mlen))\n\tif msiz != speculativeLength {\n\t\tfor i := 0; i < msiz-speculativeLength; i++ {\n\t\t\tb = append(b, 0)\n\t\t}\n\t\tcopy(b[pos+msiz:], b[pos+speculativeLength:])\n\t\tb = b[:pos+msiz+mlen]\n\t}\n\tprotowire.AppendVarint(b[:pos], uint64(mlen))\n\treturn b\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/encode_gen.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// Code generated by generate-types. DO NOT EDIT.\n\npackage proto\n\nimport (\n\t\"math\"\n\t\"unicode/utf8\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/strs\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nvar wireTypes = map[protoreflect.Kind]protowire.Type{\n\tprotoreflect.BoolKind:     protowire.VarintType,\n\tprotoreflect.EnumKind:     protowire.VarintType,\n\tprotoreflect.Int32Kind:    protowire.VarintType,\n\tprotoreflect.Sint32Kind:   protowire.VarintType,\n\tprotoreflect.Uint32Kind:   protowire.VarintType,\n\tprotoreflect.Int64Kind:    protowire.VarintType,\n\tprotoreflect.Sint64Kind:   protowire.VarintType,\n\tprotoreflect.Uint64Kind:   protowire.VarintType,\n\tprotoreflect.Sfixed32Kind: protowire.Fixed32Type,\n\tprotoreflect.Fixed32Kind:  protowire.Fixed32Type,\n\tprotoreflect.FloatKind:    protowire.Fixed32Type,\n\tprotoreflect.Sfixed64Kind: protowire.Fixed64Type,\n\tprotoreflect.Fixed64Kind:  protowire.Fixed64Type,\n\tprotoreflect.DoubleKind:   protowire.Fixed64Type,\n\tprotoreflect.StringKind:   protowire.BytesType,\n\tprotoreflect.BytesKind:    protowire.BytesType,\n\tprotoreflect.MessageKind:  protowire.BytesType,\n\tprotoreflect.GroupKind:    protowire.StartGroupType,\n}\n\nfunc (o MarshalOptions) marshalSingular(b []byte, fd protoreflect.FieldDescriptor, v protoreflect.Value) ([]byte, error) {\n\tswitch fd.Kind() {\n\tcase protoreflect.BoolKind:\n\t\tb = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))\n\tcase protoreflect.EnumKind:\n\t\tb = protowire.AppendVarint(b, uint64(v.Enum()))\n\tcase protoreflect.Int32Kind:\n\t\tb = protowire.AppendVarint(b, uint64(int32(v.Int())))\n\tcase protoreflect.Sint32Kind:\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))\n\tcase protoreflect.Uint32Kind:\n\t\tb = protowire.AppendVarint(b, uint64(uint32(v.Uint())))\n\tcase protoreflect.Int64Kind:\n\t\tb = protowire.AppendVarint(b, uint64(v.Int()))\n\tcase protoreflect.Sint64Kind:\n\t\tb = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))\n\tcase protoreflect.Uint64Kind:\n\t\tb = protowire.AppendVarint(b, v.Uint())\n\tcase protoreflect.Sfixed32Kind:\n\t\tb = protowire.AppendFixed32(b, uint32(v.Int()))\n\tcase protoreflect.Fixed32Kind:\n\t\tb = protowire.AppendFixed32(b, uint32(v.Uint()))\n\tcase protoreflect.FloatKind:\n\t\tb = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))\n\tcase protoreflect.Sfixed64Kind:\n\t\tb = protowire.AppendFixed64(b, uint64(v.Int()))\n\tcase protoreflect.Fixed64Kind:\n\t\tb = protowire.AppendFixed64(b, v.Uint())\n\tcase protoreflect.DoubleKind:\n\t\tb = protowire.AppendFixed64(b, math.Float64bits(v.Float()))\n\tcase protoreflect.StringKind:\n\t\tif strs.EnforceUTF8(fd) && !utf8.ValidString(v.String()) {\n\t\t\treturn b, errors.InvalidUTF8(string(fd.FullName()))\n\t\t}\n\t\tb = protowire.AppendString(b, v.String())\n\tcase protoreflect.BytesKind:\n\t\tb = protowire.AppendBytes(b, v.Bytes())\n\tcase protoreflect.MessageKind:\n\t\tvar pos int\n\t\tvar err error\n\t\tb, pos = appendSpeculativeLength(b)\n\t\tb, err = o.marshalMessage(b, v.Message())\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t\tb = finishSpeculativeLength(b, pos)\n\tcase protoreflect.GroupKind:\n\t\tvar err error\n\t\tb, err = o.marshalMessage(b, v.Message())\n\t\tif err != nil {\n\t\t\treturn b, err\n\t\t}\n\t\tb = protowire.AppendVarint(b, protowire.EncodeTag(fd.Number(), protowire.EndGroupType))\n\tdefault:\n\t\treturn b, errors.New(\"invalid kind %v\", fd.Kind())\n\t}\n\treturn b, nil\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/equal.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\"math\"\n\t\"reflect\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\tpref \"google.golang.org/protobuf/reflect/protoreflect\"\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 belong to the same message descriptor,\n// have the same set of populated known and extension field values,\n// and the same set of unknown fields values. If either of the top-level\n// messages are invalid, then Equal reports true only if both are invalid.\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\tif x == nil || y == nil {\n\t\treturn x == nil && y == nil\n\t}\n\tmx := x.ProtoReflect()\n\tmy := y.ProtoReflect()\n\tif mx.IsValid() != my.IsValid() {\n\t\treturn false\n\t}\n\treturn equalMessage(mx, my)\n}\n\n// equalMessage compares two messages.\nfunc equalMessage(mx, my pref.Message) bool {\n\tif mx.Descriptor() != my.Descriptor() {\n\t\treturn false\n\t}\n\n\tnx := 0\n\tequal := true\n\tmx.Range(func(fd pref.FieldDescriptor, vx pref.Value) bool {\n\t\tnx++\n\t\tvy := my.Get(fd)\n\t\tequal = my.Has(fd) && equalField(fd, vx, vy)\n\t\treturn equal\n\t})\n\tif !equal {\n\t\treturn false\n\t}\n\tny := 0\n\tmy.Range(func(fd pref.FieldDescriptor, vx pref.Value) bool {\n\t\tny++\n\t\treturn true\n\t})\n\tif nx != ny {\n\t\treturn false\n\t}\n\n\treturn equalUnknown(mx.GetUnknown(), my.GetUnknown())\n}\n\n// equalField compares two fields.\nfunc equalField(fd pref.FieldDescriptor, x, y pref.Value) bool {\n\tswitch {\n\tcase fd.IsList():\n\t\treturn equalList(fd, x.List(), y.List())\n\tcase fd.IsMap():\n\t\treturn equalMap(fd, x.Map(), y.Map())\n\tdefault:\n\t\treturn equalValue(fd, x, y)\n\t}\n}\n\n// equalMap compares two maps.\nfunc equalMap(fd pref.FieldDescriptor, x, y pref.Map) bool {\n\tif x.Len() != y.Len() {\n\t\treturn false\n\t}\n\tequal := true\n\tx.Range(func(k pref.MapKey, vx pref.Value) bool {\n\t\tvy := y.Get(k)\n\t\tequal = y.Has(k) && equalValue(fd.MapValue(), vx, vy)\n\t\treturn equal\n\t})\n\treturn equal\n}\n\n// equalList compares two lists.\nfunc equalList(fd pref.FieldDescriptor, x, y pref.List) bool {\n\tif x.Len() != y.Len() {\n\t\treturn false\n\t}\n\tfor i := x.Len() - 1; i >= 0; i-- {\n\t\tif !equalValue(fd, x.Get(i), y.Get(i)) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\n// equalValue compares two singular values.\nfunc equalValue(fd pref.FieldDescriptor, x, y pref.Value) bool {\n\tswitch fd.Kind() {\n\tcase pref.BoolKind:\n\t\treturn x.Bool() == y.Bool()\n\tcase pref.EnumKind:\n\t\treturn x.Enum() == y.Enum()\n\tcase pref.Int32Kind, pref.Sint32Kind,\n\t\tpref.Int64Kind, pref.Sint64Kind,\n\t\tpref.Sfixed32Kind, pref.Sfixed64Kind:\n\t\treturn x.Int() == y.Int()\n\tcase pref.Uint32Kind, pref.Uint64Kind,\n\t\tpref.Fixed32Kind, pref.Fixed64Kind:\n\t\treturn x.Uint() == y.Uint()\n\tcase pref.FloatKind, pref.DoubleKind:\n\t\tfx := x.Float()\n\t\tfy := y.Float()\n\t\tif math.IsNaN(fx) || math.IsNaN(fy) {\n\t\t\treturn math.IsNaN(fx) && math.IsNaN(fy)\n\t\t}\n\t\treturn fx == fy\n\tcase pref.StringKind:\n\t\treturn x.String() == y.String()\n\tcase pref.BytesKind:\n\t\treturn bytes.Equal(x.Bytes(), y.Bytes())\n\tcase pref.MessageKind, pref.GroupKind:\n\t\treturn equalMessage(x.Message(), y.Message())\n\tdefault:\n\t\treturn x.Interface() == y.Interface()\n\t}\n}\n\n// equalUnknown compares unknown fields by direct comparison on the raw bytes\n// of each individual field number.\nfunc equalUnknown(x, y pref.RawFields) bool {\n\tif len(x) != len(y) {\n\t\treturn false\n\t}\n\tif bytes.Equal([]byte(x), []byte(y)) {\n\t\treturn true\n\t}\n\n\tmx := make(map[pref.FieldNumber]pref.RawFields)\n\tmy := make(map[pref.FieldNumber]pref.RawFields)\n\tfor len(x) > 0 {\n\t\tfnum, _, n := protowire.ConsumeField(x)\n\t\tmx[fnum] = append(mx[fnum], x[:n]...)\n\t\tx = x[n:]\n\t}\n\tfor len(y) > 0 {\n\t\tfnum, _, n := protowire.ConsumeField(y)\n\t\tmy[fnum] = append(my[fnum], y[:n]...)\n\t\ty = y[n:]\n\t}\n\treturn reflect.DeepEqual(mx, my)\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/extension.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// HasExtension reports whether an extension field is populated.\n// It returns false if m is invalid or if xt does not extend m.\nfunc HasExtension(m Message, xt protoreflect.ExtensionType) bool {\n\t// Treat nil message interface as an empty message; no populated fields.\n\tif m == nil {\n\t\treturn false\n\t}\n\n\t// As a special-case, we reports invalid or mismatching descriptors\n\t// as always not being populated (since they aren't).\n\tif xt == nil || m.ProtoReflect().Descriptor() != xt.TypeDescriptor().ContainingMessage() {\n\t\treturn false\n\t}\n\n\treturn m.ProtoReflect().Has(xt.TypeDescriptor())\n}\n\n// ClearExtension clears an extension field such that subsequent\n// HasExtension calls return false.\n// It panics if m is invalid or if xt does not extend m.\nfunc ClearExtension(m Message, xt protoreflect.ExtensionType) {\n\tm.ProtoReflect().Clear(xt.TypeDescriptor())\n}\n\n// GetExtension retrieves the value for an extension field.\n// If the field is unpopulated, it returns the default value for\n// scalars and an immutable, empty value for lists or messages.\n// It panics if xt does not extend m.\nfunc GetExtension(m Message, xt protoreflect.ExtensionType) interface{} {\n\t// Treat nil message interface as an empty message; return the default.\n\tif m == nil {\n\t\treturn xt.InterfaceOf(xt.Zero())\n\t}\n\n\treturn xt.InterfaceOf(m.ProtoReflect().Get(xt.TypeDescriptor()))\n}\n\n// SetExtension stores the value of an extension field.\n// It panics if m is invalid, xt does not extend m, or if type of v\n// is invalid for the specified extension field.\nfunc SetExtension(m Message, xt protoreflect.ExtensionType, v interface{}) {\n\txd := xt.TypeDescriptor()\n\tpv := xt.ValueOf(v)\n\n\t// Specially treat an invalid list, map, or message as clear.\n\tisValid := true\n\tswitch {\n\tcase xd.IsList():\n\t\tisValid = pv.List().IsValid()\n\tcase xd.IsMap():\n\t\tisValid = pv.Map().IsValid()\n\tcase xd.Message() != nil:\n\t\tisValid = pv.Message().IsValid()\n\t}\n\tif !isValid {\n\t\tm.ProtoReflect().Clear(xd)\n\t\treturn\n\t}\n\n\tm.ProtoReflect().Set(xd, pv)\n}\n\n// RangeExtensions iterates over every populated extension field in m in an\n// undefined order, calling f for each extension type and value encountered.\n// It returns immediately if f returns false.\n// While iterating, mutating operations may only be performed\n// on the current extension field.\nfunc RangeExtensions(m Message, f func(protoreflect.ExtensionType, interface{}) bool) {\n\t// Treat nil message interface as an empty message; nothing to range over.\n\tif m == nil {\n\t\treturn\n\t}\n\n\tm.ProtoReflect().Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tif fd.IsExtension() {\n\t\t\txt := fd.(protoreflect.ExtensionTypeDescriptor).Type()\n\t\t\tvi := xt.InterfaceOf(v)\n\t\t\treturn f(xt, vi)\n\t\t}\n\t\treturn true\n\t})\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/merge.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\"fmt\"\n\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n)\n\n// Merge merges src into dst, which must be a message with the same descriptor.\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.\n//\n// It is semantically equivalent to unmarshaling the encoded form of src\n// into dst with the UnmarshalOptions.Merge option specified.\nfunc Merge(dst, src Message) {\n\t// TODO: Should nil src be treated as semantically equivalent to a\n\t// untyped, read-only, empty message? What about a nil dst?\n\n\tdstMsg, srcMsg := dst.ProtoReflect(), src.ProtoReflect()\n\tif dstMsg.Descriptor() != srcMsg.Descriptor() {\n\t\tif got, want := dstMsg.Descriptor().FullName(), srcMsg.Descriptor().FullName(); got != want {\n\t\t\tpanic(fmt.Sprintf(\"descriptor mismatch: %v != %v\", got, want))\n\t\t}\n\t\tpanic(\"descriptor mismatch\")\n\t}\n\tmergeOptions{}.mergeMessage(dstMsg, srcMsg)\n}\n\n// Clone returns a deep copy of m.\n// If the top-level message is invalid, it returns an invalid message as well.\nfunc Clone(m Message) Message {\n\t// NOTE: Most usages of Clone assume the following properties:\n\t//\tt := reflect.TypeOf(m)\n\t//\tt == reflect.TypeOf(m.ProtoReflect().New().Interface())\n\t//\tt == reflect.TypeOf(m.ProtoReflect().Type().Zero().Interface())\n\t//\n\t// Embedding protobuf messages breaks this since the parent type will have\n\t// a forwarded ProtoReflect method, but the Interface method will return\n\t// the underlying embedded message type.\n\tif m == nil {\n\t\treturn nil\n\t}\n\tsrc := m.ProtoReflect()\n\tif !src.IsValid() {\n\t\treturn src.Type().Zero().Interface()\n\t}\n\tdst := src.New()\n\tmergeOptions{}.mergeMessage(dst, src)\n\treturn dst.Interface()\n}\n\n// mergeOptions provides a namespace for merge functions, and can be\n// exported in the future if we add user-visible merge options.\ntype mergeOptions struct{}\n\nfunc (o mergeOptions) mergeMessage(dst, src protoreflect.Message) {\n\tmethods := protoMethods(dst)\n\tif methods != nil && methods.Merge != nil {\n\t\tin := protoiface.MergeInput{\n\t\t\tDestination: dst,\n\t\t\tSource:      src,\n\t\t}\n\t\tout := methods.Merge(in)\n\t\tif out.Flags&protoiface.MergeComplete != 0 {\n\t\t\treturn\n\t\t}\n\t}\n\n\tif !dst.IsValid() {\n\t\tpanic(fmt.Sprintf(\"cannot merge into invalid %v message\", dst.Descriptor().FullName()))\n\t}\n\n\tsrc.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tswitch {\n\t\tcase fd.IsList():\n\t\t\to.mergeList(dst.Mutable(fd).List(), v.List(), fd)\n\t\tcase fd.IsMap():\n\t\t\to.mergeMap(dst.Mutable(fd).Map(), v.Map(), fd.MapValue())\n\t\tcase fd.Message() != nil:\n\t\t\to.mergeMessage(dst.Mutable(fd).Message(), v.Message())\n\t\tcase fd.Kind() == protoreflect.BytesKind:\n\t\t\tdst.Set(fd, o.cloneBytes(v))\n\t\tdefault:\n\t\t\tdst.Set(fd, v)\n\t\t}\n\t\treturn true\n\t})\n\n\tif len(src.GetUnknown()) > 0 {\n\t\tdst.SetUnknown(append(dst.GetUnknown(), src.GetUnknown()...))\n\t}\n}\n\nfunc (o mergeOptions) mergeList(dst, src protoreflect.List, fd protoreflect.FieldDescriptor) {\n\t// Merge semantics appends to the end of the existing list.\n\tfor i, n := 0, src.Len(); i < n; i++ {\n\t\tswitch v := src.Get(i); {\n\t\tcase fd.Message() != nil:\n\t\t\tdstv := dst.NewElement()\n\t\t\to.mergeMessage(dstv.Message(), v.Message())\n\t\t\tdst.Append(dstv)\n\t\tcase fd.Kind() == protoreflect.BytesKind:\n\t\t\tdst.Append(o.cloneBytes(v))\n\t\tdefault:\n\t\t\tdst.Append(v)\n\t\t}\n\t}\n}\n\nfunc (o mergeOptions) mergeMap(dst, src protoreflect.Map, fd protoreflect.FieldDescriptor) {\n\t// Merge semantics replaces, rather than merges into existing entries.\n\tsrc.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {\n\t\tswitch {\n\t\tcase fd.Message() != nil:\n\t\t\tdstv := dst.NewValue()\n\t\t\to.mergeMessage(dstv.Message(), v.Message())\n\t\t\tdst.Set(k, dstv)\n\t\tcase fd.Kind() == protoreflect.BytesKind:\n\t\t\tdst.Set(k, o.cloneBytes(v))\n\t\tdefault:\n\t\t\tdst.Set(k, v)\n\t\t}\n\t\treturn true\n\t})\n}\n\nfunc (o mergeOptions) cloneBytes(v protoreflect.Value) protoreflect.Value {\n\treturn protoreflect.ValueOfBytes(append([]byte{}, v.Bytes()...))\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/messageset.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/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/internal/order\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/reflect/protoregistry\"\n)\n\nfunc (o MarshalOptions) sizeMessageSet(m protoreflect.Message) (size int) {\n\tm.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tsize += messageset.SizeField(fd.Number())\n\t\tsize += protowire.SizeTag(messageset.FieldMessage)\n\t\tsize += protowire.SizeBytes(o.size(v.Message()))\n\t\treturn true\n\t})\n\tsize += messageset.SizeUnknown(m.GetUnknown())\n\treturn size\n}\n\nfunc (o MarshalOptions) marshalMessageSet(b []byte, m protoreflect.Message) ([]byte, error) {\n\tif !flags.ProtoLegacy {\n\t\treturn b, errors.New(\"no support for message_set_wire_format\")\n\t}\n\tfieldOrder := order.AnyFieldOrder\n\tif o.Deterministic {\n\t\tfieldOrder = order.NumberFieldOrder\n\t}\n\tvar err error\n\torder.RangeFields(m, fieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tb, err = o.marshalMessageSetField(b, fd, v)\n\t\treturn err == nil\n\t})\n\tif err != nil {\n\t\treturn b, err\n\t}\n\treturn messageset.AppendUnknown(b, m.GetUnknown())\n}\n\nfunc (o MarshalOptions) marshalMessageSetField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) {\n\tb = messageset.AppendFieldStart(b, fd.Number())\n\tb = protowire.AppendTag(b, messageset.FieldMessage, protowire.BytesType)\n\tb = protowire.AppendVarint(b, uint64(o.Size(value.Message().Interface())))\n\tb, err := o.marshalMessage(b, value.Message())\n\tif err != nil {\n\t\treturn b, err\n\t}\n\tb = messageset.AppendFieldEnd(b)\n\treturn b, nil\n}\n\nfunc (o UnmarshalOptions) unmarshalMessageSet(b []byte, m protoreflect.Message) error {\n\tif !flags.ProtoLegacy {\n\t\treturn errors.New(\"no support for message_set_wire_format\")\n\t}\n\treturn messageset.Unmarshal(b, false, func(num protowire.Number, v []byte) error {\n\t\terr := o.unmarshalMessageSetField(m, num, v)\n\t\tif err == errUnknown {\n\t\t\tunknown := m.GetUnknown()\n\t\t\tunknown = protowire.AppendTag(unknown, num, protowire.BytesType)\n\t\t\tunknown = protowire.AppendBytes(unknown, v)\n\t\t\tm.SetUnknown(unknown)\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t})\n}\n\nfunc (o UnmarshalOptions) unmarshalMessageSetField(m protoreflect.Message, num protowire.Number, v []byte) error {\n\tmd := m.Descriptor()\n\tif !md.ExtensionRanges().Has(num) {\n\t\treturn errUnknown\n\t}\n\txt, err := o.Resolver.FindExtensionByNumber(md.FullName(), num)\n\tif err == protoregistry.NotFound {\n\t\treturn errUnknown\n\t}\n\tif err != nil {\n\t\treturn errors.New(\"%v: unable to resolve extension %v: %v\", md.FullName(), num, err)\n\t}\n\txd := xt.TypeDescriptor()\n\tif err := o.unmarshalMessage(v, m.Mutable(xd).Message()); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/proto.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\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// Message is the top-level interface that all messages must implement.\n// It provides access to a reflective view of a message.\n// Any implementation of this interface may be used with all functions in the\n// protobuf module that accept a Message, except where otherwise specified.\n//\n// This is the v2 interface definition for protobuf messages.\n// The v1 interface definition is \"github.com/golang/protobuf/proto\".Message.\n//\n// To convert a v1 message to a v2 message,\n// use \"github.com/golang/protobuf/proto\".MessageV2.\n// To convert a v2 message to a v1 message,\n// use \"github.com/golang/protobuf/proto\".MessageV1.\ntype Message = protoreflect.ProtoMessage\n\n// Error matches all errors produced by packages in the protobuf module.\n//\n// That is, errors.Is(err, Error) reports whether an error is produced\n// by this module.\nvar Error error\n\nfunc init() {\n\tError = errors.Error\n}\n\n// MessageName returns the full name of m.\n// If m is nil, it returns an empty string.\nfunc MessageName(m Message) protoreflect.FullName {\n\tif m == nil {\n\t\treturn \"\"\n\t}\n\treturn m.ProtoReflect().Descriptor().FullName()\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/proto_methods.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// The protoreflect build tag disables use of fast-path methods.\n// +build !protoreflect\n\npackage proto\n\nimport (\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n)\n\nconst hasProtoMethods = true\n\nfunc protoMethods(m protoreflect.Message) *protoiface.Methods {\n\treturn m.ProtoMethods()\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/proto_reflect.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// The protoreflect build tag disables use of fast-path methods.\n// +build protoreflect\n\npackage proto\n\nimport (\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n\t\"google.golang.org/protobuf/runtime/protoiface\"\n)\n\nconst hasProtoMethods = false\n\nfunc protoMethods(m protoreflect.Message) *protoiface.Methods {\n\treturn nil\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/reset.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\"fmt\"\n\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// Reset clears every field in the message.\n// The resulting message shares no observable memory with its previous state\n// other than the memory for the message itself.\nfunc Reset(m Message) {\n\tif mr, ok := m.(interface{ Reset() }); ok && hasProtoMethods {\n\t\tmr.Reset()\n\t\treturn\n\t}\n\tresetMessage(m.ProtoReflect())\n}\n\nfunc resetMessage(m protoreflect.Message) {\n\tif !m.IsValid() {\n\t\tpanic(fmt.Sprintf(\"cannot reset invalid %v message\", m.Descriptor().FullName()))\n\t}\n\n\t// Clear all known fields.\n\tfds := m.Descriptor().Fields()\n\tfor i := 0; i < fds.Len(); i++ {\n\t\tm.Clear(fds.Get(i))\n\t}\n\n\t// Clear extension fields.\n\tm.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {\n\t\tm.Clear(fd)\n\t\treturn true\n\t})\n\n\t// Clear unknown fields.\n\tm.SetUnknown(nil)\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/size.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/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\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\treturn MarshalOptions{}.Size(m)\n}\n\n// Size returns the size in bytes of the wire-format encoding of m.\nfunc (o MarshalOptions) Size(m Message) int {\n\t// Treat a nil message interface as an empty message; nothing to output.\n\tif m == nil {\n\t\treturn 0\n\t}\n\n\treturn o.size(m.ProtoReflect())\n}\n\n// size is a centralized function that all size operations go through.\n// For profiling purposes, avoid changing the name of this function or\n// introducing other code paths for size that do not go through this.\nfunc (o MarshalOptions) size(m protoreflect.Message) (size int) {\n\tmethods := protoMethods(m)\n\tif methods != nil && methods.Size != nil {\n\t\tout := methods.Size(protoiface.SizeInput{\n\t\t\tMessage: m,\n\t\t})\n\t\treturn out.Size\n\t}\n\tif methods != nil && methods.Marshal != nil {\n\t\t// This is not efficient, but we don't have any choice.\n\t\t// This case is mainly used for legacy types with a Marshal method.\n\t\tout, _ := methods.Marshal(protoiface.MarshalInput{\n\t\t\tMessage: m,\n\t\t})\n\t\treturn len(out.Buf)\n\t}\n\treturn o.sizeMessageSlow(m)\n}\n\nfunc (o MarshalOptions) sizeMessageSlow(m protoreflect.Message) (size int) {\n\tif messageset.IsMessageSet(m.Descriptor()) {\n\t\treturn o.sizeMessageSet(m)\n\t}\n\tm.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {\n\t\tsize += o.sizeField(fd, v)\n\t\treturn true\n\t})\n\tsize += len(m.GetUnknown())\n\treturn size\n}\n\nfunc (o MarshalOptions) sizeField(fd protoreflect.FieldDescriptor, value protoreflect.Value) (size int) {\n\tnum := fd.Number()\n\tswitch {\n\tcase fd.IsList():\n\t\treturn o.sizeList(num, fd, value.List())\n\tcase fd.IsMap():\n\t\treturn o.sizeMap(num, fd, value.Map())\n\tdefault:\n\t\treturn protowire.SizeTag(num) + o.sizeSingular(num, fd.Kind(), value)\n\t}\n}\n\nfunc (o MarshalOptions) sizeList(num protowire.Number, fd protoreflect.FieldDescriptor, list protoreflect.List) (size int) {\n\tif fd.IsPacked() && list.Len() > 0 {\n\t\tcontent := 0\n\t\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\t\tcontent += o.sizeSingular(num, fd.Kind(), list.Get(i))\n\t\t}\n\t\treturn protowire.SizeTag(num) + protowire.SizeBytes(content)\n\t}\n\n\tfor i, llen := 0, list.Len(); i < llen; i++ {\n\t\tsize += protowire.SizeTag(num) + o.sizeSingular(num, fd.Kind(), list.Get(i))\n\t}\n\treturn size\n}\n\nfunc (o MarshalOptions) sizeMap(num protowire.Number, fd protoreflect.FieldDescriptor, mapv protoreflect.Map) (size int) {\n\tmapv.Range(func(key protoreflect.MapKey, value protoreflect.Value) bool {\n\t\tsize += protowire.SizeTag(num)\n\t\tsize += protowire.SizeBytes(o.sizeField(fd.MapKey(), key.Value()) + o.sizeField(fd.MapValue(), value))\n\t\treturn true\n\t})\n\treturn size\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/proto/size_gen.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// Code generated by generate-types. DO NOT EDIT.\n\npackage proto\n\nimport (\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\nfunc (o MarshalOptions) sizeSingular(num protowire.Number, kind protoreflect.Kind, v protoreflect.Value) int {\n\tswitch kind {\n\tcase protoreflect.BoolKind:\n\t\treturn protowire.SizeVarint(protowire.EncodeBool(v.Bool()))\n\tcase protoreflect.EnumKind:\n\t\treturn protowire.SizeVarint(uint64(v.Enum()))\n\tcase protoreflect.Int32Kind:\n\t\treturn protowire.SizeVarint(uint64(int32(v.Int())))\n\tcase protoreflect.Sint32Kind:\n\t\treturn protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))\n\tcase protoreflect.Uint32Kind:\n\t\treturn protowire.SizeVarint(uint64(uint32(v.Uint())))\n\tcase protoreflect.Int64Kind:\n\t\treturn protowire.SizeVarint(uint64(v.Int()))\n\tcase protoreflect.Sint64Kind:\n\t\treturn protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))\n\tcase protoreflect.Uint64Kind:\n\t\treturn protowire.SizeVarint(v.Uint())\n\tcase protoreflect.Sfixed32Kind:\n\t\treturn protowire.SizeFixed32()\n\tcase protoreflect.Fixed32Kind:\n\t\treturn protowire.SizeFixed32()\n\tcase protoreflect.FloatKind:\n\t\treturn protowire.SizeFixed32()\n\tcase protoreflect.Sfixed64Kind:\n\t\treturn protowire.SizeFixed64()\n\tcase protoreflect.Fixed64Kind:\n\t\treturn protowire.SizeFixed64()\n\tcase protoreflect.DoubleKind:\n\t\treturn protowire.SizeFixed64()\n\tcase protoreflect.StringKind:\n\t\treturn protowire.SizeBytes(len(v.String()))\n\tcase protoreflect.BytesKind:\n\t\treturn protowire.SizeBytes(len(v.Bytes()))\n\tcase protoreflect.MessageKind:\n\t\treturn protowire.SizeBytes(o.size(v.Message()))\n\tcase protoreflect.GroupKind:\n\t\treturn protowire.SizeGroup(num, o.size(v.Message()))\n\tdefault:\n\t\treturn 0\n\t}\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/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// 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// 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// 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// String stores v in a new string value and returns a pointer to it.\nfunc String(v string) *string { return &v }\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/reflect/protoreflect/methods.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 protoreflect\n\nimport (\n\t\"google.golang.org/protobuf/internal/pragma\"\n)\n\n// The following types are used by the fast-path Message.ProtoMethods method.\n//\n// To avoid polluting the public protoreflect API with types used only by\n// low-level implementations, the canonical definitions of these types are\n// in the runtime/protoiface package. The definitions here and in protoiface\n// must be kept in sync.\ntype (\n\tmethods = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tFlags            supportFlags\n\t\tSize             func(sizeInput) sizeOutput\n\t\tMarshal          func(marshalInput) (marshalOutput, error)\n\t\tUnmarshal        func(unmarshalInput) (unmarshalOutput, error)\n\t\tMerge            func(mergeInput) mergeOutput\n\t\tCheckInitialized func(checkInitializedInput) (checkInitializedOutput, error)\n\t}\n\tsupportFlags = uint64\n\tsizeInput    = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tMessage Message\n\t\tFlags   uint8\n\t}\n\tsizeOutput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tSize int\n\t}\n\tmarshalInput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tMessage Message\n\t\tBuf     []byte\n\t\tFlags   uint8\n\t}\n\tmarshalOutput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tBuf []byte\n\t}\n\tunmarshalInput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tMessage  Message\n\t\tBuf      []byte\n\t\tFlags    uint8\n\t\tResolver interface {\n\t\t\tFindExtensionByName(field FullName) (ExtensionType, error)\n\t\t\tFindExtensionByNumber(message FullName, field FieldNumber) (ExtensionType, error)\n\t\t}\n\t}\n\tunmarshalOutput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tFlags uint8\n\t}\n\tmergeInput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tSource      Message\n\t\tDestination Message\n\t}\n\tmergeOutput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tFlags uint8\n\t}\n\tcheckInitializedInput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t\tMessage Message\n\t}\n\tcheckInitializedOutput = struct {\n\t\tpragma.NoUnkeyedLiterals\n\t}\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/reflect/protoreflect/proto.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 protoreflect provides interfaces to dynamically manipulate messages.\n//\n// This package includes type descriptors which describe the structure of types\n// defined in proto source files and value interfaces which provide the\n// ability to examine and manipulate the contents of messages.\n//\n//\n// Protocol Buffer Descriptors\n//\n// Protobuf descriptors (e.g., EnumDescriptor or MessageDescriptor)\n// are immutable objects that represent protobuf type information.\n// They are wrappers around the messages declared in descriptor.proto.\n// Protobuf descriptors alone lack any information regarding Go types.\n//\n// Enums and messages generated by this module implement Enum and ProtoMessage,\n// where the Descriptor and ProtoReflect.Descriptor accessors respectively\n// return the protobuf descriptor for the values.\n//\n// The protobuf descriptor interfaces are not meant to be implemented by\n// user code since they might need to be extended in the future to support\n// additions to the protobuf language.\n// The \"google.golang.org/protobuf/reflect/protodesc\" package converts between\n// google.protobuf.DescriptorProto messages and protobuf descriptors.\n//\n//\n// Go Type Descriptors\n//\n// A type descriptor (e.g., EnumType or MessageType) is a constructor for\n// a concrete Go type that represents the associated protobuf descriptor.\n// There is commonly a one-to-one relationship between protobuf descriptors and\n// Go type descriptors, but it can potentially be a one-to-many relationship.\n//\n// Enums and messages generated by this module implement Enum and ProtoMessage,\n// where the Type and ProtoReflect.Type accessors respectively\n// return the protobuf descriptor for the values.\n//\n// The \"google.golang.org/protobuf/types/dynamicpb\" package can be used to\n// create Go type descriptors from protobuf descriptors.\n//\n//\n// Value Interfaces\n//\n// The Enum and Message interfaces provide a reflective view over an\n// enum or message instance. For enums, it provides the ability to retrieve\n// the enum value number for any concrete enum type. For messages, it provides\n// the ability to access or manipulate fields of the message.\n//\n// To convert a proto.Message to a protoreflect.Message, use the\n// former's ProtoReflect method. Since the ProtoReflect method is new to the\n// v2 message interface, it may not be present on older message implementations.\n// The \"github.com/golang/protobuf/proto\".MessageReflect function can be used\n// to obtain a reflective view on older messages.\n//\n//\n// Relationships\n//\n// The following diagrams demonstrate the relationships between\n// various types declared in this package.\n//\n//\n//\t                       ┌───────────────────────────────────┐\n//\t                       V                                   │\n//\t   ┌────────────── New(n) ─────────────┐                   │\n//\t   │                                   │                   │\n//\t   │      ┌──── Descriptor() ──┐       │  ┌── Number() ──┐ │\n//\t   │      │                    V       V  │              V │\n//\t╔════════════╗  ╔════════════════╗  ╔════════╗  ╔════════════╗\n//\t║  EnumType  ║  ║ EnumDescriptor ║  ║  Enum  ║  ║ EnumNumber ║\n//\t╚════════════╝  ╚════════════════╝  ╚════════╝  ╚════════════╝\n//\t      Λ           Λ                   │ │\n//\t      │           └─── Descriptor() ──┘ │\n//\t      │                                 │\n//\t      └────────────────── Type() ───────┘\n//\n// • An EnumType describes a concrete Go enum type.\n// It has an EnumDescriptor and can construct an Enum instance.\n//\n// • An EnumDescriptor describes an abstract protobuf enum type.\n//\n// • An Enum is a concrete enum instance. Generated enums implement Enum.\n//\n//\n//\t  ┌──────────────── New() ─────────────────┐\n//\t  │                                        │\n//\t  │         ┌─── Descriptor() ─────┐       │   ┌── Interface() ───┐\n//\t  │         │                      V       V   │                  V\n//\t╔═════════════╗  ╔═══════════════════╗  ╔═════════╗  ╔══════════════╗\n//\t║ MessageType ║  ║ MessageDescriptor ║  ║ Message ║  ║ ProtoMessage ║\n//\t╚═════════════╝  ╚═══════════════════╝  ╚═════════╝  ╚══════════════╝\n//\t       Λ           Λ                      │ │  Λ                  │\n//\t       │           └──── Descriptor() ────┘ │  └─ ProtoReflect() ─┘\n//\t       │                                    │\n//\t       └─────────────────── Type() ─────────┘\n//\n// • A MessageType describes a concrete Go message type.\n// It has a MessageDescriptor and can construct a Message instance.\n//\n// • A MessageDescriptor describes an abstract protobuf message type.\n//\n// • A Message is a concrete message instance. Generated messages implement\n// ProtoMessage, which can convert to/from a Message.\n//\n//\n//\t      ┌── TypeDescriptor() ──┐    ┌───── Descriptor() ─────┐\n//\t      │                      V    │                        V\n//\t╔═══════════════╗  ╔═════════════════════════╗  ╔═════════════════════╗\n//\t║ ExtensionType ║  ║ ExtensionTypeDescriptor ║  ║ ExtensionDescriptor ║\n//\t╚═══════════════╝  ╚═════════════════════════╝  ╚═════════════════════╝\n//\t      Λ                      │   │ Λ                      │ Λ\n//\t      └─────── Type() ───────┘   │ └─── may implement ────┘ │\n//\t                                 │                          │\n//\t                                 └────── implements ────────┘\n//\n// • An ExtensionType describes a concrete Go implementation of an extension.\n// It has an ExtensionTypeDescriptor and can convert to/from\n// abstract Values and Go values.\n//\n// • An ExtensionTypeDescriptor is an ExtensionDescriptor\n// which also has an ExtensionType.\n//\n// • An ExtensionDescriptor describes an abstract protobuf extension field and\n// may not always be an ExtensionTypeDescriptor.\npackage protoreflect\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/internal/pragma\"\n)\n\ntype doNotImplement pragma.DoNotImplement\n\n// ProtoMessage is the top-level interface that all proto messages implement.\n// This is declared in the protoreflect package to avoid a cyclic dependency;\n// use the proto.Message type instead, which aliases this type.\ntype ProtoMessage interface{ ProtoReflect() Message }\n\n// Syntax is the language version of the proto file.\ntype Syntax syntax\n\ntype syntax int8 // keep exact type opaque as the int type may change\n\nconst (\n\tProto2 Syntax = 2\n\tProto3 Syntax = 3\n)\n\n// IsValid reports whether the syntax is valid.\nfunc (s Syntax) IsValid() bool {\n\tswitch s {\n\tcase Proto2, Proto3:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\n// String returns s as a proto source identifier (e.g., \"proto2\").\nfunc (s Syntax) String() string {\n\tswitch s {\n\tcase Proto2:\n\t\treturn \"proto2\"\n\tcase Proto3:\n\t\treturn \"proto3\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"<unknown:%d>\", s)\n\t}\n}\n\n// GoString returns s as a Go source identifier (e.g., \"Proto2\").\nfunc (s Syntax) GoString() string {\n\tswitch s {\n\tcase Proto2:\n\t\treturn \"Proto2\"\n\tcase Proto3:\n\t\treturn \"Proto3\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"Syntax(%d)\", s)\n\t}\n}\n\n// Cardinality determines whether a field is optional, required, or repeated.\ntype Cardinality cardinality\n\ntype cardinality int8 // keep exact type opaque as the int type may change\n\n// Constants as defined by the google.protobuf.Cardinality enumeration.\nconst (\n\tOptional Cardinality = 1 // appears zero or one times\n\tRequired Cardinality = 2 // appears exactly one time; invalid with Proto3\n\tRepeated Cardinality = 3 // appears zero or more times\n)\n\n// IsValid reports whether the cardinality is valid.\nfunc (c Cardinality) IsValid() bool {\n\tswitch c {\n\tcase Optional, Required, Repeated:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\n// String returns c as a proto source identifier (e.g., \"optional\").\nfunc (c Cardinality) String() string {\n\tswitch c {\n\tcase Optional:\n\t\treturn \"optional\"\n\tcase Required:\n\t\treturn \"required\"\n\tcase Repeated:\n\t\treturn \"repeated\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"<unknown:%d>\", c)\n\t}\n}\n\n// GoString returns c as a Go source identifier (e.g., \"Optional\").\nfunc (c Cardinality) GoString() string {\n\tswitch c {\n\tcase Optional:\n\t\treturn \"Optional\"\n\tcase Required:\n\t\treturn \"Required\"\n\tcase Repeated:\n\t\treturn \"Repeated\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"Cardinality(%d)\", c)\n\t}\n}\n\n// Kind indicates the basic proto kind of a field.\ntype Kind kind\n\ntype kind int8 // keep exact type opaque as the int type may change\n\n// Constants as defined by the google.protobuf.Field.Kind enumeration.\nconst (\n\tBoolKind     Kind = 8\n\tEnumKind     Kind = 14\n\tInt32Kind    Kind = 5\n\tSint32Kind   Kind = 17\n\tUint32Kind   Kind = 13\n\tInt64Kind    Kind = 3\n\tSint64Kind   Kind = 18\n\tUint64Kind   Kind = 4\n\tSfixed32Kind Kind = 15\n\tFixed32Kind  Kind = 7\n\tFloatKind    Kind = 2\n\tSfixed64Kind Kind = 16\n\tFixed64Kind  Kind = 6\n\tDoubleKind   Kind = 1\n\tStringKind   Kind = 9\n\tBytesKind    Kind = 12\n\tMessageKind  Kind = 11\n\tGroupKind    Kind = 10\n)\n\n// IsValid reports whether the kind is valid.\nfunc (k Kind) IsValid() bool {\n\tswitch k {\n\tcase BoolKind, EnumKind,\n\t\tInt32Kind, Sint32Kind, Uint32Kind,\n\t\tInt64Kind, Sint64Kind, Uint64Kind,\n\t\tSfixed32Kind, Fixed32Kind, FloatKind,\n\t\tSfixed64Kind, Fixed64Kind, DoubleKind,\n\t\tStringKind, BytesKind, MessageKind, GroupKind:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\n// String returns k as a proto source identifier (e.g., \"bool\").\nfunc (k Kind) String() string {\n\tswitch k {\n\tcase BoolKind:\n\t\treturn \"bool\"\n\tcase EnumKind:\n\t\treturn \"enum\"\n\tcase Int32Kind:\n\t\treturn \"int32\"\n\tcase Sint32Kind:\n\t\treturn \"sint32\"\n\tcase Uint32Kind:\n\t\treturn \"uint32\"\n\tcase Int64Kind:\n\t\treturn \"int64\"\n\tcase Sint64Kind:\n\t\treturn \"sint64\"\n\tcase Uint64Kind:\n\t\treturn \"uint64\"\n\tcase Sfixed32Kind:\n\t\treturn \"sfixed32\"\n\tcase Fixed32Kind:\n\t\treturn \"fixed32\"\n\tcase FloatKind:\n\t\treturn \"float\"\n\tcase Sfixed64Kind:\n\t\treturn \"sfixed64\"\n\tcase Fixed64Kind:\n\t\treturn \"fixed64\"\n\tcase DoubleKind:\n\t\treturn \"double\"\n\tcase StringKind:\n\t\treturn \"string\"\n\tcase BytesKind:\n\t\treturn \"bytes\"\n\tcase MessageKind:\n\t\treturn \"message\"\n\tcase GroupKind:\n\t\treturn \"group\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"<unknown:%d>\", k)\n\t}\n}\n\n// GoString returns k as a Go source identifier (e.g., \"BoolKind\").\nfunc (k Kind) GoString() string {\n\tswitch k {\n\tcase BoolKind:\n\t\treturn \"BoolKind\"\n\tcase EnumKind:\n\t\treturn \"EnumKind\"\n\tcase Int32Kind:\n\t\treturn \"Int32Kind\"\n\tcase Sint32Kind:\n\t\treturn \"Sint32Kind\"\n\tcase Uint32Kind:\n\t\treturn \"Uint32Kind\"\n\tcase Int64Kind:\n\t\treturn \"Int64Kind\"\n\tcase Sint64Kind:\n\t\treturn \"Sint64Kind\"\n\tcase Uint64Kind:\n\t\treturn \"Uint64Kind\"\n\tcase Sfixed32Kind:\n\t\treturn \"Sfixed32Kind\"\n\tcase Fixed32Kind:\n\t\treturn \"Fixed32Kind\"\n\tcase FloatKind:\n\t\treturn \"FloatKind\"\n\tcase Sfixed64Kind:\n\t\treturn \"Sfixed64Kind\"\n\tcase Fixed64Kind:\n\t\treturn \"Fixed64Kind\"\n\tcase DoubleKind:\n\t\treturn \"DoubleKind\"\n\tcase StringKind:\n\t\treturn \"StringKind\"\n\tcase BytesKind:\n\t\treturn \"BytesKind\"\n\tcase MessageKind:\n\t\treturn \"MessageKind\"\n\tcase GroupKind:\n\t\treturn \"GroupKind\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"Kind(%d)\", k)\n\t}\n}\n\n// FieldNumber is the field number in a message.\ntype FieldNumber = protowire.Number\n\n// FieldNumbers represent a list of field numbers.\ntype FieldNumbers interface {\n\t// Len reports the number of fields in the list.\n\tLen() int\n\t// Get returns the ith field number. It panics if out of bounds.\n\tGet(i int) FieldNumber\n\t// Has reports whether n is within the list of fields.\n\tHas(n FieldNumber) bool\n\n\tdoNotImplement\n}\n\n// FieldRanges represent a list of field number ranges.\ntype FieldRanges interface {\n\t// Len reports the number of ranges in the list.\n\tLen() int\n\t// Get returns the ith range. It panics if out of bounds.\n\tGet(i int) [2]FieldNumber // start inclusive; end exclusive\n\t// Has reports whether n is within any of the ranges.\n\tHas(n FieldNumber) bool\n\n\tdoNotImplement\n}\n\n// EnumNumber is the numeric value for an enum.\ntype EnumNumber int32\n\n// EnumRanges represent a list of enum number ranges.\ntype EnumRanges interface {\n\t// Len reports the number of ranges in the list.\n\tLen() int\n\t// Get returns the ith range. It panics if out of bounds.\n\tGet(i int) [2]EnumNumber // start inclusive; end inclusive\n\t// Has reports whether n is within any of the ranges.\n\tHas(n EnumNumber) bool\n\n\tdoNotImplement\n}\n\n// Name is the short name for a proto declaration. This is not the name\n// as used in Go source code, which might not be identical to the proto name.\ntype Name string // e.g., \"Kind\"\n\n// IsValid reports whether s is a syntactically valid name.\n// An empty name is invalid.\nfunc (s Name) IsValid() bool {\n\treturn consumeIdent(string(s)) == len(s)\n}\n\n// Names represent a list of names.\ntype Names interface {\n\t// Len reports the number of names in the list.\n\tLen() int\n\t// Get returns the ith name. It panics if out of bounds.\n\tGet(i int) Name\n\t// Has reports whether s matches any names in the list.\n\tHas(s Name) bool\n\n\tdoNotImplement\n}\n\n// FullName is a qualified name that uniquely identifies a proto declaration.\n// A qualified name is the concatenation of the proto package along with the\n// fully-declared name (i.e., name of parent preceding the name of the child),\n// with a '.' delimiter placed between each Name.\n//\n// This should not have any leading or trailing dots.\ntype FullName string // e.g., \"google.protobuf.Field.Kind\"\n\n// IsValid reports whether s is a syntactically valid full name.\n// An empty full name is invalid.\nfunc (s FullName) IsValid() bool {\n\ti := consumeIdent(string(s))\n\tif i < 0 {\n\t\treturn false\n\t}\n\tfor len(s) > i {\n\t\tif s[i] != '.' {\n\t\t\treturn false\n\t\t}\n\t\ti++\n\t\tn := consumeIdent(string(s[i:]))\n\t\tif n < 0 {\n\t\t\treturn false\n\t\t}\n\t\ti += n\n\t}\n\treturn true\n}\n\nfunc consumeIdent(s string) (i int) {\n\tif len(s) == 0 || !isLetter(s[i]) {\n\t\treturn -1\n\t}\n\ti++\n\tfor len(s) > i && isLetterDigit(s[i]) {\n\t\ti++\n\t}\n\treturn i\n}\nfunc isLetter(c byte) bool {\n\treturn c == '_' || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')\n}\nfunc isLetterDigit(c byte) bool {\n\treturn isLetter(c) || ('0' <= c && c <= '9')\n}\n\n// Name returns the short name, which is the last identifier segment.\n// A single segment FullName is the Name itself.\nfunc (n FullName) Name() Name {\n\tif i := strings.LastIndexByte(string(n), '.'); i >= 0 {\n\t\treturn Name(n[i+1:])\n\t}\n\treturn Name(n)\n}\n\n// Parent returns the full name with the trailing identifier removed.\n// A single segment FullName has no parent.\nfunc (n FullName) Parent() FullName {\n\tif i := strings.LastIndexByte(string(n), '.'); i >= 0 {\n\t\treturn n[:i]\n\t}\n\treturn \"\"\n}\n\n// Append returns the qualified name appended with the provided short name.\n//\n// Invariant: n == n.Parent().Append(n.Name()) // assuming n is valid\nfunc (n FullName) Append(s Name) FullName {\n\tif n == \"\" {\n\t\treturn FullName(s)\n\t}\n\treturn n + \".\" + FullName(s)\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/reflect/protoreflect/source.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 protoreflect\n\nimport (\n\t\"strconv\"\n)\n\n// SourceLocations is a list of source locations.\ntype SourceLocations interface {\n\t// Len reports the number of source locations in the proto file.\n\tLen() int\n\t// Get returns the ith SourceLocation. It panics if out of bounds.\n\tGet(int) SourceLocation\n\n\t// ByPath returns the SourceLocation for the given path,\n\t// returning the first location if multiple exist for the same path.\n\t// If multiple locations exist for the same path,\n\t// then SourceLocation.Next index can be used to identify the\n\t// index of the next SourceLocation.\n\t// If no location exists for this path, it returns the zero value.\n\tByPath(path SourcePath) SourceLocation\n\n\t// ByDescriptor returns the SourceLocation for the given descriptor,\n\t// returning the first location if multiple exist for the same path.\n\t// If no location exists for this descriptor, it returns the zero value.\n\tByDescriptor(desc Descriptor) SourceLocation\n\n\tdoNotImplement\n}\n\n// SourceLocation describes a source location and\n// corresponds with the google.protobuf.SourceCodeInfo.Location message.\ntype SourceLocation struct {\n\t// Path is the path to the declaration from the root file descriptor.\n\t// The contents of this slice must not be mutated.\n\tPath SourcePath\n\n\t// StartLine and StartColumn are the zero-indexed starting location\n\t// in the source file for the declaration.\n\tStartLine, StartColumn int\n\t// EndLine and EndColumn are the zero-indexed ending location\n\t// in the source file for the declaration.\n\t// In the descriptor.proto, the end line may be omitted if it is identical\n\t// to the start line. Here, it is always populated.\n\tEndLine, EndColumn int\n\n\t// LeadingDetachedComments are the leading detached comments\n\t// for the declaration. The contents of this slice must not be mutated.\n\tLeadingDetachedComments []string\n\t// LeadingComments is the leading attached comment for the declaration.\n\tLeadingComments string\n\t// TrailingComments is the trailing attached comment for the declaration.\n\tTrailingComments string\n\n\t// Next is an index into SourceLocations for the next source location that\n\t// has the same Path. It is zero if there is no next location.\n\tNext int\n}\n\n// SourcePath identifies part of a file descriptor for a source location.\n// The SourcePath is a sequence of either field numbers or indexes into\n// a repeated field that form a path starting from the root file descriptor.\n//\n// See google.protobuf.SourceCodeInfo.Location.path.\ntype SourcePath []int32\n\n// Equal reports whether p1 equals p2.\nfunc (p1 SourcePath) Equal(p2 SourcePath) bool {\n\tif len(p1) != len(p2) {\n\t\treturn false\n\t}\n\tfor i := range p1 {\n\t\tif p1[i] != p2[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\n// String formats the path in a humanly readable manner.\n// The output is guaranteed to be deterministic,\n// making it suitable for use as a key into a Go map.\n// It is not guaranteed to be stable as the exact output could change\n// in a future version of this module.\n//\n// Example output:\n//\t.message_type[6].nested_type[15].field[3]\nfunc (p SourcePath) String() string {\n\tb := p.appendFileDescriptorProto(nil)\n\tfor _, i := range p {\n\t\tb = append(b, '.')\n\t\tb = strconv.AppendInt(b, int64(i), 10)\n\t}\n\treturn string(b)\n}\n\ntype appendFunc func(*SourcePath, []byte) []byte\n\nfunc (p *SourcePath) appendSingularField(b []byte, name string, f appendFunc) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tb = append(b, '.')\n\tb = append(b, name...)\n\t*p = (*p)[1:]\n\tif f != nil {\n\t\tb = f(p, b)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendRepeatedField(b []byte, name string, f appendFunc) []byte {\n\tb = p.appendSingularField(b, name, nil)\n\tif len(*p) == 0 || (*p)[0] < 0 {\n\t\treturn b\n\t}\n\tb = append(b, '[')\n\tb = strconv.AppendUint(b, uint64((*p)[0]), 10)\n\tb = append(b, ']')\n\t*p = (*p)[1:]\n\tif f != nil {\n\t\tb = f(p, b)\n\t}\n\treturn b\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.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// Code generated by generate-protos. DO NOT EDIT.\n\npackage protoreflect\n\nfunc (p *SourcePath) appendFileDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"package\", nil)\n\tcase 3:\n\t\tb = p.appendRepeatedField(b, \"dependency\", nil)\n\tcase 10:\n\t\tb = p.appendRepeatedField(b, \"public_dependency\", nil)\n\tcase 11:\n\t\tb = p.appendRepeatedField(b, \"weak_dependency\", nil)\n\tcase 4:\n\t\tb = p.appendRepeatedField(b, \"message_type\", (*SourcePath).appendDescriptorProto)\n\tcase 5:\n\t\tb = p.appendRepeatedField(b, \"enum_type\", (*SourcePath).appendEnumDescriptorProto)\n\tcase 6:\n\t\tb = p.appendRepeatedField(b, \"service\", (*SourcePath).appendServiceDescriptorProto)\n\tcase 7:\n\t\tb = p.appendRepeatedField(b, \"extension\", (*SourcePath).appendFieldDescriptorProto)\n\tcase 8:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendFileOptions)\n\tcase 9:\n\t\tb = p.appendSingularField(b, \"source_code_info\", (*SourcePath).appendSourceCodeInfo)\n\tcase 12:\n\t\tb = p.appendSingularField(b, \"syntax\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 2:\n\t\tb = p.appendRepeatedField(b, \"field\", (*SourcePath).appendFieldDescriptorProto)\n\tcase 6:\n\t\tb = p.appendRepeatedField(b, \"extension\", (*SourcePath).appendFieldDescriptorProto)\n\tcase 3:\n\t\tb = p.appendRepeatedField(b, \"nested_type\", (*SourcePath).appendDescriptorProto)\n\tcase 4:\n\t\tb = p.appendRepeatedField(b, \"enum_type\", (*SourcePath).appendEnumDescriptorProto)\n\tcase 5:\n\t\tb = p.appendRepeatedField(b, \"extension_range\", (*SourcePath).appendDescriptorProto_ExtensionRange)\n\tcase 8:\n\t\tb = p.appendRepeatedField(b, \"oneof_decl\", (*SourcePath).appendOneofDescriptorProto)\n\tcase 7:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendMessageOptions)\n\tcase 9:\n\t\tb = p.appendRepeatedField(b, \"reserved_range\", (*SourcePath).appendDescriptorProto_ReservedRange)\n\tcase 10:\n\t\tb = p.appendRepeatedField(b, \"reserved_name\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendEnumDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 2:\n\t\tb = p.appendRepeatedField(b, \"value\", (*SourcePath).appendEnumValueDescriptorProto)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendEnumOptions)\n\tcase 4:\n\t\tb = p.appendRepeatedField(b, \"reserved_range\", (*SourcePath).appendEnumDescriptorProto_EnumReservedRange)\n\tcase 5:\n\t\tb = p.appendRepeatedField(b, \"reserved_name\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendServiceDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 2:\n\t\tb = p.appendRepeatedField(b, \"method\", (*SourcePath).appendMethodDescriptorProto)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendServiceOptions)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendFieldDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"number\", nil)\n\tcase 4:\n\t\tb = p.appendSingularField(b, \"label\", nil)\n\tcase 5:\n\t\tb = p.appendSingularField(b, \"type\", nil)\n\tcase 6:\n\t\tb = p.appendSingularField(b, \"type_name\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"extendee\", nil)\n\tcase 7:\n\t\tb = p.appendSingularField(b, \"default_value\", nil)\n\tcase 9:\n\t\tb = p.appendSingularField(b, \"oneof_index\", nil)\n\tcase 10:\n\t\tb = p.appendSingularField(b, \"json_name\", nil)\n\tcase 8:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendFieldOptions)\n\tcase 17:\n\t\tb = p.appendSingularField(b, \"proto3_optional\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendFileOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"java_package\", nil)\n\tcase 8:\n\t\tb = p.appendSingularField(b, \"java_outer_classname\", nil)\n\tcase 10:\n\t\tb = p.appendSingularField(b, \"java_multiple_files\", nil)\n\tcase 20:\n\t\tb = p.appendSingularField(b, \"java_generate_equals_and_hash\", nil)\n\tcase 27:\n\t\tb = p.appendSingularField(b, \"java_string_check_utf8\", nil)\n\tcase 9:\n\t\tb = p.appendSingularField(b, \"optimize_for\", nil)\n\tcase 11:\n\t\tb = p.appendSingularField(b, \"go_package\", nil)\n\tcase 16:\n\t\tb = p.appendSingularField(b, \"cc_generic_services\", nil)\n\tcase 17:\n\t\tb = p.appendSingularField(b, \"java_generic_services\", nil)\n\tcase 18:\n\t\tb = p.appendSingularField(b, \"py_generic_services\", nil)\n\tcase 42:\n\t\tb = p.appendSingularField(b, \"php_generic_services\", nil)\n\tcase 23:\n\t\tb = p.appendSingularField(b, \"deprecated\", nil)\n\tcase 31:\n\t\tb = p.appendSingularField(b, \"cc_enable_arenas\", nil)\n\tcase 36:\n\t\tb = p.appendSingularField(b, \"objc_class_prefix\", nil)\n\tcase 37:\n\t\tb = p.appendSingularField(b, \"csharp_namespace\", nil)\n\tcase 39:\n\t\tb = p.appendSingularField(b, \"swift_prefix\", nil)\n\tcase 40:\n\t\tb = p.appendSingularField(b, \"php_class_prefix\", nil)\n\tcase 41:\n\t\tb = p.appendSingularField(b, \"php_namespace\", nil)\n\tcase 44:\n\t\tb = p.appendSingularField(b, \"php_metadata_namespace\", nil)\n\tcase 45:\n\t\tb = p.appendSingularField(b, \"ruby_package\", nil)\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendSourceCodeInfo(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendRepeatedField(b, \"location\", (*SourcePath).appendSourceCodeInfo_Location)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendDescriptorProto_ExtensionRange(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"start\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"end\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendExtensionRangeOptions)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendOneofDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendOneofOptions)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendMessageOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"message_set_wire_format\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"no_standard_descriptor_accessor\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"deprecated\", nil)\n\tcase 7:\n\t\tb = p.appendSingularField(b, \"map_entry\", nil)\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendDescriptorProto_ReservedRange(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"start\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"end\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendEnumValueDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"number\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendEnumValueOptions)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendEnumOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"allow_alias\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"deprecated\", nil)\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendEnumDescriptorProto_EnumReservedRange(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"start\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"end\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendMethodDescriptorProto(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"input_type\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"output_type\", nil)\n\tcase 4:\n\t\tb = p.appendSingularField(b, \"options\", (*SourcePath).appendMethodOptions)\n\tcase 5:\n\t\tb = p.appendSingularField(b, \"client_streaming\", nil)\n\tcase 6:\n\t\tb = p.appendSingularField(b, \"server_streaming\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendServiceOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 33:\n\t\tb = p.appendSingularField(b, \"deprecated\", nil)\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendFieldOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"ctype\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"packed\", nil)\n\tcase 6:\n\t\tb = p.appendSingularField(b, \"jstype\", nil)\n\tcase 5:\n\t\tb = p.appendSingularField(b, \"lazy\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"deprecated\", nil)\n\tcase 10:\n\t\tb = p.appendSingularField(b, \"weak\", nil)\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendUninterpretedOption(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 2:\n\t\tb = p.appendRepeatedField(b, \"name\", (*SourcePath).appendUninterpretedOption_NamePart)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"identifier_value\", nil)\n\tcase 4:\n\t\tb = p.appendSingularField(b, \"positive_int_value\", nil)\n\tcase 5:\n\t\tb = p.appendSingularField(b, \"negative_int_value\", nil)\n\tcase 6:\n\t\tb = p.appendSingularField(b, \"double_value\", nil)\n\tcase 7:\n\t\tb = p.appendSingularField(b, \"string_value\", nil)\n\tcase 8:\n\t\tb = p.appendSingularField(b, \"aggregate_value\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendSourceCodeInfo_Location(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendRepeatedField(b, \"path\", nil)\n\tcase 2:\n\t\tb = p.appendRepeatedField(b, \"span\", nil)\n\tcase 3:\n\t\tb = p.appendSingularField(b, \"leading_comments\", nil)\n\tcase 4:\n\t\tb = p.appendSingularField(b, \"trailing_comments\", nil)\n\tcase 6:\n\t\tb = p.appendRepeatedField(b, \"leading_detached_comments\", nil)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendExtensionRangeOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendOneofOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendEnumValueOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"deprecated\", nil)\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendMethodOptions(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 33:\n\t\tb = p.appendSingularField(b, \"deprecated\", nil)\n\tcase 34:\n\t\tb = p.appendSingularField(b, \"idempotency_level\", nil)\n\tcase 999:\n\t\tb = p.appendRepeatedField(b, \"uninterpreted_option\", (*SourcePath).appendUninterpretedOption)\n\t}\n\treturn b\n}\n\nfunc (p *SourcePath) appendUninterpretedOption_NamePart(b []byte) []byte {\n\tif len(*p) == 0 {\n\t\treturn b\n\t}\n\tswitch (*p)[0] {\n\tcase 1:\n\t\tb = p.appendSingularField(b, \"name_part\", nil)\n\tcase 2:\n\t\tb = p.appendSingularField(b, \"is_extension\", nil)\n\t}\n\treturn b\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/reflect/protoreflect/type.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 protoreflect\n\n// Descriptor provides a set of accessors that are common to every descriptor.\n// Each descriptor type wraps the equivalent google.protobuf.XXXDescriptorProto,\n// but provides efficient lookup and immutability.\n//\n// Each descriptor is comparable. Equality implies that the two types are\n// exactly identical. However, it is possible for the same semantically\n// identical proto type to be represented by multiple type descriptors.\n//\n// For example, suppose we have t1 and t2 which are both MessageDescriptors.\n// If t1 == t2, then the types are definitely equal and all accessors return\n// the same information. However, if t1 != t2, then it is still possible that\n// they still represent the same proto type (e.g., t1.FullName == t2.FullName).\n// This can occur if a descriptor type is created dynamically, or multiple\n// versions of the same proto type are accidentally linked into the Go binary.\ntype Descriptor interface {\n\t// ParentFile returns the parent file descriptor that this descriptor\n\t// is declared within. The parent file for the file descriptor is itself.\n\t//\n\t// Support for this functionality is optional and may return nil.\n\tParentFile() FileDescriptor\n\n\t// Parent returns the parent containing this descriptor declaration.\n\t// The following shows the mapping from child type to possible parent types:\n\t//\n\t//\t╔═════════════════════╤═══════════════════════════════════╗\n\t//\t║ Child type          │ Possible parent types             ║\n\t//\t╠═════════════════════╪═══════════════════════════════════╣\n\t//\t║ FileDescriptor      │ nil                               ║\n\t//\t║ MessageDescriptor   │ FileDescriptor, MessageDescriptor ║\n\t//\t║ FieldDescriptor     │ FileDescriptor, MessageDescriptor ║\n\t//\t║ OneofDescriptor     │ MessageDescriptor                 ║\n\t//\t║ EnumDescriptor      │ FileDescriptor, MessageDescriptor ║\n\t//\t║ EnumValueDescriptor │ EnumDescriptor                    ║\n\t//\t║ ServiceDescriptor   │ FileDescriptor                    ║\n\t//\t║ MethodDescriptor    │ ServiceDescriptor                 ║\n\t//\t╚═════════════════════╧═══════════════════════════════════╝\n\t//\n\t// Support for this functionality is optional and may return nil.\n\tParent() Descriptor\n\n\t// Index returns the index of this descriptor within its parent.\n\t// It returns 0 if the descriptor does not have a parent or if the parent\n\t// is unknown.\n\tIndex() int\n\n\t// Syntax is the protobuf syntax.\n\tSyntax() Syntax // e.g., Proto2 or Proto3\n\n\t// Name is the short name of the declaration (i.e., FullName.Name).\n\tName() Name // e.g., \"Any\"\n\n\t// FullName is the fully-qualified name of the declaration.\n\t//\n\t// The FullName is a concatenation of the full name of the type that this\n\t// type is declared within and the declaration name. For example,\n\t// field \"foo_field\" in message \"proto.package.MyMessage\" is\n\t// uniquely identified as \"proto.package.MyMessage.foo_field\".\n\t// Enum values are an exception to the rule (see EnumValueDescriptor).\n\tFullName() FullName // e.g., \"google.protobuf.Any\"\n\n\t// IsPlaceholder reports whether type information is missing since a\n\t// dependency is not resolved, in which case only name information is known.\n\t//\n\t// Placeholder types may only be returned by the following accessors\n\t// as a result of unresolved dependencies or weak imports:\n\t//\n\t//\t╔═══════════════════════════════════╤═════════════════════╗\n\t//\t║ Accessor                          │ Descriptor          ║\n\t//\t╠═══════════════════════════════════╪═════════════════════╣\n\t//\t║ FileImports.FileDescriptor        │ FileDescriptor      ║\n\t//\t║ FieldDescriptor.Enum              │ EnumDescriptor      ║\n\t//\t║ FieldDescriptor.Message           │ MessageDescriptor   ║\n\t//\t║ FieldDescriptor.DefaultEnumValue  │ EnumValueDescriptor ║\n\t//\t║ FieldDescriptor.ContainingMessage │ MessageDescriptor   ║\n\t//\t║ MethodDescriptor.Input            │ MessageDescriptor   ║\n\t//\t║ MethodDescriptor.Output           │ MessageDescriptor   ║\n\t//\t╚═══════════════════════════════════╧═════════════════════╝\n\t//\n\t// If true, only Name and FullName are valid.\n\t// For FileDescriptor, the Path is also valid.\n\tIsPlaceholder() bool\n\n\t// Options returns the descriptor options. The caller must not modify\n\t// the returned value.\n\t//\n\t// To avoid a dependency cycle, this function returns a proto.Message value.\n\t// The proto message type returned for each descriptor type is as follows:\n\t//\t╔═════════════════════╤══════════════════════════════════════════╗\n\t//\t║ Go type             │ Protobuf message type                    ║\n\t//\t╠═════════════════════╪══════════════════════════════════════════╣\n\t//\t║ FileDescriptor      │ google.protobuf.FileOptions              ║\n\t//\t║ EnumDescriptor      │ google.protobuf.EnumOptions              ║\n\t//\t║ EnumValueDescriptor │ google.protobuf.EnumValueOptions         ║\n\t//\t║ MessageDescriptor   │ google.protobuf.MessageOptions           ║\n\t//\t║ FieldDescriptor     │ google.protobuf.FieldOptions             ║\n\t//\t║ OneofDescriptor     │ google.protobuf.OneofOptions             ║\n\t//\t║ ServiceDescriptor   │ google.protobuf.ServiceOptions           ║\n\t//\t║ MethodDescriptor    │ google.protobuf.MethodOptions            ║\n\t//\t╚═════════════════════╧══════════════════════════════════════════╝\n\t//\n\t// This method returns a typed nil-pointer if no options are present.\n\t// The caller must import the descriptorpb package to use this.\n\tOptions() ProtoMessage\n\n\tdoNotImplement\n}\n\n// FileDescriptor describes the types in a complete proto file and\n// corresponds with the google.protobuf.FileDescriptorProto message.\n//\n// Top-level declarations:\n// EnumDescriptor, MessageDescriptor, FieldDescriptor, and/or ServiceDescriptor.\ntype FileDescriptor interface {\n\tDescriptor // Descriptor.FullName is identical to Package\n\n\t// Path returns the file name, relative to the source tree root.\n\tPath() string // e.g., \"path/to/file.proto\"\n\t// Package returns the protobuf package namespace.\n\tPackage() FullName // e.g., \"google.protobuf\"\n\n\t// Imports is a list of imported proto files.\n\tImports() FileImports\n\n\t// Enums is a list of the top-level enum declarations.\n\tEnums() EnumDescriptors\n\t// Messages is a list of the top-level message declarations.\n\tMessages() MessageDescriptors\n\t// Extensions is a list of the top-level extension declarations.\n\tExtensions() ExtensionDescriptors\n\t// Services is a list of the top-level service declarations.\n\tServices() ServiceDescriptors\n\n\t// SourceLocations is a list of source locations.\n\tSourceLocations() SourceLocations\n\n\tisFileDescriptor\n}\ntype isFileDescriptor interface{ ProtoType(FileDescriptor) }\n\n// FileImports is a list of file imports.\ntype FileImports interface {\n\t// Len reports the number of files imported by this proto file.\n\tLen() int\n\t// Get returns the ith FileImport. It panics if out of bounds.\n\tGet(i int) FileImport\n\n\tdoNotImplement\n}\n\n// FileImport is the declaration for a proto file import.\ntype FileImport struct {\n\t// FileDescriptor is the file type for the given import.\n\t// It is a placeholder descriptor if IsWeak is set or if a dependency has\n\t// not been regenerated to implement the new reflection APIs.\n\tFileDescriptor\n\n\t// IsPublic reports whether this is a public import, which causes this file\n\t// to alias declarations within the imported file. The intended use cases\n\t// for this feature is the ability to move proto files without breaking\n\t// existing dependencies.\n\t//\n\t// The current file and the imported file must be within proto package.\n\tIsPublic bool\n\n\t// IsWeak reports whether this is a weak import, which does not impose\n\t// a direct dependency on the target file.\n\t//\n\t// Weak imports are a legacy proto1 feature. Equivalent behavior is\n\t// achieved using proto2 extension fields or proto3 Any messages.\n\tIsWeak bool\n}\n\n// MessageDescriptor describes a message and\n// corresponds with the google.protobuf.DescriptorProto message.\n//\n// Nested declarations:\n// FieldDescriptor, OneofDescriptor, FieldDescriptor, EnumDescriptor,\n// and/or MessageDescriptor.\ntype MessageDescriptor interface {\n\tDescriptor\n\n\t// IsMapEntry indicates that this is an auto-generated message type to\n\t// represent the entry type for a map field.\n\t//\n\t// Map entry messages have only two fields:\n\t//\t• a \"key\" field with a field number of 1\n\t//\t• a \"value\" field with a field number of 2\n\t// The key and value types are determined by these two fields.\n\t//\n\t// If IsMapEntry is true, it implies that FieldDescriptor.IsMap is true\n\t// for some field with this message type.\n\tIsMapEntry() bool\n\n\t// Fields is a list of nested field declarations.\n\tFields() FieldDescriptors\n\t// Oneofs is a list of nested oneof declarations.\n\tOneofs() OneofDescriptors\n\n\t// ReservedNames is a list of reserved field names.\n\tReservedNames() Names\n\t// ReservedRanges is a list of reserved ranges of field numbers.\n\tReservedRanges() FieldRanges\n\t// RequiredNumbers is a list of required field numbers.\n\t// In Proto3, it is always an empty list.\n\tRequiredNumbers() FieldNumbers\n\t// ExtensionRanges is the field ranges used for extension fields.\n\t// In Proto3, it is always an empty ranges.\n\tExtensionRanges() FieldRanges\n\t// ExtensionRangeOptions returns the ith extension range options.\n\t//\n\t// To avoid a dependency cycle, this method returns a proto.Message value,\n\t// which always contains a google.protobuf.ExtensionRangeOptions message.\n\t// This method returns a typed nil-pointer if no options are present.\n\t// The caller must import the descriptorpb package to use this.\n\tExtensionRangeOptions(i int) ProtoMessage\n\n\t// Enums is a list of nested enum declarations.\n\tEnums() EnumDescriptors\n\t// Messages is a list of nested message declarations.\n\tMessages() MessageDescriptors\n\t// Extensions is a list of nested extension declarations.\n\tExtensions() ExtensionDescriptors\n\n\tisMessageDescriptor\n}\ntype isMessageDescriptor interface{ ProtoType(MessageDescriptor) }\n\n// MessageType encapsulates a MessageDescriptor with a concrete Go implementation.\n// It is recommended that implementations of this interface also implement the\n// MessageFieldTypes interface.\ntype MessageType interface {\n\t// New returns a newly allocated empty message.\n\t// It may return nil for synthetic messages representing a map entry.\n\tNew() Message\n\n\t// Zero returns an empty, read-only message.\n\t// It may return nil for synthetic messages representing a map entry.\n\tZero() Message\n\n\t// Descriptor returns the message descriptor.\n\t//\n\t// Invariant: t.Descriptor() == t.New().Descriptor()\n\tDescriptor() MessageDescriptor\n}\n\n// MessageFieldTypes extends a MessageType by providing type information\n// regarding enums and messages referenced by the message fields.\ntype MessageFieldTypes interface {\n\tMessageType\n\n\t// Enum returns the EnumType for the ith field in Descriptor.Fields.\n\t// It returns nil if the ith field is not an enum kind.\n\t// It panics if out of bounds.\n\t//\n\t// Invariant: mt.Enum(i).Descriptor() == mt.Descriptor().Fields(i).Enum()\n\tEnum(i int) EnumType\n\n\t// Message returns the MessageType for the ith field in Descriptor.Fields.\n\t// It returns nil if the ith field is not a message or group kind.\n\t// It panics if out of bounds.\n\t//\n\t// Invariant: mt.Message(i).Descriptor() == mt.Descriptor().Fields(i).Message()\n\tMessage(i int) MessageType\n}\n\n// MessageDescriptors is a list of message declarations.\ntype MessageDescriptors interface {\n\t// Len reports the number of messages.\n\tLen() int\n\t// Get returns the ith MessageDescriptor. It panics if out of bounds.\n\tGet(i int) MessageDescriptor\n\t// ByName returns the MessageDescriptor for a message named s.\n\t// It returns nil if not found.\n\tByName(s Name) MessageDescriptor\n\n\tdoNotImplement\n}\n\n// FieldDescriptor describes a field within a message and\n// corresponds with the google.protobuf.FieldDescriptorProto message.\n//\n// It is used for both normal fields defined within the parent message\n// (e.g., MessageDescriptor.Fields) and fields that extend some remote message\n// (e.g., FileDescriptor.Extensions or MessageDescriptor.Extensions).\ntype FieldDescriptor interface {\n\tDescriptor\n\n\t// Number reports the unique number for this field.\n\tNumber() FieldNumber\n\t// Cardinality reports the cardinality for this field.\n\tCardinality() Cardinality\n\t// Kind reports the basic kind for this field.\n\tKind() Kind\n\n\t// HasJSONName reports whether this field has an explicitly set JSON name.\n\tHasJSONName() bool\n\n\t// JSONName reports the name used for JSON serialization.\n\t// It is usually the camel-cased form of the field name.\n\t// Extension fields are represented by the full name surrounded by brackets.\n\tJSONName() string\n\n\t// TextName reports the name used for text serialization.\n\t// It is usually the name of the field, except that groups use the name\n\t// of the inlined message, and extension fields are represented by the\n\t// full name surrounded by brackets.\n\tTextName() string\n\n\t// HasPresence reports whether the field distinguishes between unpopulated\n\t// and default values.\n\tHasPresence() bool\n\n\t// IsExtension reports whether this is an extension field. If false,\n\t// then Parent and ContainingMessage refer to the same message.\n\t// Otherwise, ContainingMessage and Parent likely differ.\n\tIsExtension() bool\n\n\t// HasOptionalKeyword reports whether the \"optional\" keyword was explicitly\n\t// specified in the source .proto file.\n\tHasOptionalKeyword() bool\n\n\t// IsWeak reports whether this is a weak field, which does not impose a\n\t// direct dependency on the target type.\n\t// If true, then Message returns a placeholder type.\n\tIsWeak() bool\n\n\t// IsPacked reports whether repeated primitive numeric kinds should be\n\t// serialized using a packed encoding.\n\t// If true, then it implies Cardinality is Repeated.\n\tIsPacked() bool\n\n\t// IsList reports whether this field represents a list,\n\t// where the value type for the associated field is a List.\n\t// It is equivalent to checking whether Cardinality is Repeated and\n\t// that IsMap reports false.\n\tIsList() bool\n\n\t// IsMap reports whether this field represents a map,\n\t// where the value type for the associated field is a Map.\n\t// It is equivalent to checking whether Cardinality is Repeated,\n\t// that the Kind is MessageKind, and that Message.IsMapEntry reports true.\n\tIsMap() bool\n\n\t// MapKey returns the field descriptor for the key in the map entry.\n\t// It returns nil if IsMap reports false.\n\tMapKey() FieldDescriptor\n\n\t// MapValue returns the field descriptor for the value in the map entry.\n\t// It returns nil if IsMap reports false.\n\tMapValue() FieldDescriptor\n\n\t// HasDefault reports whether this field has a default value.\n\tHasDefault() bool\n\n\t// Default returns the default value for scalar fields.\n\t// For proto2, it is the default value as specified in the proto file,\n\t// or the zero value if unspecified.\n\t// For proto3, it is always the zero value of the scalar.\n\t// The Value type is determined by the Kind.\n\tDefault() Value\n\n\t// DefaultEnumValue returns the enum value descriptor for the default value\n\t// of an enum field, and is nil for any other kind of field.\n\tDefaultEnumValue() EnumValueDescriptor\n\n\t// ContainingOneof is the containing oneof that this field belongs to,\n\t// and is nil if this field is not part of a oneof.\n\tContainingOneof() OneofDescriptor\n\n\t// ContainingMessage is the containing message that this field belongs to.\n\t// For extension fields, this may not necessarily be the parent message\n\t// that the field is declared within.\n\tContainingMessage() MessageDescriptor\n\n\t// Enum is the enum descriptor if Kind is EnumKind.\n\t// It returns nil for any other Kind.\n\tEnum() EnumDescriptor\n\n\t// Message is the message descriptor if Kind is\n\t// MessageKind or GroupKind. It returns nil for any other Kind.\n\tMessage() MessageDescriptor\n\n\tisFieldDescriptor\n}\ntype isFieldDescriptor interface{ ProtoType(FieldDescriptor) }\n\n// FieldDescriptors is a list of field declarations.\ntype FieldDescriptors interface {\n\t// Len reports the number of fields.\n\tLen() int\n\t// Get returns the ith FieldDescriptor. It panics if out of bounds.\n\tGet(i int) FieldDescriptor\n\t// ByName returns the FieldDescriptor for a field named s.\n\t// It returns nil if not found.\n\tByName(s Name) FieldDescriptor\n\t// ByJSONName returns the FieldDescriptor for a field with s as the JSON name.\n\t// It returns nil if not found.\n\tByJSONName(s string) FieldDescriptor\n\t// ByTextName returns the FieldDescriptor for a field with s as the text name.\n\t// It returns nil if not found.\n\tByTextName(s string) FieldDescriptor\n\t// ByNumber returns the FieldDescriptor for a field numbered n.\n\t// It returns nil if not found.\n\tByNumber(n FieldNumber) FieldDescriptor\n\n\tdoNotImplement\n}\n\n// OneofDescriptor describes a oneof field set within a given message and\n// corresponds with the google.protobuf.OneofDescriptorProto message.\ntype OneofDescriptor interface {\n\tDescriptor\n\n\t// IsSynthetic reports whether this is a synthetic oneof created to support\n\t// proto3 optional semantics. If true, Fields contains exactly one field\n\t// with HasOptionalKeyword specified.\n\tIsSynthetic() bool\n\n\t// Fields is a list of fields belonging to this oneof.\n\tFields() FieldDescriptors\n\n\tisOneofDescriptor\n}\ntype isOneofDescriptor interface{ ProtoType(OneofDescriptor) }\n\n// OneofDescriptors is a list of oneof declarations.\ntype OneofDescriptors interface {\n\t// Len reports the number of oneof fields.\n\tLen() int\n\t// Get returns the ith OneofDescriptor. It panics if out of bounds.\n\tGet(i int) OneofDescriptor\n\t// ByName returns the OneofDescriptor for a oneof named s.\n\t// It returns nil if not found.\n\tByName(s Name) OneofDescriptor\n\n\tdoNotImplement\n}\n\n// ExtensionDescriptor is an alias of FieldDescriptor for documentation.\ntype ExtensionDescriptor = FieldDescriptor\n\n// ExtensionTypeDescriptor is an ExtensionDescriptor with an associated ExtensionType.\ntype ExtensionTypeDescriptor interface {\n\tExtensionDescriptor\n\n\t// Type returns the associated ExtensionType.\n\tType() ExtensionType\n\n\t// Descriptor returns the plain ExtensionDescriptor without the\n\t// associated ExtensionType.\n\tDescriptor() ExtensionDescriptor\n}\n\n// ExtensionDescriptors is a list of field declarations.\ntype ExtensionDescriptors interface {\n\t// Len reports the number of fields.\n\tLen() int\n\t// Get returns the ith ExtensionDescriptor. It panics if out of bounds.\n\tGet(i int) ExtensionDescriptor\n\t// ByName returns the ExtensionDescriptor for a field named s.\n\t// It returns nil if not found.\n\tByName(s Name) ExtensionDescriptor\n\n\tdoNotImplement\n}\n\n// ExtensionType encapsulates an ExtensionDescriptor with a concrete\n// Go implementation. The nested field descriptor must be for a extension field.\n//\n// While a normal field is a member of the parent message that it is declared\n// within (see Descriptor.Parent), an extension field is a member of some other\n// target message (see ExtensionDescriptor.Extendee) and may have no\n// relationship with the parent. However, the full name of an extension field is\n// relative to the parent that it is declared within.\n//\n// For example:\n//\tsyntax = \"proto2\";\n//\tpackage example;\n//\tmessage FooMessage {\n//\t\textensions 100 to max;\n//\t}\n//\tmessage BarMessage {\n//\t\textends FooMessage { optional BarMessage bar_field = 100; }\n//\t}\n//\n// Field \"bar_field\" is an extension of FooMessage, but its full name is\n// \"example.BarMessage.bar_field\" instead of \"example.FooMessage.bar_field\".\ntype ExtensionType interface {\n\t// New returns a new value for the field.\n\t// For scalars, this returns the default value in native Go form.\n\tNew() Value\n\n\t// Zero returns a new value for the field.\n\t// For scalars, this returns the default value in native Go form.\n\t// For composite types, this returns an empty, read-only message, list, or map.\n\tZero() Value\n\n\t// TypeDescriptor returns the extension type descriptor.\n\tTypeDescriptor() ExtensionTypeDescriptor\n\n\t// ValueOf wraps the input and returns it as a Value.\n\t// ValueOf panics if the input value is invalid or not the appropriate type.\n\t//\n\t// ValueOf is more extensive than protoreflect.ValueOf for a given field's\n\t// value as it has more type information available.\n\tValueOf(interface{}) Value\n\n\t// InterfaceOf completely unwraps the Value to the underlying Go type.\n\t// InterfaceOf panics if the input is nil or does not represent the\n\t// appropriate underlying Go type. For composite types, it panics if the\n\t// value is not mutable.\n\t//\n\t// InterfaceOf is able to unwrap the Value further than Value.Interface\n\t// as it has more type information available.\n\tInterfaceOf(Value) interface{}\n\n\t// IsValidValue reports whether the Value is valid to assign to the field.\n\tIsValidValue(Value) bool\n\n\t// IsValidInterface reports whether the input is valid to assign to the field.\n\tIsValidInterface(interface{}) bool\n}\n\n// EnumDescriptor describes an enum and\n// corresponds with the google.protobuf.EnumDescriptorProto message.\n//\n// Nested declarations:\n// EnumValueDescriptor.\ntype EnumDescriptor interface {\n\tDescriptor\n\n\t// Values is a list of nested enum value declarations.\n\tValues() EnumValueDescriptors\n\n\t// ReservedNames is a list of reserved enum names.\n\tReservedNames() Names\n\t// ReservedRanges is a list of reserved ranges of enum numbers.\n\tReservedRanges() EnumRanges\n\n\tisEnumDescriptor\n}\ntype isEnumDescriptor interface{ ProtoType(EnumDescriptor) }\n\n// EnumType encapsulates an EnumDescriptor with a concrete Go implementation.\ntype EnumType interface {\n\t// New returns an instance of this enum type with its value set to n.\n\tNew(n EnumNumber) Enum\n\n\t// Descriptor returns the enum descriptor.\n\t//\n\t// Invariant: t.Descriptor() == t.New(0).Descriptor()\n\tDescriptor() EnumDescriptor\n}\n\n// EnumDescriptors is a list of enum declarations.\ntype EnumDescriptors interface {\n\t// Len reports the number of enum types.\n\tLen() int\n\t// Get returns the ith EnumDescriptor. It panics if out of bounds.\n\tGet(i int) EnumDescriptor\n\t// ByName returns the EnumDescriptor for an enum named s.\n\t// It returns nil if not found.\n\tByName(s Name) EnumDescriptor\n\n\tdoNotImplement\n}\n\n// EnumValueDescriptor describes an enum value and\n// corresponds with the google.protobuf.EnumValueDescriptorProto message.\n//\n// All other proto declarations are in the namespace of the parent.\n// However, enum values do not follow this rule and are within the namespace\n// of the parent's parent (i.e., they are a sibling of the containing enum).\n// Thus, a value named \"FOO_VALUE\" declared within an enum uniquely identified\n// as \"proto.package.MyEnum\" has a full name of \"proto.package.FOO_VALUE\".\ntype EnumValueDescriptor interface {\n\tDescriptor\n\n\t// Number returns the enum value as an integer.\n\tNumber() EnumNumber\n\n\tisEnumValueDescriptor\n}\ntype isEnumValueDescriptor interface{ ProtoType(EnumValueDescriptor) }\n\n// EnumValueDescriptors is a list of enum value declarations.\ntype EnumValueDescriptors interface {\n\t// Len reports the number of enum values.\n\tLen() int\n\t// Get returns the ith EnumValueDescriptor. It panics if out of bounds.\n\tGet(i int) EnumValueDescriptor\n\t// ByName returns the EnumValueDescriptor for the enum value named s.\n\t// It returns nil if not found.\n\tByName(s Name) EnumValueDescriptor\n\t// ByNumber returns the EnumValueDescriptor for the enum value numbered n.\n\t// If multiple have the same number, the first one defined is returned\n\t// It returns nil if not found.\n\tByNumber(n EnumNumber) EnumValueDescriptor\n\n\tdoNotImplement\n}\n\n// ServiceDescriptor describes a service and\n// corresponds with the google.protobuf.ServiceDescriptorProto message.\n//\n// Nested declarations: MethodDescriptor.\ntype ServiceDescriptor interface {\n\tDescriptor\n\n\t// Methods is a list of nested message declarations.\n\tMethods() MethodDescriptors\n\n\tisServiceDescriptor\n}\ntype isServiceDescriptor interface{ ProtoType(ServiceDescriptor) }\n\n// ServiceDescriptors is a list of service declarations.\ntype ServiceDescriptors interface {\n\t// Len reports the number of services.\n\tLen() int\n\t// Get returns the ith ServiceDescriptor. It panics if out of bounds.\n\tGet(i int) ServiceDescriptor\n\t// ByName returns the ServiceDescriptor for a service named s.\n\t// It returns nil if not found.\n\tByName(s Name) ServiceDescriptor\n\n\tdoNotImplement\n}\n\n// MethodDescriptor describes a method and\n// corresponds with the google.protobuf.MethodDescriptorProto message.\ntype MethodDescriptor interface {\n\tDescriptor\n\n\t// Input is the input message descriptor.\n\tInput() MessageDescriptor\n\t// Output is the output message descriptor.\n\tOutput() MessageDescriptor\n\t// IsStreamingClient reports whether the client streams multiple messages.\n\tIsStreamingClient() bool\n\t// IsStreamingServer reports whether the server streams multiple messages.\n\tIsStreamingServer() bool\n\n\tisMethodDescriptor\n}\ntype isMethodDescriptor interface{ ProtoType(MethodDescriptor) }\n\n// MethodDescriptors is a list of method declarations.\ntype MethodDescriptors interface {\n\t// Len reports the number of methods.\n\tLen() int\n\t// Get returns the ith MethodDescriptor. It panics if out of bounds.\n\tGet(i int) MethodDescriptor\n\t// ByName returns the MethodDescriptor for a service method named s.\n\t// It returns nil if not found.\n\tByName(s Name) MethodDescriptor\n\n\tdoNotImplement\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/reflect/protoreflect/value.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 protoreflect\n\nimport \"google.golang.org/protobuf/encoding/protowire\"\n\n// Enum is a reflection interface for a concrete enum value,\n// which provides type information and a getter for the enum number.\n// Enum does not provide a mutable API since enums are commonly backed by\n// Go constants, which are not addressable.\ntype Enum interface {\n\t// Descriptor returns enum descriptor, which contains only the protobuf\n\t// type information for the enum.\n\tDescriptor() EnumDescriptor\n\n\t// Type returns the enum type, which encapsulates both Go and protobuf\n\t// type information. If the Go type information is not needed,\n\t// it is recommended that the enum descriptor be used instead.\n\tType() EnumType\n\n\t// Number returns the enum value as an integer.\n\tNumber() EnumNumber\n}\n\n// Message is a reflective interface for a concrete message value,\n// encapsulating both type and value information for the message.\n//\n// Accessor/mutators for individual fields are keyed by FieldDescriptor.\n// For non-extension fields, the descriptor must exactly match the\n// field known by the parent message.\n// For extension fields, the descriptor must implement ExtensionTypeDescriptor,\n// extend the parent message (i.e., have the same message FullName), and\n// be within the parent's extension range.\n//\n// Each field Value can be a scalar or a composite type (Message, List, or Map).\n// See Value for the Go types associated with a FieldDescriptor.\n// Providing a Value that is invalid or of an incorrect type panics.\ntype Message interface {\n\t// Descriptor returns message descriptor, which contains only the protobuf\n\t// type information for the message.\n\tDescriptor() MessageDescriptor\n\n\t// Type returns the message type, which encapsulates both Go and protobuf\n\t// type information. If the Go type information is not needed,\n\t// it is recommended that the message descriptor be used instead.\n\tType() MessageType\n\n\t// New returns a newly allocated and mutable empty message.\n\tNew() Message\n\n\t// Interface unwraps the message reflection interface and\n\t// returns the underlying ProtoMessage interface.\n\tInterface() ProtoMessage\n\n\t// Range iterates over every populated field in an undefined order,\n\t// calling f for each field descriptor and value encountered.\n\t// Range returns immediately if f returns false.\n\t// While iterating, mutating operations may only be performed\n\t// on the current field descriptor.\n\tRange(f func(FieldDescriptor, Value) bool)\n\n\t// Has reports whether a field is populated.\n\t//\n\t// Some fields have the property of nullability where it is possible to\n\t// distinguish between the default value of a field and whether the field\n\t// was explicitly populated with the default value. Singular message fields,\n\t// member fields of a oneof, and proto2 scalar fields are nullable. Such\n\t// fields are populated only if explicitly set.\n\t//\n\t// In other cases (aside from the nullable cases above),\n\t// a proto3 scalar field is populated if it contains a non-zero value, and\n\t// a repeated field is populated if it is non-empty.\n\tHas(FieldDescriptor) bool\n\n\t// Clear clears the field such that a subsequent Has call reports false.\n\t//\n\t// Clearing an extension field clears both the extension type and value\n\t// associated with the given field number.\n\t//\n\t// Clear is a mutating operation and unsafe for concurrent use.\n\tClear(FieldDescriptor)\n\n\t// Get retrieves the value for a field.\n\t//\n\t// For unpopulated scalars, it returns the default value, where\n\t// the default value of a bytes scalar is guaranteed to be a copy.\n\t// For unpopulated composite types, it returns an empty, read-only view\n\t// of the value; to obtain a mutable reference, use Mutable.\n\tGet(FieldDescriptor) Value\n\n\t// Set stores the value for a field.\n\t//\n\t// For a field belonging to a oneof, it implicitly clears any other field\n\t// that may be currently set within the same oneof.\n\t// For extension fields, it implicitly stores the provided ExtensionType.\n\t// When setting a composite type, it is unspecified whether the stored value\n\t// aliases the source's memory in any way. If the composite value is an\n\t// empty, read-only value, then it panics.\n\t//\n\t// Set is a mutating operation and unsafe for concurrent use.\n\tSet(FieldDescriptor, Value)\n\n\t// Mutable returns a mutable reference to a composite type.\n\t//\n\t// If the field is unpopulated, it may allocate a composite value.\n\t// For a field belonging to a oneof, it implicitly clears any other field\n\t// that may be currently set within the same oneof.\n\t// For extension fields, it implicitly stores the provided ExtensionType\n\t// if not already stored.\n\t// It panics if the field does not contain a composite type.\n\t//\n\t// Mutable is a mutating operation and unsafe for concurrent use.\n\tMutable(FieldDescriptor) Value\n\n\t// NewField returns a new value that is assignable to the field\n\t// for the given descriptor. For scalars, this returns the default value.\n\t// For lists, maps, and messages, this returns a new, empty, mutable value.\n\tNewField(FieldDescriptor) Value\n\n\t// WhichOneof reports which field within the oneof is populated,\n\t// returning nil if none are populated.\n\t// It panics if the oneof descriptor does not belong to this message.\n\tWhichOneof(OneofDescriptor) FieldDescriptor\n\n\t// GetUnknown retrieves the entire list of unknown fields.\n\t// The caller may only mutate the contents of the RawFields\n\t// if the mutated bytes are stored back into the message with SetUnknown.\n\tGetUnknown() RawFields\n\n\t// SetUnknown stores an entire list of unknown fields.\n\t// The raw fields must be syntactically valid according to the wire format.\n\t// An implementation may panic if this is not the case.\n\t// Once stored, the caller must not mutate the content of the RawFields.\n\t// An empty RawFields may be passed to clear the fields.\n\t//\n\t// SetUnknown is a mutating operation and unsafe for concurrent use.\n\tSetUnknown(RawFields)\n\n\t// IsValid reports whether the message is valid.\n\t//\n\t// An invalid message is an empty, read-only value.\n\t//\n\t// An invalid message often corresponds to a nil pointer of the concrete\n\t// message type, but the details are implementation dependent.\n\t// Validity is not part of the protobuf data model, and may not\n\t// be preserved in marshaling or other operations.\n\tIsValid() bool\n\n\t// ProtoMethods returns optional fast-path implementions of various operations.\n\t// This method may return nil.\n\t//\n\t// The returned methods type is identical to\n\t// \"google.golang.org/protobuf/runtime/protoiface\".Methods.\n\t// Consult the protoiface package documentation for details.\n\tProtoMethods() *methods\n}\n\n// RawFields is the raw bytes for an ordered sequence of fields.\n// Each field contains both the tag (representing field number and wire type),\n// and also the wire data itself.\ntype RawFields []byte\n\n// IsValid reports whether b is syntactically correct wire format.\nfunc (b RawFields) IsValid() bool {\n\tfor len(b) > 0 {\n\t\t_, _, n := protowire.ConsumeField(b)\n\t\tif n < 0 {\n\t\t\treturn false\n\t\t}\n\t\tb = b[n:]\n\t}\n\treturn true\n}\n\n// List is a zero-indexed, ordered list.\n// The element Value type is determined by FieldDescriptor.Kind.\n// Providing a Value that is invalid or of an incorrect type panics.\ntype List interface {\n\t// Len reports the number of entries in the List.\n\t// Get, Set, and Truncate panic with out of bound indexes.\n\tLen() int\n\n\t// Get retrieves the value at the given index.\n\t// It never returns an invalid value.\n\tGet(int) Value\n\n\t// Set stores a value for the given index.\n\t// When setting a composite type, it is unspecified whether the set\n\t// value aliases the source's memory in any way.\n\t//\n\t// Set is a mutating operation and unsafe for concurrent use.\n\tSet(int, Value)\n\n\t// Append appends the provided value to the end of the list.\n\t// When appending a composite type, it is unspecified whether the appended\n\t// value aliases the source's memory in any way.\n\t//\n\t// Append is a mutating operation and unsafe for concurrent use.\n\tAppend(Value)\n\n\t// AppendMutable appends a new, empty, mutable message value to the end\n\t// of the list and returns it.\n\t// It panics if the list does not contain a message type.\n\tAppendMutable() Value\n\n\t// Truncate truncates the list to a smaller length.\n\t//\n\t// Truncate is a mutating operation and unsafe for concurrent use.\n\tTruncate(int)\n\n\t// NewElement returns a new value for a list element.\n\t// For enums, this returns the first enum value.\n\t// For other scalars, this returns the zero value.\n\t// For messages, this returns a new, empty, mutable value.\n\tNewElement() Value\n\n\t// IsValid reports whether the list is valid.\n\t//\n\t// An invalid list is an empty, read-only value.\n\t//\n\t// Validity is not part of the protobuf data model, and may not\n\t// be preserved in marshaling or other operations.\n\tIsValid() bool\n}\n\n// Map is an unordered, associative map.\n// The entry MapKey type is determined by FieldDescriptor.MapKey.Kind.\n// The entry Value type is determined by FieldDescriptor.MapValue.Kind.\n// Providing a MapKey or Value that is invalid or of an incorrect type panics.\ntype Map interface {\n\t// Len reports the number of elements in the map.\n\tLen() int\n\n\t// Range iterates over every map entry in an undefined order,\n\t// calling f for each key and value encountered.\n\t// Range calls f Len times unless f returns false, which stops iteration.\n\t// While iterating, mutating operations may only be performed\n\t// on the current map key.\n\tRange(f func(MapKey, Value) bool)\n\n\t// Has reports whether an entry with the given key is in the map.\n\tHas(MapKey) bool\n\n\t// Clear clears the entry associated with they given key.\n\t// The operation does nothing if there is no entry associated with the key.\n\t//\n\t// Clear is a mutating operation and unsafe for concurrent use.\n\tClear(MapKey)\n\n\t// Get retrieves the value for an entry with the given key.\n\t// It returns an invalid value for non-existent entries.\n\tGet(MapKey) Value\n\n\t// Set stores the value for an entry with the given key.\n\t// It panics when given a key or value that is invalid or the wrong type.\n\t// When setting a composite type, it is unspecified whether the set\n\t// value aliases the source's memory in any way.\n\t//\n\t// Set is a mutating operation and unsafe for concurrent use.\n\tSet(MapKey, Value)\n\n\t// Mutable retrieves a mutable reference to the entry for the given key.\n\t// If no entry exists for the key, it creates a new, empty, mutable value\n\t// and stores it as the entry for the key.\n\t// It panics if the map value is not a message.\n\tMutable(MapKey) Value\n\n\t// NewValue returns a new value assignable as a map value.\n\t// For enums, this returns the first enum value.\n\t// For other scalars, this returns the zero value.\n\t// For messages, this returns a new, empty, mutable value.\n\tNewValue() Value\n\n\t// IsValid reports whether the map is valid.\n\t//\n\t// An invalid map is an empty, read-only value.\n\t//\n\t// An invalid message often corresponds to a nil Go map value,\n\t// but the details are implementation dependent.\n\t// Validity is not part of the protobuf data model, and may not\n\t// be preserved in marshaling or other operations.\n\tIsValid() bool\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.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// +build purego appengine\n\npackage protoreflect\n\nimport \"google.golang.org/protobuf/internal/pragma\"\n\ntype valueType int\n\nconst (\n\tnilType valueType = iota\n\tboolType\n\tint32Type\n\tint64Type\n\tuint32Type\n\tuint64Type\n\tfloat32Type\n\tfloat64Type\n\tstringType\n\tbytesType\n\tenumType\n\tifaceType\n)\n\n// value is a union where only one type can be represented at a time.\n// This uses a distinct field for each type. This is type safe in Go, but\n// occupies more memory than necessary (72B).\ntype value struct {\n\tpragma.DoNotCompare // 0B\n\n\ttyp   valueType   // 8B\n\tnum   uint64      // 8B\n\tstr   string      // 16B\n\tbin   []byte      // 24B\n\tiface interface{} // 16B\n}\n\nfunc valueOfString(v string) Value {\n\treturn Value{typ: stringType, str: v}\n}\nfunc valueOfBytes(v []byte) Value {\n\treturn Value{typ: bytesType, bin: v}\n}\nfunc valueOfIface(v interface{}) Value {\n\treturn Value{typ: ifaceType, iface: v}\n}\n\nfunc (v Value) getString() string {\n\treturn v.str\n}\nfunc (v Value) getBytes() []byte {\n\treturn v.bin\n}\nfunc (v Value) getIface() interface{} {\n\treturn v.iface\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.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 protoreflect\n\nimport (\n\t\"fmt\"\n\t\"math\"\n)\n\n// Value is a union where only one Go type may be set at a time.\n// The Value is used to represent all possible values a field may take.\n// The following shows which Go type is used to represent each proto Kind:\n//\n//\t╔════════════╤═════════════════════════════════════╗\n//\t║ Go type    │ Protobuf kind                       ║\n//\t╠════════════╪═════════════════════════════════════╣\n//\t║ bool       │ BoolKind                            ║\n//\t║ int32      │ Int32Kind, Sint32Kind, Sfixed32Kind ║\n//\t║ int64      │ Int64Kind, Sint64Kind, Sfixed64Kind ║\n//\t║ uint32     │ Uint32Kind, Fixed32Kind             ║\n//\t║ uint64     │ Uint64Kind, Fixed64Kind             ║\n//\t║ float32    │ FloatKind                           ║\n//\t║ float64    │ DoubleKind                          ║\n//\t║ string     │ StringKind                          ║\n//\t║ []byte     │ BytesKind                           ║\n//\t║ EnumNumber │ EnumKind                            ║\n//\t║ Message    │ MessageKind, GroupKind              ║\n//\t╚════════════╧═════════════════════════════════════╝\n//\n// Multiple protobuf Kinds may be represented by a single Go type if the type\n// can losslessly represent the information for the proto kind. For example,\n// Int64Kind, Sint64Kind, and Sfixed64Kind are all represented by int64,\n// but use different integer encoding methods.\n//\n// The List or Map types are used if the field cardinality is repeated.\n// A field is a List if FieldDescriptor.IsList reports true.\n// A field is a Map if FieldDescriptor.IsMap reports true.\n//\n// Converting to/from a Value and a concrete Go value panics on type mismatch.\n// For example, ValueOf(\"hello\").Int() panics because this attempts to\n// retrieve an int64 from a string.\ntype Value value\n\n// The protoreflect API uses a custom Value union type instead of interface{}\n// to keep the future open for performance optimizations. Using an interface{}\n// always incurs an allocation for primitives (e.g., int64) since it needs to\n// be boxed on the heap (as interfaces can only contain pointers natively).\n// Instead, we represent the Value union as a flat struct that internally keeps\n// track of which type is set. Using unsafe, the Value union can be reduced\n// down to 24B, which is identical in size to a slice.\n//\n// The latest compiler (Go1.11) currently suffers from some limitations:\n//\t• With inlining, the compiler should be able to statically prove that\n//\tonly one of these switch cases are taken and inline one specific case.\n//\tSee https://golang.org/issue/22310.\n\n// ValueOf returns a Value initialized with the concrete value stored in v.\n// This panics if the type does not match one of the allowed types in the\n// Value union.\nfunc ValueOf(v interface{}) Value {\n\tswitch v := v.(type) {\n\tcase nil:\n\t\treturn Value{}\n\tcase bool:\n\t\treturn ValueOfBool(v)\n\tcase int32:\n\t\treturn ValueOfInt32(v)\n\tcase int64:\n\t\treturn ValueOfInt64(v)\n\tcase uint32:\n\t\treturn ValueOfUint32(v)\n\tcase uint64:\n\t\treturn ValueOfUint64(v)\n\tcase float32:\n\t\treturn ValueOfFloat32(v)\n\tcase float64:\n\t\treturn ValueOfFloat64(v)\n\tcase string:\n\t\treturn ValueOfString(v)\n\tcase []byte:\n\t\treturn ValueOfBytes(v)\n\tcase EnumNumber:\n\t\treturn ValueOfEnum(v)\n\tcase Message, List, Map:\n\t\treturn valueOfIface(v)\n\tcase ProtoMessage:\n\t\tpanic(fmt.Sprintf(\"invalid proto.Message(%T) type, expected a protoreflect.Message type\", v))\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"invalid type: %T\", v))\n\t}\n}\n\n// ValueOfBool returns a new boolean value.\nfunc ValueOfBool(v bool) Value {\n\tif v {\n\t\treturn Value{typ: boolType, num: 1}\n\t} else {\n\t\treturn Value{typ: boolType, num: 0}\n\t}\n}\n\n// ValueOfInt32 returns a new int32 value.\nfunc ValueOfInt32(v int32) Value {\n\treturn Value{typ: int32Type, num: uint64(v)}\n}\n\n// ValueOfInt64 returns a new int64 value.\nfunc ValueOfInt64(v int64) Value {\n\treturn Value{typ: int64Type, num: uint64(v)}\n}\n\n// ValueOfUint32 returns a new uint32 value.\nfunc ValueOfUint32(v uint32) Value {\n\treturn Value{typ: uint32Type, num: uint64(v)}\n}\n\n// ValueOfUint64 returns a new uint64 value.\nfunc ValueOfUint64(v uint64) Value {\n\treturn Value{typ: uint64Type, num: v}\n}\n\n// ValueOfFloat32 returns a new float32 value.\nfunc ValueOfFloat32(v float32) Value {\n\treturn Value{typ: float32Type, num: uint64(math.Float64bits(float64(v)))}\n}\n\n// ValueOfFloat64 returns a new float64 value.\nfunc ValueOfFloat64(v float64) Value {\n\treturn Value{typ: float64Type, num: uint64(math.Float64bits(float64(v)))}\n}\n\n// ValueOfString returns a new string value.\nfunc ValueOfString(v string) Value {\n\treturn valueOfString(v)\n}\n\n// ValueOfBytes returns a new bytes value.\nfunc ValueOfBytes(v []byte) Value {\n\treturn valueOfBytes(v[:len(v):len(v)])\n}\n\n// ValueOfEnum returns a new enum value.\nfunc ValueOfEnum(v EnumNumber) Value {\n\treturn Value{typ: enumType, num: uint64(v)}\n}\n\n// ValueOfMessage returns a new Message value.\nfunc ValueOfMessage(v Message) Value {\n\treturn valueOfIface(v)\n}\n\n// ValueOfList returns a new List value.\nfunc ValueOfList(v List) Value {\n\treturn valueOfIface(v)\n}\n\n// ValueOfMap returns a new Map value.\nfunc ValueOfMap(v Map) Value {\n\treturn valueOfIface(v)\n}\n\n// IsValid reports whether v is populated with a value.\nfunc (v Value) IsValid() bool {\n\treturn v.typ != nilType\n}\n\n// Interface returns v as an interface{}.\n//\n// Invariant: v == ValueOf(v).Interface()\nfunc (v Value) Interface() interface{} {\n\tswitch v.typ {\n\tcase nilType:\n\t\treturn nil\n\tcase boolType:\n\t\treturn v.Bool()\n\tcase int32Type:\n\t\treturn int32(v.Int())\n\tcase int64Type:\n\t\treturn int64(v.Int())\n\tcase uint32Type:\n\t\treturn uint32(v.Uint())\n\tcase uint64Type:\n\t\treturn uint64(v.Uint())\n\tcase float32Type:\n\t\treturn float32(v.Float())\n\tcase float64Type:\n\t\treturn float64(v.Float())\n\tcase stringType:\n\t\treturn v.String()\n\tcase bytesType:\n\t\treturn v.Bytes()\n\tcase enumType:\n\t\treturn v.Enum()\n\tdefault:\n\t\treturn v.getIface()\n\t}\n}\n\nfunc (v Value) typeName() string {\n\tswitch v.typ {\n\tcase nilType:\n\t\treturn \"nil\"\n\tcase boolType:\n\t\treturn \"bool\"\n\tcase int32Type:\n\t\treturn \"int32\"\n\tcase int64Type:\n\t\treturn \"int64\"\n\tcase uint32Type:\n\t\treturn \"uint32\"\n\tcase uint64Type:\n\t\treturn \"uint64\"\n\tcase float32Type:\n\t\treturn \"float32\"\n\tcase float64Type:\n\t\treturn \"float64\"\n\tcase stringType:\n\t\treturn \"string\"\n\tcase bytesType:\n\t\treturn \"bytes\"\n\tcase enumType:\n\t\treturn \"enum\"\n\tdefault:\n\t\tswitch v := v.getIface().(type) {\n\t\tcase Message:\n\t\t\treturn \"message\"\n\t\tcase List:\n\t\t\treturn \"list\"\n\t\tcase Map:\n\t\t\treturn \"map\"\n\t\tdefault:\n\t\t\treturn fmt.Sprintf(\"<unknown: %T>\", v)\n\t\t}\n\t}\n}\n\nfunc (v Value) panicMessage(what string) string {\n\treturn fmt.Sprintf(\"type mismatch: cannot convert %v to %s\", v.typeName(), what)\n}\n\n// Bool returns v as a bool and panics if the type is not a bool.\nfunc (v Value) Bool() bool {\n\tswitch v.typ {\n\tcase boolType:\n\t\treturn v.num > 0\n\tdefault:\n\t\tpanic(v.panicMessage(\"bool\"))\n\t}\n}\n\n// Int returns v as a int64 and panics if the type is not a int32 or int64.\nfunc (v Value) Int() int64 {\n\tswitch v.typ {\n\tcase int32Type, int64Type:\n\t\treturn int64(v.num)\n\tdefault:\n\t\tpanic(v.panicMessage(\"int\"))\n\t}\n}\n\n// Uint returns v as a uint64 and panics if the type is not a uint32 or uint64.\nfunc (v Value) Uint() uint64 {\n\tswitch v.typ {\n\tcase uint32Type, uint64Type:\n\t\treturn uint64(v.num)\n\tdefault:\n\t\tpanic(v.panicMessage(\"uint\"))\n\t}\n}\n\n// Float returns v as a float64 and panics if the type is not a float32 or float64.\nfunc (v Value) Float() float64 {\n\tswitch v.typ {\n\tcase float32Type, float64Type:\n\t\treturn math.Float64frombits(uint64(v.num))\n\tdefault:\n\t\tpanic(v.panicMessage(\"float\"))\n\t}\n}\n\n// String returns v as a string. Since this method implements fmt.Stringer,\n// this returns the formatted string value for any non-string type.\nfunc (v Value) String() string {\n\tswitch v.typ {\n\tcase stringType:\n\t\treturn v.getString()\n\tdefault:\n\t\treturn fmt.Sprint(v.Interface())\n\t}\n}\n\n// Bytes returns v as a []byte and panics if the type is not a []byte.\nfunc (v Value) Bytes() []byte {\n\tswitch v.typ {\n\tcase bytesType:\n\t\treturn v.getBytes()\n\tdefault:\n\t\tpanic(v.panicMessage(\"bytes\"))\n\t}\n}\n\n// Enum returns v as a EnumNumber and panics if the type is not a EnumNumber.\nfunc (v Value) Enum() EnumNumber {\n\tswitch v.typ {\n\tcase enumType:\n\t\treturn EnumNumber(v.num)\n\tdefault:\n\t\tpanic(v.panicMessage(\"enum\"))\n\t}\n}\n\n// Message returns v as a Message and panics if the type is not a Message.\nfunc (v Value) Message() Message {\n\tswitch vi := v.getIface().(type) {\n\tcase Message:\n\t\treturn vi\n\tdefault:\n\t\tpanic(v.panicMessage(\"message\"))\n\t}\n}\n\n// List returns v as a List and panics if the type is not a List.\nfunc (v Value) List() List {\n\tswitch vi := v.getIface().(type) {\n\tcase List:\n\t\treturn vi\n\tdefault:\n\t\tpanic(v.panicMessage(\"list\"))\n\t}\n}\n\n// Map returns v as a Map and panics if the type is not a Map.\nfunc (v Value) Map() Map {\n\tswitch vi := v.getIface().(type) {\n\tcase Map:\n\t\treturn vi\n\tdefault:\n\t\tpanic(v.panicMessage(\"map\"))\n\t}\n}\n\n// MapKey returns v as a MapKey and panics for invalid MapKey types.\nfunc (v Value) MapKey() MapKey {\n\tswitch v.typ {\n\tcase boolType, int32Type, int64Type, uint32Type, uint64Type, stringType:\n\t\treturn MapKey(v)\n\tdefault:\n\t\tpanic(v.panicMessage(\"map key\"))\n\t}\n}\n\n// MapKey is used to index maps, where the Go type of the MapKey must match\n// the specified key Kind (see MessageDescriptor.IsMapEntry).\n// The following shows what Go type is used to represent each proto Kind:\n//\n//\t╔═════════╤═════════════════════════════════════╗\n//\t║ Go type │ Protobuf kind                       ║\n//\t╠═════════╪═════════════════════════════════════╣\n//\t║ bool    │ BoolKind                            ║\n//\t║ int32   │ Int32Kind, Sint32Kind, Sfixed32Kind ║\n//\t║ int64   │ Int64Kind, Sint64Kind, Sfixed64Kind ║\n//\t║ uint32  │ Uint32Kind, Fixed32Kind             ║\n//\t║ uint64  │ Uint64Kind, Fixed64Kind             ║\n//\t║ string  │ StringKind                          ║\n//\t╚═════════╧═════════════════════════════════════╝\n//\n// A MapKey is constructed and accessed through a Value:\n//\tk := ValueOf(\"hash\").MapKey() // convert string to MapKey\n//\ts := k.String()               // convert MapKey to string\n//\n// The MapKey is a strict subset of valid types used in Value;\n// converting a Value to a MapKey with an invalid type panics.\ntype MapKey value\n\n// IsValid reports whether k is populated with a value.\nfunc (k MapKey) IsValid() bool {\n\treturn Value(k).IsValid()\n}\n\n// Interface returns k as an interface{}.\nfunc (k MapKey) Interface() interface{} {\n\treturn Value(k).Interface()\n}\n\n// Bool returns k as a bool and panics if the type is not a bool.\nfunc (k MapKey) Bool() bool {\n\treturn Value(k).Bool()\n}\n\n// Int returns k as a int64 and panics if the type is not a int32 or int64.\nfunc (k MapKey) Int() int64 {\n\treturn Value(k).Int()\n}\n\n// Uint returns k as a uint64 and panics if the type is not a uint32 or uint64.\nfunc (k MapKey) Uint() uint64 {\n\treturn Value(k).Uint()\n}\n\n// String returns k as a string. Since this method implements fmt.Stringer,\n// this returns the formatted string value for any non-string type.\nfunc (k MapKey) String() string {\n\treturn Value(k).String()\n}\n\n// Value returns k as a Value.\nfunc (k MapKey) Value() Value {\n\treturn Value(k)\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.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// +build !purego,!appengine\n\npackage protoreflect\n\nimport (\n\t\"unsafe\"\n\n\t\"google.golang.org/protobuf/internal/pragma\"\n)\n\ntype (\n\tstringHeader struct {\n\t\tData unsafe.Pointer\n\t\tLen  int\n\t}\n\tsliceHeader struct {\n\t\tData unsafe.Pointer\n\t\tLen  int\n\t\tCap  int\n\t}\n\tifaceHeader struct {\n\t\tType unsafe.Pointer\n\t\tData unsafe.Pointer\n\t}\n)\n\nvar (\n\tnilType     = typeOf(nil)\n\tboolType    = typeOf(*new(bool))\n\tint32Type   = typeOf(*new(int32))\n\tint64Type   = typeOf(*new(int64))\n\tuint32Type  = typeOf(*new(uint32))\n\tuint64Type  = typeOf(*new(uint64))\n\tfloat32Type = typeOf(*new(float32))\n\tfloat64Type = typeOf(*new(float64))\n\tstringType  = typeOf(*new(string))\n\tbytesType   = typeOf(*new([]byte))\n\tenumType    = typeOf(*new(EnumNumber))\n)\n\n// typeOf returns a pointer to the Go type information.\n// The pointer is comparable and equal if and only if the types are identical.\nfunc typeOf(t interface{}) unsafe.Pointer {\n\treturn (*ifaceHeader)(unsafe.Pointer(&t)).Type\n}\n\n// value is a union where only one type can be represented at a time.\n// The struct is 24B large on 64-bit systems and requires the minimum storage\n// necessary to represent each possible type.\n//\n// The Go GC needs to be able to scan variables containing pointers.\n// As such, pointers and non-pointers cannot be intermixed.\ntype value struct {\n\tpragma.DoNotCompare // 0B\n\n\t// typ stores the type of the value as a pointer to the Go type.\n\ttyp unsafe.Pointer // 8B\n\n\t// ptr stores the data pointer for a String, Bytes, or interface value.\n\tptr unsafe.Pointer // 8B\n\n\t// num stores a Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, or\n\t// Enum value as a raw uint64.\n\t//\n\t// It is also used to store the length of a String or Bytes value;\n\t// the capacity is ignored.\n\tnum uint64 // 8B\n}\n\nfunc valueOfString(v string) Value {\n\tp := (*stringHeader)(unsafe.Pointer(&v))\n\treturn Value{typ: stringType, ptr: p.Data, num: uint64(len(v))}\n}\nfunc valueOfBytes(v []byte) Value {\n\tp := (*sliceHeader)(unsafe.Pointer(&v))\n\treturn Value{typ: bytesType, ptr: p.Data, num: uint64(len(v))}\n}\nfunc valueOfIface(v interface{}) Value {\n\tp := (*ifaceHeader)(unsafe.Pointer(&v))\n\treturn Value{typ: p.Type, ptr: p.Data}\n}\n\nfunc (v Value) getString() (x string) {\n\t*(*stringHeader)(unsafe.Pointer(&x)) = stringHeader{Data: v.ptr, Len: int(v.num)}\n\treturn x\n}\nfunc (v Value) getBytes() (x []byte) {\n\t*(*sliceHeader)(unsafe.Pointer(&x)) = sliceHeader{Data: v.ptr, Len: int(v.num), Cap: int(v.num)}\n\treturn x\n}\nfunc (v Value) getIface() (x interface{}) {\n\t*(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr}\n\treturn x\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/reflect/protoregistry/registry.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 protoregistry provides data structures to register and lookup\n// protobuf descriptor types.\n//\n// The Files registry contains file descriptors and provides the ability\n// to iterate over the files or lookup a specific descriptor within the files.\n// Files only contains protobuf descriptors and has no understanding of Go\n// type information that may be associated with each descriptor.\n//\n// The Types registry contains descriptor types for which there is a known\n// Go type associated with that descriptor. It provides the ability to iterate\n// over the registered types or lookup a type by name.\npackage protoregistry\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"google.golang.org/protobuf/internal/encoding/messageset\"\n\t\"google.golang.org/protobuf/internal/errors\"\n\t\"google.golang.org/protobuf/internal/flags\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// conflictPolicy configures the policy for handling registration conflicts.\n//\n// It can be over-written at compile time with a linker-initialized variable:\n//\tgo build -ldflags \"-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn\"\n//\n// It can be over-written at program execution with an environment variable:\n//\tGOLANG_PROTOBUF_REGISTRATION_CONFLICT=warn ./main\n//\n// Neither of the above are covered by the compatibility promise and\n// may be removed in a future release of this module.\nvar conflictPolicy = \"panic\" // \"panic\" | \"warn\" | \"ignore\"\n\n// ignoreConflict reports whether to ignore a registration conflict\n// given the descriptor being registered and the error.\n// It is a variable so that the behavior is easily overridden in another file.\nvar ignoreConflict = func(d protoreflect.Descriptor, err error) bool {\n\tconst env = \"GOLANG_PROTOBUF_REGISTRATION_CONFLICT\"\n\tconst faq = \"https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict\"\n\tpolicy := conflictPolicy\n\tif v := os.Getenv(env); v != \"\" {\n\t\tpolicy = v\n\t}\n\tswitch policy {\n\tcase \"panic\":\n\t\tpanic(fmt.Sprintf(\"%v\\nSee %v\\n\", err, faq))\n\tcase \"warn\":\n\t\tfmt.Fprintf(os.Stderr, \"WARNING: %v\\nSee %v\\n\\n\", err, faq)\n\t\treturn true\n\tcase \"ignore\":\n\t\treturn true\n\tdefault:\n\t\tpanic(\"invalid \" + env + \" value: \" + os.Getenv(env))\n\t}\n}\n\nvar globalMutex sync.RWMutex\n\n// GlobalFiles is a global registry of file descriptors.\nvar GlobalFiles *Files = new(Files)\n\n// GlobalTypes is the registry used by default for type lookups\n// unless a local registry is provided by the user.\nvar GlobalTypes *Types = new(Types)\n\n// NotFound is a sentinel error value to indicate that the type was not found.\n//\n// Since registry lookup can happen in the critical performance path, resolvers\n// must return this exact error value, not an error wrapping it.\nvar NotFound = errors.New(\"not found\")\n\n// Files is a registry for looking up or iterating over files and the\n// descriptors contained within them.\n// The Find and Range methods are safe for concurrent use.\ntype Files struct {\n\t// The map of descsByName contains:\n\t//\tEnumDescriptor\n\t//\tEnumValueDescriptor\n\t//\tMessageDescriptor\n\t//\tExtensionDescriptor\n\t//\tServiceDescriptor\n\t//\t*packageDescriptor\n\t//\n\t// Note that files are stored as a slice, since a package may contain\n\t// multiple files. Only top-level declarations are registered.\n\t// Note that enum values are in the top-level since that are in the same\n\t// scope as the parent enum.\n\tdescsByName map[protoreflect.FullName]interface{}\n\tfilesByPath map[string]protoreflect.FileDescriptor\n}\n\ntype packageDescriptor struct {\n\tfiles []protoreflect.FileDescriptor\n}\n\n// RegisterFile registers the provided file descriptor.\n//\n// If any descriptor within the file conflicts with the descriptor of any\n// previously registered file (e.g., two enums with the same full name),\n// then the file is not registered and an error is returned.\n//\n// It is permitted for multiple files to have the same file path.\nfunc (r *Files) RegisterFile(file protoreflect.FileDescriptor) error {\n\tif r == GlobalFiles {\n\t\tglobalMutex.Lock()\n\t\tdefer globalMutex.Unlock()\n\t}\n\tif r.descsByName == nil {\n\t\tr.descsByName = map[protoreflect.FullName]interface{}{\n\t\t\t\"\": &packageDescriptor{},\n\t\t}\n\t\tr.filesByPath = make(map[string]protoreflect.FileDescriptor)\n\t}\n\tpath := file.Path()\n\tif prev := r.filesByPath[path]; prev != nil {\n\t\tr.checkGenProtoConflict(path)\n\t\terr := errors.New(\"file %q is already registered\", file.Path())\n\t\terr = amendErrorWithCaller(err, prev, file)\n\t\tif r == GlobalFiles && ignoreConflict(file, err) {\n\t\t\terr = nil\n\t\t}\n\t\treturn err\n\t}\n\n\tfor name := file.Package(); name != \"\"; name = name.Parent() {\n\t\tswitch prev := r.descsByName[name]; prev.(type) {\n\t\tcase nil, *packageDescriptor:\n\t\tdefault:\n\t\t\terr := errors.New(\"file %q has a package name conflict over %v\", file.Path(), name)\n\t\t\terr = amendErrorWithCaller(err, prev, file)\n\t\t\tif r == GlobalFiles && ignoreConflict(file, err) {\n\t\t\t\terr = nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t}\n\tvar err error\n\tvar hasConflict bool\n\trangeTopLevelDescriptors(file, func(d protoreflect.Descriptor) {\n\t\tif prev := r.descsByName[d.FullName()]; prev != nil {\n\t\t\thasConflict = true\n\t\t\terr = errors.New(\"file %q has a name conflict over %v\", file.Path(), d.FullName())\n\t\t\terr = amendErrorWithCaller(err, prev, file)\n\t\t\tif r == GlobalFiles && ignoreConflict(d, err) {\n\t\t\t\terr = nil\n\t\t\t}\n\t\t}\n\t})\n\tif hasConflict {\n\t\treturn err\n\t}\n\n\tfor name := file.Package(); name != \"\"; name = name.Parent() {\n\t\tif r.descsByName[name] == nil {\n\t\t\tr.descsByName[name] = &packageDescriptor{}\n\t\t}\n\t}\n\tp := r.descsByName[file.Package()].(*packageDescriptor)\n\tp.files = append(p.files, file)\n\trangeTopLevelDescriptors(file, func(d protoreflect.Descriptor) {\n\t\tr.descsByName[d.FullName()] = d\n\t})\n\tr.filesByPath[path] = file\n\treturn nil\n}\n\n// Several well-known types were hosted in the google.golang.org/genproto module\n// but were later moved to this module. To avoid a weak dependency on the\n// genproto module (and its relatively large set of transitive dependencies),\n// we rely on a registration conflict to determine whether the genproto version\n// is too old (i.e., does not contain aliases to the new type declarations).\nfunc (r *Files) checkGenProtoConflict(path string) {\n\tif r != GlobalFiles {\n\t\treturn\n\t}\n\tvar prevPath string\n\tconst prevModule = \"google.golang.org/genproto\"\n\tconst prevVersion = \"cb27e3aa (May 26th, 2020)\"\n\tswitch path {\n\tcase \"google/protobuf/field_mask.proto\":\n\t\tprevPath = prevModule + \"/protobuf/field_mask\"\n\tcase \"google/protobuf/api.proto\":\n\t\tprevPath = prevModule + \"/protobuf/api\"\n\tcase \"google/protobuf/type.proto\":\n\t\tprevPath = prevModule + \"/protobuf/ptype\"\n\tcase \"google/protobuf/source_context.proto\":\n\t\tprevPath = prevModule + \"/protobuf/source_context\"\n\tdefault:\n\t\treturn\n\t}\n\tpkgName := strings.TrimSuffix(strings.TrimPrefix(path, \"google/protobuf/\"), \".proto\")\n\tpkgName = strings.Replace(pkgName, \"_\", \"\", -1) + \"pb\" // e.g., \"field_mask\" => \"fieldmaskpb\"\n\tcurrPath := \"google.golang.org/protobuf/types/known/\" + pkgName\n\tpanic(fmt.Sprintf(\"\"+\n\t\t\"duplicate registration of %q\\n\"+\n\t\t\"\\n\"+\n\t\t\"The generated definition for this file has moved:\\n\"+\n\t\t\"\\tfrom: %q\\n\"+\n\t\t\"\\tto:   %q\\n\"+\n\t\t\"A dependency on the %q module must\\n\"+\n\t\t\"be at version %v or higher.\\n\"+\n\t\t\"\\n\"+\n\t\t\"Upgrade the dependency by running:\\n\"+\n\t\t\"\\tgo get -u %v\\n\",\n\t\tpath, prevPath, currPath, prevModule, prevVersion, prevPath))\n}\n\n// FindDescriptorByName looks up a descriptor by the full name.\n//\n// This returns (nil, NotFound) if not found.\nfunc (r *Files) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) {\n\tif r == nil {\n\t\treturn nil, NotFound\n\t}\n\tif r == GlobalFiles {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tprefix := name\n\tsuffix := nameSuffix(\"\")\n\tfor prefix != \"\" {\n\t\tif d, ok := r.descsByName[prefix]; ok {\n\t\t\tswitch d := d.(type) {\n\t\t\tcase protoreflect.EnumDescriptor:\n\t\t\t\tif d.FullName() == name {\n\t\t\t\t\treturn d, nil\n\t\t\t\t}\n\t\t\tcase protoreflect.EnumValueDescriptor:\n\t\t\t\tif d.FullName() == name {\n\t\t\t\t\treturn d, nil\n\t\t\t\t}\n\t\t\tcase protoreflect.MessageDescriptor:\n\t\t\t\tif d.FullName() == name {\n\t\t\t\t\treturn d, nil\n\t\t\t\t}\n\t\t\t\tif d := findDescriptorInMessage(d, suffix); d != nil && d.FullName() == name {\n\t\t\t\t\treturn d, nil\n\t\t\t\t}\n\t\t\tcase protoreflect.ExtensionDescriptor:\n\t\t\t\tif d.FullName() == name {\n\t\t\t\t\treturn d, nil\n\t\t\t\t}\n\t\t\tcase protoreflect.ServiceDescriptor:\n\t\t\t\tif d.FullName() == name {\n\t\t\t\t\treturn d, nil\n\t\t\t\t}\n\t\t\t\tif d := d.Methods().ByName(suffix.Pop()); d != nil && d.FullName() == name {\n\t\t\t\t\treturn d, nil\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil, NotFound\n\t\t}\n\t\tprefix = prefix.Parent()\n\t\tsuffix = nameSuffix(name[len(prefix)+len(\".\"):])\n\t}\n\treturn nil, NotFound\n}\n\nfunc findDescriptorInMessage(md protoreflect.MessageDescriptor, suffix nameSuffix) protoreflect.Descriptor {\n\tname := suffix.Pop()\n\tif suffix == \"\" {\n\t\tif ed := md.Enums().ByName(name); ed != nil {\n\t\t\treturn ed\n\t\t}\n\t\tfor i := md.Enums().Len() - 1; i >= 0; i-- {\n\t\t\tif vd := md.Enums().Get(i).Values().ByName(name); vd != nil {\n\t\t\t\treturn vd\n\t\t\t}\n\t\t}\n\t\tif xd := md.Extensions().ByName(name); xd != nil {\n\t\t\treturn xd\n\t\t}\n\t\tif fd := md.Fields().ByName(name); fd != nil {\n\t\t\treturn fd\n\t\t}\n\t\tif od := md.Oneofs().ByName(name); od != nil {\n\t\t\treturn od\n\t\t}\n\t}\n\tif md := md.Messages().ByName(name); md != nil {\n\t\tif suffix == \"\" {\n\t\t\treturn md\n\t\t}\n\t\treturn findDescriptorInMessage(md, suffix)\n\t}\n\treturn nil\n}\n\ntype nameSuffix string\n\nfunc (s *nameSuffix) Pop() (name protoreflect.Name) {\n\tif i := strings.IndexByte(string(*s), '.'); i >= 0 {\n\t\tname, *s = protoreflect.Name((*s)[:i]), (*s)[i+1:]\n\t} else {\n\t\tname, *s = protoreflect.Name((*s)), \"\"\n\t}\n\treturn name\n}\n\n// FindFileByPath looks up a file by the path.\n//\n// This returns (nil, NotFound) if not found.\nfunc (r *Files) FindFileByPath(path string) (protoreflect.FileDescriptor, error) {\n\tif r == nil {\n\t\treturn nil, NotFound\n\t}\n\tif r == GlobalFiles {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tif fd, ok := r.filesByPath[path]; ok {\n\t\treturn fd, nil\n\t}\n\treturn nil, NotFound\n}\n\n// NumFiles reports the number of registered files.\nfunc (r *Files) NumFiles() int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\tif r == GlobalFiles {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\treturn len(r.filesByPath)\n}\n\n// RangeFiles iterates over all registered files while f returns true.\n// The iteration order is undefined.\nfunc (r *Files) RangeFiles(f func(protoreflect.FileDescriptor) bool) {\n\tif r == nil {\n\t\treturn\n\t}\n\tif r == GlobalFiles {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tfor _, file := range r.filesByPath {\n\t\tif !f(file) {\n\t\t\treturn\n\t\t}\n\t}\n}\n\n// NumFilesByPackage reports the number of registered files in a proto package.\nfunc (r *Files) NumFilesByPackage(name protoreflect.FullName) int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\tif r == GlobalFiles {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tp, ok := r.descsByName[name].(*packageDescriptor)\n\tif !ok {\n\t\treturn 0\n\t}\n\treturn len(p.files)\n}\n\n// RangeFilesByPackage iterates over all registered files in a given proto package\n// while f returns true. The iteration order is undefined.\nfunc (r *Files) RangeFilesByPackage(name protoreflect.FullName, f func(protoreflect.FileDescriptor) bool) {\n\tif r == nil {\n\t\treturn\n\t}\n\tif r == GlobalFiles {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tp, ok := r.descsByName[name].(*packageDescriptor)\n\tif !ok {\n\t\treturn\n\t}\n\tfor _, file := range p.files {\n\t\tif !f(file) {\n\t\t\treturn\n\t\t}\n\t}\n}\n\n// rangeTopLevelDescriptors iterates over all top-level descriptors in a file\n// which will be directly entered into the registry.\nfunc rangeTopLevelDescriptors(fd protoreflect.FileDescriptor, f func(protoreflect.Descriptor)) {\n\teds := fd.Enums()\n\tfor i := eds.Len() - 1; i >= 0; i-- {\n\t\tf(eds.Get(i))\n\t\tvds := eds.Get(i).Values()\n\t\tfor i := vds.Len() - 1; i >= 0; i-- {\n\t\t\tf(vds.Get(i))\n\t\t}\n\t}\n\tmds := fd.Messages()\n\tfor i := mds.Len() - 1; i >= 0; i-- {\n\t\tf(mds.Get(i))\n\t}\n\txds := fd.Extensions()\n\tfor i := xds.Len() - 1; i >= 0; i-- {\n\t\tf(xds.Get(i))\n\t}\n\tsds := fd.Services()\n\tfor i := sds.Len() - 1; i >= 0; i-- {\n\t\tf(sds.Get(i))\n\t}\n}\n\n// MessageTypeResolver is an interface for looking up messages.\n//\n// A compliant implementation must deterministically return the same type\n// if no error is encountered.\n//\n// The Types type implements this interface.\ntype MessageTypeResolver interface {\n\t// FindMessageByName looks up a message by its full name.\n\t// E.g., \"google.protobuf.Any\"\n\t//\n\t// This return (nil, NotFound) if not found.\n\tFindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error)\n\n\t// FindMessageByURL looks up a message by a URL identifier.\n\t// See documentation on google.protobuf.Any.type_url for the URL format.\n\t//\n\t// This returns (nil, NotFound) if not found.\n\tFindMessageByURL(url string) (protoreflect.MessageType, error)\n}\n\n// ExtensionTypeResolver is an interface for looking up extensions.\n//\n// A compliant implementation must deterministically return the same type\n// if no error is encountered.\n//\n// The Types type implements this interface.\ntype ExtensionTypeResolver interface {\n\t// FindExtensionByName looks up a extension field by the field's full name.\n\t// Note that this is the full name of the field as determined by\n\t// where the extension is declared and is unrelated to the full name of the\n\t// message being extended.\n\t//\n\t// This returns (nil, NotFound) if not found.\n\tFindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)\n\n\t// FindExtensionByNumber looks up a extension field by the field number\n\t// within some parent message, identified by full name.\n\t//\n\t// This returns (nil, NotFound) if not found.\n\tFindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)\n}\n\nvar (\n\t_ MessageTypeResolver   = (*Types)(nil)\n\t_ ExtensionTypeResolver = (*Types)(nil)\n)\n\n// Types is a registry for looking up or iterating over descriptor types.\n// The Find and Range methods are safe for concurrent use.\ntype Types struct {\n\ttypesByName         typesByName\n\textensionsByMessage extensionsByMessage\n\n\tnumEnums      int\n\tnumMessages   int\n\tnumExtensions int\n}\n\ntype (\n\ttypesByName         map[protoreflect.FullName]interface{}\n\textensionsByMessage map[protoreflect.FullName]extensionsByNumber\n\textensionsByNumber  map[protoreflect.FieldNumber]protoreflect.ExtensionType\n)\n\n// RegisterMessage registers the provided message type.\n//\n// If a naming conflict occurs, the type is not registered and an error is returned.\nfunc (r *Types) RegisterMessage(mt protoreflect.MessageType) error {\n\t// Under rare circumstances getting the descriptor might recursively\n\t// examine the registry, so fetch it before locking.\n\tmd := mt.Descriptor()\n\n\tif r == GlobalTypes {\n\t\tglobalMutex.Lock()\n\t\tdefer globalMutex.Unlock()\n\t}\n\n\tif err := r.register(\"message\", md, mt); err != nil {\n\t\treturn err\n\t}\n\tr.numMessages++\n\treturn nil\n}\n\n// RegisterEnum registers the provided enum type.\n//\n// If a naming conflict occurs, the type is not registered and an error is returned.\nfunc (r *Types) RegisterEnum(et protoreflect.EnumType) error {\n\t// Under rare circumstances getting the descriptor might recursively\n\t// examine the registry, so fetch it before locking.\n\ted := et.Descriptor()\n\n\tif r == GlobalTypes {\n\t\tglobalMutex.Lock()\n\t\tdefer globalMutex.Unlock()\n\t}\n\n\tif err := r.register(\"enum\", ed, et); err != nil {\n\t\treturn err\n\t}\n\tr.numEnums++\n\treturn nil\n}\n\n// RegisterExtension registers the provided extension type.\n//\n// If a naming conflict occurs, the type is not registered and an error is returned.\nfunc (r *Types) RegisterExtension(xt protoreflect.ExtensionType) error {\n\t// Under rare circumstances getting the descriptor might recursively\n\t// examine the registry, so fetch it before locking.\n\t//\n\t// A known case where this can happen: Fetching the TypeDescriptor for a\n\t// legacy ExtensionDesc can consult the global registry.\n\txd := xt.TypeDescriptor()\n\n\tif r == GlobalTypes {\n\t\tglobalMutex.Lock()\n\t\tdefer globalMutex.Unlock()\n\t}\n\n\tfield := xd.Number()\n\tmessage := xd.ContainingMessage().FullName()\n\tif prev := r.extensionsByMessage[message][field]; prev != nil {\n\t\terr := errors.New(\"extension number %d is already registered on message %v\", field, message)\n\t\terr = amendErrorWithCaller(err, prev, xt)\n\t\tif !(r == GlobalTypes && ignoreConflict(xd, err)) {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := r.register(\"extension\", xd, xt); err != nil {\n\t\treturn err\n\t}\n\tif r.extensionsByMessage == nil {\n\t\tr.extensionsByMessage = make(extensionsByMessage)\n\t}\n\tif r.extensionsByMessage[message] == nil {\n\t\tr.extensionsByMessage[message] = make(extensionsByNumber)\n\t}\n\tr.extensionsByMessage[message][field] = xt\n\tr.numExtensions++\n\treturn nil\n}\n\nfunc (r *Types) register(kind string, desc protoreflect.Descriptor, typ interface{}) error {\n\tname := desc.FullName()\n\tprev := r.typesByName[name]\n\tif prev != nil {\n\t\terr := errors.New(\"%v %v is already registered\", kind, name)\n\t\terr = amendErrorWithCaller(err, prev, typ)\n\t\tif !(r == GlobalTypes && ignoreConflict(desc, err)) {\n\t\t\treturn err\n\t\t}\n\t}\n\tif r.typesByName == nil {\n\t\tr.typesByName = make(typesByName)\n\t}\n\tr.typesByName[name] = typ\n\treturn nil\n}\n\n// FindEnumByName looks up an enum by its full name.\n// E.g., \"google.protobuf.Field.Kind\".\n//\n// This returns (nil, NotFound) if not found.\nfunc (r *Types) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumType, error) {\n\tif r == nil {\n\t\treturn nil, NotFound\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tif v := r.typesByName[enum]; v != nil {\n\t\tif et, _ := v.(protoreflect.EnumType); et != nil {\n\t\t\treturn et, nil\n\t\t}\n\t\treturn nil, errors.New(\"found wrong type: got %v, want enum\", typeName(v))\n\t}\n\treturn nil, NotFound\n}\n\n// FindMessageByName looks up a message by its full name,\n// e.g. \"google.protobuf.Any\".\n//\n// This returns (nil, NotFound) if not found.\nfunc (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) {\n\tif r == nil {\n\t\treturn nil, NotFound\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tif v := r.typesByName[message]; v != nil {\n\t\tif mt, _ := v.(protoreflect.MessageType); mt != nil {\n\t\t\treturn mt, nil\n\t\t}\n\t\treturn nil, errors.New(\"found wrong type: got %v, want message\", typeName(v))\n\t}\n\treturn nil, NotFound\n}\n\n// FindMessageByURL looks up a message by a URL identifier.\n// See documentation on google.protobuf.Any.type_url for the URL format.\n//\n// This returns (nil, NotFound) if not found.\nfunc (r *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) {\n\t// This function is similar to FindMessageByName but\n\t// truncates anything before and including '/' in the URL.\n\tif r == nil {\n\t\treturn nil, NotFound\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tmessage := protoreflect.FullName(url)\n\tif i := strings.LastIndexByte(url, '/'); i >= 0 {\n\t\tmessage = message[i+len(\"/\"):]\n\t}\n\n\tif v := r.typesByName[message]; v != nil {\n\t\tif mt, _ := v.(protoreflect.MessageType); mt != nil {\n\t\t\treturn mt, nil\n\t\t}\n\t\treturn nil, errors.New(\"found wrong type: got %v, want message\", typeName(v))\n\t}\n\treturn nil, NotFound\n}\n\n// FindExtensionByName looks up a extension field by the field's full name.\n// Note that this is the full name of the field as determined by\n// where the extension is declared and is unrelated to the full name of the\n// message being extended.\n//\n// This returns (nil, NotFound) if not found.\nfunc (r *Types) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) {\n\tif r == nil {\n\t\treturn nil, NotFound\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tif v := r.typesByName[field]; v != nil {\n\t\tif xt, _ := v.(protoreflect.ExtensionType); xt != nil {\n\t\t\treturn xt, nil\n\t\t}\n\n\t\t// MessageSet extensions are special in that the name of the extension\n\t\t// is the name of the message type used to extend the MessageSet.\n\t\t// This naming scheme is used by text and JSON serialization.\n\t\t//\n\t\t// This feature is protected by the ProtoLegacy flag since MessageSets\n\t\t// are a proto1 feature that is long deprecated.\n\t\tif flags.ProtoLegacy {\n\t\t\tif _, ok := v.(protoreflect.MessageType); ok {\n\t\t\t\tfield := field.Append(messageset.ExtensionName)\n\t\t\t\tif v := r.typesByName[field]; v != nil {\n\t\t\t\t\tif xt, _ := v.(protoreflect.ExtensionType); xt != nil {\n\t\t\t\t\t\tif messageset.IsMessageSetExtension(xt.TypeDescriptor()) {\n\t\t\t\t\t\t\treturn xt, nil\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn nil, errors.New(\"found wrong type: got %v, want extension\", typeName(v))\n\t}\n\treturn nil, NotFound\n}\n\n// FindExtensionByNumber looks up a extension field by the field number\n// within some parent message, identified by full name.\n//\n// This returns (nil, NotFound) if not found.\nfunc (r *Types) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) {\n\tif r == nil {\n\t\treturn nil, NotFound\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tif xt, ok := r.extensionsByMessage[message][field]; ok {\n\t\treturn xt, nil\n\t}\n\treturn nil, NotFound\n}\n\n// NumEnums reports the number of registered enums.\nfunc (r *Types) NumEnums() int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\treturn r.numEnums\n}\n\n// RangeEnums iterates over all registered enums while f returns true.\n// Iteration order is undefined.\nfunc (r *Types) RangeEnums(f func(protoreflect.EnumType) bool) {\n\tif r == nil {\n\t\treturn\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tfor _, typ := range r.typesByName {\n\t\tif et, ok := typ.(protoreflect.EnumType); ok {\n\t\t\tif !f(et) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}\n\n// NumMessages reports the number of registered messages.\nfunc (r *Types) NumMessages() int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\treturn r.numMessages\n}\n\n// RangeMessages iterates over all registered messages while f returns true.\n// Iteration order is undefined.\nfunc (r *Types) RangeMessages(f func(protoreflect.MessageType) bool) {\n\tif r == nil {\n\t\treturn\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tfor _, typ := range r.typesByName {\n\t\tif mt, ok := typ.(protoreflect.MessageType); ok {\n\t\t\tif !f(mt) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}\n\n// NumExtensions reports the number of registered extensions.\nfunc (r *Types) NumExtensions() int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\treturn r.numExtensions\n}\n\n// RangeExtensions iterates over all registered extensions while f returns true.\n// Iteration order is undefined.\nfunc (r *Types) RangeExtensions(f func(protoreflect.ExtensionType) bool) {\n\tif r == nil {\n\t\treturn\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tfor _, typ := range r.typesByName {\n\t\tif xt, ok := typ.(protoreflect.ExtensionType); ok {\n\t\t\tif !f(xt) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}\n\n// NumExtensionsByMessage reports the number of registered extensions for\n// a given message type.\nfunc (r *Types) NumExtensionsByMessage(message protoreflect.FullName) int {\n\tif r == nil {\n\t\treturn 0\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\treturn len(r.extensionsByMessage[message])\n}\n\n// RangeExtensionsByMessage iterates over all registered extensions filtered\n// by a given message type while f returns true. Iteration order is undefined.\nfunc (r *Types) RangeExtensionsByMessage(message protoreflect.FullName, f func(protoreflect.ExtensionType) bool) {\n\tif r == nil {\n\t\treturn\n\t}\n\tif r == GlobalTypes {\n\t\tglobalMutex.RLock()\n\t\tdefer globalMutex.RUnlock()\n\t}\n\tfor _, xt := range r.extensionsByMessage[message] {\n\t\tif !f(xt) {\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunc typeName(t interface{}) string {\n\tswitch t.(type) {\n\tcase protoreflect.EnumType:\n\t\treturn \"enum\"\n\tcase protoreflect.MessageType:\n\t\treturn \"message\"\n\tcase protoreflect.ExtensionType:\n\t\treturn \"extension\"\n\tdefault:\n\t\treturn fmt.Sprintf(\"%T\", t)\n\t}\n}\n\nfunc amendErrorWithCaller(err error, prev, curr interface{}) error {\n\tprevPkg := goPackage(prev)\n\tcurrPkg := goPackage(curr)\n\tif prevPkg == \"\" || currPkg == \"\" || prevPkg == currPkg {\n\t\treturn err\n\t}\n\treturn errors.New(\"%s\\n\\tpreviously from: %q\\n\\tcurrently from:  %q\", err, prevPkg, currPkg)\n}\n\nfunc goPackage(v interface{}) string {\n\tswitch d := v.(type) {\n\tcase protoreflect.EnumType:\n\t\tv = d.Descriptor()\n\tcase protoreflect.MessageType:\n\t\tv = d.Descriptor()\n\tcase protoreflect.ExtensionType:\n\t\tv = d.TypeDescriptor()\n\t}\n\tif d, ok := v.(protoreflect.Descriptor); ok {\n\t\tv = d.ParentFile()\n\t}\n\tif d, ok := v.(interface{ GoPackagePath() string }); ok {\n\t\treturn d.GoPackagePath()\n\t}\n\treturn \"\"\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/runtime/protoiface/legacy.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 protoiface\n\ntype MessageV1 interface {\n\tReset()\n\tString() string\n\tProtoMessage()\n}\n\ntype ExtensionRangeV1 struct {\n\tStart, End int32 // both inclusive\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/runtime/protoiface/methods.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 protoiface contains types referenced or implemented by messages.\n//\n// WARNING: This package should only be imported by message implementations.\n// The functionality found in this package should be accessed through\n// higher-level abstractions provided by the proto package.\npackage protoiface\n\nimport (\n\t\"google.golang.org/protobuf/internal/pragma\"\n\t\"google.golang.org/protobuf/reflect/protoreflect\"\n)\n\n// Methods is a set of optional fast-path implementations of various operations.\ntype Methods = struct {\n\tpragma.NoUnkeyedLiterals\n\n\t// Flags indicate support for optional features.\n\tFlags SupportFlags\n\n\t// Size returns the size in bytes of the wire-format encoding of a message.\n\t// Marshal must be provided if a custom Size is provided.\n\tSize func(SizeInput) SizeOutput\n\n\t// Marshal formats a message in the wire-format encoding to the provided buffer.\n\t// Size should be provided if a custom Marshal is provided.\n\t// It must not return an error for a partial message.\n\tMarshal func(MarshalInput) (MarshalOutput, error)\n\n\t// Unmarshal parses the wire-format encoding and merges the result into a message.\n\t// It must not reset the target message or return an error for a partial message.\n\tUnmarshal func(UnmarshalInput) (UnmarshalOutput, error)\n\n\t// Merge merges the contents of a source message into a destination message.\n\tMerge func(MergeInput) MergeOutput\n\n\t// CheckInitialized returns an error if any required fields in the message are not set.\n\tCheckInitialized func(CheckInitializedInput) (CheckInitializedOutput, error)\n}\n\n// SupportFlags indicate support for optional features.\ntype SupportFlags = uint64\n\nconst (\n\t// SupportMarshalDeterministic reports whether MarshalOptions.Deterministic is supported.\n\tSupportMarshalDeterministic SupportFlags = 1 << iota\n\n\t// SupportUnmarshalDiscardUnknown reports whether UnmarshalOptions.DiscardUnknown is supported.\n\tSupportUnmarshalDiscardUnknown\n)\n\n// SizeInput is input to the Size method.\ntype SizeInput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tMessage protoreflect.Message\n\tFlags   MarshalInputFlags\n}\n\n// SizeOutput is output from the Size method.\ntype SizeOutput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tSize int\n}\n\n// MarshalInput is input to the Marshal method.\ntype MarshalInput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tMessage protoreflect.Message\n\tBuf     []byte // output is appended to this buffer\n\tFlags   MarshalInputFlags\n}\n\n// MarshalOutput is output from the Marshal method.\ntype MarshalOutput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tBuf []byte // contains marshaled message\n}\n\n// MarshalInputFlags configure the marshaler.\n// Most flags correspond to fields in proto.MarshalOptions.\ntype MarshalInputFlags = uint8\n\nconst (\n\tMarshalDeterministic MarshalInputFlags = 1 << iota\n\tMarshalUseCachedSize\n)\n\n// UnmarshalInput is input to the Unmarshal method.\ntype UnmarshalInput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tMessage  protoreflect.Message\n\tBuf      []byte // input buffer\n\tFlags    UnmarshalInputFlags\n\tResolver interface {\n\t\tFindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)\n\t\tFindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)\n\t}\n}\n\n// UnmarshalOutput is output from the Unmarshal method.\ntype UnmarshalOutput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tFlags UnmarshalOutputFlags\n}\n\n// UnmarshalInputFlags configure the unmarshaler.\n// Most flags correspond to fields in proto.UnmarshalOptions.\ntype UnmarshalInputFlags = uint8\n\nconst (\n\tUnmarshalDiscardUnknown UnmarshalInputFlags = 1 << iota\n)\n\n// UnmarshalOutputFlags are output from the Unmarshal method.\ntype UnmarshalOutputFlags = uint8\n\nconst (\n\t// UnmarshalInitialized may be set on return if all required fields are known to be set.\n\t// If unset, then it does not necessarily indicate that the message is uninitialized,\n\t// only that its status could not be confirmed.\n\tUnmarshalInitialized UnmarshalOutputFlags = 1 << iota\n)\n\n// MergeInput is input to the Merge method.\ntype MergeInput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tSource      protoreflect.Message\n\tDestination protoreflect.Message\n}\n\n// MergeOutput is output from the Merge method.\ntype MergeOutput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tFlags MergeOutputFlags\n}\n\n// MergeOutputFlags are output from the Merge method.\ntype MergeOutputFlags = uint8\n\nconst (\n\t// MergeComplete reports whether the merge was performed.\n\t// If unset, the merger must have made no changes to the destination.\n\tMergeComplete MergeOutputFlags = 1 << iota\n)\n\n// CheckInitializedInput is input to the CheckInitialized method.\ntype CheckInitializedInput = struct {\n\tpragma.NoUnkeyedLiterals\n\n\tMessage protoreflect.Message\n}\n\n// CheckInitializedOutput is output from the CheckInitialized method.\ntype CheckInitializedOutput = struct {\n\tpragma.NoUnkeyedLiterals\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/runtime/protoimpl/impl.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 protoimpl contains the default implementation for messages\n// generated by protoc-gen-go.\n//\n// WARNING: This package should only ever be imported by generated messages.\n// The compatibility agreement covers nothing except for functionality needed\n// to keep existing generated messages operational. Breakages that occur due\n// to unauthorized usages of this package are not the author's responsibility.\npackage protoimpl\n\nimport (\n\t\"google.golang.org/protobuf/internal/filedesc\"\n\t\"google.golang.org/protobuf/internal/filetype\"\n\t\"google.golang.org/protobuf/internal/impl\"\n)\n\n// UnsafeEnabled specifies whether package unsafe can be used.\nconst UnsafeEnabled = impl.UnsafeEnabled\n\ntype (\n\t// Types used by generated code in init functions.\n\tDescBuilder = filedesc.Builder\n\tTypeBuilder = filetype.Builder\n\n\t// Types used by generated code to implement EnumType, MessageType, and ExtensionType.\n\tEnumInfo      = impl.EnumInfo\n\tMessageInfo   = impl.MessageInfo\n\tExtensionInfo = impl.ExtensionInfo\n\n\t// Types embedded in generated messages.\n\tMessageState     = impl.MessageState\n\tSizeCache        = impl.SizeCache\n\tWeakFields       = impl.WeakFields\n\tUnknownFields    = impl.UnknownFields\n\tExtensionFields  = impl.ExtensionFields\n\tExtensionFieldV1 = impl.ExtensionField\n\n\tPointer = impl.Pointer\n)\n\nvar X impl.Export\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/runtime/protoimpl/version.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 protoimpl\n\nimport (\n\t\"google.golang.org/protobuf/internal/version\"\n)\n\nconst (\n\t// MaxVersion is the maximum supported version for generated .pb.go files.\n\t// It is always the current version of the module.\n\tMaxVersion = version.Minor\n\n\t// GenVersion is the runtime version required by generated .pb.go files.\n\t// This is incremented when generated code relies on new functionality\n\t// in the runtime.\n\tGenVersion = 20\n\n\t// MinVersion is the minimum supported version for generated .pb.go files.\n\t// This is incremented when the runtime drops support for old code.\n\tMinVersion = 0\n)\n\n// EnforceVersion is used by code generated by protoc-gen-go\n// to statically enforce minimum and maximum versions of this package.\n// A compilation failure implies either that:\n//\t* the runtime package is too old and needs to be updated OR\n//\t* the generated code is too old and needs to be regenerated.\n//\n// The runtime package can be upgraded by running:\n//\tgo get google.golang.org/protobuf\n//\n// The generated code can be regenerated by running:\n//\tprotoc --go_out=${PROTOC_GEN_GO_ARGS} ${PROTO_FILES}\n//\n// Example usage by generated code:\n//\tconst (\n//\t\t// Verify that this generated code is sufficiently up-to-date.\n//\t\t_ = protoimpl.EnforceVersion(genVersion - protoimpl.MinVersion)\n//\t\t// Verify that runtime/protoimpl is sufficiently up-to-date.\n//\t\t_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - genVersion)\n//\t)\n//\n// The genVersion is the current minor version used to generated the code.\n// This compile-time check relies on negative integer overflow of a uint\n// being a compilation failure (guaranteed by the Go specification).\ntype EnforceVersion uint\n\n// This enforces the following invariant:\n//\tMinVersion ≤ GenVersion ≤ MaxVersion\nconst (\n\t_ = EnforceVersion(GenVersion - MinVersion)\n\t_ = EnforceVersion(MaxVersion - GenVersion)\n)\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Author: kenton@google.com (Kenton Varda)\n//  Based on original Protocol Buffers design by\n//  Sanjay Ghemawat, Jeff Dean, and others.\n//\n// The messages in this file describe the definitions found in .proto files.\n// A valid .proto file can be translated directly to a FileDescriptorProto\n// without any other information (e.g. without reading its imports).\n\n// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: google/protobuf/descriptor.proto\n\npackage descriptorpb\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoiface \"google.golang.org/protobuf/runtime/protoiface\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\ntype FieldDescriptorProto_Type int32\n\nconst (\n\t// 0 is reserved for errors.\n\t// Order is weird for historical reasons.\n\tFieldDescriptorProto_TYPE_DOUBLE FieldDescriptorProto_Type = 1\n\tFieldDescriptorProto_TYPE_FLOAT  FieldDescriptorProto_Type = 2\n\t// Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if\n\t// negative values are likely.\n\tFieldDescriptorProto_TYPE_INT64  FieldDescriptorProto_Type = 3\n\tFieldDescriptorProto_TYPE_UINT64 FieldDescriptorProto_Type = 4\n\t// Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if\n\t// negative values are likely.\n\tFieldDescriptorProto_TYPE_INT32   FieldDescriptorProto_Type = 5\n\tFieldDescriptorProto_TYPE_FIXED64 FieldDescriptorProto_Type = 6\n\tFieldDescriptorProto_TYPE_FIXED32 FieldDescriptorProto_Type = 7\n\tFieldDescriptorProto_TYPE_BOOL    FieldDescriptorProto_Type = 8\n\tFieldDescriptorProto_TYPE_STRING  FieldDescriptorProto_Type = 9\n\t// Tag-delimited aggregate.\n\t// Group type is deprecated and not supported in proto3. However, Proto3\n\t// implementations should still be able to parse the group wire format and\n\t// treat group fields as unknown fields.\n\tFieldDescriptorProto_TYPE_GROUP   FieldDescriptorProto_Type = 10\n\tFieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11 // Length-delimited aggregate.\n\t// New in version 2.\n\tFieldDescriptorProto_TYPE_BYTES    FieldDescriptorProto_Type = 12\n\tFieldDescriptorProto_TYPE_UINT32   FieldDescriptorProto_Type = 13\n\tFieldDescriptorProto_TYPE_ENUM     FieldDescriptorProto_Type = 14\n\tFieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15\n\tFieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16\n\tFieldDescriptorProto_TYPE_SINT32   FieldDescriptorProto_Type = 17 // Uses ZigZag encoding.\n\tFieldDescriptorProto_TYPE_SINT64   FieldDescriptorProto_Type = 18 // Uses ZigZag encoding.\n)\n\n// Enum value maps for FieldDescriptorProto_Type.\nvar (\n\tFieldDescriptorProto_Type_name = map[int32]string{\n\t\t1:  \"TYPE_DOUBLE\",\n\t\t2:  \"TYPE_FLOAT\",\n\t\t3:  \"TYPE_INT64\",\n\t\t4:  \"TYPE_UINT64\",\n\t\t5:  \"TYPE_INT32\",\n\t\t6:  \"TYPE_FIXED64\",\n\t\t7:  \"TYPE_FIXED32\",\n\t\t8:  \"TYPE_BOOL\",\n\t\t9:  \"TYPE_STRING\",\n\t\t10: \"TYPE_GROUP\",\n\t\t11: \"TYPE_MESSAGE\",\n\t\t12: \"TYPE_BYTES\",\n\t\t13: \"TYPE_UINT32\",\n\t\t14: \"TYPE_ENUM\",\n\t\t15: \"TYPE_SFIXED32\",\n\t\t16: \"TYPE_SFIXED64\",\n\t\t17: \"TYPE_SINT32\",\n\t\t18: \"TYPE_SINT64\",\n\t}\n\tFieldDescriptorProto_Type_value = map[string]int32{\n\t\t\"TYPE_DOUBLE\":   1,\n\t\t\"TYPE_FLOAT\":    2,\n\t\t\"TYPE_INT64\":    3,\n\t\t\"TYPE_UINT64\":   4,\n\t\t\"TYPE_INT32\":    5,\n\t\t\"TYPE_FIXED64\":  6,\n\t\t\"TYPE_FIXED32\":  7,\n\t\t\"TYPE_BOOL\":     8,\n\t\t\"TYPE_STRING\":   9,\n\t\t\"TYPE_GROUP\":    10,\n\t\t\"TYPE_MESSAGE\":  11,\n\t\t\"TYPE_BYTES\":    12,\n\t\t\"TYPE_UINT32\":   13,\n\t\t\"TYPE_ENUM\":     14,\n\t\t\"TYPE_SFIXED32\": 15,\n\t\t\"TYPE_SFIXED64\": 16,\n\t\t\"TYPE_SINT32\":   17,\n\t\t\"TYPE_SINT64\":   18,\n\t}\n)\n\nfunc (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type {\n\tp := new(FieldDescriptorProto_Type)\n\t*p = x\n\treturn p\n}\n\nfunc (x FieldDescriptorProto_Type) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (FieldDescriptorProto_Type) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_google_protobuf_descriptor_proto_enumTypes[0].Descriptor()\n}\n\nfunc (FieldDescriptorProto_Type) Type() protoreflect.EnumType {\n\treturn &file_google_protobuf_descriptor_proto_enumTypes[0]\n}\n\nfunc (x FieldDescriptorProto_Type) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Do not use.\nfunc (x *FieldDescriptorProto_Type) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FieldDescriptorProto_Type(num)\n\treturn nil\n}\n\n// Deprecated: Use FieldDescriptorProto_Type.Descriptor instead.\nfunc (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{4, 0}\n}\n\ntype FieldDescriptorProto_Label int32\n\nconst (\n\t// 0 is reserved for errors\n\tFieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1\n\tFieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2\n\tFieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3\n)\n\n// Enum value maps for FieldDescriptorProto_Label.\nvar (\n\tFieldDescriptorProto_Label_name = map[int32]string{\n\t\t1: \"LABEL_OPTIONAL\",\n\t\t2: \"LABEL_REQUIRED\",\n\t\t3: \"LABEL_REPEATED\",\n\t}\n\tFieldDescriptorProto_Label_value = map[string]int32{\n\t\t\"LABEL_OPTIONAL\": 1,\n\t\t\"LABEL_REQUIRED\": 2,\n\t\t\"LABEL_REPEATED\": 3,\n\t}\n)\n\nfunc (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label {\n\tp := new(FieldDescriptorProto_Label)\n\t*p = x\n\treturn p\n}\n\nfunc (x FieldDescriptorProto_Label) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (FieldDescriptorProto_Label) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_google_protobuf_descriptor_proto_enumTypes[1].Descriptor()\n}\n\nfunc (FieldDescriptorProto_Label) Type() protoreflect.EnumType {\n\treturn &file_google_protobuf_descriptor_proto_enumTypes[1]\n}\n\nfunc (x FieldDescriptorProto_Label) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Do not use.\nfunc (x *FieldDescriptorProto_Label) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FieldDescriptorProto_Label(num)\n\treturn nil\n}\n\n// Deprecated: Use FieldDescriptorProto_Label.Descriptor instead.\nfunc (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{4, 1}\n}\n\n// Generated classes can be optimized for speed or code size.\ntype FileOptions_OptimizeMode int32\n\nconst (\n\tFileOptions_SPEED FileOptions_OptimizeMode = 1 // Generate complete code for parsing, serialization,\n\t// etc.\n\tFileOptions_CODE_SIZE    FileOptions_OptimizeMode = 2 // Use ReflectionOps to implement these methods.\n\tFileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3 // Generate code using MessageLite and the lite runtime.\n)\n\n// Enum value maps for FileOptions_OptimizeMode.\nvar (\n\tFileOptions_OptimizeMode_name = map[int32]string{\n\t\t1: \"SPEED\",\n\t\t2: \"CODE_SIZE\",\n\t\t3: \"LITE_RUNTIME\",\n\t}\n\tFileOptions_OptimizeMode_value = map[string]int32{\n\t\t\"SPEED\":        1,\n\t\t\"CODE_SIZE\":    2,\n\t\t\"LITE_RUNTIME\": 3,\n\t}\n)\n\nfunc (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode {\n\tp := new(FileOptions_OptimizeMode)\n\t*p = x\n\treturn p\n}\n\nfunc (x FileOptions_OptimizeMode) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (FileOptions_OptimizeMode) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_google_protobuf_descriptor_proto_enumTypes[2].Descriptor()\n}\n\nfunc (FileOptions_OptimizeMode) Type() protoreflect.EnumType {\n\treturn &file_google_protobuf_descriptor_proto_enumTypes[2]\n}\n\nfunc (x FileOptions_OptimizeMode) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Do not use.\nfunc (x *FileOptions_OptimizeMode) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FileOptions_OptimizeMode(num)\n\treturn nil\n}\n\n// Deprecated: Use FileOptions_OptimizeMode.Descriptor instead.\nfunc (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{10, 0}\n}\n\ntype FieldOptions_CType int32\n\nconst (\n\t// Default mode.\n\tFieldOptions_STRING       FieldOptions_CType = 0\n\tFieldOptions_CORD         FieldOptions_CType = 1\n\tFieldOptions_STRING_PIECE FieldOptions_CType = 2\n)\n\n// Enum value maps for FieldOptions_CType.\nvar (\n\tFieldOptions_CType_name = map[int32]string{\n\t\t0: \"STRING\",\n\t\t1: \"CORD\",\n\t\t2: \"STRING_PIECE\",\n\t}\n\tFieldOptions_CType_value = map[string]int32{\n\t\t\"STRING\":       0,\n\t\t\"CORD\":         1,\n\t\t\"STRING_PIECE\": 2,\n\t}\n)\n\nfunc (x FieldOptions_CType) Enum() *FieldOptions_CType {\n\tp := new(FieldOptions_CType)\n\t*p = x\n\treturn p\n}\n\nfunc (x FieldOptions_CType) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (FieldOptions_CType) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_google_protobuf_descriptor_proto_enumTypes[3].Descriptor()\n}\n\nfunc (FieldOptions_CType) Type() protoreflect.EnumType {\n\treturn &file_google_protobuf_descriptor_proto_enumTypes[3]\n}\n\nfunc (x FieldOptions_CType) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Do not use.\nfunc (x *FieldOptions_CType) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FieldOptions_CType(num)\n\treturn nil\n}\n\n// Deprecated: Use FieldOptions_CType.Descriptor instead.\nfunc (FieldOptions_CType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12, 0}\n}\n\ntype FieldOptions_JSType int32\n\nconst (\n\t// Use the default type.\n\tFieldOptions_JS_NORMAL FieldOptions_JSType = 0\n\t// Use JavaScript strings.\n\tFieldOptions_JS_STRING FieldOptions_JSType = 1\n\t// Use JavaScript numbers.\n\tFieldOptions_JS_NUMBER FieldOptions_JSType = 2\n)\n\n// Enum value maps for FieldOptions_JSType.\nvar (\n\tFieldOptions_JSType_name = map[int32]string{\n\t\t0: \"JS_NORMAL\",\n\t\t1: \"JS_STRING\",\n\t\t2: \"JS_NUMBER\",\n\t}\n\tFieldOptions_JSType_value = map[string]int32{\n\t\t\"JS_NORMAL\": 0,\n\t\t\"JS_STRING\": 1,\n\t\t\"JS_NUMBER\": 2,\n\t}\n)\n\nfunc (x FieldOptions_JSType) Enum() *FieldOptions_JSType {\n\tp := new(FieldOptions_JSType)\n\t*p = x\n\treturn p\n}\n\nfunc (x FieldOptions_JSType) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (FieldOptions_JSType) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_google_protobuf_descriptor_proto_enumTypes[4].Descriptor()\n}\n\nfunc (FieldOptions_JSType) Type() protoreflect.EnumType {\n\treturn &file_google_protobuf_descriptor_proto_enumTypes[4]\n}\n\nfunc (x FieldOptions_JSType) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Do not use.\nfunc (x *FieldOptions_JSType) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = FieldOptions_JSType(num)\n\treturn nil\n}\n\n// Deprecated: Use FieldOptions_JSType.Descriptor instead.\nfunc (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12, 1}\n}\n\n// Is this method side-effect-free (or safe in HTTP parlance), or idempotent,\n// or neither? HTTP based RPC implementation may choose GET verb for safe\n// methods, and PUT verb for idempotent methods instead of the default POST.\ntype MethodOptions_IdempotencyLevel int32\n\nconst (\n\tMethodOptions_IDEMPOTENCY_UNKNOWN MethodOptions_IdempotencyLevel = 0\n\tMethodOptions_NO_SIDE_EFFECTS     MethodOptions_IdempotencyLevel = 1 // implies idempotent\n\tMethodOptions_IDEMPOTENT          MethodOptions_IdempotencyLevel = 2 // idempotent, but may have side effects\n)\n\n// Enum value maps for MethodOptions_IdempotencyLevel.\nvar (\n\tMethodOptions_IdempotencyLevel_name = map[int32]string{\n\t\t0: \"IDEMPOTENCY_UNKNOWN\",\n\t\t1: \"NO_SIDE_EFFECTS\",\n\t\t2: \"IDEMPOTENT\",\n\t}\n\tMethodOptions_IdempotencyLevel_value = map[string]int32{\n\t\t\"IDEMPOTENCY_UNKNOWN\": 0,\n\t\t\"NO_SIDE_EFFECTS\":     1,\n\t\t\"IDEMPOTENT\":          2,\n\t}\n)\n\nfunc (x MethodOptions_IdempotencyLevel) Enum() *MethodOptions_IdempotencyLevel {\n\tp := new(MethodOptions_IdempotencyLevel)\n\t*p = x\n\treturn p\n}\n\nfunc (x MethodOptions_IdempotencyLevel) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (MethodOptions_IdempotencyLevel) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_google_protobuf_descriptor_proto_enumTypes[5].Descriptor()\n}\n\nfunc (MethodOptions_IdempotencyLevel) Type() protoreflect.EnumType {\n\treturn &file_google_protobuf_descriptor_proto_enumTypes[5]\n}\n\nfunc (x MethodOptions_IdempotencyLevel) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Do not use.\nfunc (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = MethodOptions_IdempotencyLevel(num)\n\treturn nil\n}\n\n// Deprecated: Use MethodOptions_IdempotencyLevel.Descriptor instead.\nfunc (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{17, 0}\n}\n\n// The protocol compiler can output a FileDescriptorSet containing the .proto\n// files it parses.\ntype FileDescriptorSet struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tFile []*FileDescriptorProto `protobuf:\"bytes,1,rep,name=file\" json:\"file,omitempty\"`\n}\n\nfunc (x *FileDescriptorSet) Reset() {\n\t*x = FileDescriptorSet{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *FileDescriptorSet) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*FileDescriptorSet) ProtoMessage() {}\n\nfunc (x *FileDescriptorSet) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use FileDescriptorSet.ProtoReflect.Descriptor instead.\nfunc (*FileDescriptorSet) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{0}\n}\n\nfunc (x *FileDescriptorSet) GetFile() []*FileDescriptorProto {\n\tif x != nil {\n\t\treturn x.File\n\t}\n\treturn nil\n}\n\n// Describes a complete .proto file.\ntype FileDescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName    *string `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`       // file name, relative to root of source tree\n\tPackage *string `protobuf:\"bytes,2,opt,name=package\" json:\"package,omitempty\"` // e.g. \"foo\", \"foo.bar\", etc.\n\t// Names of files imported by this file.\n\tDependency []string `protobuf:\"bytes,3,rep,name=dependency\" json:\"dependency,omitempty\"`\n\t// Indexes of the public imported files in the dependency list above.\n\tPublicDependency []int32 `protobuf:\"varint,10,rep,name=public_dependency,json=publicDependency\" json:\"public_dependency,omitempty\"`\n\t// Indexes of the weak imported files in the dependency list.\n\t// For Google-internal migration only. Do not use.\n\tWeakDependency []int32 `protobuf:\"varint,11,rep,name=weak_dependency,json=weakDependency\" json:\"weak_dependency,omitempty\"`\n\t// All top-level definitions in this file.\n\tMessageType []*DescriptorProto        `protobuf:\"bytes,4,rep,name=message_type,json=messageType\" json:\"message_type,omitempty\"`\n\tEnumType    []*EnumDescriptorProto    `protobuf:\"bytes,5,rep,name=enum_type,json=enumType\" json:\"enum_type,omitempty\"`\n\tService     []*ServiceDescriptorProto `protobuf:\"bytes,6,rep,name=service\" json:\"service,omitempty\"`\n\tExtension   []*FieldDescriptorProto   `protobuf:\"bytes,7,rep,name=extension\" json:\"extension,omitempty\"`\n\tOptions     *FileOptions              `protobuf:\"bytes,8,opt,name=options\" json:\"options,omitempty\"`\n\t// This field contains optional information about the original source code.\n\t// You may safely remove this entire field without harming runtime\n\t// functionality of the descriptors -- the information is needed only by\n\t// development tools.\n\tSourceCodeInfo *SourceCodeInfo `protobuf:\"bytes,9,opt,name=source_code_info,json=sourceCodeInfo\" json:\"source_code_info,omitempty\"`\n\t// The syntax of the proto file.\n\t// The supported values are \"proto2\" and \"proto3\".\n\tSyntax *string `protobuf:\"bytes,12,opt,name=syntax\" json:\"syntax,omitempty\"`\n}\n\nfunc (x *FileDescriptorProto) Reset() {\n\t*x = FileDescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[1]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *FileDescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*FileDescriptorProto) ProtoMessage() {}\n\nfunc (x *FileDescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[1]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use FileDescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*FileDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{1}\n}\n\nfunc (x *FileDescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileDescriptorProto) GetPackage() string {\n\tif x != nil && x.Package != nil {\n\t\treturn *x.Package\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileDescriptorProto) GetDependency() []string {\n\tif x != nil {\n\t\treturn x.Dependency\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetPublicDependency() []int32 {\n\tif x != nil {\n\t\treturn x.PublicDependency\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetWeakDependency() []int32 {\n\tif x != nil {\n\t\treturn x.WeakDependency\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetMessageType() []*DescriptorProto {\n\tif x != nil {\n\t\treturn x.MessageType\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto {\n\tif x != nil {\n\t\treturn x.EnumType\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetService() []*ServiceDescriptorProto {\n\tif x != nil {\n\t\treturn x.Service\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetExtension() []*FieldDescriptorProto {\n\tif x != nil {\n\t\treturn x.Extension\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetOptions() *FileOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo {\n\tif x != nil {\n\t\treturn x.SourceCodeInfo\n\t}\n\treturn nil\n}\n\nfunc (x *FileDescriptorProto) GetSyntax() string {\n\tif x != nil && x.Syntax != nil {\n\t\treturn *x.Syntax\n\t}\n\treturn \"\"\n}\n\n// Describes a message type.\ntype DescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName           *string                           `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tField          []*FieldDescriptorProto           `protobuf:\"bytes,2,rep,name=field\" json:\"field,omitempty\"`\n\tExtension      []*FieldDescriptorProto           `protobuf:\"bytes,6,rep,name=extension\" json:\"extension,omitempty\"`\n\tNestedType     []*DescriptorProto                `protobuf:\"bytes,3,rep,name=nested_type,json=nestedType\" json:\"nested_type,omitempty\"`\n\tEnumType       []*EnumDescriptorProto            `protobuf:\"bytes,4,rep,name=enum_type,json=enumType\" json:\"enum_type,omitempty\"`\n\tExtensionRange []*DescriptorProto_ExtensionRange `protobuf:\"bytes,5,rep,name=extension_range,json=extensionRange\" json:\"extension_range,omitempty\"`\n\tOneofDecl      []*OneofDescriptorProto           `protobuf:\"bytes,8,rep,name=oneof_decl,json=oneofDecl\" json:\"oneof_decl,omitempty\"`\n\tOptions        *MessageOptions                   `protobuf:\"bytes,7,opt,name=options\" json:\"options,omitempty\"`\n\tReservedRange  []*DescriptorProto_ReservedRange  `protobuf:\"bytes,9,rep,name=reserved_range,json=reservedRange\" json:\"reserved_range,omitempty\"`\n\t// Reserved field names, which may not be used by fields in the same message.\n\t// A given name may only be reserved once.\n\tReservedName []string `protobuf:\"bytes,10,rep,name=reserved_name,json=reservedName\" json:\"reserved_name,omitempty\"`\n}\n\nfunc (x *DescriptorProto) Reset() {\n\t*x = DescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[2]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *DescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*DescriptorProto) ProtoMessage() {}\n\nfunc (x *DescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[2]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use DescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*DescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{2}\n}\n\nfunc (x *DescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *DescriptorProto) GetField() []*FieldDescriptorProto {\n\tif x != nil {\n\t\treturn x.Field\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetExtension() []*FieldDescriptorProto {\n\tif x != nil {\n\t\treturn x.Extension\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetNestedType() []*DescriptorProto {\n\tif x != nil {\n\t\treturn x.NestedType\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetEnumType() []*EnumDescriptorProto {\n\tif x != nil {\n\t\treturn x.EnumType\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange {\n\tif x != nil {\n\t\treturn x.ExtensionRange\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetOneofDecl() []*OneofDescriptorProto {\n\tif x != nil {\n\t\treturn x.OneofDecl\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetOptions() *MessageOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetReservedRange() []*DescriptorProto_ReservedRange {\n\tif x != nil {\n\t\treturn x.ReservedRange\n\t}\n\treturn nil\n}\n\nfunc (x *DescriptorProto) GetReservedName() []string {\n\tif x != nil {\n\t\treturn x.ReservedName\n\t}\n\treturn nil\n}\n\ntype ExtensionRangeOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\nfunc (x *ExtensionRangeOptions) Reset() {\n\t*x = ExtensionRangeOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[3]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *ExtensionRangeOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*ExtensionRangeOptions) ProtoMessage() {}\n\nfunc (x *ExtensionRangeOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[3]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use ExtensionRangeOptions.ProtoReflect.Descriptor instead.\nfunc (*ExtensionRangeOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{3}\n}\n\nvar extRange_ExtensionRangeOptions = []protoiface.ExtensionRangeV1{\n\t{Start: 1000, End: 536870911},\n}\n\n// Deprecated: Use ExtensionRangeOptions.ProtoReflect.Descriptor.ExtensionRanges instead.\nfunc (*ExtensionRangeOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {\n\treturn extRange_ExtensionRangeOptions\n}\n\nfunc (x *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\n// Describes a field within a message.\ntype FieldDescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName   *string                     `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tNumber *int32                      `protobuf:\"varint,3,opt,name=number\" json:\"number,omitempty\"`\n\tLabel  *FieldDescriptorProto_Label `protobuf:\"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label\" json:\"label,omitempty\"`\n\t// If type_name is set, this need not be set.  If both this and type_name\n\t// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.\n\tType *FieldDescriptorProto_Type `protobuf:\"varint,5,opt,name=type,enum=google.protobuf.FieldDescriptorProto_Type\" json:\"type,omitempty\"`\n\t// For message and enum types, this is the name of the type.  If the name\n\t// starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping\n\t// rules are used to find the type (i.e. first the nested types within this\n\t// message are searched, then within the parent, on up to the root\n\t// namespace).\n\tTypeName *string `protobuf:\"bytes,6,opt,name=type_name,json=typeName\" json:\"type_name,omitempty\"`\n\t// For extensions, this is the name of the type being extended.  It is\n\t// resolved in the same manner as type_name.\n\tExtendee *string `protobuf:\"bytes,2,opt,name=extendee\" json:\"extendee,omitempty\"`\n\t// For numeric types, contains the original text representation of the value.\n\t// For booleans, \"true\" or \"false\".\n\t// For strings, contains the default text contents (not escaped in any way).\n\t// For bytes, contains the C escaped value.  All bytes >= 128 are escaped.\n\t// TODO(kenton):  Base-64 encode?\n\tDefaultValue *string `protobuf:\"bytes,7,opt,name=default_value,json=defaultValue\" json:\"default_value,omitempty\"`\n\t// If set, gives the index of a oneof in the containing type's oneof_decl\n\t// list.  This field is a member of that oneof.\n\tOneofIndex *int32 `protobuf:\"varint,9,opt,name=oneof_index,json=oneofIndex\" json:\"oneof_index,omitempty\"`\n\t// JSON name of this field. The value is set by protocol compiler. If the\n\t// user has set a \"json_name\" option on this field, that option's value\n\t// will be used. Otherwise, it's deduced from the field's name by converting\n\t// it to camelCase.\n\tJsonName *string       `protobuf:\"bytes,10,opt,name=json_name,json=jsonName\" json:\"json_name,omitempty\"`\n\tOptions  *FieldOptions `protobuf:\"bytes,8,opt,name=options\" json:\"options,omitempty\"`\n\t// If true, this is a proto3 \"optional\". When a proto3 field is optional, it\n\t// tracks presence regardless of field type.\n\t//\n\t// When proto3_optional is true, this field must be belong to a oneof to\n\t// signal to old proto3 clients that presence is tracked for this field. This\n\t// oneof is known as a \"synthetic\" oneof, and this field must be its sole\n\t// member (each proto3 optional field gets its own synthetic oneof). Synthetic\n\t// oneofs exist in the descriptor only, and do not generate any API. Synthetic\n\t// oneofs must be ordered after all \"real\" oneofs.\n\t//\n\t// For message fields, proto3_optional doesn't create any semantic change,\n\t// since non-repeated message fields always track presence. However it still\n\t// indicates the semantic detail of whether the user wrote \"optional\" or not.\n\t// This can be useful for round-tripping the .proto file. For consistency we\n\t// give message fields a synthetic oneof also, even though it is not required\n\t// to track presence. This is especially important because the parser can't\n\t// tell if a field is a message or an enum, so it must always create a\n\t// synthetic oneof.\n\t//\n\t// Proto2 optional fields do not set this flag, because they already indicate\n\t// optional with `LABEL_OPTIONAL`.\n\tProto3Optional *bool `protobuf:\"varint,17,opt,name=proto3_optional,json=proto3Optional\" json:\"proto3_optional,omitempty\"`\n}\n\nfunc (x *FieldDescriptorProto) Reset() {\n\t*x = FieldDescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[4]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *FieldDescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*FieldDescriptorProto) ProtoMessage() {}\n\nfunc (x *FieldDescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[4]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use FieldDescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*FieldDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{4}\n}\n\nfunc (x *FieldDescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *FieldDescriptorProto) GetNumber() int32 {\n\tif x != nil && x.Number != nil {\n\t\treturn *x.Number\n\t}\n\treturn 0\n}\n\nfunc (x *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label {\n\tif x != nil && x.Label != nil {\n\t\treturn *x.Label\n\t}\n\treturn FieldDescriptorProto_LABEL_OPTIONAL\n}\n\nfunc (x *FieldDescriptorProto) GetType() FieldDescriptorProto_Type {\n\tif x != nil && x.Type != nil {\n\t\treturn *x.Type\n\t}\n\treturn FieldDescriptorProto_TYPE_DOUBLE\n}\n\nfunc (x *FieldDescriptorProto) GetTypeName() string {\n\tif x != nil && x.TypeName != nil {\n\t\treturn *x.TypeName\n\t}\n\treturn \"\"\n}\n\nfunc (x *FieldDescriptorProto) GetExtendee() string {\n\tif x != nil && x.Extendee != nil {\n\t\treturn *x.Extendee\n\t}\n\treturn \"\"\n}\n\nfunc (x *FieldDescriptorProto) GetDefaultValue() string {\n\tif x != nil && x.DefaultValue != nil {\n\t\treturn *x.DefaultValue\n\t}\n\treturn \"\"\n}\n\nfunc (x *FieldDescriptorProto) GetOneofIndex() int32 {\n\tif x != nil && x.OneofIndex != nil {\n\t\treturn *x.OneofIndex\n\t}\n\treturn 0\n}\n\nfunc (x *FieldDescriptorProto) GetJsonName() string {\n\tif x != nil && x.JsonName != nil {\n\t\treturn *x.JsonName\n\t}\n\treturn \"\"\n}\n\nfunc (x *FieldDescriptorProto) GetOptions() *FieldOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\nfunc (x *FieldDescriptorProto) GetProto3Optional() bool {\n\tif x != nil && x.Proto3Optional != nil {\n\t\treturn *x.Proto3Optional\n\t}\n\treturn false\n}\n\n// Describes a oneof.\ntype OneofDescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName    *string       `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tOptions *OneofOptions `protobuf:\"bytes,2,opt,name=options\" json:\"options,omitempty\"`\n}\n\nfunc (x *OneofDescriptorProto) Reset() {\n\t*x = OneofDescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[5]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *OneofDescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*OneofDescriptorProto) ProtoMessage() {}\n\nfunc (x *OneofDescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[5]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use OneofDescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*OneofDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{5}\n}\n\nfunc (x *OneofDescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *OneofDescriptorProto) GetOptions() *OneofOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\n// Describes an enum type.\ntype EnumDescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName    *string                     `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tValue   []*EnumValueDescriptorProto `protobuf:\"bytes,2,rep,name=value\" json:\"value,omitempty\"`\n\tOptions *EnumOptions                `protobuf:\"bytes,3,opt,name=options\" json:\"options,omitempty\"`\n\t// Range of reserved numeric values. Reserved numeric values may not be used\n\t// by enum values in the same enum declaration. Reserved ranges may not\n\t// overlap.\n\tReservedRange []*EnumDescriptorProto_EnumReservedRange `protobuf:\"bytes,4,rep,name=reserved_range,json=reservedRange\" json:\"reserved_range,omitempty\"`\n\t// Reserved enum value names, which may not be reused. A given name may only\n\t// be reserved once.\n\tReservedName []string `protobuf:\"bytes,5,rep,name=reserved_name,json=reservedName\" json:\"reserved_name,omitempty\"`\n}\n\nfunc (x *EnumDescriptorProto) Reset() {\n\t*x = EnumDescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[6]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *EnumDescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*EnumDescriptorProto) ProtoMessage() {}\n\nfunc (x *EnumDescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[6]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use EnumDescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*EnumDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{6}\n}\n\nfunc (x *EnumDescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto {\n\tif x != nil {\n\t\treturn x.Value\n\t}\n\treturn nil\n}\n\nfunc (x *EnumDescriptorProto) GetOptions() *EnumOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\nfunc (x *EnumDescriptorProto) GetReservedRange() []*EnumDescriptorProto_EnumReservedRange {\n\tif x != nil {\n\t\treturn x.ReservedRange\n\t}\n\treturn nil\n}\n\nfunc (x *EnumDescriptorProto) GetReservedName() []string {\n\tif x != nil {\n\t\treturn x.ReservedName\n\t}\n\treturn nil\n}\n\n// Describes a value within an enum.\ntype EnumValueDescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName    *string           `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tNumber  *int32            `protobuf:\"varint,2,opt,name=number\" json:\"number,omitempty\"`\n\tOptions *EnumValueOptions `protobuf:\"bytes,3,opt,name=options\" json:\"options,omitempty\"`\n}\n\nfunc (x *EnumValueDescriptorProto) Reset() {\n\t*x = EnumValueDescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[7]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *EnumValueDescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*EnumValueDescriptorProto) ProtoMessage() {}\n\nfunc (x *EnumValueDescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[7]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use EnumValueDescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{7}\n}\n\nfunc (x *EnumValueDescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *EnumValueDescriptorProto) GetNumber() int32 {\n\tif x != nil && x.Number != nil {\n\t\treturn *x.Number\n\t}\n\treturn 0\n}\n\nfunc (x *EnumValueDescriptorProto) GetOptions() *EnumValueOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\n// Describes a service.\ntype ServiceDescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName    *string                  `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\tMethod  []*MethodDescriptorProto `protobuf:\"bytes,2,rep,name=method\" json:\"method,omitempty\"`\n\tOptions *ServiceOptions          `protobuf:\"bytes,3,opt,name=options\" json:\"options,omitempty\"`\n}\n\nfunc (x *ServiceDescriptorProto) Reset() {\n\t*x = ServiceDescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[8]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *ServiceDescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*ServiceDescriptorProto) ProtoMessage() {}\n\nfunc (x *ServiceDescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[8]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use ServiceDescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*ServiceDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{8}\n}\n\nfunc (x *ServiceDescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto {\n\tif x != nil {\n\t\treturn x.Method\n\t}\n\treturn nil\n}\n\nfunc (x *ServiceDescriptorProto) GetOptions() *ServiceOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\n// Describes a method of a service.\ntype MethodDescriptorProto struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName *string `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\t// Input and output type names.  These are resolved in the same way as\n\t// FieldDescriptorProto.type_name, but must refer to a message type.\n\tInputType  *string        `protobuf:\"bytes,2,opt,name=input_type,json=inputType\" json:\"input_type,omitempty\"`\n\tOutputType *string        `protobuf:\"bytes,3,opt,name=output_type,json=outputType\" json:\"output_type,omitempty\"`\n\tOptions    *MethodOptions `protobuf:\"bytes,4,opt,name=options\" json:\"options,omitempty\"`\n\t// Identifies if client streams multiple client messages\n\tClientStreaming *bool `protobuf:\"varint,5,opt,name=client_streaming,json=clientStreaming,def=0\" json:\"client_streaming,omitempty\"`\n\t// Identifies if server streams multiple server messages\n\tServerStreaming *bool `protobuf:\"varint,6,opt,name=server_streaming,json=serverStreaming,def=0\" json:\"server_streaming,omitempty\"`\n}\n\n// Default values for MethodDescriptorProto fields.\nconst (\n\tDefault_MethodDescriptorProto_ClientStreaming = bool(false)\n\tDefault_MethodDescriptorProto_ServerStreaming = bool(false)\n)\n\nfunc (x *MethodDescriptorProto) Reset() {\n\t*x = MethodDescriptorProto{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[9]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *MethodDescriptorProto) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*MethodDescriptorProto) ProtoMessage() {}\n\nfunc (x *MethodDescriptorProto) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[9]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use MethodDescriptorProto.ProtoReflect.Descriptor instead.\nfunc (*MethodDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{9}\n}\n\nfunc (x *MethodDescriptorProto) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *MethodDescriptorProto) GetInputType() string {\n\tif x != nil && x.InputType != nil {\n\t\treturn *x.InputType\n\t}\n\treturn \"\"\n}\n\nfunc (x *MethodDescriptorProto) GetOutputType() string {\n\tif x != nil && x.OutputType != nil {\n\t\treturn *x.OutputType\n\t}\n\treturn \"\"\n}\n\nfunc (x *MethodDescriptorProto) GetOptions() *MethodOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\nfunc (x *MethodDescriptorProto) GetClientStreaming() bool {\n\tif x != nil && x.ClientStreaming != nil {\n\t\treturn *x.ClientStreaming\n\t}\n\treturn Default_MethodDescriptorProto_ClientStreaming\n}\n\nfunc (x *MethodDescriptorProto) GetServerStreaming() bool {\n\tif x != nil && x.ServerStreaming != nil {\n\t\treturn *x.ServerStreaming\n\t}\n\treturn Default_MethodDescriptorProto_ServerStreaming\n}\n\ntype FileOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// Sets the Java package where classes generated from this .proto will be\n\t// placed.  By default, the proto package is used, but this is often\n\t// inappropriate because proto packages do not normally start with backwards\n\t// domain names.\n\tJavaPackage *string `protobuf:\"bytes,1,opt,name=java_package,json=javaPackage\" json:\"java_package,omitempty\"`\n\t// If set, all the classes from the .proto file are wrapped in a single\n\t// outer class with the given name.  This applies to both Proto1\n\t// (equivalent to the old \"--one_java_file\" option) and Proto2 (where\n\t// a .proto always translates to a single class, but you may want to\n\t// explicitly choose the class name).\n\tJavaOuterClassname *string `protobuf:\"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname\" json:\"java_outer_classname,omitempty\"`\n\t// If set true, then the Java code generator will generate a separate .java\n\t// file for each top-level message, enum, and service defined in the .proto\n\t// file.  Thus, these types will *not* be nested inside the outer class\n\t// named by java_outer_classname.  However, the outer class will still be\n\t// generated to contain the file's getDescriptor() method as well as any\n\t// top-level extensions defined in the file.\n\tJavaMultipleFiles *bool `protobuf:\"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0\" json:\"java_multiple_files,omitempty\"`\n\t// This option does nothing.\n\t//\n\t// Deprecated: Do not use.\n\tJavaGenerateEqualsAndHash *bool `protobuf:\"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash\" json:\"java_generate_equals_and_hash,omitempty\"`\n\t// If set true, then the Java2 code generator will generate code that\n\t// throws an exception whenever an attempt is made to assign a non-UTF-8\n\t// byte sequence to a string field.\n\t// Message reflection will do the same.\n\t// However, an extension field still accepts non-UTF-8 byte sequences.\n\t// This option has no effect on when used with the lite runtime.\n\tJavaStringCheckUtf8 *bool                     `protobuf:\"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0\" json:\"java_string_check_utf8,omitempty\"`\n\tOptimizeFor         *FileOptions_OptimizeMode `protobuf:\"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1\" json:\"optimize_for,omitempty\"`\n\t// Sets the Go package where structs generated from this .proto will be\n\t// placed. If omitted, the Go package will be derived from the following:\n\t//   - The basename of the package import path, if provided.\n\t//   - Otherwise, the package statement in the .proto file, if present.\n\t//   - Otherwise, the basename of the .proto file, without extension.\n\tGoPackage *string `protobuf:\"bytes,11,opt,name=go_package,json=goPackage\" json:\"go_package,omitempty\"`\n\t// Should generic services be generated in each language?  \"Generic\" services\n\t// are not specific to any particular RPC system.  They are generated by the\n\t// main code generators in each language (without additional plugins).\n\t// Generic services were the only kind of service generation supported by\n\t// early versions of google.protobuf.\n\t//\n\t// Generic services are now considered deprecated in favor of using plugins\n\t// that generate code specific to your particular RPC system.  Therefore,\n\t// these default to false.  Old code which depends on generic services should\n\t// explicitly set them to true.\n\tCcGenericServices   *bool `protobuf:\"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0\" json:\"cc_generic_services,omitempty\"`\n\tJavaGenericServices *bool `protobuf:\"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0\" json:\"java_generic_services,omitempty\"`\n\tPyGenericServices   *bool `protobuf:\"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0\" json:\"py_generic_services,omitempty\"`\n\tPhpGenericServices  *bool `protobuf:\"varint,42,opt,name=php_generic_services,json=phpGenericServices,def=0\" json:\"php_generic_services,omitempty\"`\n\t// Is this file deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for everything in the file, or it will be completely ignored; in the very\n\t// least, this is a formalization for deprecating files.\n\tDeprecated *bool `protobuf:\"varint,23,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// Enables the use of arenas for the proto messages in this file. This applies\n\t// only to generated classes for C++.\n\tCcEnableArenas *bool `protobuf:\"varint,31,opt,name=cc_enable_arenas,json=ccEnableArenas,def=1\" json:\"cc_enable_arenas,omitempty\"`\n\t// Sets the objective c class prefix which is prepended to all objective c\n\t// generated classes from this .proto. There is no default.\n\tObjcClassPrefix *string `protobuf:\"bytes,36,opt,name=objc_class_prefix,json=objcClassPrefix\" json:\"objc_class_prefix,omitempty\"`\n\t// Namespace for generated classes; defaults to the package.\n\tCsharpNamespace *string `protobuf:\"bytes,37,opt,name=csharp_namespace,json=csharpNamespace\" json:\"csharp_namespace,omitempty\"`\n\t// By default Swift generators will take the proto package and CamelCase it\n\t// replacing '.' with underscore and use that to prefix the types/symbols\n\t// defined. When this options is provided, they will use this value instead\n\t// to prefix the types/symbols defined.\n\tSwiftPrefix *string `protobuf:\"bytes,39,opt,name=swift_prefix,json=swiftPrefix\" json:\"swift_prefix,omitempty\"`\n\t// Sets the php class prefix which is prepended to all php generated classes\n\t// from this .proto. Default is empty.\n\tPhpClassPrefix *string `protobuf:\"bytes,40,opt,name=php_class_prefix,json=phpClassPrefix\" json:\"php_class_prefix,omitempty\"`\n\t// Use this option to change the namespace of php generated classes. Default\n\t// is empty. When this option is empty, the package name will be used for\n\t// determining the namespace.\n\tPhpNamespace *string `protobuf:\"bytes,41,opt,name=php_namespace,json=phpNamespace\" json:\"php_namespace,omitempty\"`\n\t// Use this option to change the namespace of php generated metadata classes.\n\t// Default is empty. When this option is empty, the proto file name will be\n\t// used for determining the namespace.\n\tPhpMetadataNamespace *string `protobuf:\"bytes,44,opt,name=php_metadata_namespace,json=phpMetadataNamespace\" json:\"php_metadata_namespace,omitempty\"`\n\t// Use this option to change the package of ruby generated classes. Default\n\t// is empty. When this option is not set, the package name will be used for\n\t// determining the ruby package.\n\tRubyPackage *string `protobuf:\"bytes,45,opt,name=ruby_package,json=rubyPackage\" json:\"ruby_package,omitempty\"`\n\t// The parser stores options it doesn't recognize here.\n\t// See the documentation for the \"Options\" section above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\n// Default values for FileOptions fields.\nconst (\n\tDefault_FileOptions_JavaMultipleFiles   = bool(false)\n\tDefault_FileOptions_JavaStringCheckUtf8 = bool(false)\n\tDefault_FileOptions_OptimizeFor         = FileOptions_SPEED\n\tDefault_FileOptions_CcGenericServices   = bool(false)\n\tDefault_FileOptions_JavaGenericServices = bool(false)\n\tDefault_FileOptions_PyGenericServices   = bool(false)\n\tDefault_FileOptions_PhpGenericServices  = bool(false)\n\tDefault_FileOptions_Deprecated          = bool(false)\n\tDefault_FileOptions_CcEnableArenas      = bool(true)\n)\n\nfunc (x *FileOptions) Reset() {\n\t*x = FileOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[10]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *FileOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*FileOptions) ProtoMessage() {}\n\nfunc (x *FileOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[10]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use FileOptions.ProtoReflect.Descriptor instead.\nfunc (*FileOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{10}\n}\n\nvar extRange_FileOptions = []protoiface.ExtensionRangeV1{\n\t{Start: 1000, End: 536870911},\n}\n\n// Deprecated: Use FileOptions.ProtoReflect.Descriptor.ExtensionRanges instead.\nfunc (*FileOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {\n\treturn extRange_FileOptions\n}\n\nfunc (x *FileOptions) GetJavaPackage() string {\n\tif x != nil && x.JavaPackage != nil {\n\t\treturn *x.JavaPackage\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetJavaOuterClassname() string {\n\tif x != nil && x.JavaOuterClassname != nil {\n\t\treturn *x.JavaOuterClassname\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetJavaMultipleFiles() bool {\n\tif x != nil && x.JavaMultipleFiles != nil {\n\t\treturn *x.JavaMultipleFiles\n\t}\n\treturn Default_FileOptions_JavaMultipleFiles\n}\n\n// Deprecated: Do not use.\nfunc (x *FileOptions) GetJavaGenerateEqualsAndHash() bool {\n\tif x != nil && x.JavaGenerateEqualsAndHash != nil {\n\t\treturn *x.JavaGenerateEqualsAndHash\n\t}\n\treturn false\n}\n\nfunc (x *FileOptions) GetJavaStringCheckUtf8() bool {\n\tif x != nil && x.JavaStringCheckUtf8 != nil {\n\t\treturn *x.JavaStringCheckUtf8\n\t}\n\treturn Default_FileOptions_JavaStringCheckUtf8\n}\n\nfunc (x *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode {\n\tif x != nil && x.OptimizeFor != nil {\n\t\treturn *x.OptimizeFor\n\t}\n\treturn Default_FileOptions_OptimizeFor\n}\n\nfunc (x *FileOptions) GetGoPackage() string {\n\tif x != nil && x.GoPackage != nil {\n\t\treturn *x.GoPackage\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetCcGenericServices() bool {\n\tif x != nil && x.CcGenericServices != nil {\n\t\treturn *x.CcGenericServices\n\t}\n\treturn Default_FileOptions_CcGenericServices\n}\n\nfunc (x *FileOptions) GetJavaGenericServices() bool {\n\tif x != nil && x.JavaGenericServices != nil {\n\t\treturn *x.JavaGenericServices\n\t}\n\treturn Default_FileOptions_JavaGenericServices\n}\n\nfunc (x *FileOptions) GetPyGenericServices() bool {\n\tif x != nil && x.PyGenericServices != nil {\n\t\treturn *x.PyGenericServices\n\t}\n\treturn Default_FileOptions_PyGenericServices\n}\n\nfunc (x *FileOptions) GetPhpGenericServices() bool {\n\tif x != nil && x.PhpGenericServices != nil {\n\t\treturn *x.PhpGenericServices\n\t}\n\treturn Default_FileOptions_PhpGenericServices\n}\n\nfunc (x *FileOptions) GetDeprecated() bool {\n\tif x != nil && x.Deprecated != nil {\n\t\treturn *x.Deprecated\n\t}\n\treturn Default_FileOptions_Deprecated\n}\n\nfunc (x *FileOptions) GetCcEnableArenas() bool {\n\tif x != nil && x.CcEnableArenas != nil {\n\t\treturn *x.CcEnableArenas\n\t}\n\treturn Default_FileOptions_CcEnableArenas\n}\n\nfunc (x *FileOptions) GetObjcClassPrefix() string {\n\tif x != nil && x.ObjcClassPrefix != nil {\n\t\treturn *x.ObjcClassPrefix\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetCsharpNamespace() string {\n\tif x != nil && x.CsharpNamespace != nil {\n\t\treturn *x.CsharpNamespace\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetSwiftPrefix() string {\n\tif x != nil && x.SwiftPrefix != nil {\n\t\treturn *x.SwiftPrefix\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetPhpClassPrefix() string {\n\tif x != nil && x.PhpClassPrefix != nil {\n\t\treturn *x.PhpClassPrefix\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetPhpNamespace() string {\n\tif x != nil && x.PhpNamespace != nil {\n\t\treturn *x.PhpNamespace\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetPhpMetadataNamespace() string {\n\tif x != nil && x.PhpMetadataNamespace != nil {\n\t\treturn *x.PhpMetadataNamespace\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetRubyPackage() string {\n\tif x != nil && x.RubyPackage != nil {\n\t\treturn *x.RubyPackage\n\t}\n\treturn \"\"\n}\n\nfunc (x *FileOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype MessageOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// Set true to use the old proto1 MessageSet wire format for extensions.\n\t// This is provided for backwards-compatibility with the MessageSet wire\n\t// format.  You should not use this for any other reason:  It's less\n\t// efficient, has fewer features, and is more complicated.\n\t//\n\t// The message must be defined exactly as follows:\n\t//   message Foo {\n\t//     option message_set_wire_format = true;\n\t//     extensions 4 to max;\n\t//   }\n\t// Note that the message cannot have any defined fields; MessageSets only\n\t// have extensions.\n\t//\n\t// All extensions of your type must be singular messages; e.g. they cannot\n\t// be int32s, enums, or repeated messages.\n\t//\n\t// Because this is an option, the above two restrictions are not enforced by\n\t// the protocol compiler.\n\tMessageSetWireFormat *bool `protobuf:\"varint,1,opt,name=message_set_wire_format,json=messageSetWireFormat,def=0\" json:\"message_set_wire_format,omitempty\"`\n\t// Disables the generation of the standard \"descriptor()\" accessor, which can\n\t// conflict with a field of the same name.  This is meant to make migration\n\t// from proto1 easier; new code should avoid fields named \"descriptor\".\n\tNoStandardDescriptorAccessor *bool `protobuf:\"varint,2,opt,name=no_standard_descriptor_accessor,json=noStandardDescriptorAccessor,def=0\" json:\"no_standard_descriptor_accessor,omitempty\"`\n\t// Is this message deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the message, or it will be completely ignored; in the very least,\n\t// this is a formalization for deprecating messages.\n\tDeprecated *bool `protobuf:\"varint,3,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// Whether the message is an automatically generated map entry type for the\n\t// maps field.\n\t//\n\t// For maps fields:\n\t//     map<KeyType, ValueType> map_field = 1;\n\t// The parsed descriptor looks like:\n\t//     message MapFieldEntry {\n\t//         option map_entry = true;\n\t//         optional KeyType key = 1;\n\t//         optional ValueType value = 2;\n\t//     }\n\t//     repeated MapFieldEntry map_field = 1;\n\t//\n\t// Implementations may choose not to generate the map_entry=true message, but\n\t// use a native map in the target language to hold the keys and values.\n\t// The reflection APIs in such implementations still need to work as\n\t// if the field is a repeated message field.\n\t//\n\t// NOTE: Do not set the option in .proto files. Always use the maps syntax\n\t// instead. The option should only be implicitly set by the proto compiler\n\t// parser.\n\tMapEntry *bool `protobuf:\"varint,7,opt,name=map_entry,json=mapEntry\" json:\"map_entry,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\n// Default values for MessageOptions fields.\nconst (\n\tDefault_MessageOptions_MessageSetWireFormat         = bool(false)\n\tDefault_MessageOptions_NoStandardDescriptorAccessor = bool(false)\n\tDefault_MessageOptions_Deprecated                   = bool(false)\n)\n\nfunc (x *MessageOptions) Reset() {\n\t*x = MessageOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[11]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *MessageOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*MessageOptions) ProtoMessage() {}\n\nfunc (x *MessageOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[11]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use MessageOptions.ProtoReflect.Descriptor instead.\nfunc (*MessageOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{11}\n}\n\nvar extRange_MessageOptions = []protoiface.ExtensionRangeV1{\n\t{Start: 1000, End: 536870911},\n}\n\n// Deprecated: Use MessageOptions.ProtoReflect.Descriptor.ExtensionRanges instead.\nfunc (*MessageOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {\n\treturn extRange_MessageOptions\n}\n\nfunc (x *MessageOptions) GetMessageSetWireFormat() bool {\n\tif x != nil && x.MessageSetWireFormat != nil {\n\t\treturn *x.MessageSetWireFormat\n\t}\n\treturn Default_MessageOptions_MessageSetWireFormat\n}\n\nfunc (x *MessageOptions) GetNoStandardDescriptorAccessor() bool {\n\tif x != nil && x.NoStandardDescriptorAccessor != nil {\n\t\treturn *x.NoStandardDescriptorAccessor\n\t}\n\treturn Default_MessageOptions_NoStandardDescriptorAccessor\n}\n\nfunc (x *MessageOptions) GetDeprecated() bool {\n\tif x != nil && x.Deprecated != nil {\n\t\treturn *x.Deprecated\n\t}\n\treturn Default_MessageOptions_Deprecated\n}\n\nfunc (x *MessageOptions) GetMapEntry() bool {\n\tif x != nil && x.MapEntry != nil {\n\t\treturn *x.MapEntry\n\t}\n\treturn false\n}\n\nfunc (x *MessageOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype FieldOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// The ctype option instructs the C++ code generator to use a different\n\t// representation of the field than it normally would.  See the specific\n\t// options below.  This option is not yet implemented in the open source\n\t// release -- sorry, we'll try to include it in a future version!\n\tCtype *FieldOptions_CType `protobuf:\"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0\" json:\"ctype,omitempty\"`\n\t// The packed option can be enabled for repeated primitive fields to enable\n\t// a more efficient representation on the wire. Rather than repeatedly\n\t// writing the tag and type for each element, the entire array is encoded as\n\t// a single length-delimited blob. In proto3, only explicit setting it to\n\t// false will avoid using packed encoding.\n\tPacked *bool `protobuf:\"varint,2,opt,name=packed\" json:\"packed,omitempty\"`\n\t// The jstype option determines the JavaScript type used for values of the\n\t// field.  The option is permitted only for 64 bit integral and fixed types\n\t// (int64, uint64, sint64, fixed64, sfixed64).  A field with jstype JS_STRING\n\t// is represented as JavaScript string, which avoids loss of precision that\n\t// can happen when a large value is converted to a floating point JavaScript.\n\t// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to\n\t// use the JavaScript \"number\" type.  The behavior of the default option\n\t// JS_NORMAL is implementation dependent.\n\t//\n\t// This option is an enum to permit additional types to be added, e.g.\n\t// goog.math.Integer.\n\tJstype *FieldOptions_JSType `protobuf:\"varint,6,opt,name=jstype,enum=google.protobuf.FieldOptions_JSType,def=0\" json:\"jstype,omitempty\"`\n\t// Should this field be parsed lazily?  Lazy applies only to message-type\n\t// fields.  It means that when the outer message is initially parsed, the\n\t// inner message's contents will not be parsed but instead stored in encoded\n\t// form.  The inner message will actually be parsed when it is first accessed.\n\t//\n\t// This is only a hint.  Implementations are free to choose whether to use\n\t// eager or lazy parsing regardless of the value of this option.  However,\n\t// setting this option true suggests that the protocol author believes that\n\t// using lazy parsing on this field is worth the additional bookkeeping\n\t// overhead typically needed to implement it.\n\t//\n\t// This option does not affect the public interface of any generated code;\n\t// all method signatures remain the same.  Furthermore, thread-safety of the\n\t// interface is not affected by this option; const methods remain safe to\n\t// call from multiple threads concurrently, while non-const methods continue\n\t// to require exclusive access.\n\t//\n\t//\n\t// Note that implementations may choose not to check required fields within\n\t// a lazy sub-message.  That is, calling IsInitialized() on the outer message\n\t// may return true even if the inner message has missing required fields.\n\t// This is necessary because otherwise the inner message would have to be\n\t// parsed in order to perform the check, defeating the purpose of lazy\n\t// parsing.  An implementation which chooses not to check required fields\n\t// must be consistent about it.  That is, for any particular sub-message, the\n\t// implementation must either *always* check its required fields, or *never*\n\t// check its required fields, regardless of whether or not the message has\n\t// been parsed.\n\tLazy *bool `protobuf:\"varint,5,opt,name=lazy,def=0\" json:\"lazy,omitempty\"`\n\t// Is this field deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for accessors, or it will be completely ignored; in the very least, this\n\t// is a formalization for deprecating fields.\n\tDeprecated *bool `protobuf:\"varint,3,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// For Google-internal migration only. Do not use.\n\tWeak *bool `protobuf:\"varint,10,opt,name=weak,def=0\" json:\"weak,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\n// Default values for FieldOptions fields.\nconst (\n\tDefault_FieldOptions_Ctype      = FieldOptions_STRING\n\tDefault_FieldOptions_Jstype     = FieldOptions_JS_NORMAL\n\tDefault_FieldOptions_Lazy       = bool(false)\n\tDefault_FieldOptions_Deprecated = bool(false)\n\tDefault_FieldOptions_Weak       = bool(false)\n)\n\nfunc (x *FieldOptions) Reset() {\n\t*x = FieldOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[12]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *FieldOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*FieldOptions) ProtoMessage() {}\n\nfunc (x *FieldOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[12]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use FieldOptions.ProtoReflect.Descriptor instead.\nfunc (*FieldOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12}\n}\n\nvar extRange_FieldOptions = []protoiface.ExtensionRangeV1{\n\t{Start: 1000, End: 536870911},\n}\n\n// Deprecated: Use FieldOptions.ProtoReflect.Descriptor.ExtensionRanges instead.\nfunc (*FieldOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {\n\treturn extRange_FieldOptions\n}\n\nfunc (x *FieldOptions) GetCtype() FieldOptions_CType {\n\tif x != nil && x.Ctype != nil {\n\t\treturn *x.Ctype\n\t}\n\treturn Default_FieldOptions_Ctype\n}\n\nfunc (x *FieldOptions) GetPacked() bool {\n\tif x != nil && x.Packed != nil {\n\t\treturn *x.Packed\n\t}\n\treturn false\n}\n\nfunc (x *FieldOptions) GetJstype() FieldOptions_JSType {\n\tif x != nil && x.Jstype != nil {\n\t\treturn *x.Jstype\n\t}\n\treturn Default_FieldOptions_Jstype\n}\n\nfunc (x *FieldOptions) GetLazy() bool {\n\tif x != nil && x.Lazy != nil {\n\t\treturn *x.Lazy\n\t}\n\treturn Default_FieldOptions_Lazy\n}\n\nfunc (x *FieldOptions) GetDeprecated() bool {\n\tif x != nil && x.Deprecated != nil {\n\t\treturn *x.Deprecated\n\t}\n\treturn Default_FieldOptions_Deprecated\n}\n\nfunc (x *FieldOptions) GetWeak() bool {\n\tif x != nil && x.Weak != nil {\n\t\treturn *x.Weak\n\t}\n\treturn Default_FieldOptions_Weak\n}\n\nfunc (x *FieldOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype OneofOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\nfunc (x *OneofOptions) Reset() {\n\t*x = OneofOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[13]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *OneofOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*OneofOptions) ProtoMessage() {}\n\nfunc (x *OneofOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[13]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use OneofOptions.ProtoReflect.Descriptor instead.\nfunc (*OneofOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{13}\n}\n\nvar extRange_OneofOptions = []protoiface.ExtensionRangeV1{\n\t{Start: 1000, End: 536870911},\n}\n\n// Deprecated: Use OneofOptions.ProtoReflect.Descriptor.ExtensionRanges instead.\nfunc (*OneofOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {\n\treturn extRange_OneofOptions\n}\n\nfunc (x *OneofOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype EnumOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// Set this option to true to allow mapping different tag names to the same\n\t// value.\n\tAllowAlias *bool `protobuf:\"varint,2,opt,name=allow_alias,json=allowAlias\" json:\"allow_alias,omitempty\"`\n\t// Is this enum deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the enum, or it will be completely ignored; in the very least, this\n\t// is a formalization for deprecating enums.\n\tDeprecated *bool `protobuf:\"varint,3,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\n// Default values for EnumOptions fields.\nconst (\n\tDefault_EnumOptions_Deprecated = bool(false)\n)\n\nfunc (x *EnumOptions) Reset() {\n\t*x = EnumOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[14]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *EnumOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*EnumOptions) ProtoMessage() {}\n\nfunc (x *EnumOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[14]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use EnumOptions.ProtoReflect.Descriptor instead.\nfunc (*EnumOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{14}\n}\n\nvar extRange_EnumOptions = []protoiface.ExtensionRangeV1{\n\t{Start: 1000, End: 536870911},\n}\n\n// Deprecated: Use EnumOptions.ProtoReflect.Descriptor.ExtensionRanges instead.\nfunc (*EnumOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {\n\treturn extRange_EnumOptions\n}\n\nfunc (x *EnumOptions) GetAllowAlias() bool {\n\tif x != nil && x.AllowAlias != nil {\n\t\treturn *x.AllowAlias\n\t}\n\treturn false\n}\n\nfunc (x *EnumOptions) GetDeprecated() bool {\n\tif x != nil && x.Deprecated != nil {\n\t\treturn *x.Deprecated\n\t}\n\treturn Default_EnumOptions_Deprecated\n}\n\nfunc (x *EnumOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype EnumValueOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// Is this enum value deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the enum value, or it will be completely ignored; in the very least,\n\t// this is a formalization for deprecating enum values.\n\tDeprecated *bool `protobuf:\"varint,1,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\n// Default values for EnumValueOptions fields.\nconst (\n\tDefault_EnumValueOptions_Deprecated = bool(false)\n)\n\nfunc (x *EnumValueOptions) Reset() {\n\t*x = EnumValueOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[15]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *EnumValueOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*EnumValueOptions) ProtoMessage() {}\n\nfunc (x *EnumValueOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[15]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use EnumValueOptions.ProtoReflect.Descriptor instead.\nfunc (*EnumValueOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{15}\n}\n\nvar extRange_EnumValueOptions = []protoiface.ExtensionRangeV1{\n\t{Start: 1000, End: 536870911},\n}\n\n// Deprecated: Use EnumValueOptions.ProtoReflect.Descriptor.ExtensionRanges instead.\nfunc (*EnumValueOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {\n\treturn extRange_EnumValueOptions\n}\n\nfunc (x *EnumValueOptions) GetDeprecated() bool {\n\tif x != nil && x.Deprecated != nil {\n\t\treturn *x.Deprecated\n\t}\n\treturn Default_EnumValueOptions_Deprecated\n}\n\nfunc (x *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype ServiceOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// Is this service deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the service, or it will be completely ignored; in the very least,\n\t// this is a formalization for deprecating services.\n\tDeprecated *bool `protobuf:\"varint,33,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\n// Default values for ServiceOptions fields.\nconst (\n\tDefault_ServiceOptions_Deprecated = bool(false)\n)\n\nfunc (x *ServiceOptions) Reset() {\n\t*x = ServiceOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[16]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *ServiceOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*ServiceOptions) ProtoMessage() {}\n\nfunc (x *ServiceOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[16]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use ServiceOptions.ProtoReflect.Descriptor instead.\nfunc (*ServiceOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{16}\n}\n\nvar extRange_ServiceOptions = []protoiface.ExtensionRangeV1{\n\t{Start: 1000, End: 536870911},\n}\n\n// Deprecated: Use ServiceOptions.ProtoReflect.Descriptor.ExtensionRanges instead.\nfunc (*ServiceOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {\n\treturn extRange_ServiceOptions\n}\n\nfunc (x *ServiceOptions) GetDeprecated() bool {\n\tif x != nil && x.Deprecated != nil {\n\t\treturn *x.Deprecated\n\t}\n\treturn Default_ServiceOptions_Deprecated\n}\n\nfunc (x *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\ntype MethodOptions struct {\n\tstate           protoimpl.MessageState\n\tsizeCache       protoimpl.SizeCache\n\tunknownFields   protoimpl.UnknownFields\n\textensionFields protoimpl.ExtensionFields\n\n\t// Is this method deprecated?\n\t// Depending on the target platform, this can emit Deprecated annotations\n\t// for the method, or it will be completely ignored; in the very least,\n\t// this is a formalization for deprecating methods.\n\tDeprecated       *bool                           `protobuf:\"varint,33,opt,name=deprecated,def=0\" json:\"deprecated,omitempty\"`\n\tIdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:\"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0\" json:\"idempotency_level,omitempty\"`\n\t// The parser stores options it doesn't recognize here. See above.\n\tUninterpretedOption []*UninterpretedOption `protobuf:\"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption\" json:\"uninterpreted_option,omitempty\"`\n}\n\n// Default values for MethodOptions fields.\nconst (\n\tDefault_MethodOptions_Deprecated       = bool(false)\n\tDefault_MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN\n)\n\nfunc (x *MethodOptions) Reset() {\n\t*x = MethodOptions{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[17]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *MethodOptions) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*MethodOptions) ProtoMessage() {}\n\nfunc (x *MethodOptions) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[17]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use MethodOptions.ProtoReflect.Descriptor instead.\nfunc (*MethodOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{17}\n}\n\nvar extRange_MethodOptions = []protoiface.ExtensionRangeV1{\n\t{Start: 1000, End: 536870911},\n}\n\n// Deprecated: Use MethodOptions.ProtoReflect.Descriptor.ExtensionRanges instead.\nfunc (*MethodOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {\n\treturn extRange_MethodOptions\n}\n\nfunc (x *MethodOptions) GetDeprecated() bool {\n\tif x != nil && x.Deprecated != nil {\n\t\treturn *x.Deprecated\n\t}\n\treturn Default_MethodOptions_Deprecated\n}\n\nfunc (x *MethodOptions) GetIdempotencyLevel() MethodOptions_IdempotencyLevel {\n\tif x != nil && x.IdempotencyLevel != nil {\n\t\treturn *x.IdempotencyLevel\n\t}\n\treturn Default_MethodOptions_IdempotencyLevel\n}\n\nfunc (x *MethodOptions) GetUninterpretedOption() []*UninterpretedOption {\n\tif x != nil {\n\t\treturn x.UninterpretedOption\n\t}\n\treturn nil\n}\n\n// A message representing a option the parser does not recognize. This only\n// appears in options protos created by the compiler::Parser class.\n// DescriptorPool resolves these when building Descriptor objects. Therefore,\n// options protos in descriptor objects (e.g. returned by Descriptor::options(),\n// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions\n// in them.\ntype UninterpretedOption struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tName []*UninterpretedOption_NamePart `protobuf:\"bytes,2,rep,name=name\" json:\"name,omitempty\"`\n\t// The value of the uninterpreted option, in whatever type the tokenizer\n\t// identified it as during parsing. Exactly one of these should be set.\n\tIdentifierValue  *string  `protobuf:\"bytes,3,opt,name=identifier_value,json=identifierValue\" json:\"identifier_value,omitempty\"`\n\tPositiveIntValue *uint64  `protobuf:\"varint,4,opt,name=positive_int_value,json=positiveIntValue\" json:\"positive_int_value,omitempty\"`\n\tNegativeIntValue *int64   `protobuf:\"varint,5,opt,name=negative_int_value,json=negativeIntValue\" json:\"negative_int_value,omitempty\"`\n\tDoubleValue      *float64 `protobuf:\"fixed64,6,opt,name=double_value,json=doubleValue\" json:\"double_value,omitempty\"`\n\tStringValue      []byte   `protobuf:\"bytes,7,opt,name=string_value,json=stringValue\" json:\"string_value,omitempty\"`\n\tAggregateValue   *string  `protobuf:\"bytes,8,opt,name=aggregate_value,json=aggregateValue\" json:\"aggregate_value,omitempty\"`\n}\n\nfunc (x *UninterpretedOption) Reset() {\n\t*x = UninterpretedOption{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[18]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *UninterpretedOption) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*UninterpretedOption) ProtoMessage() {}\n\nfunc (x *UninterpretedOption) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[18]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use UninterpretedOption.ProtoReflect.Descriptor instead.\nfunc (*UninterpretedOption) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{18}\n}\n\nfunc (x *UninterpretedOption) GetName() []*UninterpretedOption_NamePart {\n\tif x != nil {\n\t\treturn x.Name\n\t}\n\treturn nil\n}\n\nfunc (x *UninterpretedOption) GetIdentifierValue() string {\n\tif x != nil && x.IdentifierValue != nil {\n\t\treturn *x.IdentifierValue\n\t}\n\treturn \"\"\n}\n\nfunc (x *UninterpretedOption) GetPositiveIntValue() uint64 {\n\tif x != nil && x.PositiveIntValue != nil {\n\t\treturn *x.PositiveIntValue\n\t}\n\treturn 0\n}\n\nfunc (x *UninterpretedOption) GetNegativeIntValue() int64 {\n\tif x != nil && x.NegativeIntValue != nil {\n\t\treturn *x.NegativeIntValue\n\t}\n\treturn 0\n}\n\nfunc (x *UninterpretedOption) GetDoubleValue() float64 {\n\tif x != nil && x.DoubleValue != nil {\n\t\treturn *x.DoubleValue\n\t}\n\treturn 0\n}\n\nfunc (x *UninterpretedOption) GetStringValue() []byte {\n\tif x != nil {\n\t\treturn x.StringValue\n\t}\n\treturn nil\n}\n\nfunc (x *UninterpretedOption) GetAggregateValue() string {\n\tif x != nil && x.AggregateValue != nil {\n\t\treturn *x.AggregateValue\n\t}\n\treturn \"\"\n}\n\n// Encapsulates information about the original source file from which a\n// FileDescriptorProto was generated.\ntype SourceCodeInfo struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// A Location identifies a piece of source code in a .proto file which\n\t// corresponds to a particular definition.  This information is intended\n\t// to be useful to IDEs, code indexers, documentation generators, and similar\n\t// tools.\n\t//\n\t// For example, say we have a file like:\n\t//   message Foo {\n\t//     optional string foo = 1;\n\t//   }\n\t// Let's look at just the field definition:\n\t//   optional string foo = 1;\n\t//   ^       ^^     ^^  ^  ^^^\n\t//   a       bc     de  f  ghi\n\t// We have the following locations:\n\t//   span   path               represents\n\t//   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.\n\t//   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).\n\t//   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).\n\t//   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).\n\t//   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).\n\t//\n\t// Notes:\n\t// - A location may refer to a repeated field itself (i.e. not to any\n\t//   particular index within it).  This is used whenever a set of elements are\n\t//   logically enclosed in a single code segment.  For example, an entire\n\t//   extend block (possibly containing multiple extension definitions) will\n\t//   have an outer location whose path refers to the \"extensions\" repeated\n\t//   field without an index.\n\t// - Multiple locations may have the same path.  This happens when a single\n\t//   logical declaration is spread out across multiple places.  The most\n\t//   obvious example is the \"extend\" block again -- there may be multiple\n\t//   extend blocks in the same scope, each of which will have the same path.\n\t// - A location's span is not always a subset of its parent's span.  For\n\t//   example, the \"extendee\" of an extension declaration appears at the\n\t//   beginning of the \"extend\" block and is shared by all extensions within\n\t//   the block.\n\t// - Just because a location's span is a subset of some other location's span\n\t//   does not mean that it is a descendant.  For example, a \"group\" defines\n\t//   both a type and a field in a single declaration.  Thus, the locations\n\t//   corresponding to the type and field and their components will overlap.\n\t// - Code which tries to interpret locations should probably be designed to\n\t//   ignore those that it doesn't understand, as more types of locations could\n\t//   be recorded in the future.\n\tLocation []*SourceCodeInfo_Location `protobuf:\"bytes,1,rep,name=location\" json:\"location,omitempty\"`\n}\n\nfunc (x *SourceCodeInfo) Reset() {\n\t*x = SourceCodeInfo{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[19]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *SourceCodeInfo) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*SourceCodeInfo) ProtoMessage() {}\n\nfunc (x *SourceCodeInfo) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[19]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use SourceCodeInfo.ProtoReflect.Descriptor instead.\nfunc (*SourceCodeInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19}\n}\n\nfunc (x *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location {\n\tif x != nil {\n\t\treturn x.Location\n\t}\n\treturn nil\n}\n\n// Describes the relationship between generated code and its original source\n// file. A GeneratedCodeInfo message is associated with only one generated\n// source file, but may contain references to different source .proto files.\ntype GeneratedCodeInfo struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// An Annotation connects some span of text in generated code to an element\n\t// of its generating .proto file.\n\tAnnotation []*GeneratedCodeInfo_Annotation `protobuf:\"bytes,1,rep,name=annotation\" json:\"annotation,omitempty\"`\n}\n\nfunc (x *GeneratedCodeInfo) Reset() {\n\t*x = GeneratedCodeInfo{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[20]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *GeneratedCodeInfo) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*GeneratedCodeInfo) ProtoMessage() {}\n\nfunc (x *GeneratedCodeInfo) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[20]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use GeneratedCodeInfo.ProtoReflect.Descriptor instead.\nfunc (*GeneratedCodeInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{20}\n}\n\nfunc (x *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation {\n\tif x != nil {\n\t\treturn x.Annotation\n\t}\n\treturn nil\n}\n\ntype DescriptorProto_ExtensionRange struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tStart   *int32                 `protobuf:\"varint,1,opt,name=start\" json:\"start,omitempty\"` // Inclusive.\n\tEnd     *int32                 `protobuf:\"varint,2,opt,name=end\" json:\"end,omitempty\"`     // Exclusive.\n\tOptions *ExtensionRangeOptions `protobuf:\"bytes,3,opt,name=options\" json:\"options,omitempty\"`\n}\n\nfunc (x *DescriptorProto_ExtensionRange) Reset() {\n\t*x = DescriptorProto_ExtensionRange{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[21]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *DescriptorProto_ExtensionRange) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*DescriptorProto_ExtensionRange) ProtoMessage() {}\n\nfunc (x *DescriptorProto_ExtensionRange) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[21]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use DescriptorProto_ExtensionRange.ProtoReflect.Descriptor instead.\nfunc (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{2, 0}\n}\n\nfunc (x *DescriptorProto_ExtensionRange) GetStart() int32 {\n\tif x != nil && x.Start != nil {\n\t\treturn *x.Start\n\t}\n\treturn 0\n}\n\nfunc (x *DescriptorProto_ExtensionRange) GetEnd() int32 {\n\tif x != nil && x.End != nil {\n\t\treturn *x.End\n\t}\n\treturn 0\n}\n\nfunc (x *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions {\n\tif x != nil {\n\t\treturn x.Options\n\t}\n\treturn nil\n}\n\n// Range of reserved tag numbers. Reserved tag numbers may not be used by\n// fields or extension ranges in the same message. Reserved ranges may\n// not overlap.\ntype DescriptorProto_ReservedRange struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tStart *int32 `protobuf:\"varint,1,opt,name=start\" json:\"start,omitempty\"` // Inclusive.\n\tEnd   *int32 `protobuf:\"varint,2,opt,name=end\" json:\"end,omitempty\"`     // Exclusive.\n}\n\nfunc (x *DescriptorProto_ReservedRange) Reset() {\n\t*x = DescriptorProto_ReservedRange{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[22]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *DescriptorProto_ReservedRange) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*DescriptorProto_ReservedRange) ProtoMessage() {}\n\nfunc (x *DescriptorProto_ReservedRange) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[22]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use DescriptorProto_ReservedRange.ProtoReflect.Descriptor instead.\nfunc (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{2, 1}\n}\n\nfunc (x *DescriptorProto_ReservedRange) GetStart() int32 {\n\tif x != nil && x.Start != nil {\n\t\treturn *x.Start\n\t}\n\treturn 0\n}\n\nfunc (x *DescriptorProto_ReservedRange) GetEnd() int32 {\n\tif x != nil && x.End != nil {\n\t\treturn *x.End\n\t}\n\treturn 0\n}\n\n// Range of reserved numeric values. Reserved values may not be used by\n// entries in the same enum. Reserved ranges may not overlap.\n//\n// Note that this is distinct from DescriptorProto.ReservedRange in that it\n// is inclusive such that it can appropriately represent the entire int32\n// domain.\ntype EnumDescriptorProto_EnumReservedRange struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tStart *int32 `protobuf:\"varint,1,opt,name=start\" json:\"start,omitempty\"` // Inclusive.\n\tEnd   *int32 `protobuf:\"varint,2,opt,name=end\" json:\"end,omitempty\"`     // Inclusive.\n}\n\nfunc (x *EnumDescriptorProto_EnumReservedRange) Reset() {\n\t*x = EnumDescriptorProto_EnumReservedRange{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[23]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *EnumDescriptorProto_EnumReservedRange) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {}\n\nfunc (x *EnumDescriptorProto_EnumReservedRange) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[23]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use EnumDescriptorProto_EnumReservedRange.ProtoReflect.Descriptor instead.\nfunc (*EnumDescriptorProto_EnumReservedRange) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{6, 0}\n}\n\nfunc (x *EnumDescriptorProto_EnumReservedRange) GetStart() int32 {\n\tif x != nil && x.Start != nil {\n\t\treturn *x.Start\n\t}\n\treturn 0\n}\n\nfunc (x *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 {\n\tif x != nil && x.End != nil {\n\t\treturn *x.End\n\t}\n\treturn 0\n}\n\n// The name of the uninterpreted option.  Each string represents a segment in\n// a dot-separated name.  is_extension is true iff a segment represents an\n// extension (denoted with parentheses in options specs in .proto files).\n// E.g.,{ [\"foo\", false], [\"bar.baz\", true], [\"qux\", false] } represents\n// \"foo.(bar.baz).qux\".\ntype UninterpretedOption_NamePart struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tNamePart    *string `protobuf:\"bytes,1,req,name=name_part,json=namePart\" json:\"name_part,omitempty\"`\n\tIsExtension *bool   `protobuf:\"varint,2,req,name=is_extension,json=isExtension\" json:\"is_extension,omitempty\"`\n}\n\nfunc (x *UninterpretedOption_NamePart) Reset() {\n\t*x = UninterpretedOption_NamePart{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[24]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *UninterpretedOption_NamePart) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*UninterpretedOption_NamePart) ProtoMessage() {}\n\nfunc (x *UninterpretedOption_NamePart) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[24]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use UninterpretedOption_NamePart.ProtoReflect.Descriptor instead.\nfunc (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{18, 0}\n}\n\nfunc (x *UninterpretedOption_NamePart) GetNamePart() string {\n\tif x != nil && x.NamePart != nil {\n\t\treturn *x.NamePart\n\t}\n\treturn \"\"\n}\n\nfunc (x *UninterpretedOption_NamePart) GetIsExtension() bool {\n\tif x != nil && x.IsExtension != nil {\n\t\treturn *x.IsExtension\n\t}\n\treturn false\n}\n\ntype SourceCodeInfo_Location struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// Identifies which part of the FileDescriptorProto was defined at this\n\t// location.\n\t//\n\t// Each element is a field number or an index.  They form a path from\n\t// the root FileDescriptorProto to the place where the definition.  For\n\t// example, this path:\n\t//   [ 4, 3, 2, 7, 1 ]\n\t// refers to:\n\t//   file.message_type(3)  // 4, 3\n\t//       .field(7)         // 2, 7\n\t//       .name()           // 1\n\t// This is because FileDescriptorProto.message_type has field number 4:\n\t//   repeated DescriptorProto message_type = 4;\n\t// and DescriptorProto.field has field number 2:\n\t//   repeated FieldDescriptorProto field = 2;\n\t// and FieldDescriptorProto.name has field number 1:\n\t//   optional string name = 1;\n\t//\n\t// Thus, the above path gives the location of a field name.  If we removed\n\t// the last element:\n\t//   [ 4, 3, 2, 7 ]\n\t// this path refers to the whole field declaration (from the beginning\n\t// of the label to the terminating semicolon).\n\tPath []int32 `protobuf:\"varint,1,rep,packed,name=path\" json:\"path,omitempty\"`\n\t// Always has exactly three or four elements: start line, start column,\n\t// end line (optional, otherwise assumed same as start line), end column.\n\t// These are packed into a single field for efficiency.  Note that line\n\t// and column numbers are zero-based -- typically you will want to add\n\t// 1 to each before displaying to a user.\n\tSpan []int32 `protobuf:\"varint,2,rep,packed,name=span\" json:\"span,omitempty\"`\n\t// If this SourceCodeInfo represents a complete declaration, these are any\n\t// comments appearing before and after the declaration which appear to be\n\t// attached to the declaration.\n\t//\n\t// A series of line comments appearing on consecutive lines, with no other\n\t// tokens appearing on those lines, will be treated as a single comment.\n\t//\n\t// leading_detached_comments will keep paragraphs of comments that appear\n\t// before (but not connected to) the current element. Each paragraph,\n\t// separated by empty lines, will be one comment element in the repeated\n\t// field.\n\t//\n\t// Only the comment content is provided; comment markers (e.g. //) are\n\t// stripped out.  For block comments, leading whitespace and an asterisk\n\t// will be stripped from the beginning of each line other than the first.\n\t// Newlines are included in the output.\n\t//\n\t// Examples:\n\t//\n\t//   optional int32 foo = 1;  // Comment attached to foo.\n\t//   // Comment attached to bar.\n\t//   optional int32 bar = 2;\n\t//\n\t//   optional string baz = 3;\n\t//   // Comment attached to baz.\n\t//   // Another line attached to baz.\n\t//\n\t//   // Comment attached to qux.\n\t//   //\n\t//   // Another line attached to qux.\n\t//   optional double qux = 4;\n\t//\n\t//   // Detached comment for corge. This is not leading or trailing comments\n\t//   // to qux or corge because there are blank lines separating it from\n\t//   // both.\n\t//\n\t//   // Detached comment for corge paragraph 2.\n\t//\n\t//   optional string corge = 5;\n\t//   /* Block comment attached\n\t//    * to corge.  Leading asterisks\n\t//    * will be removed. */\n\t//   /* Block comment attached to\n\t//    * grault. */\n\t//   optional int32 grault = 6;\n\t//\n\t//   // ignored detached comments.\n\tLeadingComments         *string  `protobuf:\"bytes,3,opt,name=leading_comments,json=leadingComments\" json:\"leading_comments,omitempty\"`\n\tTrailingComments        *string  `protobuf:\"bytes,4,opt,name=trailing_comments,json=trailingComments\" json:\"trailing_comments,omitempty\"`\n\tLeadingDetachedComments []string `protobuf:\"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments\" json:\"leading_detached_comments,omitempty\"`\n}\n\nfunc (x *SourceCodeInfo_Location) Reset() {\n\t*x = SourceCodeInfo_Location{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[25]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *SourceCodeInfo_Location) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*SourceCodeInfo_Location) ProtoMessage() {}\n\nfunc (x *SourceCodeInfo_Location) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[25]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use SourceCodeInfo_Location.ProtoReflect.Descriptor instead.\nfunc (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{19, 0}\n}\n\nfunc (x *SourceCodeInfo_Location) GetPath() []int32 {\n\tif x != nil {\n\t\treturn x.Path\n\t}\n\treturn nil\n}\n\nfunc (x *SourceCodeInfo_Location) GetSpan() []int32 {\n\tif x != nil {\n\t\treturn x.Span\n\t}\n\treturn nil\n}\n\nfunc (x *SourceCodeInfo_Location) GetLeadingComments() string {\n\tif x != nil && x.LeadingComments != nil {\n\t\treturn *x.LeadingComments\n\t}\n\treturn \"\"\n}\n\nfunc (x *SourceCodeInfo_Location) GetTrailingComments() string {\n\tif x != nil && x.TrailingComments != nil {\n\t\treturn *x.TrailingComments\n\t}\n\treturn \"\"\n}\n\nfunc (x *SourceCodeInfo_Location) GetLeadingDetachedComments() []string {\n\tif x != nil {\n\t\treturn x.LeadingDetachedComments\n\t}\n\treturn nil\n}\n\ntype GeneratedCodeInfo_Annotation struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// Identifies the element in the original source .proto file. This field\n\t// is formatted the same as SourceCodeInfo.Location.path.\n\tPath []int32 `protobuf:\"varint,1,rep,packed,name=path\" json:\"path,omitempty\"`\n\t// Identifies the filesystem path to the original source .proto.\n\tSourceFile *string `protobuf:\"bytes,2,opt,name=source_file,json=sourceFile\" json:\"source_file,omitempty\"`\n\t// Identifies the starting offset in bytes in the generated code\n\t// that relates to the identified object.\n\tBegin *int32 `protobuf:\"varint,3,opt,name=begin\" json:\"begin,omitempty\"`\n\t// Identifies the ending offset in bytes in the generated code that\n\t// relates to the identified offset. The end offset should be one past\n\t// the last relevant byte (so the length of the text = end - begin).\n\tEnd *int32 `protobuf:\"varint,4,opt,name=end\" json:\"end,omitempty\"`\n}\n\nfunc (x *GeneratedCodeInfo_Annotation) Reset() {\n\t*x = GeneratedCodeInfo_Annotation{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_descriptor_proto_msgTypes[26]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *GeneratedCodeInfo_Annotation) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*GeneratedCodeInfo_Annotation) ProtoMessage() {}\n\nfunc (x *GeneratedCodeInfo_Annotation) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_descriptor_proto_msgTypes[26]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use GeneratedCodeInfo_Annotation.ProtoReflect.Descriptor instead.\nfunc (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{20, 0}\n}\n\nfunc (x *GeneratedCodeInfo_Annotation) GetPath() []int32 {\n\tif x != nil {\n\t\treturn x.Path\n\t}\n\treturn nil\n}\n\nfunc (x *GeneratedCodeInfo_Annotation) GetSourceFile() string {\n\tif x != nil && x.SourceFile != nil {\n\t\treturn *x.SourceFile\n\t}\n\treturn \"\"\n}\n\nfunc (x *GeneratedCodeInfo_Annotation) GetBegin() int32 {\n\tif x != nil && x.Begin != nil {\n\t\treturn *x.Begin\n\t}\n\treturn 0\n}\n\nfunc (x *GeneratedCodeInfo_Annotation) GetEnd() int32 {\n\tif x != nil && x.End != nil {\n\t\treturn *x.End\n\t}\n\treturn 0\n}\n\nvar File_google_protobuf_descriptor_proto protoreflect.FileDescriptor\n\nvar file_google_protobuf_descriptor_proto_rawDesc = []byte{\n\t0x0a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,\n\t0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f,\n\t0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x62, 0x75, 0x66, 0x22, 0x4d, 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72,\n\t0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65,\n\t0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73,\n\t0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x04, 0x66, 0x69,\n\t0x6c, 0x65, 0x22, 0xe4, 0x04, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72,\n\t0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,\n\t0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18,\n\t0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,\n\t0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x65,\n\t0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65,\n\t0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x2b, 0x0a, 0x11, 0x70, 0x75, 0x62, 0x6c,\n\t0x69, 0x63, 0x5f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0a, 0x20,\n\t0x03, 0x28, 0x05, 0x52, 0x10, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x44, 0x65, 0x70, 0x65, 0x6e,\n\t0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x77, 0x65, 0x61, 0x6b, 0x5f, 0x64, 0x65,\n\t0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0e,\n\t0x77, 0x65, 0x61, 0x6b, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x43,\n\t0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04,\n\t0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,\n\t0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f,\n\t0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54,\n\t0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65,\n\t0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73,\n\t0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x08, 0x65, 0x6e,\n\t0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,\n\t0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,\n\t0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f,\n\t0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x09, 0x65, 0x78, 0x74,\n\t0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67,\n\t0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46,\n\t0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72,\n\t0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x36,\n\t0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32,\n\t0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,\n\t0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f,\n\t0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x49, 0x0a, 0x10, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,\n\t0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b,\n\t0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,\n\t0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66,\n\t0x6f, 0x52, 0x0e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66,\n\t0x6f, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28,\n\t0x09, 0x52, 0x06, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x22, 0xb9, 0x06, 0x0a, 0x0f, 0x44, 0x65,\n\t0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a,\n\t0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,\n\t0x65, 0x12, 0x3b, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,\n\t0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,\n\t0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,\n\t0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x43,\n\t0x0a, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28,\n\t0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,\n\t0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73,\n\t0x69, 0x6f, 0x6e, 0x12, 0x41, 0x0a, 0x0b, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x79,\n\t0x70, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,\n\t0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72,\n\t0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x0a, 0x6e, 0x65, 0x73, 0x74,\n\t0x65, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x41, 0x0a, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x74,\n\t0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67,\n\t0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d,\n\t0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52,\n\t0x08, 0x65, 0x6e, 0x75, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x58, 0x0a, 0x0f, 0x65, 0x78, 0x74,\n\t0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x05, 0x20, 0x03,\n\t0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,\n\t0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50,\n\t0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61,\n\t0x6e, 0x67, 0x65, 0x52, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61,\n\t0x6e, 0x67, 0x65, 0x12, 0x44, 0x0a, 0x0a, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x5f, 0x64, 0x65, 0x63,\n\t0x6c, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x44,\n\t0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x09,\n\t0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x44, 0x65, 0x63, 0x6c, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74,\n\t0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f,\n\t0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x73,\n\t0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74,\n\t0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64,\n\t0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x67,\n\t0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44,\n\t0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52,\n\t0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0d, 0x72, 0x65,\n\t0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72,\n\t0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x03,\n\t0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65,\n\t0x1a, 0x7a, 0x0a, 0x0e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e,\n\t0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,\n\t0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18,\n\t0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x40, 0x0a, 0x07, 0x6f, 0x70,\n\t0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f,\n\t0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78,\n\t0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69,\n\t0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x37, 0x0a, 0x0d,\n\t0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a,\n\t0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74,\n\t0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,\n\t0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x7c, 0x0a, 0x15, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,\n\t0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58,\n\t0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f,\n\t0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e,\n\t0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,\n\t0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74,\n\t0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74,\n\t0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80,\n\t0x80, 0x80, 0x02, 0x22, 0xc1, 0x06, 0x0a, 0x14, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x65, 0x73,\n\t0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04,\n\t0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,\n\t0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05,\n\t0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65,\n\t0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44,\n\t0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c,\n\t0x61, 0x62, 0x65, 0x6c, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x3e, 0x0a, 0x04, 0x74,\n\t0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x6f, 0x67,\n\t0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c,\n\t0x64, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f,\n\t0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74,\n\t0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,\n\t0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65,\n\t0x6e, 0x64, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x78, 0x74, 0x65,\n\t0x6e, 0x64, 0x65, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f,\n\t0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66,\n\t0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x6e, 0x65,\n\t0x6f, 0x66, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a,\n\t0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x6a, 0x73,\n\t0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6a,\n\t0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f,\n\t0x6e, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,\n\t0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64,\n\t0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,\n\t0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f,\n\t0x6e, 0x61, 0x6c, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x33, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x22, 0xb6, 0x02, 0x0a, 0x04, 0x54, 0x79,\n\t0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x4f, 0x55, 0x42, 0x4c,\n\t0x45, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4c, 0x4f, 0x41,\n\t0x54, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54, 0x36,\n\t0x34, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54,\n\t0x36, 0x34, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x4e, 0x54,\n\t0x33, 0x32, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x58,\n\t0x45, 0x44, 0x36, 0x34, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46,\n\t0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45,\n\t0x5f, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x08, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f,\n\t0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x09, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59, 0x50, 0x45,\n\t0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x0a, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45,\n\t0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x59,\n\t0x50, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x53, 0x10, 0x0c, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59,\n\t0x50, 0x45, 0x5f, 0x55, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10, 0x0d, 0x12, 0x0d, 0x0a, 0x09, 0x54,\n\t0x59, 0x50, 0x45, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x10, 0x0e, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x59,\n\t0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x33, 0x32, 0x10, 0x0f, 0x12, 0x11, 0x0a,\n\t0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x46, 0x49, 0x58, 0x45, 0x44, 0x36, 0x34, 0x10, 0x10,\n\t0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x33, 0x32, 0x10,\n\t0x11, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x49, 0x4e, 0x54, 0x36, 0x34,\n\t0x10, 0x12, 0x22, 0x43, 0x0a, 0x05, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x0e, 0x4c,\n\t0x41, 0x42, 0x45, 0x4c, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x10, 0x01, 0x12,\n\t0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45,\n\t0x44, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x5f, 0x52, 0x45, 0x50,\n\t0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x03, 0x22, 0x63, 0x0a, 0x14, 0x4f, 0x6e, 0x65, 0x6f, 0x66,\n\t0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12,\n\t0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,\n\t0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02,\n\t0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,\n\t0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4f, 0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69,\n\t0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xe3, 0x02, 0x0a,\n\t0x13, 0x45, 0x6e, 0x75, 0x6d, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50,\n\t0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,\n\t0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,\n\t0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61,\n\t0x6c, 0x75, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f,\n\t0x74, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x6f, 0x70, 0x74,\n\t0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f,\n\t0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75,\n\t0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,\n\t0x73, 0x12, 0x5d, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x72, 0x61,\n\t0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x67, 0x6f, 0x6f, 0x67,\n\t0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6e, 0x75, 0x6d,\n\t0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e,\n\t0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67,\n\t0x65, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65,\n\t0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d,\n\t0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65,\n\t0x64, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x3b, 0x0a, 0x11, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x65, 0x73,\n\t0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74,\n\t0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74,\n\t0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65,\n\t0x6e, 0x64, 0x22, 0x83, 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65,\n\t0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12,\n\t0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,\n\t0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20,\n\t0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x07, 0x6f,\n\t0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67,\n\t0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45,\n\t0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52,\n\t0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x16, 0x53, 0x65, 0x72,\n\t0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72,\n\t0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,\n\t0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f,\n\t0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64,\n\t0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52,\n\t0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x39, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f,\n\t0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,\n\t0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69,\n\t0x63, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f,\n\t0x6e, 0x73, 0x22, 0x89, 0x02, 0x0a, 0x15, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x44, 0x65, 0x73,\n\t0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04,\n\t0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,\n\t0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02,\n\t0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12,\n\t0x1f, 0x0a, 0x0b, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03,\n\t0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65,\n\t0x12, 0x38, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28,\n\t0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,\n\t0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x30, 0x0a, 0x10, 0x63, 0x6c,\n\t0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x05,\n\t0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x63, 0x6c, 0x69,\n\t0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x30, 0x0a, 0x10,\n\t0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67,\n\t0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0f, 0x73,\n\t0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x22, 0x91,\n\t0x09, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21,\n\t0x0a, 0x0c, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x01,\n\t0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6a, 0x61, 0x76, 0x61, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67,\n\t0x65, 0x12, 0x30, 0x0a, 0x14, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f,\n\t0x63, 0x6c, 0x61, 0x73, 0x73, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52,\n\t0x12, 0x6a, 0x61, 0x76, 0x61, 0x4f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x6e,\n\t0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x6d, 0x75, 0x6c, 0x74,\n\t0x69, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08,\n\t0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x6a, 0x61, 0x76, 0x61, 0x4d, 0x75, 0x6c,\n\t0x74, 0x69, 0x70, 0x6c, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x1d, 0x6a, 0x61,\n\t0x76, 0x61, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x65, 0x71, 0x75, 0x61,\n\t0x6c, 0x73, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x14, 0x20, 0x01, 0x28,\n\t0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x19, 0x6a, 0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72,\n\t0x61, 0x74, 0x65, 0x45, 0x71, 0x75, 0x61, 0x6c, 0x73, 0x41, 0x6e, 0x64, 0x48, 0x61, 0x73, 0x68,\n\t0x12, 0x3a, 0x0a, 0x16, 0x6a, 0x61, 0x76, 0x61, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f,\n\t0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x75, 0x74, 0x66, 0x38, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x08,\n\t0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a, 0x61, 0x76, 0x61, 0x53, 0x74, 0x72,\n\t0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x74, 0x66, 0x38, 0x12, 0x53, 0x0a, 0x0c,\n\t0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01,\n\t0x28, 0x0e, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,\n\t0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,\n\t0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x3a, 0x05, 0x53,\n\t0x50, 0x45, 0x45, 0x44, 0x52, 0x0b, 0x6f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x46, 0x6f,\n\t0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18,\n\t0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65,\n\t0x12, 0x35, 0x0a, 0x13, 0x63, 0x63, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73,\n\t0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66,\n\t0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x63, 0x63, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53,\n\t0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x15, 0x6a, 0x61, 0x76, 0x61, 0x5f,\n\t0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73,\n\t0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x13, 0x6a,\n\t0x61, 0x76, 0x61, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,\n\t0x65, 0x73, 0x12, 0x35, 0x0a, 0x13, 0x70, 0x79, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63,\n\t0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x08, 0x3a,\n\t0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x11, 0x70, 0x79, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69,\n\t0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x37, 0x0a, 0x14, 0x70, 0x68, 0x70,\n\t0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,\n\t0x73, 0x18, 0x2a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x12,\n\t0x70, 0x68, 0x70, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,\n\t0x65, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64,\n\t0x18, 0x17, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64,\n\t0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x10, 0x63, 0x63, 0x5f,\n\t0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x18, 0x1f, 0x20,\n\t0x01, 0x28, 0x08, 0x3a, 0x04, 0x74, 0x72, 0x75, 0x65, 0x52, 0x0e, 0x63, 0x63, 0x45, 0x6e, 0x61,\n\t0x62, 0x6c, 0x65, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x6f, 0x62, 0x6a,\n\t0x63, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x24,\n\t0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6f, 0x62, 0x6a, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50,\n\t0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x5f,\n\t0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x25, 0x20, 0x01, 0x28, 0x09, 0x52,\n\t0x0f, 0x63, 0x73, 0x68, 0x61, 0x72, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65,\n\t0x12, 0x21, 0x0a, 0x0c, 0x73, 0x77, 0x69, 0x66, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78,\n\t0x18, 0x27, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x77, 0x69, 0x66, 0x74, 0x50, 0x72, 0x65,\n\t0x66, 0x69, 0x78, 0x12, 0x28, 0x0a, 0x10, 0x70, 0x68, 0x70, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73,\n\t0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70,\n\t0x68, 0x70, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x23, 0x0a,\n\t0x0d, 0x70, 0x68, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x29,\n\t0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x68, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61,\n\t0x63, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x70, 0x68, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61,\n\t0x74, 0x61, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x2c, 0x20, 0x01,\n\t0x28, 0x09, 0x52, 0x14, 0x70, 0x68, 0x70, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4e,\n\t0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x75, 0x62, 0x79,\n\t0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x2d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,\n\t0x72, 0x75, 0x62, 0x79, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x58, 0x0a, 0x14, 0x75,\n\t0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74,\n\t0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f,\n\t0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69,\n\t0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,\n\t0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f,\n\t0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x0a, 0x0c, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a,\n\t0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x50, 0x45, 0x45, 0x44, 0x10, 0x01,\n\t0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x49, 0x5a, 0x45, 0x10, 0x02, 0x12,\n\t0x10, 0x0a, 0x0c, 0x4c, 0x49, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10,\n\t0x03, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x26,\n\t0x10, 0x27, 0x22, 0xd1, 0x02, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70,\n\t0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,\n\t0x5f, 0x73, 0x65, 0x74, 0x5f, 0x77, 0x69, 0x72, 0x65, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74,\n\t0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x14, 0x6d,\n\t0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, 0x74, 0x57, 0x69, 0x72, 0x65, 0x46, 0x6f, 0x72,\n\t0x6d, 0x61, 0x74, 0x12, 0x4c, 0x0a, 0x1f, 0x6e, 0x6f, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61,\n\t0x72, 0x64, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x63,\n\t0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61,\n\t0x6c, 0x73, 0x65, 0x52, 0x1c, 0x6e, 0x6f, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x44,\n\t0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f,\n\t0x72, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18,\n\t0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65,\n\t0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f,\n\t0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6d, 0x61, 0x70,\n\t0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72,\n\t0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07,\n\t0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,\n\t0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72,\n\t0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e,\n\t0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a,\n\t0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09,\n\t0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0xe2, 0x03, 0x0a, 0x0c, 0x46, 0x69, 0x65, 0x6c, 0x64,\n\t0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65,\n\t0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70,\n\t0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x06, 0x53, 0x54, 0x52,\n\t0x49, 0x4e, 0x47, 0x52, 0x05, 0x63, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61,\n\t0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x61, 0x63, 0x6b,\n\t0x65, 0x64, 0x12, 0x47, 0x0a, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01,\n\t0x28, 0x0e, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,\n\t0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,\n\t0x73, 0x2e, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52,\n\t0x4d, 0x41, 0x4c, 0x52, 0x06, 0x6a, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x04, 0x6c,\n\t0x61, 0x7a, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65,\n\t0x52, 0x04, 0x6c, 0x61, 0x7a, 0x79, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63,\n\t0x61, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73,\n\t0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a,\n\t0x04, 0x77, 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c,\n\t0x73, 0x65, 0x52, 0x04, 0x77, 0x65, 0x61, 0x6b, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e,\n\t0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,\n\t0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65,\n\t0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75,\n\t0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69,\n\t0x6f, 0x6e, 0x22, 0x2f, 0x0a, 0x05, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x53,\n\t0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x4f, 0x52, 0x44, 0x10,\n\t0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x49, 0x45, 0x43,\n\t0x45, 0x10, 0x02, 0x22, 0x35, 0x0a, 0x06, 0x4a, 0x53, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a,\n\t0x09, 0x4a, 0x53, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09,\n\t0x4a, 0x53, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4a,\n\t0x53, 0x5f, 0x4e, 0x55, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10,\n\t0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x73, 0x0a, 0x0c, 0x4f,\n\t0x6e, 0x65, 0x6f, 0x66, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x75,\n\t0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74,\n\t0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f,\n\t0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69,\n\t0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e,\n\t0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f,\n\t0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02,\n\t0x22, 0xc0, 0x01, 0x0a, 0x0b, 0x45, 0x6e, 0x75, 0x6d, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,\n\t0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18,\n\t0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x69, 0x61,\n\t0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18,\n\t0x03, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65,\n\t0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e,\n\t0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,\n\t0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65,\n\t0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75,\n\t0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69,\n\t0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x4a, 0x04, 0x08,\n\t0x05, 0x10, 0x06, 0x22, 0x9e, 0x01, 0x0a, 0x10, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75,\n\t0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72,\n\t0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61,\n\t0x6c, 0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12,\n\t0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64,\n\t0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24,\n\t0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,\n\t0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70,\n\t0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65,\n\t0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80,\n\t0x80, 0x80, 0x80, 0x02, 0x22, 0x9c, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,\n\t0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65,\n\t0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c,\n\t0x73, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x58,\n\t0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x5f,\n\t0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e,\n\t0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,\n\t0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74,\n\t0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74,\n\t0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x09, 0x08, 0xe8, 0x07, 0x10, 0x80, 0x80,\n\t0x80, 0x80, 0x02, 0x22, 0xe0, 0x02, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4f, 0x70,\n\t0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61,\n\t0x74, 0x65, 0x64, 0x18, 0x21, 0x20, 0x01, 0x28, 0x08, 0x3a, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65,\n\t0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x71, 0x0a, 0x11,\n\t0x69, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x6c, 0x65, 0x76, 0x65,\n\t0x6c, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64,\n\t0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65,\n\t0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x3a, 0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f,\n\t0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x52, 0x10, 0x69,\n\t0x64, 0x65, 0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12,\n\t0x58, 0x0a, 0x14, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64,\n\t0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0xe7, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24,\n\t0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,\n\t0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70,\n\t0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x75, 0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65,\n\t0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x50, 0x0a, 0x10, 0x49, 0x64, 0x65,\n\t0x6d, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x17, 0x0a,\n\t0x13, 0x49, 0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x43, 0x59, 0x5f, 0x55, 0x4e, 0x4b,\n\t0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4e, 0x4f, 0x5f, 0x53, 0x49, 0x44,\n\t0x45, 0x5f, 0x45, 0x46, 0x46, 0x45, 0x43, 0x54, 0x53, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x49,\n\t0x44, 0x45, 0x4d, 0x50, 0x4f, 0x54, 0x45, 0x4e, 0x54, 0x10, 0x02, 0x2a, 0x09, 0x08, 0xe8, 0x07,\n\t0x10, 0x80, 0x80, 0x80, 0x80, 0x02, 0x22, 0x9a, 0x03, 0x0a, 0x13, 0x55, 0x6e, 0x69, 0x6e, 0x74,\n\t0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x41,\n\t0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67,\n\t0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55,\n\t0x6e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x65, 0x64, 0x4f, 0x70, 0x74, 0x69,\n\t0x6f, 0x6e, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d,\n\t0x65, 0x12, 0x29, 0x0a, 0x10, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f,\n\t0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x69, 0x64, 0x65,\n\t0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12,\n\t0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c,\n\t0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69,\n\t0x76, 0x65, 0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x65,\n\t0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65,\n\t0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65,\n\t0x49, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x75, 0x62,\n\t0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b,\n\t0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73,\n\t0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28,\n\t0x0c, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27,\n\t0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75,\n\t0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61,\n\t0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x4a, 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x50,\n\t0x61, 0x72, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x74,\n\t0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x61, 0x6d, 0x65, 0x50, 0x61, 0x72, 0x74,\n\t0x12, 0x21, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,\n\t0x18, 0x02, 0x20, 0x02, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73,\n\t0x69, 0x6f, 0x6e, 0x22, 0xa7, 0x02, 0x0a, 0x0e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f,\n\t0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x44, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69,\n\t0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,\n\t0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63,\n\t0x65, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69,\n\t0x6f, 0x6e, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xce, 0x01, 0x0a,\n\t0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74,\n\t0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02, 0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74,\n\t0x68, 0x12, 0x16, 0x0a, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x42,\n\t0x02, 0x10, 0x01, 0x52, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x6c, 0x65, 0x61,\n\t0x64, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20,\n\t0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d,\n\t0x65, 0x6e, 0x74, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67,\n\t0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,\n\t0x10, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74,\n\t0x73, 0x12, 0x3a, 0x0a, 0x19, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x65, 0x74,\n\t0x61, 0x63, 0x68, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06,\n\t0x20, 0x03, 0x28, 0x09, 0x52, 0x17, 0x6c, 0x65, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x65, 0x74,\n\t0x61, 0x63, 0x68, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xd1, 0x01,\n\t0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49,\n\t0x6e, 0x66, 0x6f, 0x12, 0x4d, 0x0a, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f,\n\t0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,\n\t0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61,\n\t0x74, 0x65, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x41, 0x6e, 0x6e, 0x6f,\n\t0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69,\n\t0x6f, 0x6e, 0x1a, 0x6d, 0x0a, 0x0a, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e,\n\t0x12, 0x16, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x42, 0x02,\n\t0x10, 0x01, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72,\n\t0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73,\n\t0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x65, 0x67,\n\t0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x12,\n\t0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e,\n\t0x64, 0x42, 0x7e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69,\n\t0x70, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x48, 0x01, 0x5a, 0x2d, 0x67, 0x6f,\n\t0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x64,\n\t0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02,\n\t0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1a, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72,\n\t0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f,\n\t0x6e,\n}\n\nvar (\n\tfile_google_protobuf_descriptor_proto_rawDescOnce sync.Once\n\tfile_google_protobuf_descriptor_proto_rawDescData = file_google_protobuf_descriptor_proto_rawDesc\n)\n\nfunc file_google_protobuf_descriptor_proto_rawDescGZIP() []byte {\n\tfile_google_protobuf_descriptor_proto_rawDescOnce.Do(func() {\n\t\tfile_google_protobuf_descriptor_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_descriptor_proto_rawDescData)\n\t})\n\treturn file_google_protobuf_descriptor_proto_rawDescData\n}\n\nvar file_google_protobuf_descriptor_proto_enumTypes = make([]protoimpl.EnumInfo, 6)\nvar file_google_protobuf_descriptor_proto_msgTypes = make([]protoimpl.MessageInfo, 27)\nvar file_google_protobuf_descriptor_proto_goTypes = []interface{}{\n\t(FieldDescriptorProto_Type)(0),                // 0: google.protobuf.FieldDescriptorProto.Type\n\t(FieldDescriptorProto_Label)(0),               // 1: google.protobuf.FieldDescriptorProto.Label\n\t(FileOptions_OptimizeMode)(0),                 // 2: google.protobuf.FileOptions.OptimizeMode\n\t(FieldOptions_CType)(0),                       // 3: google.protobuf.FieldOptions.CType\n\t(FieldOptions_JSType)(0),                      // 4: google.protobuf.FieldOptions.JSType\n\t(MethodOptions_IdempotencyLevel)(0),           // 5: google.protobuf.MethodOptions.IdempotencyLevel\n\t(*FileDescriptorSet)(nil),                     // 6: google.protobuf.FileDescriptorSet\n\t(*FileDescriptorProto)(nil),                   // 7: google.protobuf.FileDescriptorProto\n\t(*DescriptorProto)(nil),                       // 8: google.protobuf.DescriptorProto\n\t(*ExtensionRangeOptions)(nil),                 // 9: google.protobuf.ExtensionRangeOptions\n\t(*FieldDescriptorProto)(nil),                  // 10: google.protobuf.FieldDescriptorProto\n\t(*OneofDescriptorProto)(nil),                  // 11: google.protobuf.OneofDescriptorProto\n\t(*EnumDescriptorProto)(nil),                   // 12: google.protobuf.EnumDescriptorProto\n\t(*EnumValueDescriptorProto)(nil),              // 13: google.protobuf.EnumValueDescriptorProto\n\t(*ServiceDescriptorProto)(nil),                // 14: google.protobuf.ServiceDescriptorProto\n\t(*MethodDescriptorProto)(nil),                 // 15: google.protobuf.MethodDescriptorProto\n\t(*FileOptions)(nil),                           // 16: google.protobuf.FileOptions\n\t(*MessageOptions)(nil),                        // 17: google.protobuf.MessageOptions\n\t(*FieldOptions)(nil),                          // 18: google.protobuf.FieldOptions\n\t(*OneofOptions)(nil),                          // 19: google.protobuf.OneofOptions\n\t(*EnumOptions)(nil),                           // 20: google.protobuf.EnumOptions\n\t(*EnumValueOptions)(nil),                      // 21: google.protobuf.EnumValueOptions\n\t(*ServiceOptions)(nil),                        // 22: google.protobuf.ServiceOptions\n\t(*MethodOptions)(nil),                         // 23: google.protobuf.MethodOptions\n\t(*UninterpretedOption)(nil),                   // 24: google.protobuf.UninterpretedOption\n\t(*SourceCodeInfo)(nil),                        // 25: google.protobuf.SourceCodeInfo\n\t(*GeneratedCodeInfo)(nil),                     // 26: google.protobuf.GeneratedCodeInfo\n\t(*DescriptorProto_ExtensionRange)(nil),        // 27: google.protobuf.DescriptorProto.ExtensionRange\n\t(*DescriptorProto_ReservedRange)(nil),         // 28: google.protobuf.DescriptorProto.ReservedRange\n\t(*EnumDescriptorProto_EnumReservedRange)(nil), // 29: google.protobuf.EnumDescriptorProto.EnumReservedRange\n\t(*UninterpretedOption_NamePart)(nil),          // 30: google.protobuf.UninterpretedOption.NamePart\n\t(*SourceCodeInfo_Location)(nil),               // 31: google.protobuf.SourceCodeInfo.Location\n\t(*GeneratedCodeInfo_Annotation)(nil),          // 32: google.protobuf.GeneratedCodeInfo.Annotation\n}\nvar file_google_protobuf_descriptor_proto_depIdxs = []int32{\n\t7,  // 0: google.protobuf.FileDescriptorSet.file:type_name -> google.protobuf.FileDescriptorProto\n\t8,  // 1: google.protobuf.FileDescriptorProto.message_type:type_name -> google.protobuf.DescriptorProto\n\t12, // 2: google.protobuf.FileDescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto\n\t14, // 3: google.protobuf.FileDescriptorProto.service:type_name -> google.protobuf.ServiceDescriptorProto\n\t10, // 4: google.protobuf.FileDescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto\n\t16, // 5: google.protobuf.FileDescriptorProto.options:type_name -> google.protobuf.FileOptions\n\t25, // 6: google.protobuf.FileDescriptorProto.source_code_info:type_name -> google.protobuf.SourceCodeInfo\n\t10, // 7: google.protobuf.DescriptorProto.field:type_name -> google.protobuf.FieldDescriptorProto\n\t10, // 8: google.protobuf.DescriptorProto.extension:type_name -> google.protobuf.FieldDescriptorProto\n\t8,  // 9: google.protobuf.DescriptorProto.nested_type:type_name -> google.protobuf.DescriptorProto\n\t12, // 10: google.protobuf.DescriptorProto.enum_type:type_name -> google.protobuf.EnumDescriptorProto\n\t27, // 11: google.protobuf.DescriptorProto.extension_range:type_name -> google.protobuf.DescriptorProto.ExtensionRange\n\t11, // 12: google.protobuf.DescriptorProto.oneof_decl:type_name -> google.protobuf.OneofDescriptorProto\n\t17, // 13: google.protobuf.DescriptorProto.options:type_name -> google.protobuf.MessageOptions\n\t28, // 14: google.protobuf.DescriptorProto.reserved_range:type_name -> google.protobuf.DescriptorProto.ReservedRange\n\t24, // 15: google.protobuf.ExtensionRangeOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t1,  // 16: google.protobuf.FieldDescriptorProto.label:type_name -> google.protobuf.FieldDescriptorProto.Label\n\t0,  // 17: google.protobuf.FieldDescriptorProto.type:type_name -> google.protobuf.FieldDescriptorProto.Type\n\t18, // 18: google.protobuf.FieldDescriptorProto.options:type_name -> google.protobuf.FieldOptions\n\t19, // 19: google.protobuf.OneofDescriptorProto.options:type_name -> google.protobuf.OneofOptions\n\t13, // 20: google.protobuf.EnumDescriptorProto.value:type_name -> google.protobuf.EnumValueDescriptorProto\n\t20, // 21: google.protobuf.EnumDescriptorProto.options:type_name -> google.protobuf.EnumOptions\n\t29, // 22: google.protobuf.EnumDescriptorProto.reserved_range:type_name -> google.protobuf.EnumDescriptorProto.EnumReservedRange\n\t21, // 23: google.protobuf.EnumValueDescriptorProto.options:type_name -> google.protobuf.EnumValueOptions\n\t15, // 24: google.protobuf.ServiceDescriptorProto.method:type_name -> google.protobuf.MethodDescriptorProto\n\t22, // 25: google.protobuf.ServiceDescriptorProto.options:type_name -> google.protobuf.ServiceOptions\n\t23, // 26: google.protobuf.MethodDescriptorProto.options:type_name -> google.protobuf.MethodOptions\n\t2,  // 27: google.protobuf.FileOptions.optimize_for:type_name -> google.protobuf.FileOptions.OptimizeMode\n\t24, // 28: google.protobuf.FileOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t24, // 29: google.protobuf.MessageOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t3,  // 30: google.protobuf.FieldOptions.ctype:type_name -> google.protobuf.FieldOptions.CType\n\t4,  // 31: google.protobuf.FieldOptions.jstype:type_name -> google.protobuf.FieldOptions.JSType\n\t24, // 32: google.protobuf.FieldOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t24, // 33: google.protobuf.OneofOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t24, // 34: google.protobuf.EnumOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t24, // 35: google.protobuf.EnumValueOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t24, // 36: google.protobuf.ServiceOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t5,  // 37: google.protobuf.MethodOptions.idempotency_level:type_name -> google.protobuf.MethodOptions.IdempotencyLevel\n\t24, // 38: google.protobuf.MethodOptions.uninterpreted_option:type_name -> google.protobuf.UninterpretedOption\n\t30, // 39: google.protobuf.UninterpretedOption.name:type_name -> google.protobuf.UninterpretedOption.NamePart\n\t31, // 40: google.protobuf.SourceCodeInfo.location:type_name -> google.protobuf.SourceCodeInfo.Location\n\t32, // 41: google.protobuf.GeneratedCodeInfo.annotation:type_name -> google.protobuf.GeneratedCodeInfo.Annotation\n\t9,  // 42: google.protobuf.DescriptorProto.ExtensionRange.options:type_name -> google.protobuf.ExtensionRangeOptions\n\t43, // [43:43] is the sub-list for method output_type\n\t43, // [43:43] is the sub-list for method input_type\n\t43, // [43:43] is the sub-list for extension type_name\n\t43, // [43:43] is the sub-list for extension extendee\n\t0,  // [0:43] is the sub-list for field type_name\n}\n\nfunc init() { file_google_protobuf_descriptor_proto_init() }\nfunc file_google_protobuf_descriptor_proto_init() {\n\tif File_google_protobuf_descriptor_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*FileDescriptorSet); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*FileDescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*DescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*ExtensionRangeOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*FieldDescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*OneofDescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*EnumDescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*EnumValueDescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*ServiceDescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*MethodDescriptorProto); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*FileOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*MessageOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*FieldOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*OneofOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*EnumOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*EnumValueOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*ServiceOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*MethodOptions); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tcase 3:\n\t\t\t\treturn &v.extensionFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*UninterpretedOption); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*SourceCodeInfo); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*GeneratedCodeInfo); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*DescriptorProto_ExtensionRange); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*DescriptorProto_ReservedRange); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*EnumDescriptorProto_EnumReservedRange); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*UninterpretedOption_NamePart); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*SourceCodeInfo_Location); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_descriptor_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*GeneratedCodeInfo_Annotation); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_google_protobuf_descriptor_proto_rawDesc,\n\t\t\tNumEnums:      6,\n\t\t\tNumMessages:   27,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_google_protobuf_descriptor_proto_goTypes,\n\t\tDependencyIndexes: file_google_protobuf_descriptor_proto_depIdxs,\n\t\tEnumInfos:         file_google_protobuf_descriptor_proto_enumTypes,\n\t\tMessageInfos:      file_google_protobuf_descriptor_proto_msgTypes,\n\t}.Build()\n\tFile_google_protobuf_descriptor_proto = out.File\n\tfile_google_protobuf_descriptor_proto_rawDesc = nil\n\tfile_google_protobuf_descriptor_proto_goTypes = nil\n\tfile_google_protobuf_descriptor_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/types/known/emptypb/empty.pb.go",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: google/protobuf/empty.proto\n\npackage emptypb\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\n// A generic empty message that you can re-use to avoid defining duplicated\n// empty messages in your APIs. A typical example is to use it as the request\n// or the response type of an API method. For instance:\n//\n//     service Foo {\n//       rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n//     }\n//\n// The JSON representation for `Empty` is empty JSON object `{}`.\ntype Empty struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n}\n\nfunc (x *Empty) Reset() {\n\t*x = Empty{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_empty_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Empty) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Empty) ProtoMessage() {}\n\nfunc (x *Empty) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_empty_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Empty.ProtoReflect.Descriptor instead.\nfunc (*Empty) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_empty_proto_rawDescGZIP(), []int{0}\n}\n\nvar File_google_protobuf_empty_proto protoreflect.FileDescriptor\n\nvar file_google_protobuf_empty_proto_rawDesc = []byte{\n\t0x0a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,\n\t0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67,\n\t0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x07,\n\t0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x7d, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67,\n\t0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0a,\n\t0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x6f,\n\t0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b,\n\t0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2,\n\t0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50,\n\t0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77,\n\t0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar (\n\tfile_google_protobuf_empty_proto_rawDescOnce sync.Once\n\tfile_google_protobuf_empty_proto_rawDescData = file_google_protobuf_empty_proto_rawDesc\n)\n\nfunc file_google_protobuf_empty_proto_rawDescGZIP() []byte {\n\tfile_google_protobuf_empty_proto_rawDescOnce.Do(func() {\n\t\tfile_google_protobuf_empty_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_empty_proto_rawDescData)\n\t})\n\treturn file_google_protobuf_empty_proto_rawDescData\n}\n\nvar file_google_protobuf_empty_proto_msgTypes = make([]protoimpl.MessageInfo, 1)\nvar file_google_protobuf_empty_proto_goTypes = []interface{}{\n\t(*Empty)(nil), // 0: google.protobuf.Empty\n}\nvar file_google_protobuf_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_google_protobuf_empty_proto_init() }\nfunc file_google_protobuf_empty_proto_init() {\n\tif File_google_protobuf_empty_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_google_protobuf_empty_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Empty); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_google_protobuf_empty_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   1,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_google_protobuf_empty_proto_goTypes,\n\t\tDependencyIndexes: file_google_protobuf_empty_proto_depIdxs,\n\t\tMessageInfos:      file_google_protobuf_empty_proto_msgTypes,\n\t}.Build()\n\tFile_google_protobuf_empty_proto = out.File\n\tfile_google_protobuf_empty_proto_rawDesc = nil\n\tfile_google_protobuf_empty_proto_goTypes = nil\n\tfile_google_protobuf_empty_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/types/known/wrapperspb/wrappers.pb.go",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Wrappers for primitive (non-message) types. These types are useful\n// for embedding primitives in the `google.protobuf.Any` type and for places\n// where we need to distinguish between the absence of a primitive\n// typed field and its default value.\n//\n// These wrappers have no meaningful use within repeated fields as they lack\n// the ability to detect presence on individual elements.\n// These wrappers have no meaningful use within a map or a oneof since\n// individual entries of a map or fields of a oneof can already detect presence.\n\n// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: google/protobuf/wrappers.proto\n\npackage wrapperspb\n\nimport (\n\tprotoreflect \"google.golang.org/protobuf/reflect/protoreflect\"\n\tprotoimpl \"google.golang.org/protobuf/runtime/protoimpl\"\n\treflect \"reflect\"\n\tsync \"sync\"\n)\n\n// Wrapper message for `double`.\n//\n// The JSON representation for `DoubleValue` is JSON number.\ntype DoubleValue struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// The double value.\n\tValue float64 `protobuf:\"fixed64,1,opt,name=value,proto3\" json:\"value,omitempty\"`\n}\n\n// Double stores v in a new DoubleValue and returns a pointer to it.\nfunc Double(v float64) *DoubleValue {\n\treturn &DoubleValue{Value: v}\n}\n\nfunc (x *DoubleValue) Reset() {\n\t*x = DoubleValue{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_wrappers_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *DoubleValue) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*DoubleValue) ProtoMessage() {}\n\nfunc (x *DoubleValue) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_wrappers_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use DoubleValue.ProtoReflect.Descriptor instead.\nfunc (*DoubleValue) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{0}\n}\n\nfunc (x *DoubleValue) GetValue() float64 {\n\tif x != nil {\n\t\treturn x.Value\n\t}\n\treturn 0\n}\n\n// Wrapper message for `float`.\n//\n// The JSON representation for `FloatValue` is JSON number.\ntype FloatValue struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// The float value.\n\tValue float32 `protobuf:\"fixed32,1,opt,name=value,proto3\" json:\"value,omitempty\"`\n}\n\n// Float stores v in a new FloatValue and returns a pointer to it.\nfunc Float(v float32) *FloatValue {\n\treturn &FloatValue{Value: v}\n}\n\nfunc (x *FloatValue) Reset() {\n\t*x = FloatValue{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_wrappers_proto_msgTypes[1]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *FloatValue) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*FloatValue) ProtoMessage() {}\n\nfunc (x *FloatValue) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_wrappers_proto_msgTypes[1]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use FloatValue.ProtoReflect.Descriptor instead.\nfunc (*FloatValue) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{1}\n}\n\nfunc (x *FloatValue) GetValue() float32 {\n\tif x != nil {\n\t\treturn x.Value\n\t}\n\treturn 0\n}\n\n// Wrapper message for `int64`.\n//\n// The JSON representation for `Int64Value` is JSON string.\ntype Int64Value struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// The int64 value.\n\tValue int64 `protobuf:\"varint,1,opt,name=value,proto3\" json:\"value,omitempty\"`\n}\n\n// Int64 stores v in a new Int64Value and returns a pointer to it.\nfunc Int64(v int64) *Int64Value {\n\treturn &Int64Value{Value: v}\n}\n\nfunc (x *Int64Value) Reset() {\n\t*x = Int64Value{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_wrappers_proto_msgTypes[2]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Int64Value) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Int64Value) ProtoMessage() {}\n\nfunc (x *Int64Value) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_wrappers_proto_msgTypes[2]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Int64Value.ProtoReflect.Descriptor instead.\nfunc (*Int64Value) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{2}\n}\n\nfunc (x *Int64Value) GetValue() int64 {\n\tif x != nil {\n\t\treturn x.Value\n\t}\n\treturn 0\n}\n\n// Wrapper message for `uint64`.\n//\n// The JSON representation for `UInt64Value` is JSON string.\ntype UInt64Value struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// The uint64 value.\n\tValue uint64 `protobuf:\"varint,1,opt,name=value,proto3\" json:\"value,omitempty\"`\n}\n\n// UInt64 stores v in a new UInt64Value and returns a pointer to it.\nfunc UInt64(v uint64) *UInt64Value {\n\treturn &UInt64Value{Value: v}\n}\n\nfunc (x *UInt64Value) Reset() {\n\t*x = UInt64Value{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_wrappers_proto_msgTypes[3]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *UInt64Value) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*UInt64Value) ProtoMessage() {}\n\nfunc (x *UInt64Value) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_wrappers_proto_msgTypes[3]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use UInt64Value.ProtoReflect.Descriptor instead.\nfunc (*UInt64Value) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{3}\n}\n\nfunc (x *UInt64Value) GetValue() uint64 {\n\tif x != nil {\n\t\treturn x.Value\n\t}\n\treturn 0\n}\n\n// Wrapper message for `int32`.\n//\n// The JSON representation for `Int32Value` is JSON number.\ntype Int32Value struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// The int32 value.\n\tValue int32 `protobuf:\"varint,1,opt,name=value,proto3\" json:\"value,omitempty\"`\n}\n\n// Int32 stores v in a new Int32Value and returns a pointer to it.\nfunc Int32(v int32) *Int32Value {\n\treturn &Int32Value{Value: v}\n}\n\nfunc (x *Int32Value) Reset() {\n\t*x = Int32Value{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_wrappers_proto_msgTypes[4]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Int32Value) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Int32Value) ProtoMessage() {}\n\nfunc (x *Int32Value) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_wrappers_proto_msgTypes[4]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Int32Value.ProtoReflect.Descriptor instead.\nfunc (*Int32Value) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{4}\n}\n\nfunc (x *Int32Value) GetValue() int32 {\n\tif x != nil {\n\t\treturn x.Value\n\t}\n\treturn 0\n}\n\n// Wrapper message for `uint32`.\n//\n// The JSON representation for `UInt32Value` is JSON number.\ntype UInt32Value struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// The uint32 value.\n\tValue uint32 `protobuf:\"varint,1,opt,name=value,proto3\" json:\"value,omitempty\"`\n}\n\n// UInt32 stores v in a new UInt32Value and returns a pointer to it.\nfunc UInt32(v uint32) *UInt32Value {\n\treturn &UInt32Value{Value: v}\n}\n\nfunc (x *UInt32Value) Reset() {\n\t*x = UInt32Value{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_wrappers_proto_msgTypes[5]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *UInt32Value) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*UInt32Value) ProtoMessage() {}\n\nfunc (x *UInt32Value) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_wrappers_proto_msgTypes[5]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use UInt32Value.ProtoReflect.Descriptor instead.\nfunc (*UInt32Value) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{5}\n}\n\nfunc (x *UInt32Value) GetValue() uint32 {\n\tif x != nil {\n\t\treturn x.Value\n\t}\n\treturn 0\n}\n\n// Wrapper message for `bool`.\n//\n// The JSON representation for `BoolValue` is JSON `true` and `false`.\ntype BoolValue struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// The bool value.\n\tValue bool `protobuf:\"varint,1,opt,name=value,proto3\" json:\"value,omitempty\"`\n}\n\n// Bool stores v in a new BoolValue and returns a pointer to it.\nfunc Bool(v bool) *BoolValue {\n\treturn &BoolValue{Value: v}\n}\n\nfunc (x *BoolValue) Reset() {\n\t*x = BoolValue{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_wrappers_proto_msgTypes[6]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *BoolValue) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*BoolValue) ProtoMessage() {}\n\nfunc (x *BoolValue) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_wrappers_proto_msgTypes[6]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use BoolValue.ProtoReflect.Descriptor instead.\nfunc (*BoolValue) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{6}\n}\n\nfunc (x *BoolValue) GetValue() bool {\n\tif x != nil {\n\t\treturn x.Value\n\t}\n\treturn false\n}\n\n// Wrapper message for `string`.\n//\n// The JSON representation for `StringValue` is JSON string.\ntype StringValue struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// The string value.\n\tValue string `protobuf:\"bytes,1,opt,name=value,proto3\" json:\"value,omitempty\"`\n}\n\n// String stores v in a new StringValue and returns a pointer to it.\nfunc String(v string) *StringValue {\n\treturn &StringValue{Value: v}\n}\n\nfunc (x *StringValue) Reset() {\n\t*x = StringValue{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_wrappers_proto_msgTypes[7]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *StringValue) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*StringValue) ProtoMessage() {}\n\nfunc (x *StringValue) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_wrappers_proto_msgTypes[7]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use StringValue.ProtoReflect.Descriptor instead.\nfunc (*StringValue) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{7}\n}\n\nfunc (x *StringValue) GetValue() string {\n\tif x != nil {\n\t\treturn x.Value\n\t}\n\treturn \"\"\n}\n\n// Wrapper message for `bytes`.\n//\n// The JSON representation for `BytesValue` is JSON string.\ntype BytesValue struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// The bytes value.\n\tValue []byte `protobuf:\"bytes,1,opt,name=value,proto3\" json:\"value,omitempty\"`\n}\n\n// Bytes stores v in a new BytesValue and returns a pointer to it.\nfunc Bytes(v []byte) *BytesValue {\n\treturn &BytesValue{Value: v}\n}\n\nfunc (x *BytesValue) Reset() {\n\t*x = BytesValue{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_wrappers_proto_msgTypes[8]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *BytesValue) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*BytesValue) ProtoMessage() {}\n\nfunc (x *BytesValue) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_wrappers_proto_msgTypes[8]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use BytesValue.ProtoReflect.Descriptor instead.\nfunc (*BytesValue) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_wrappers_proto_rawDescGZIP(), []int{8}\n}\n\nfunc (x *BytesValue) GetValue() []byte {\n\tif x != nil {\n\t\treturn x.Value\n\t}\n\treturn nil\n}\n\nvar File_google_protobuf_wrappers_proto protoreflect.FileDescriptor\n\nvar file_google_protobuf_wrappers_proto_rawDesc = []byte{\n\t0x0a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,\n\t0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,\n\t0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,\n\t0x66, 0x22, 0x23, 0x0a, 0x0b, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65,\n\t0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52,\n\t0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x56,\n\t0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20,\n\t0x01, 0x28, 0x02, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x49, 0x6e,\n\t0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,\n\t0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x23,\n\t0x0a, 0x0b, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a,\n\t0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x61,\n\t0x6c, 0x75, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75,\n\t0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,\n\t0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x23, 0x0a, 0x0b, 0x55, 0x49, 0x6e, 0x74, 0x33,\n\t0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,\n\t0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x21, 0x0a, 0x09,\n\t0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,\n\t0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,\n\t0x23, 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14,\n\t0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76,\n\t0x61, 0x6c, 0x75, 0x65, 0x22, 0x22, 0x0a, 0x0a, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c,\n\t0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,\n\t0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x83, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d,\n\t0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,\n\t0x42, 0x0d, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50,\n\t0x01, 0x5a, 0x31, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67,\n\t0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79,\n\t0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65,\n\t0x72, 0x73, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e,\n\t0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,\n\t0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,\n}\n\nvar (\n\tfile_google_protobuf_wrappers_proto_rawDescOnce sync.Once\n\tfile_google_protobuf_wrappers_proto_rawDescData = file_google_protobuf_wrappers_proto_rawDesc\n)\n\nfunc file_google_protobuf_wrappers_proto_rawDescGZIP() []byte {\n\tfile_google_protobuf_wrappers_proto_rawDescOnce.Do(func() {\n\t\tfile_google_protobuf_wrappers_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_wrappers_proto_rawDescData)\n\t})\n\treturn file_google_protobuf_wrappers_proto_rawDescData\n}\n\nvar file_google_protobuf_wrappers_proto_msgTypes = make([]protoimpl.MessageInfo, 9)\nvar file_google_protobuf_wrappers_proto_goTypes = []interface{}{\n\t(*DoubleValue)(nil), // 0: google.protobuf.DoubleValue\n\t(*FloatValue)(nil),  // 1: google.protobuf.FloatValue\n\t(*Int64Value)(nil),  // 2: google.protobuf.Int64Value\n\t(*UInt64Value)(nil), // 3: google.protobuf.UInt64Value\n\t(*Int32Value)(nil),  // 4: google.protobuf.Int32Value\n\t(*UInt32Value)(nil), // 5: google.protobuf.UInt32Value\n\t(*BoolValue)(nil),   // 6: google.protobuf.BoolValue\n\t(*StringValue)(nil), // 7: google.protobuf.StringValue\n\t(*BytesValue)(nil),  // 8: google.protobuf.BytesValue\n}\nvar file_google_protobuf_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_google_protobuf_wrappers_proto_init() }\nfunc file_google_protobuf_wrappers_proto_init() {\n\tif File_google_protobuf_wrappers_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_google_protobuf_wrappers_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*DoubleValue); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_wrappers_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*FloatValue); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_wrappers_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Int64Value); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_wrappers_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*UInt64Value); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_wrappers_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Int32Value); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_wrappers_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*UInt32Value); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_wrappers_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*BoolValue); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_wrappers_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*StringValue); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_wrappers_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*BytesValue); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_google_protobuf_wrappers_proto_rawDesc,\n\t\t\tNumEnums:      0,\n\t\t\tNumMessages:   9,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_google_protobuf_wrappers_proto_goTypes,\n\t\tDependencyIndexes: file_google_protobuf_wrappers_proto_depIdxs,\n\t\tMessageInfos:      file_google_protobuf_wrappers_proto_msgTypes,\n\t}.Build()\n\tFile_google_protobuf_wrappers_proto = out.File\n\tfile_google_protobuf_wrappers_proto_rawDesc = nil\n\tfile_google_protobuf_wrappers_proto_goTypes = nil\n\tfile_google_protobuf_wrappers_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "vendor/google.golang.org/protobuf/types/pluginpb/plugin.pb.go",
    "content": "// Protocol Buffers - Google's data interchange format\n// Copyright 2008 Google Inc.  All rights reserved.\n// https://developers.google.com/protocol-buffers/\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n//     * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// Author: kenton@google.com (Kenton Varda)\n//\n// WARNING:  The plugin interface is currently EXPERIMENTAL and is subject to\n//   change.\n//\n// protoc (aka the Protocol Compiler) can be extended via plugins.  A plugin is\n// just a program that reads a CodeGeneratorRequest from stdin and writes a\n// CodeGeneratorResponse to stdout.\n//\n// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead\n// of dealing with the raw protocol defined here.\n//\n// A plugin executable needs only to be placed somewhere in the path.  The\n// plugin should be named \"protoc-gen-$NAME\", and will then be used when the\n// flag \"--${NAME}_out\" is passed to protoc.\n\n// Code generated by protoc-gen-go. DO NOT EDIT.\n// source: google/protobuf/compiler/plugin.proto\n\npackage pluginpb\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\tsync \"sync\"\n)\n\n// Sync with code_generator.h.\ntype CodeGeneratorResponse_Feature int32\n\nconst (\n\tCodeGeneratorResponse_FEATURE_NONE            CodeGeneratorResponse_Feature = 0\n\tCodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL CodeGeneratorResponse_Feature = 1\n)\n\n// Enum value maps for CodeGeneratorResponse_Feature.\nvar (\n\tCodeGeneratorResponse_Feature_name = map[int32]string{\n\t\t0: \"FEATURE_NONE\",\n\t\t1: \"FEATURE_PROTO3_OPTIONAL\",\n\t}\n\tCodeGeneratorResponse_Feature_value = map[string]int32{\n\t\t\"FEATURE_NONE\":            0,\n\t\t\"FEATURE_PROTO3_OPTIONAL\": 1,\n\t}\n)\n\nfunc (x CodeGeneratorResponse_Feature) Enum() *CodeGeneratorResponse_Feature {\n\tp := new(CodeGeneratorResponse_Feature)\n\t*p = x\n\treturn p\n}\n\nfunc (x CodeGeneratorResponse_Feature) String() string {\n\treturn protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))\n}\n\nfunc (CodeGeneratorResponse_Feature) Descriptor() protoreflect.EnumDescriptor {\n\treturn file_google_protobuf_compiler_plugin_proto_enumTypes[0].Descriptor()\n}\n\nfunc (CodeGeneratorResponse_Feature) Type() protoreflect.EnumType {\n\treturn &file_google_protobuf_compiler_plugin_proto_enumTypes[0]\n}\n\nfunc (x CodeGeneratorResponse_Feature) Number() protoreflect.EnumNumber {\n\treturn protoreflect.EnumNumber(x)\n}\n\n// Deprecated: Do not use.\nfunc (x *CodeGeneratorResponse_Feature) UnmarshalJSON(b []byte) error {\n\tnum, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*x = CodeGeneratorResponse_Feature(num)\n\treturn nil\n}\n\n// Deprecated: Use CodeGeneratorResponse_Feature.Descriptor instead.\nfunc (CodeGeneratorResponse_Feature) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{2, 0}\n}\n\n// The version number of protocol compiler.\ntype Version struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\tMajor *int32 `protobuf:\"varint,1,opt,name=major\" json:\"major,omitempty\"`\n\tMinor *int32 `protobuf:\"varint,2,opt,name=minor\" json:\"minor,omitempty\"`\n\tPatch *int32 `protobuf:\"varint,3,opt,name=patch\" json:\"patch,omitempty\"`\n\t// A suffix for alpha, beta or rc release, e.g., \"alpha-1\", \"rc2\". It should\n\t// be empty for mainline stable releases.\n\tSuffix *string `protobuf:\"bytes,4,opt,name=suffix\" json:\"suffix,omitempty\"`\n}\n\nfunc (x *Version) Reset() {\n\t*x = Version{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[0]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *Version) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*Version) ProtoMessage() {}\n\nfunc (x *Version) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[0]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use Version.ProtoReflect.Descriptor instead.\nfunc (*Version) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{0}\n}\n\nfunc (x *Version) GetMajor() int32 {\n\tif x != nil && x.Major != nil {\n\t\treturn *x.Major\n\t}\n\treturn 0\n}\n\nfunc (x *Version) GetMinor() int32 {\n\tif x != nil && x.Minor != nil {\n\t\treturn *x.Minor\n\t}\n\treturn 0\n}\n\nfunc (x *Version) GetPatch() int32 {\n\tif x != nil && x.Patch != nil {\n\t\treturn *x.Patch\n\t}\n\treturn 0\n}\n\nfunc (x *Version) GetSuffix() string {\n\tif x != nil && x.Suffix != nil {\n\t\treturn *x.Suffix\n\t}\n\treturn \"\"\n}\n\n// An encoded CodeGeneratorRequest is written to the plugin's stdin.\ntype CodeGeneratorRequest struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// The .proto files that were explicitly listed on the command-line.  The\n\t// code generator should generate code only for these files.  Each file's\n\t// descriptor will be included in proto_file, below.\n\tFileToGenerate []string `protobuf:\"bytes,1,rep,name=file_to_generate,json=fileToGenerate\" json:\"file_to_generate,omitempty\"`\n\t// The generator parameter passed on the command-line.\n\tParameter *string `protobuf:\"bytes,2,opt,name=parameter\" json:\"parameter,omitempty\"`\n\t// FileDescriptorProtos for all files in files_to_generate and everything\n\t// they import.  The files will appear in topological order, so each file\n\t// appears before any file that imports it.\n\t//\n\t// protoc guarantees that all proto_files will be written after\n\t// the fields above, even though this is not technically guaranteed by the\n\t// protobuf wire format.  This theoretically could allow a plugin to stream\n\t// in the FileDescriptorProtos and handle them one by one rather than read\n\t// the entire set into memory at once.  However, as of this writing, this\n\t// is not similarly optimized on protoc's end -- it will store all fields in\n\t// memory at once before sending them to the plugin.\n\t//\n\t// Type names of fields and extensions in the FileDescriptorProto are always\n\t// fully qualified.\n\tProtoFile []*descriptorpb.FileDescriptorProto `protobuf:\"bytes,15,rep,name=proto_file,json=protoFile\" json:\"proto_file,omitempty\"`\n\t// The version number of protocol compiler.\n\tCompilerVersion *Version `protobuf:\"bytes,3,opt,name=compiler_version,json=compilerVersion\" json:\"compiler_version,omitempty\"`\n}\n\nfunc (x *CodeGeneratorRequest) Reset() {\n\t*x = CodeGeneratorRequest{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[1]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *CodeGeneratorRequest) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*CodeGeneratorRequest) ProtoMessage() {}\n\nfunc (x *CodeGeneratorRequest) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[1]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use CodeGeneratorRequest.ProtoReflect.Descriptor instead.\nfunc (*CodeGeneratorRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{1}\n}\n\nfunc (x *CodeGeneratorRequest) GetFileToGenerate() []string {\n\tif x != nil {\n\t\treturn x.FileToGenerate\n\t}\n\treturn nil\n}\n\nfunc (x *CodeGeneratorRequest) GetParameter() string {\n\tif x != nil && x.Parameter != nil {\n\t\treturn *x.Parameter\n\t}\n\treturn \"\"\n}\n\nfunc (x *CodeGeneratorRequest) GetProtoFile() []*descriptorpb.FileDescriptorProto {\n\tif x != nil {\n\t\treturn x.ProtoFile\n\t}\n\treturn nil\n}\n\nfunc (x *CodeGeneratorRequest) GetCompilerVersion() *Version {\n\tif x != nil {\n\t\treturn x.CompilerVersion\n\t}\n\treturn nil\n}\n\n// The plugin writes an encoded CodeGeneratorResponse to stdout.\ntype CodeGeneratorResponse struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// Error message.  If non-empty, code generation failed.  The plugin process\n\t// should exit with status code zero even if it reports an error in this way.\n\t//\n\t// This should be used to indicate errors in .proto files which prevent the\n\t// code generator from generating correct code.  Errors which indicate a\n\t// problem in protoc itself -- such as the input CodeGeneratorRequest being\n\t// unparseable -- should be reported by writing a message to stderr and\n\t// exiting with a non-zero status code.\n\tError *string `protobuf:\"bytes,1,opt,name=error\" json:\"error,omitempty\"`\n\t// A bitmask of supported features that the code generator supports.\n\t// This is a bitwise \"or\" of values from the Feature enum.\n\tSupportedFeatures *uint64                       `protobuf:\"varint,2,opt,name=supported_features,json=supportedFeatures\" json:\"supported_features,omitempty\"`\n\tFile              []*CodeGeneratorResponse_File `protobuf:\"bytes,15,rep,name=file\" json:\"file,omitempty\"`\n}\n\nfunc (x *CodeGeneratorResponse) Reset() {\n\t*x = CodeGeneratorResponse{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[2]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *CodeGeneratorResponse) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*CodeGeneratorResponse) ProtoMessage() {}\n\nfunc (x *CodeGeneratorResponse) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[2]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use CodeGeneratorResponse.ProtoReflect.Descriptor instead.\nfunc (*CodeGeneratorResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{2}\n}\n\nfunc (x *CodeGeneratorResponse) GetError() string {\n\tif x != nil && x.Error != nil {\n\t\treturn *x.Error\n\t}\n\treturn \"\"\n}\n\nfunc (x *CodeGeneratorResponse) GetSupportedFeatures() uint64 {\n\tif x != nil && x.SupportedFeatures != nil {\n\t\treturn *x.SupportedFeatures\n\t}\n\treturn 0\n}\n\nfunc (x *CodeGeneratorResponse) GetFile() []*CodeGeneratorResponse_File {\n\tif x != nil {\n\t\treturn x.File\n\t}\n\treturn nil\n}\n\n// Represents a single generated file.\ntype CodeGeneratorResponse_File struct {\n\tstate         protoimpl.MessageState\n\tsizeCache     protoimpl.SizeCache\n\tunknownFields protoimpl.UnknownFields\n\n\t// The file name, relative to the output directory.  The name must not\n\t// contain \".\" or \"..\" components and must be relative, not be absolute (so,\n\t// the file cannot lie outside the output directory).  \"/\" must be used as\n\t// the path separator, not \"\\\".\n\t//\n\t// If the name is omitted, the content will be appended to the previous\n\t// file.  This allows the generator to break large files into small chunks,\n\t// and allows the generated text to be streamed back to protoc so that large\n\t// files need not reside completely in memory at one time.  Note that as of\n\t// this writing protoc does not optimize for this -- it will read the entire\n\t// CodeGeneratorResponse before writing files to disk.\n\tName *string `protobuf:\"bytes,1,opt,name=name\" json:\"name,omitempty\"`\n\t// If non-empty, indicates that the named file should already exist, and the\n\t// content here is to be inserted into that file at a defined insertion\n\t// point.  This feature allows a code generator to extend the output\n\t// produced by another code generator.  The original generator may provide\n\t// insertion points by placing special annotations in the file that look\n\t// like:\n\t//   @@protoc_insertion_point(NAME)\n\t// The annotation can have arbitrary text before and after it on the line,\n\t// which allows it to be placed in a comment.  NAME should be replaced with\n\t// an identifier naming the point -- this is what other generators will use\n\t// as the insertion_point.  Code inserted at this point will be placed\n\t// immediately above the line containing the insertion point (thus multiple\n\t// insertions to the same point will come out in the order they were added).\n\t// The double-@ is intended to make it unlikely that the generated code\n\t// could contain things that look like insertion points by accident.\n\t//\n\t// For example, the C++ code generator places the following line in the\n\t// .pb.h files that it generates:\n\t//   // @@protoc_insertion_point(namespace_scope)\n\t// This line appears within the scope of the file's package namespace, but\n\t// outside of any particular class.  Another plugin can then specify the\n\t// insertion_point \"namespace_scope\" to generate additional classes or\n\t// other declarations that should be placed in this scope.\n\t//\n\t// Note that if the line containing the insertion point begins with\n\t// whitespace, the same whitespace will be added to every line of the\n\t// inserted text.  This is useful for languages like Python, where\n\t// indentation matters.  In these languages, the insertion point comment\n\t// should be indented the same amount as any inserted code will need to be\n\t// in order to work correctly in that context.\n\t//\n\t// The code generator that generates the initial file and the one which\n\t// inserts into it must both run as part of a single invocation of protoc.\n\t// Code generators are executed in the order in which they appear on the\n\t// command line.\n\t//\n\t// If |insertion_point| is present, |name| must also be present.\n\tInsertionPoint *string `protobuf:\"bytes,2,opt,name=insertion_point,json=insertionPoint\" json:\"insertion_point,omitempty\"`\n\t// The file contents.\n\tContent *string `protobuf:\"bytes,15,opt,name=content\" json:\"content,omitempty\"`\n\t// Information describing the file content being inserted. If an insertion\n\t// point is used, this information will be appropriately offset and inserted\n\t// into the code generation metadata for the generated files.\n\tGeneratedCodeInfo *descriptorpb.GeneratedCodeInfo `protobuf:\"bytes,16,opt,name=generated_code_info,json=generatedCodeInfo\" json:\"generated_code_info,omitempty\"`\n}\n\nfunc (x *CodeGeneratorResponse_File) Reset() {\n\t*x = CodeGeneratorResponse_File{}\n\tif protoimpl.UnsafeEnabled {\n\t\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[3]\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tms.StoreMessageInfo(mi)\n\t}\n}\n\nfunc (x *CodeGeneratorResponse_File) String() string {\n\treturn protoimpl.X.MessageStringOf(x)\n}\n\nfunc (*CodeGeneratorResponse_File) ProtoMessage() {}\n\nfunc (x *CodeGeneratorResponse_File) ProtoReflect() protoreflect.Message {\n\tmi := &file_google_protobuf_compiler_plugin_proto_msgTypes[3]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}\n\n// Deprecated: Use CodeGeneratorResponse_File.ProtoReflect.Descriptor instead.\nfunc (*CodeGeneratorResponse_File) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{2, 0}\n}\n\nfunc (x *CodeGeneratorResponse_File) GetName() string {\n\tif x != nil && x.Name != nil {\n\t\treturn *x.Name\n\t}\n\treturn \"\"\n}\n\nfunc (x *CodeGeneratorResponse_File) GetInsertionPoint() string {\n\tif x != nil && x.InsertionPoint != nil {\n\t\treturn *x.InsertionPoint\n\t}\n\treturn \"\"\n}\n\nfunc (x *CodeGeneratorResponse_File) GetContent() string {\n\tif x != nil && x.Content != nil {\n\t\treturn *x.Content\n\t}\n\treturn \"\"\n}\n\nfunc (x *CodeGeneratorResponse_File) GetGeneratedCodeInfo() *descriptorpb.GeneratedCodeInfo {\n\tif x != nil {\n\t\treturn x.GeneratedCodeInfo\n\t}\n\treturn nil\n}\n\nvar File_google_protobuf_compiler_plugin_proto protoreflect.FileDescriptor\n\nvar file_google_protobuf_compiler_plugin_proto_rawDesc = []byte{\n\t0x0a, 0x25, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,\n\t0x66, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69,\n\t0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x18, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,\n\t0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65,\n\t0x72, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,\n\t0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72,\n\t0x6f, 0x74, 0x6f, 0x22, 0x63, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14,\n\t0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d,\n\t0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, 0x20,\n\t0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61,\n\t0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68,\n\t0x12, 0x16, 0x0a, 0x06, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,\n\t0x52, 0x06, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x22, 0xf1, 0x01, 0x0a, 0x14, 0x43, 0x6f, 0x64,\n\t0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,\n\t0x74, 0x12, 0x28, 0x0a, 0x10, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x74, 0x6f, 0x5f, 0x67, 0x65, 0x6e,\n\t0x65, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x66, 0x69, 0x6c,\n\t0x65, 0x54, 0x6f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70,\n\t0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,\n\t0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x43, 0x0a, 0x0a, 0x70, 0x72, 0x6f,\n\t0x74, 0x6f, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e,\n\t0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,\n\t0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50, 0x72,\n\t0x6f, 0x74, 0x6f, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x4c,\n\t0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69,\n\t0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,\n\t0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69,\n\t0x6c, 0x65, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x63, 0x6f, 0x6d,\n\t0x70, 0x69, 0x6c, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x94, 0x03, 0x0a,\n\t0x15, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65,\n\t0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18,\n\t0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x2d, 0x0a, 0x12,\n\t0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72,\n\t0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72,\n\t0x74, 0x65, 0x64, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x04, 0x66,\n\t0x69, 0x6c, 0x65, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x67, 0x6f, 0x6f, 0x67,\n\t0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70,\n\t0x69, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,\n\t0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52,\n\t0x04, 0x66, 0x69, 0x6c, 0x65, 0x1a, 0xb1, 0x01, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12,\n\t0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,\n\t0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x5f,\n\t0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x69, 0x6e, 0x73,\n\t0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63,\n\t0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f,\n\t0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x52, 0x0a, 0x13, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,\n\t0x65, 0x64, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x10, 0x20, 0x01,\n\t0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,\n\t0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f,\n\t0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x11, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,\n\t0x64, 0x43, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x38, 0x0a, 0x07, 0x46, 0x65, 0x61,\n\t0x74, 0x75, 0x72, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x46, 0x45, 0x41, 0x54, 0x55, 0x52, 0x45, 0x5f,\n\t0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x46, 0x45, 0x41, 0x54, 0x55, 0x52,\n\t0x45, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x33, 0x5f, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x41,\n\t0x4c, 0x10, 0x01, 0x42, 0x57, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,\n\t0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69,\n\t0x6c, 0x65, 0x72, 0x42, 0x0c, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f,\n\t0x73, 0x5a, 0x29, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67,\n\t0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79,\n\t0x70, 0x65, 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x70, 0x62,\n}\n\nvar (\n\tfile_google_protobuf_compiler_plugin_proto_rawDescOnce sync.Once\n\tfile_google_protobuf_compiler_plugin_proto_rawDescData = file_google_protobuf_compiler_plugin_proto_rawDesc\n)\n\nfunc file_google_protobuf_compiler_plugin_proto_rawDescGZIP() []byte {\n\tfile_google_protobuf_compiler_plugin_proto_rawDescOnce.Do(func() {\n\t\tfile_google_protobuf_compiler_plugin_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_compiler_plugin_proto_rawDescData)\n\t})\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescData\n}\n\nvar file_google_protobuf_compiler_plugin_proto_enumTypes = make([]protoimpl.EnumInfo, 1)\nvar file_google_protobuf_compiler_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 4)\nvar file_google_protobuf_compiler_plugin_proto_goTypes = []interface{}{\n\t(CodeGeneratorResponse_Feature)(0),       // 0: google.protobuf.compiler.CodeGeneratorResponse.Feature\n\t(*Version)(nil),                          // 1: google.protobuf.compiler.Version\n\t(*CodeGeneratorRequest)(nil),             // 2: google.protobuf.compiler.CodeGeneratorRequest\n\t(*CodeGeneratorResponse)(nil),            // 3: google.protobuf.compiler.CodeGeneratorResponse\n\t(*CodeGeneratorResponse_File)(nil),       // 4: google.protobuf.compiler.CodeGeneratorResponse.File\n\t(*descriptorpb.FileDescriptorProto)(nil), // 5: google.protobuf.FileDescriptorProto\n\t(*descriptorpb.GeneratedCodeInfo)(nil),   // 6: google.protobuf.GeneratedCodeInfo\n}\nvar file_google_protobuf_compiler_plugin_proto_depIdxs = []int32{\n\t5, // 0: google.protobuf.compiler.CodeGeneratorRequest.proto_file:type_name -> google.protobuf.FileDescriptorProto\n\t1, // 1: google.protobuf.compiler.CodeGeneratorRequest.compiler_version:type_name -> google.protobuf.compiler.Version\n\t4, // 2: google.protobuf.compiler.CodeGeneratorResponse.file:type_name -> google.protobuf.compiler.CodeGeneratorResponse.File\n\t6, // 3: google.protobuf.compiler.CodeGeneratorResponse.File.generated_code_info:type_name -> google.protobuf.GeneratedCodeInfo\n\t4, // [4:4] is the sub-list for method output_type\n\t4, // [4:4] is the sub-list for method input_type\n\t4, // [4:4] is the sub-list for extension type_name\n\t4, // [4:4] is the sub-list for extension extendee\n\t0, // [0:4] is the sub-list for field type_name\n}\n\nfunc init() { file_google_protobuf_compiler_plugin_proto_init() }\nfunc file_google_protobuf_compiler_plugin_proto_init() {\n\tif File_google_protobuf_compiler_plugin_proto != nil {\n\t\treturn\n\t}\n\tif !protoimpl.UnsafeEnabled {\n\t\tfile_google_protobuf_compiler_plugin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*Version); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_compiler_plugin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*CodeGeneratorRequest); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_compiler_plugin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*CodeGeneratorResponse); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tfile_google_protobuf_compiler_plugin_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {\n\t\t\tswitch v := v.(*CodeGeneratorResponse_File); i {\n\t\t\tcase 0:\n\t\t\t\treturn &v.state\n\t\t\tcase 1:\n\t\t\t\treturn &v.sizeCache\n\t\t\tcase 2:\n\t\t\t\treturn &v.unknownFields\n\t\t\tdefault:\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\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_google_protobuf_compiler_plugin_proto_rawDesc,\n\t\t\tNumEnums:      1,\n\t\t\tNumMessages:   4,\n\t\t\tNumExtensions: 0,\n\t\t\tNumServices:   0,\n\t\t},\n\t\tGoTypes:           file_google_protobuf_compiler_plugin_proto_goTypes,\n\t\tDependencyIndexes: file_google_protobuf_compiler_plugin_proto_depIdxs,\n\t\tEnumInfos:         file_google_protobuf_compiler_plugin_proto_enumTypes,\n\t\tMessageInfos:      file_google_protobuf_compiler_plugin_proto_msgTypes,\n\t}.Build()\n\tFile_google_protobuf_compiler_plugin_proto = out.File\n\tfile_google_protobuf_compiler_plugin_proto_rawDesc = nil\n\tfile_google_protobuf_compiler_plugin_proto_goTypes = nil\n\tfile_google_protobuf_compiler_plugin_proto_depIdxs = nil\n}\n"
  },
  {
    "path": "vendor_test.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage twirp\n\nimport (\n\t\"go/build\"\n\t\"os\"\n\t\"strings\"\n\t\"testing\"\n)\n\nfunc TestNoExternalDeps(t *testing.T) {\n\t// Twirp commits its vendor directory so that 'go get' works for its main\n\t// packages, but vendoring dependencies of the 'twirp' package could cause\n\t// problems for users.\n\t//\n\t// The simplest way to make things safe is to have no non-stdlib dependencies\n\t// in the twirp package.\n\n\twd, err := os.Getwd()\n\tif err != nil {\n\t\tt.Fatalf(\"unable to get current working directory: %v\", err)\n\t}\n\n\t// Gather all imports of the current package recursively\n\tallPkgs := make(map[string]bool)\n\n\tvar walkImports func(string)\n\twalkImports = func(pkgName string) {\n\t\tif allPkgs[pkgName] {\n\t\t\t// already visited\n\t\t\treturn\n\t\t}\n\t\tallPkgs[pkgName] = true\n\n\t\tpkg, err := build.Default.Import(pkgName, wd, 0)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"unable to import package %s: %s\", pkgName, err)\n\t\t}\n\t\tfor _, imported := range pkg.Imports {\n\t\t\t// Standard library packages don't have a '.' in them.\n\t\t\tif !strings.Contains(imported, \".\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// This is a non-stdlib package. It's okay if it's a twirp package - as\n\t\t\t// long as it doesn't have any external deps itself.\n\t\t\tif strings.HasPrefix(imported, \"github.com/twitchtv/twirp\") {\n\t\t\t\twalkImports(imported)\n\t\t\t} else {\n\t\t\t\tt.Errorf(\"imported external dependency: %v, imported by %v\", imported, pkgName)\n\t\t\t}\n\t\t}\n\t}\n\twalkImports(\"github.com/twitchtv/twirp\")\n}\n"
  },
  {
    "path": "version_constant.go",
    "content": "// Copyright 2018 Twitch Interactive, Inc.  All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"). You may not\n// use this file except in compliance with the License. A copy of the License is\n// located at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// or in the \"license\" file accompanying this file. This file is distributed on\n// an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n// express or implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\npackage twirp\n\n// TwirpPackageIsVersion7 is a constant referenced from generated code to\n// assert version compatibility at compile time.\nconst TwirpPackageIsVersion7 = true\n\n// TwirpPackageMinVersion_8_1_0 is required from generated code to\n// assert version compatibility at compile time.\nconst TwirpPackageMinVersion_8_1_0 = true\n"
  },
  {
    "path": "website/.gitignore",
    "content": "node_modules\n.DS_Store\n\nbuild/\nyarn.lock\npackage-lock.json\n\ni18n/*\n!i18n/en.json\ntranslated_docs\n"
  },
  {
    "path": "website/core/Footer.js",
    "content": "/**\n * Copyright (c) 2017-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nconst React = require('react');\n\nclass Footer extends React.Component {\n  render() {\n    const currentYear = new Date().getFullYear();\n    return (\n      <footer className=\"nav-footer\" id=\"footer\">\n        <section className=\"copyright\">\n          Copyright &copy; {currentYear} Twitch Interactive, Inc.\n        </section>\n      </footer>\n    );\n  }\n}\n\nmodule.exports = Footer;\n"
  },
  {
    "path": "website/i18n/en.json",
    "content": "{\n  \"_comment\": \"This file is auto-generated by write-translations.js\",\n  \"localized-strings\": {\n    \"next\": \"Next\",\n    \"previous\": \"Previous\",\n    \"tagline\": \"Simple RPC framework powered by protobuf\",\n    \"docs\": {\n      \"best_practices\": {\n        \"title\": \"Best Practices\",\n        \"sidebar_label\": \"Best Practices\"\n      },\n      \"command_line\": {\n        \"title\": \"Generator Flags for the Protoc Compiler\",\n        \"sidebar_label\": \"Generator Flags\"\n      },\n      \"curl\": {\n        \"title\": \"cURL\",\n        \"sidebar_label\": \"cURL\"\n      },\n      \"errors\": {\n        \"title\": \"Errors\",\n        \"sidebar_label\": \"Errors\"\n      },\n      \"example\": {\n        \"title\": \"Usage Example: Haberdasher\",\n        \"sidebar_label\": \"Usage Example\"\n      },\n      \"headers\": {\n        \"title\": \"Using custom HTTP Headers\",\n        \"sidebar_label\": \"Custom HTTP Headers\"\n      },\n      \"hooks\": {\n        \"title\": \"Hooks and Interceptors\",\n        \"sidebar_label\": \"Hooks and Interceptors\"\n      },\n      \"install\": {\n        \"title\": \"Installing Twirp\",\n        \"sidebar_label\": \"Installation\"\n      },\n      \"intro\": {\n        \"title\": \"Meet Twirp!\",\n        \"sidebar_label\": \"Overview\"\n      },\n      \"migrate_to_twirp\": {\n        \"title\": \"Migrate APIs to Twirp\",\n        \"sidebar_label\": \"Migrate APIs to Twirp\"\n      },\n      \"mux\": {\n        \"title\": \"Muxing Twirp with other HTTP services\",\n        \"sidebar_label\": \"Muxing Twirp services\"\n      },\n      \"proto_and_json\": {\n        \"title\": \"Twirp's Serialization Schemes\",\n        \"sidebar_label\": \"Protobuf and JSON\"\n      },\n      \"routing\": {\n        \"title\": \"Routing and Serialization\",\n        \"sidebar_label\": \"Routing and Serialization\"\n      },\n      \"spec_v5\": {\n        \"title\": \"Twirp Wire Protocol (v5)\",\n        \"sidebar_label\": \"Version 5 (Previous)\"\n      },\n      \"spec_v6\": {\n        \"title\": \"Twirp Wire Protocol (v6)\",\n        \"sidebar_label\": \"Version 6 (Archived)\"\n      },\n      \"spec_v7\": {\n        \"title\": \"Twirp Wire Protocol (v7)\",\n        \"sidebar_label\": \"Version 7 (Current)\"\n      },\n      \"version_matrix\": {\n        \"title\": \"Version Compatibility\",\n        \"sidebar_label\": \"Version Compatibility\"\n      }\n    },\n    \"links\": {\n      \"Docs\": \"Docs\",\n      \"Spec\": \"Spec\"\n    },\n    \"categories\": {\n      \"Getting started\": \"Getting started\",\n      \"Beyond the basics\": \"Beyond the basics\",\n      \"Formal specification\": \"Formal specification\"\n    }\n  },\n  \"pages-strings\": {\n    \"Help Translate|recruit community translators for your project\": \"Help Translate\",\n    \"Edit this Doc|recruitment message asking to edit the doc source\": \"Edit\",\n    \"Translate this Doc|recruitment message asking to translate the docs\": \"Translate\"\n  }\n}\n"
  },
  {
    "path": "website/package.json",
    "content": "{\n  \"scripts\": {\n    \"examples\": \"docusaurus-examples\",\n    \"start\": \"docusaurus-start\",\n    \"build\": \"docusaurus-build\",\n    \"publish-gh-pages\": \"docusaurus-publish\",\n    \"write-translations\": \"docusaurus-write-translations\",\n    \"version\": \"docusaurus-version\",\n    \"rename-version\": \"docusaurus-rename-version\"\n  },\n  \"devDependencies\": {\n    \"docusaurus\": \"^1.0.5\"\n  }\n}\n"
  },
  {
    "path": "website/pages/en/help.js",
    "content": "/**\n * Copyright (c) 2017-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nconst React = require('react');\n\nconst CompLibrary = require('../../core/CompLibrary.js');\nconst Container = CompLibrary.Container;\nconst GridBlock = CompLibrary.GridBlock;\n\nconst siteConfig = require(process.cwd() + '/siteConfig.js');\n\nclass Help extends React.Component {\n  render() {\n    const supportLinks = [\n      {\n        content:\n          'Learn more using the [documentation on this site.](/test-site/docs/en/doc1.html)',\n        title: 'Browse Docs',\n      },\n      {\n        content: 'Ask questions about the documentation and project',\n        title: 'Join the community',\n      },\n      {\n        content: \"Find out what's new with this project\",\n        title: 'Stay up to date',\n      },\n    ];\n\n    return (\n      <div className=\"docMainWrapper wrapper\">\n        <Container className=\"mainContainer documentContainer postContainer\">\n          <div className=\"post\">\n            <header className=\"postHeader\">\n              <h2>Need help?</h2>\n            </header>\n            <p>This project is maintained by a dedicated group of people.</p>\n            <GridBlock contents={supportLinks} layout=\"threeColumn\" />\n          </div>\n        </Container>\n      </div>\n    );\n  }\n}\n\nmodule.exports = Help;\n"
  },
  {
    "path": "website/pages/en/index.js",
    "content": "/**\n * Copyright (c) 2017-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nconst React = require('react');\n\nconst CompLibrary = require('../../core/CompLibrary.js');\nconst MarkdownBlock = CompLibrary.MarkdownBlock; /* Used to read markdown */\nconst Container = CompLibrary.Container;\nconst GridBlock = CompLibrary.GridBlock;\n\nconst siteConfig = require(process.cwd() + '/siteConfig.js');\n\nfunction imgUrl(img) {\n  return siteConfig.baseUrl + 'img/' + img;\n}\n\nfunction docUrl(doc, language) {\n  return siteConfig.baseUrl + 'docs/' + (language ? language + '/' : '') + doc;\n}\n\nfunction pageUrl(page, language) {\n  return siteConfig.baseUrl + (language ? language + '/' : '') + page;\n}\n\nclass Button extends React.Component {\n  render() {\n    return (\n      <div className=\"pluginWrapper buttonWrapper\">\n        <a className=\"button\" href={this.props.href} target={this.props.target}>\n          {this.props.children}\n        </a>\n      </div>\n    );\n  }\n}\n\nButton.defaultProps = {\n  target: '_self',\n};\n\nconst SplashContainer = props => (\n  <div className=\"homeContainer\">\n    <div className=\"homeSplashFade\">\n      <div className=\"wrapper homeWrapper\">{props.children}</div>\n    </div>\n  </div>\n);\n\nconst Logo = props => (\n  <div className=\"projectLogo\">\n    <img src={props.img_src} />\n  </div>\n);\n\nconst ProjectTitle = props => (\n  <h2 className=\"projectTitle\">\n    {siteConfig.title}\n    <small>{siteConfig.tagline}</small>\n  </h2>\n);\n\nconst PromoSection = props => (\n  <div className=\"section promoSection\">\n    <div className=\"promoRow\">\n      <div className=\"pluginRowBlock\">{props.children}</div>\n    </div>\n  </div>\n);\n\nclass HomeSplash extends React.Component {\n  render() {\n    let language = this.props.language || '';\n    return (\n      <SplashContainer>\n        <div className=\"inner\">\n          <ProjectTitle />\n          <PromoSection>\n            <Button href={docUrl('intro.html', language)}>Documentation</Button>\n            <Button href={docUrl('spec_v7.html', language)}>Protocol Specification</Button>\n          </PromoSection>\n        </div>\n      </SplashContainer>\n    );\n  }\n}\n\nconst Block = props => (\n  <Container\n    padding={['bottom', 'top']}\n    id={props.id}\n    background={props.background}>\n    <GridBlock align=\"center\" contents={props.children} layout={props.layout} />\n  </Container>\n);\n\nclass Index extends React.Component {\n  render() {\n    let language = this.props.language || '';\n\n    return (\n      <div>\n        <HomeSplash language={language} />\n        <div className=\"mainContainer\">\n        </div>\n      </div>\n    );\n  }\n}\n\nmodule.exports = Index;\n"
  },
  {
    "path": "website/pages/en/users.js",
    "content": "/**\n * Copyright (c) 2017-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nconst React = require('react');\n\nconst CompLibrary = require('../../core/CompLibrary.js');\nconst Container = CompLibrary.Container;\n\nconst siteConfig = require(process.cwd() + '/siteConfig.js');\n\nclass Users extends React.Component {\n  render() {\n    const showcase = siteConfig.users.map((user, i) => {\n      return (\n        <a href={user.infoLink} key={i}>\n          <img src={user.image} title={user.caption} />\n        </a>\n      );\n    });\n\n    return (\n      <div className=\"mainContainer\">\n        <Container padding={['bottom', 'top']}>\n          <div className=\"showcaseSection\">\n            <div className=\"prose\">\n              <h1>Who's Using This?</h1>\n              <p>This project is used by many folks</p>\n            </div>\n            <div className=\"logos\">{showcase}</div>\n            <p>Are you using this project?</p>\n            <a\n              href=\"https://github.com/facebook/docusaurus/edit/master/website/siteConfig.js\"\n              className=\"button\">\n              Add your company\n            </a>\n          </div>\n        </Container>\n      </div>\n    );\n  }\n}\n\nmodule.exports = Users;\n"
  },
  {
    "path": "website/sidebars.json",
    "content": "{\n  \"docs\": {\n    \"Getting started\": [\"intro\", \"install\", \"example\", \"best_practices\"],\n    \"Beyond the basics\": [\n      \"routing\",\n      \"errors\",\n      \"proto_and_json\",\n      \"hooks\",\n      \"mux\",\n      \"headers\",\n      \"command_line\",\n      \"curl\",\n      \"migrate_to_twirp\",\n      \"version_matrix\"\n    ],\n    \"Formal specification\": [\"spec_v5\", \"spec_v6\", \"spec_v7\"]\n  }\n}\n"
  },
  {
    "path": "website/siteConfig.js",
    "content": "/**\n * Copyright (c) 2017-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/* List of projects/orgs using your project for the users page */\nconst users = [\n    {\n        caption: 'Twitch',\n        image: '/test-site/img/twitch.png',\n        infoLink: 'https://twitch.tv',\n        pinned: true,\n    },\n];\n\nconst siteConfig = {\n    title: 'Twirp' /* title for your website */,\n    tagline: 'Simple RPC framework powered by protobuf',\n    url: 'https://twitchtv.github.io' /* your website url */,\n    baseUrl: '/twirp/' /* base url for your project */,\n    organizationName: 'twitchtv',\n    projectName: 'twirp',\n    headerLinks: [\n        {doc: 'intro', label: 'Docs'},\n        {doc: 'spec_v7', label: 'Spec'},\n    ],\n    users,\n    /* colors for website */\n    colors: {\n        primaryColor: '#6441a5',\n        secondaryColor: '#f1f1f1',\n    },\n    // This copyright info is used in /core/Footer.js and blog rss/atom feeds.\n    copyright:\n    'Copyright © ' +\n        new Date().getFullYear() +\n        ' Twitch Interactive, Inc.',\n    // organizationName: 'deltice', // or set an env variable ORGANIZATION_NAME\n    // projectName: 'test-site', // or set an env variable PROJECT_NAME\n    highlight: {\n        // Highlight.js theme to use for syntax highlighting in code blocks\n        theme: 'tomorrow',\n    },\n    scripts: ['https://buttons.github.io/buttons.js'],\n    // You may provide arbitrary config keys to be used as needed by your template.\n    repoUrl: 'https://github.com/twitchtv/twirp',\n};\n\nmodule.exports = siteConfig;\n"
  },
  {
    "path": "website/static/.well-known/assetlinks.json",
    "content": "[{\n    \"relation\": [\"lookalikes/allowlist\"],\n    \"target\" : { \"namespace\": \"web\", \"site\": \"https://twitchtv.github.io\" }\n},{\n    \"relation\": [\"lookalikes/allowlist\"],\n    \"target\" : { \"namespace\": \"web\", \"site\": \"https://twitch.tv\" }\n}]"
  },
  {
    "path": "website/static/css/custom.css",
    "content": "/* your custom css */\n\n@media only screen and (min-device-width: 360px) and (max-device-width: 736px) {\n}\n\n@media only screen and (min-width: 1024px) {\n}\n\n@media only screen and (max-width: 1023px) {\n}\n\n@media only screen and (min-width: 1400px) {\n}\n\n@media only screen and (min-width: 1500px) {\n}\n\n.mainContainer .wrapper p,\n.blockElement p,\n.mainContainer .wrapper ul li,\n.mainContainer .wrapper ol li {\n    line-height: 1.5;\n}\n"
  }
]