mirror of https://github.com/docker/cli.git
Merge pull request #4944 from thaJeztah/update_engine
vendor: github.com/docker/docker 70e46f2c7c2d (v26.0.0-rc3-dev)
This commit is contained in:
commit
23563728bc
|
@ -5,8 +5,6 @@
|
||||||
"RepoDigests": null,
|
"RepoDigests": null,
|
||||||
"Parent": "",
|
"Parent": "",
|
||||||
"Comment": "",
|
"Comment": "",
|
||||||
"Container": "",
|
|
||||||
"ContainerConfig": null,
|
|
||||||
"DockerVersion": "",
|
"DockerVersion": "",
|
||||||
"Author": "",
|
"Author": "",
|
||||||
"Config": null,
|
"Config": null,
|
||||||
|
@ -28,8 +26,6 @@
|
||||||
"RepoDigests": null,
|
"RepoDigests": null,
|
||||||
"Parent": "",
|
"Parent": "",
|
||||||
"Comment": "",
|
"Comment": "",
|
||||||
"Container": "",
|
|
||||||
"ContainerConfig": null,
|
|
||||||
"DockerVersion": "",
|
"DockerVersion": "",
|
||||||
"Author": "",
|
"Author": "",
|
||||||
"Config": null,
|
"Config": null,
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
"RepoDigests": null,
|
"RepoDigests": null,
|
||||||
"Parent": "",
|
"Parent": "",
|
||||||
"Comment": "",
|
"Comment": "",
|
||||||
"Container": "",
|
|
||||||
"ContainerConfig": null,
|
|
||||||
"DockerVersion": "",
|
"DockerVersion": "",
|
||||||
"Author": "",
|
"Author": "",
|
||||||
"Config": null,
|
"Config": null,
|
||||||
|
|
10
vendor.mod
10
vendor.mod
|
@ -4,15 +4,15 @@ module github.com/docker/cli
|
||||||
// There is no 'go.mod' file, as that would imply opting in for all the rules
|
// There is no 'go.mod' file, as that would imply opting in for all the rules
|
||||||
// around SemVer, which this repo cannot abide by as it uses CalVer.
|
// around SemVer, which this repo cannot abide by as it uses CalVer.
|
||||||
|
|
||||||
go 1.19
|
go 1.21
|
||||||
|
|
||||||
require (
|
require (
|
||||||
dario.cat/mergo v1.0.0
|
dario.cat/mergo v1.0.0
|
||||||
github.com/containerd/containerd v1.7.13
|
github.com/containerd/containerd v1.7.14
|
||||||
github.com/creack/pty v1.1.21
|
github.com/creack/pty v1.1.21
|
||||||
github.com/distribution/reference v0.5.0
|
github.com/distribution/reference v0.5.0
|
||||||
github.com/docker/distribution v2.8.3+incompatible
|
github.com/docker/distribution v2.8.3+incompatible
|
||||||
github.com/docker/docker v26.0.0-rc2+incompatible // 26.0.0-rc2
|
github.com/docker/docker v26.0.0-rc2.0.20240316145409-70e46f2c7c2d+incompatible // master (v26.0.0-rc3-dev)
|
||||||
github.com/docker/docker-credential-helpers v0.8.1
|
github.com/docker/docker-credential-helpers v0.8.1
|
||||||
github.com/docker/go-connections v0.5.0
|
github.com/docker/go-connections v0.5.0
|
||||||
github.com/docker/go-units v0.5.0
|
github.com/docker/go-units v0.5.0
|
||||||
|
@ -60,7 +60,7 @@ require (
|
||||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||||
github.com/go-logr/logr v1.3.0 // indirect
|
github.com/go-logr/logr v1.3.0 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/golang/protobuf v1.5.3 // indirect
|
github.com/golang/protobuf v1.5.4 // indirect
|
||||||
github.com/gorilla/mux v1.8.1 // indirect
|
github.com/gorilla/mux v1.8.1 // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/klauspost/compress v1.17.4 // indirect
|
github.com/klauspost/compress v1.17.4 // indirect
|
||||||
|
@ -87,5 +87,5 @@ require (
|
||||||
golang.org/x/tools v0.16.0 // indirect
|
golang.org/x/tools v0.16.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect
|
||||||
google.golang.org/grpc v1.59.0 // indirect
|
google.golang.org/grpc v1.59.0 // indirect
|
||||||
google.golang.org/protobuf v1.31.0 // indirect
|
google.golang.org/protobuf v1.33.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
35
vendor.sum
35
vendor.sum
|
@ -1,6 +1,7 @@
|
||||||
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
|
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
|
||||||
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
|
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
|
||||||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU=
|
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU=
|
||||||
|
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8=
|
||||||
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8=
|
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8=
|
||||||
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
|
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
|
||||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||||
|
@ -27,17 +28,19 @@ github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0Bsq
|
||||||
github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0 h1:nvj0OLI3YqYXer/kZD8Ri1aaunCxIEsOst1BVJswV0o=
|
github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0 h1:nvj0OLI3YqYXer/kZD8Ri1aaunCxIEsOst1BVJswV0o=
|
||||||
github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE=
|
github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE=
|
||||||
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
|
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
|
||||||
|
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
||||||
github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
|
github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
|
||||||
github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
|
github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
|
||||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
||||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA=
|
github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA=
|
||||||
github.com/cloudflare/cfssl v1.6.4 h1:NMOvfrEjFfC63K3SGXgAnFdsgkmiq4kATme5BfcqrO8=
|
github.com/cloudflare/cfssl v1.6.4 h1:NMOvfrEjFfC63K3SGXgAnFdsgkmiq4kATme5BfcqrO8=
|
||||||
|
github.com/cloudflare/cfssl v1.6.4/go.mod h1:8b3CQMxfWPAeom3zBnGJ6sd+G1NkL5TXqmDXacb+1J0=
|
||||||
github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo=
|
github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo=
|
||||||
github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA=
|
github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA=
|
||||||
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
|
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
|
||||||
github.com/containerd/containerd v1.7.13 h1:wPYKIeGMN8vaggSKuV1X0wZulpMz4CrgEsZdaCyB6Is=
|
github.com/containerd/containerd v1.7.14 h1:H/XLzbnGuenZEGK+v0RkwTdv2u1QFAruMe5N0GNPJwA=
|
||||||
github.com/containerd/containerd v1.7.13/go.mod h1:zT3up6yTRfEUa6+GsITYIJNgSVL9NQ4x4h1RPzk0Wu4=
|
github.com/containerd/containerd v1.7.14/go.mod h1:YMC9Qt5yzNqXx/fO4j/5yYVIHXSRrlB3H7sxkUTvspg=
|
||||||
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
|
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
|
||||||
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
|
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
|
||||||
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
|
@ -54,8 +57,8 @@ github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5
|
||||||
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||||
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
|
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
|
||||||
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||||
github.com/docker/docker v26.0.0-rc2+incompatible h1:EgOKh0HdpXSSmV7dvxqySuLU2qNEySrv+LxFixZ0/jM=
|
github.com/docker/docker v26.0.0-rc2.0.20240316145409-70e46f2c7c2d+incompatible h1:caMsYR2ImIsgd1nlEtaNvDo5BJa6/4iLjbqQIwzFl8A=
|
||||||
github.com/docker/docker v26.0.0-rc2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
github.com/docker/docker v26.0.0-rc2.0.20240316145409-70e46f2c7c2d+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||||
github.com/docker/docker-credential-helpers v0.8.1 h1:j/eKUktUltBtMzKqmfLB0PAgqYyMHOp5vfsD1807oKo=
|
github.com/docker/docker-credential-helpers v0.8.1 h1:j/eKUktUltBtMzKqmfLB0PAgqYyMHOp5vfsD1807oKo=
|
||||||
github.com/docker/docker-credential-helpers v0.8.1/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M=
|
github.com/docker/docker-credential-helpers v0.8.1/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M=
|
||||||
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0=
|
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0=
|
||||||
|
@ -104,10 +107,11 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
|
||||||
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
github.com/google/certificate-transparency-go v1.0.10-0.20180222191210-5ab67e519c93/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg=
|
github.com/google/certificate-transparency-go v1.0.10-0.20180222191210-5ab67e519c93/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg=
|
||||||
github.com/google/certificate-transparency-go v1.1.4 h1:hCyXHDbtqlr/lMXU0D4WgbalXL0Zk4dSWWMbPV8VrqY=
|
github.com/google/certificate-transparency-go v1.1.4 h1:hCyXHDbtqlr/lMXU0D4WgbalXL0Zk4dSWWMbPV8VrqY=
|
||||||
|
github.com/google/certificate-transparency-go v1.1.4/go.mod h1:D6lvbfwckhNrbM9WVl1EVeMOyzC19mpIjMOI4nxBHtQ=
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
|
@ -119,6 +123,7 @@ github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z
|
||||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg=
|
||||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8=
|
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8=
|
||||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
|
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
|
@ -131,6 +136,7 @@ github.com/jinzhu/inflection v0.0.0-20170102125226-1c35d901db3d h1:jRQLvyVGL+iVt
|
||||||
github.com/jinzhu/inflection v0.0.0-20170102125226-1c35d901db3d/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
github.com/jinzhu/inflection v0.0.0-20170102125226-1c35d901db3d/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||||
github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||||
github.com/jmoiron/sqlx v1.3.3 h1:j82X0bf7oQ27XeqxicSZsTU5suPwKElg3oyxNn43iTk=
|
github.com/jmoiron/sqlx v1.3.3 h1:j82X0bf7oQ27XeqxicSZsTU5suPwKElg3oyxNn43iTk=
|
||||||
|
github.com/jmoiron/sqlx v1.3.3/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ=
|
||||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||||
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U=
|
github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U=
|
||||||
|
@ -144,6 +150,7 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
|
||||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
@ -229,6 +236,7 @@ github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3c
|
||||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||||
|
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
|
@ -256,11 +264,13 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
|
||||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||||
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
github.com/theupdateframework/notary v0.7.1-0.20210315103452-bf96a202a09a h1:tlJ7tGUHvcvL1v3yR6NcCc9nOqh2L+CG6HWrYQtwzQ0=
|
github.com/theupdateframework/notary v0.7.1-0.20210315103452-bf96a202a09a h1:tlJ7tGUHvcvL1v3yR6NcCc9nOqh2L+CG6HWrYQtwzQ0=
|
||||||
github.com/theupdateframework/notary v0.7.1-0.20210315103452-bf96a202a09a/go.mod h1:Y94A6rPp2OwNfP/7vmf8O2xx2IykP8pPXQ1DLouGnEw=
|
github.com/theupdateframework/notary v0.7.1-0.20210315103452-bf96a202a09a/go.mod h1:Y94A6rPp2OwNfP/7vmf8O2xx2IykP8pPXQ1DLouGnEw=
|
||||||
github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d h1:wvQZpqy8p0D/FUia6ipKDhXrzPzBVJE4PZyPc5+5Ay0=
|
github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d h1:wvQZpqy8p0D/FUia6ipKDhXrzPzBVJE4PZyPc5+5Ay0=
|
||||||
github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d/go.mod h1:xKQhd7snlzKFuUi1taTGWjpRE8iFTA06DeacYi3CVFQ=
|
github.com/tonistiigi/go-rosetta v0.0.0-20200727161949-f79598599c5d/go.mod h1:xKQhd7snlzKFuUi1taTGWjpRE8iFTA06DeacYi3CVFQ=
|
||||||
github.com/weppos/publicsuffix-go v0.15.1-0.20210511084619-b1f36a2d6c0b h1:FsyNrX12e5BkplJq7wKOLk0+C6LZ+KGXvuEcKUYm5ss=
|
github.com/weppos/publicsuffix-go v0.15.1-0.20210511084619-b1f36a2d6c0b h1:FsyNrX12e5BkplJq7wKOLk0+C6LZ+KGXvuEcKUYm5ss=
|
||||||
|
github.com/weppos/publicsuffix-go v0.15.1-0.20210511084619-b1f36a2d6c0b/go.mod h1:HYux0V0Zi04bHNwOHy4cXJVz/TQjYonnF6aoYhj+3QE=
|
||||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
|
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
|
||||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||||
|
@ -271,7 +281,9 @@ github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQ
|
||||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/zmap/zcrypto v0.0.0-20210511125630-18f1e0152cfc h1:zkGwegkOW709y0oiAraH/3D8njopUR/pARHv4tZZ6pw=
|
github.com/zmap/zcrypto v0.0.0-20210511125630-18f1e0152cfc h1:zkGwegkOW709y0oiAraH/3D8njopUR/pARHv4tZZ6pw=
|
||||||
|
github.com/zmap/zcrypto v0.0.0-20210511125630-18f1e0152cfc/go.mod h1:FM4U1E3NzlNMRnSUTU3P1UdukWhYGifqEsjk9fn7BCk=
|
||||||
github.com/zmap/zlint/v3 v3.1.0 h1:WjVytZo79m/L1+/Mlphl09WBob6YTGljN5IGWZFpAv0=
|
github.com/zmap/zlint/v3 v3.1.0 h1:WjVytZo79m/L1+/Mlphl09WBob6YTGljN5IGWZFpAv0=
|
||||||
|
github.com/zmap/zlint/v3 v3.1.0/go.mod h1:L7t8s3sEKkb0A2BxGy1IWrxt1ZATa1R4QfJZaQOD3zU=
|
||||||
go.etcd.io/etcd/client/pkg/v3 v3.5.6/go.mod h1:ggrwbk069qxpKPq8/FKkQ3Xq9y39kbFR4LnKszpRXeQ=
|
go.etcd.io/etcd/client/pkg/v3 v3.5.6/go.mod h1:ggrwbk069qxpKPq8/FKkQ3Xq9y39kbFR4LnKszpRXeQ=
|
||||||
go.etcd.io/etcd/raft/v3 v3.5.6 h1:tOmx6Ym6rn2GpZOrvTGJZciJHek6RnC3U/zNInzIN50=
|
go.etcd.io/etcd/raft/v3 v3.5.6 h1:tOmx6Ym6rn2GpZOrvTGJZciJHek6RnC3U/zNInzIN50=
|
||||||
go.etcd.io/etcd/raft/v3 v3.5.6/go.mod h1:wL8kkRGx1Hp8FmZUuHfL3K2/OaGIDaXGr1N7i2G07J0=
|
go.etcd.io/etcd/raft/v3 v3.5.6/go.mod h1:wL8kkRGx1Hp8FmZUuHfL3K2/OaGIDaXGr1N7i2G07J0=
|
||||||
|
@ -280,13 +292,17 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:
|
||||||
go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc=
|
go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc=
|
||||||
go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo=
|
go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 h1:Mne5On7VWdx7omSrSSZvM4Kw7cS7NQkOOmLcgscI51U=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 h1:Mne5On7VWdx7omSrSSZvM4Kw7cS7NQkOOmLcgscI51U=
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0/go.mod h1:IPtUMKL4O3tH5y+iXVyAXqpAwMuzC1IrxVS81rummfE=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 h1:IeMeyr1aBvBiPVYihXIaeIZba6b8E1bYp7lbdxK8CQg=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 h1:IeMeyr1aBvBiPVYihXIaeIZba6b8E1bYp7lbdxK8CQg=
|
||||||
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0/go.mod h1:oVdCUtjq9MK9BlS7TtucsQwUcXcymNiEDjgDD2jMtZU=
|
||||||
go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4=
|
go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4=
|
||||||
go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM=
|
go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM=
|
||||||
go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o=
|
go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A=
|
||||||
go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc=
|
go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc=
|
||||||
go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ=
|
go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ=
|
||||||
go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I=
|
go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I=
|
||||||
|
go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM=
|
||||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||||
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
|
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
|
||||||
|
@ -357,6 +373,7 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
|
||||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a h1:fwgW9j3vHirt4ObdHoYNwuO24BEZjSzbh+zPaNWoiY8=
|
google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a h1:fwgW9j3vHirt4ObdHoYNwuO24BEZjSzbh+zPaNWoiY8=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q=
|
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b h1:ZlWIi1wSK56/8hn4QcBp/j9M7Gt3U/3hZw3mC7vDICo=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b h1:ZlWIi1wSK56/8hn4QcBp/j9M7Gt3U/3hZw3mC7vDICo=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc=
|
||||||
google.golang.org/grpc v1.0.5/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
google.golang.org/grpc v1.0.5/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
||||||
|
@ -364,8 +381,8 @@ google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk=
|
||||||
google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98=
|
google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98=
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||||
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
|
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
gopkg.in/cenkalti/backoff.v2 v2.2.1 h1:eJ9UAg01/HIHG987TwxvnzK2MgxXq97YY6rYDpY9aII=
|
gopkg.in/cenkalti/backoff.v2 v2.2.1 h1:eJ9UAg01/HIHG987TwxvnzK2MgxXq97YY6rYDpY9aII=
|
||||||
|
@ -373,6 +390,7 @@ gopkg.in/cenkalti/backoff.v2 v2.2.1/go.mod h1:S0QdOvT2AlerfSBkp0O+dk+bbIMaNbEmVk
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo=
|
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo=
|
||||||
gopkg.in/rethinkdb/rethinkdb-go.v6 v6.2.1 h1:d4KQkxAaAiRY2h5Zqis161Pv91A37uZyJOx73duwUwM=
|
gopkg.in/rethinkdb/rethinkdb-go.v6 v6.2.1 h1:d4KQkxAaAiRY2h5Zqis161Pv91A37uZyJOx73duwUwM=
|
||||||
|
@ -391,5 +409,6 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU=
|
gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU=
|
||||||
gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
|
gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
|
||||||
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
|
||||||
|
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
|
||||||
tags.cncf.io/container-device-interface v0.6.2 h1:dThE6dtp/93ZDGhqaED2Pu374SOeUkBfuvkLuiTdwzg=
|
tags.cncf.io/container-device-interface v0.6.2 h1:dThE6dtp/93ZDGhqaED2Pu374SOeUkBfuvkLuiTdwzg=
|
||||||
tags.cncf.io/container-device-interface v0.6.2/go.mod h1:Shusyhjs1A5Na/kqPVLL0KqnHQHuunol9LFeUNkuGVE=
|
tags.cncf.io/container-device-interface v0.6.2/go.mod h1:Shusyhjs1A5Na/kqPVLL0KqnHQHuunol9LFeUNkuGVE=
|
||||||
|
|
|
@ -82,7 +82,7 @@ type ImageInspect struct {
|
||||||
// Depending on how the image was created, this field may be empty.
|
// Depending on how the image was created, this field may be empty.
|
||||||
//
|
//
|
||||||
// Deprecated: this field is omitted in API v1.45, but kept for backward compatibility.
|
// Deprecated: this field is omitted in API v1.45, but kept for backward compatibility.
|
||||||
Container string
|
Container string `json:",omitempty"`
|
||||||
|
|
||||||
// ContainerConfig is an optional field containing the configuration of the
|
// ContainerConfig is an optional field containing the configuration of the
|
||||||
// container that was last committed when creating the image.
|
// container that was last committed when creating the image.
|
||||||
|
@ -91,7 +91,7 @@ type ImageInspect struct {
|
||||||
// and it is not in active use anymore.
|
// and it is not in active use anymore.
|
||||||
//
|
//
|
||||||
// Deprecated: this field is omitted in API v1.45, but kept for backward compatibility.
|
// Deprecated: this field is omitted in API v1.45, but kept for backward compatibility.
|
||||||
ContainerConfig *container.Config
|
ContainerConfig *container.Config `json:",omitempty"`
|
||||||
|
|
||||||
// DockerVersion is the version of Docker that was used to build the image.
|
// DockerVersion is the version of Docker that was used to build the image.
|
||||||
//
|
//
|
||||||
|
|
|
@ -56,6 +56,7 @@ type Unmarshaler struct {
|
||||||
// implement JSONPBMarshaler so that the custom format can be produced.
|
// implement JSONPBMarshaler so that the custom format can be produced.
|
||||||
//
|
//
|
||||||
// The JSON unmarshaling must follow the JSON to proto specification:
|
// The JSON unmarshaling must follow the JSON to proto specification:
|
||||||
|
//
|
||||||
// https://developers.google.com/protocol-buffers/docs/proto3#json
|
// https://developers.google.com/protocol-buffers/docs/proto3#json
|
||||||
//
|
//
|
||||||
// Deprecated: Custom types should implement protobuf reflection instead.
|
// Deprecated: Custom types should implement protobuf reflection instead.
|
||||||
|
|
|
@ -55,6 +55,7 @@ type Marshaler struct {
|
||||||
// implement JSONPBUnmarshaler so that the custom format can be parsed.
|
// implement JSONPBUnmarshaler so that the custom format can be parsed.
|
||||||
//
|
//
|
||||||
// The JSON marshaling must follow the proto to JSON specification:
|
// The JSON marshaling must follow the proto to JSON specification:
|
||||||
|
//
|
||||||
// https://developers.google.com/protocol-buffers/docs/proto3#json
|
// https://developers.google.com/protocol-buffers/docs/proto3#json
|
||||||
//
|
//
|
||||||
// Deprecated: Custom types should implement protobuf reflection instead.
|
// Deprecated: Custom types should implement protobuf reflection instead.
|
||||||
|
|
|
@ -127,9 +127,10 @@ func Is(any *anypb.Any, m proto.Message) bool {
|
||||||
// The allocated message is stored in the embedded proto.Message.
|
// The allocated message is stored in the embedded proto.Message.
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
// var x ptypes.DynamicAny
|
//
|
||||||
// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... }
|
// var x ptypes.DynamicAny
|
||||||
// fmt.Printf("unmarshaled message: %v", x.Message)
|
// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... }
|
||||||
|
// fmt.Printf("unmarshaled message: %v", x.Message)
|
||||||
//
|
//
|
||||||
// Deprecated: Use the any.UnmarshalNew method instead to unmarshal
|
// Deprecated: Use the any.UnmarshalNew method instead to unmarshal
|
||||||
// the any message contents into a new instance of the underlying message.
|
// the any message contents into a new instance of the underlying message.
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
"google.golang.org/protobuf/internal/encoding/json"
|
"google.golang.org/protobuf/internal/encoding/json"
|
||||||
"google.golang.org/protobuf/internal/encoding/messageset"
|
"google.golang.org/protobuf/internal/encoding/messageset"
|
||||||
"google.golang.org/protobuf/internal/errors"
|
"google.golang.org/protobuf/internal/errors"
|
||||||
|
@ -23,7 +24,7 @@ import (
|
||||||
"google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Unmarshal reads the given []byte into the given proto.Message.
|
// Unmarshal reads the given []byte into the given [proto.Message].
|
||||||
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
||||||
func Unmarshal(b []byte, m proto.Message) error {
|
func Unmarshal(b []byte, m proto.Message) error {
|
||||||
return UnmarshalOptions{}.Unmarshal(b, m)
|
return UnmarshalOptions{}.Unmarshal(b, m)
|
||||||
|
@ -37,7 +38,7 @@ type UnmarshalOptions struct {
|
||||||
// required fields will not return an error.
|
// required fields will not return an error.
|
||||||
AllowPartial bool
|
AllowPartial bool
|
||||||
|
|
||||||
// If DiscardUnknown is set, unknown fields are ignored.
|
// If DiscardUnknown is set, unknown fields and enum name values are ignored.
|
||||||
DiscardUnknown bool
|
DiscardUnknown bool
|
||||||
|
|
||||||
// Resolver is used for looking up types when unmarshaling
|
// Resolver is used for looking up types when unmarshaling
|
||||||
|
@ -47,9 +48,13 @@ type UnmarshalOptions struct {
|
||||||
protoregistry.MessageTypeResolver
|
protoregistry.MessageTypeResolver
|
||||||
protoregistry.ExtensionTypeResolver
|
protoregistry.ExtensionTypeResolver
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RecursionLimit limits how deeply messages may be nested.
|
||||||
|
// If zero, a default limit is applied.
|
||||||
|
RecursionLimit int
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal reads the given []byte and populates the given proto.Message
|
// Unmarshal reads the given []byte and populates the given [proto.Message]
|
||||||
// using options in the UnmarshalOptions object.
|
// using options in the UnmarshalOptions object.
|
||||||
// It will clear the message first before setting the fields.
|
// It will clear the message first before setting the fields.
|
||||||
// If it returns an error, the given message may be partially set.
|
// If it returns an error, the given message may be partially set.
|
||||||
|
@ -67,6 +72,9 @@ func (o UnmarshalOptions) unmarshal(b []byte, m proto.Message) error {
|
||||||
if o.Resolver == nil {
|
if o.Resolver == nil {
|
||||||
o.Resolver = protoregistry.GlobalTypes
|
o.Resolver = protoregistry.GlobalTypes
|
||||||
}
|
}
|
||||||
|
if o.RecursionLimit == 0 {
|
||||||
|
o.RecursionLimit = protowire.DefaultRecursionLimit
|
||||||
|
}
|
||||||
|
|
||||||
dec := decoder{json.NewDecoder(b), o}
|
dec := decoder{json.NewDecoder(b), o}
|
||||||
if err := dec.unmarshalMessage(m.ProtoReflect(), false); err != nil {
|
if err := dec.unmarshalMessage(m.ProtoReflect(), false); err != nil {
|
||||||
|
@ -114,6 +122,10 @@ func (d decoder) syntaxError(pos int, f string, x ...interface{}) error {
|
||||||
|
|
||||||
// unmarshalMessage unmarshals a message into the given protoreflect.Message.
|
// unmarshalMessage unmarshals a message into the given protoreflect.Message.
|
||||||
func (d decoder) unmarshalMessage(m protoreflect.Message, skipTypeURL bool) error {
|
func (d decoder) unmarshalMessage(m protoreflect.Message, skipTypeURL bool) error {
|
||||||
|
d.opts.RecursionLimit--
|
||||||
|
if d.opts.RecursionLimit < 0 {
|
||||||
|
return errors.New("exceeded max recursion depth")
|
||||||
|
}
|
||||||
if unmarshal := wellKnownTypeUnmarshaler(m.Descriptor().FullName()); unmarshal != nil {
|
if unmarshal := wellKnownTypeUnmarshaler(m.Descriptor().FullName()); unmarshal != nil {
|
||||||
return unmarshal(d, m)
|
return unmarshal(d, m)
|
||||||
}
|
}
|
||||||
|
@ -266,7 +278,9 @@ func (d decoder) unmarshalSingular(m protoreflect.Message, fd protoreflect.Field
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
m.Set(fd, val)
|
if val.IsValid() {
|
||||||
|
m.Set(fd, val)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +343,7 @@ func (d decoder) unmarshalScalar(fd protoreflect.FieldDescriptor) (protoreflect.
|
||||||
}
|
}
|
||||||
|
|
||||||
case protoreflect.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
if v, ok := unmarshalEnum(tok, fd); ok {
|
if v, ok := unmarshalEnum(tok, fd, d.opts.DiscardUnknown); ok {
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,7 +488,7 @@ func unmarshalBytes(tok json.Token) (protoreflect.Value, bool) {
|
||||||
return protoreflect.ValueOfBytes(b), true
|
return protoreflect.ValueOfBytes(b), true
|
||||||
}
|
}
|
||||||
|
|
||||||
func unmarshalEnum(tok json.Token, fd protoreflect.FieldDescriptor) (protoreflect.Value, bool) {
|
func unmarshalEnum(tok json.Token, fd protoreflect.FieldDescriptor, discardUnknown bool) (protoreflect.Value, bool) {
|
||||||
switch tok.Kind() {
|
switch tok.Kind() {
|
||||||
case json.String:
|
case json.String:
|
||||||
// Lookup EnumNumber based on name.
|
// Lookup EnumNumber based on name.
|
||||||
|
@ -482,6 +496,9 @@ func unmarshalEnum(tok json.Token, fd protoreflect.FieldDescriptor) (protoreflec
|
||||||
if enumVal := fd.Enum().Values().ByName(protoreflect.Name(s)); enumVal != nil {
|
if enumVal := fd.Enum().Values().ByName(protoreflect.Name(s)); enumVal != nil {
|
||||||
return protoreflect.ValueOfEnum(enumVal.Number()), true
|
return protoreflect.ValueOfEnum(enumVal.Number()), true
|
||||||
}
|
}
|
||||||
|
if discardUnknown {
|
||||||
|
return protoreflect.Value{}, true
|
||||||
|
}
|
||||||
|
|
||||||
case json.Number:
|
case json.Number:
|
||||||
if n, ok := tok.Int(32); ok {
|
if n, ok := tok.Int(32); ok {
|
||||||
|
@ -542,7 +559,9 @@ func (d decoder) unmarshalList(list protoreflect.List, fd protoreflect.FieldDesc
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
list.Append(val)
|
if val.IsValid() {
|
||||||
|
list.Append(val)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,8 +628,9 @@ Loop:
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if pval.IsValid() {
|
||||||
mmap.Set(pkey, pval)
|
mmap.Set(pkey, pval)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
// format. It follows the guide at
|
// format. It follows the guide at
|
||||||
// https://protobuf.dev/programming-guides/proto3#json.
|
// https://protobuf.dev/programming-guides/proto3#json.
|
||||||
//
|
//
|
||||||
// This package produces a different output than the standard "encoding/json"
|
// This package produces a different output than the standard [encoding/json]
|
||||||
// package, which does not operate correctly on protocol buffer messages.
|
// package, which does not operate correctly on protocol buffer messages.
|
||||||
package protojson
|
package protojson
|
||||||
|
|
|
@ -31,7 +31,7 @@ func Format(m proto.Message) string {
|
||||||
return MarshalOptions{Multiline: true}.Format(m)
|
return MarshalOptions{Multiline: true}.Format(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal writes the given proto.Message in JSON format using default options.
|
// Marshal writes the given [proto.Message] in JSON format using default options.
|
||||||
// Do not depend on the output being stable. It may change over time across
|
// Do not depend on the output being stable. It may change over time across
|
||||||
// different versions of the program.
|
// different versions of the program.
|
||||||
func Marshal(m proto.Message) ([]byte, error) {
|
func Marshal(m proto.Message) ([]byte, error) {
|
||||||
|
@ -81,6 +81,25 @@ type MarshalOptions struct {
|
||||||
// ╚═══════╧════════════════════════════╝
|
// ╚═══════╧════════════════════════════╝
|
||||||
EmitUnpopulated bool
|
EmitUnpopulated bool
|
||||||
|
|
||||||
|
// EmitDefaultValues specifies whether to emit default-valued primitive fields,
|
||||||
|
// empty lists, and empty maps. The fields affected are as follows:
|
||||||
|
// ╔═══════╤════════════════════════════════════════╗
|
||||||
|
// ║ JSON │ Protobuf field ║
|
||||||
|
// ╠═══════╪════════════════════════════════════════╣
|
||||||
|
// ║ false │ non-optional scalar boolean fields ║
|
||||||
|
// ║ 0 │ non-optional scalar numeric fields ║
|
||||||
|
// ║ "" │ non-optional scalar string/byte fields ║
|
||||||
|
// ║ [] │ empty repeated fields ║
|
||||||
|
// ║ {} │ empty map fields ║
|
||||||
|
// ╚═══════╧════════════════════════════════════════╝
|
||||||
|
//
|
||||||
|
// Behaves similarly to EmitUnpopulated, but does not emit "null"-value fields,
|
||||||
|
// i.e. presence-sensing fields that are omitted will remain omitted to preserve
|
||||||
|
// presence-sensing.
|
||||||
|
// EmitUnpopulated takes precedence over EmitDefaultValues since the former generates
|
||||||
|
// a strict superset of the latter.
|
||||||
|
EmitDefaultValues bool
|
||||||
|
|
||||||
// Resolver is used for looking up types when expanding google.protobuf.Any
|
// Resolver is used for looking up types when expanding google.protobuf.Any
|
||||||
// messages. If nil, this defaults to using protoregistry.GlobalTypes.
|
// messages. If nil, this defaults to using protoregistry.GlobalTypes.
|
||||||
Resolver interface {
|
Resolver interface {
|
||||||
|
@ -102,7 +121,7 @@ func (o MarshalOptions) Format(m proto.Message) string {
|
||||||
return string(b)
|
return string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal marshals the given proto.Message in the JSON format using options in
|
// Marshal marshals the given [proto.Message] in the JSON format using options in
|
||||||
// MarshalOptions. Do not depend on the output being stable. It may change over
|
// MarshalOptions. Do not depend on the output being stable. It may change over
|
||||||
// time across different versions of the program.
|
// time across different versions of the program.
|
||||||
func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) {
|
func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) {
|
||||||
|
@ -178,7 +197,11 @@ func (m typeURLFieldRanger) Range(f func(protoreflect.FieldDescriptor, protorefl
|
||||||
|
|
||||||
// unpopulatedFieldRanger wraps a protoreflect.Message and modifies its Range
|
// unpopulatedFieldRanger wraps a protoreflect.Message and modifies its Range
|
||||||
// method to additionally iterate over unpopulated fields.
|
// method to additionally iterate over unpopulated fields.
|
||||||
type unpopulatedFieldRanger struct{ protoreflect.Message }
|
type unpopulatedFieldRanger struct {
|
||||||
|
protoreflect.Message
|
||||||
|
|
||||||
|
skipNull bool
|
||||||
|
}
|
||||||
|
|
||||||
func (m unpopulatedFieldRanger) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
func (m unpopulatedFieldRanger) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||||
fds := m.Descriptor().Fields()
|
fds := m.Descriptor().Fields()
|
||||||
|
@ -192,6 +215,9 @@ func (m unpopulatedFieldRanger) Range(f func(protoreflect.FieldDescriptor, proto
|
||||||
isProto2Scalar := fd.Syntax() == protoreflect.Proto2 && fd.Default().IsValid()
|
isProto2Scalar := fd.Syntax() == protoreflect.Proto2 && fd.Default().IsValid()
|
||||||
isSingularMessage := fd.Cardinality() != protoreflect.Repeated && fd.Message() != nil
|
isSingularMessage := fd.Cardinality() != protoreflect.Repeated && fd.Message() != nil
|
||||||
if isProto2Scalar || isSingularMessage {
|
if isProto2Scalar || isSingularMessage {
|
||||||
|
if m.skipNull {
|
||||||
|
continue
|
||||||
|
}
|
||||||
v = protoreflect.Value{} // use invalid value to emit null
|
v = protoreflect.Value{} // use invalid value to emit null
|
||||||
}
|
}
|
||||||
if !f(fd, v) {
|
if !f(fd, v) {
|
||||||
|
@ -217,8 +243,11 @@ func (e encoder) marshalMessage(m protoreflect.Message, typeURL string) error {
|
||||||
defer e.EndObject()
|
defer e.EndObject()
|
||||||
|
|
||||||
var fields order.FieldRanger = m
|
var fields order.FieldRanger = m
|
||||||
if e.opts.EmitUnpopulated {
|
switch {
|
||||||
fields = unpopulatedFieldRanger{m}
|
case e.opts.EmitUnpopulated:
|
||||||
|
fields = unpopulatedFieldRanger{Message: m, skipNull: false}
|
||||||
|
case e.opts.EmitDefaultValues:
|
||||||
|
fields = unpopulatedFieldRanger{Message: m, skipNull: true}
|
||||||
}
|
}
|
||||||
if typeURL != "" {
|
if typeURL != "" {
|
||||||
fields = typeURLFieldRanger{fields, typeURL}
|
fields = typeURLFieldRanger{fields, typeURL}
|
||||||
|
|
|
@ -176,7 +176,7 @@ func (d decoder) unmarshalAny(m protoreflect.Message) error {
|
||||||
// Use another decoder to parse the unread bytes for @type field. This
|
// Use another decoder to parse the unread bytes for @type field. This
|
||||||
// avoids advancing a read from current decoder because the current JSON
|
// avoids advancing a read from current decoder because the current JSON
|
||||||
// object may contain the fields of the embedded type.
|
// object may contain the fields of the embedded type.
|
||||||
dec := decoder{d.Clone(), UnmarshalOptions{}}
|
dec := decoder{d.Clone(), UnmarshalOptions{RecursionLimit: d.opts.RecursionLimit}}
|
||||||
tok, err := findTypeURL(dec)
|
tok, err := findTypeURL(dec)
|
||||||
switch err {
|
switch err {
|
||||||
case errEmptyObject:
|
case errEmptyObject:
|
||||||
|
@ -308,48 +308,29 @@ Loop:
|
||||||
// array) in order to advance the read to the next JSON value. It relies on
|
// array) in order to advance the read to the next JSON value. It relies on
|
||||||
// the decoder returning an error if the types are not in valid sequence.
|
// the decoder returning an error if the types are not in valid sequence.
|
||||||
func (d decoder) skipJSONValue() error {
|
func (d decoder) skipJSONValue() error {
|
||||||
tok, err := d.Read()
|
var open int
|
||||||
if err != nil {
|
for {
|
||||||
return err
|
tok, err := d.Read()
|
||||||
}
|
if err != nil {
|
||||||
// Only need to continue reading for objects and arrays.
|
return err
|
||||||
switch tok.Kind() {
|
|
||||||
case json.ObjectOpen:
|
|
||||||
for {
|
|
||||||
tok, err := d.Read()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
switch tok.Kind() {
|
|
||||||
case json.ObjectClose:
|
|
||||||
return nil
|
|
||||||
case json.Name:
|
|
||||||
// Skip object field value.
|
|
||||||
if err := d.skipJSONValue(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
switch tok.Kind() {
|
||||||
case json.ArrayOpen:
|
case json.ObjectClose, json.ArrayClose:
|
||||||
for {
|
open--
|
||||||
tok, err := d.Peek()
|
case json.ObjectOpen, json.ArrayOpen:
|
||||||
if err != nil {
|
open++
|
||||||
return err
|
if open > d.opts.RecursionLimit {
|
||||||
}
|
return errors.New("exceeded max recursion depth")
|
||||||
switch tok.Kind() {
|
|
||||||
case json.ArrayClose:
|
|
||||||
d.Read()
|
|
||||||
return nil
|
|
||||||
default:
|
|
||||||
// Skip array item.
|
|
||||||
if err := d.skipJSONValue(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
case json.EOF:
|
||||||
|
// This can only happen if there's a bug in Decoder.Read.
|
||||||
|
// Avoid an infinite loop if this does happen.
|
||||||
|
return errors.New("unexpected EOF")
|
||||||
|
}
|
||||||
|
if open == 0 {
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// unmarshalAnyValue unmarshals the given custom-type message from the JSON
|
// unmarshalAnyValue unmarshals the given custom-type message from the JSON
|
||||||
|
|
|
@ -21,7 +21,7 @@ import (
|
||||||
"google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Unmarshal reads the given []byte into the given proto.Message.
|
// Unmarshal reads the given []byte into the given [proto.Message].
|
||||||
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
||||||
func Unmarshal(b []byte, m proto.Message) error {
|
func Unmarshal(b []byte, m proto.Message) error {
|
||||||
return UnmarshalOptions{}.Unmarshal(b, m)
|
return UnmarshalOptions{}.Unmarshal(b, m)
|
||||||
|
@ -51,7 +51,7 @@ type UnmarshalOptions struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmarshal reads the given []byte and populates the given proto.Message
|
// Unmarshal reads the given []byte and populates the given [proto.Message]
|
||||||
// using options in the UnmarshalOptions object.
|
// using options in the UnmarshalOptions object.
|
||||||
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
||||||
func (o UnmarshalOptions) Unmarshal(b []byte, m proto.Message) error {
|
func (o UnmarshalOptions) Unmarshal(b []byte, m proto.Message) error {
|
||||||
|
@ -739,7 +739,9 @@ func (d decoder) skipValue() error {
|
||||||
case text.ListClose:
|
case text.ListClose:
|
||||||
return nil
|
return nil
|
||||||
case text.MessageOpen:
|
case text.MessageOpen:
|
||||||
return d.skipMessageValue()
|
if err := d.skipMessageValue(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
// Skip items. This will not validate whether skipped values are
|
// Skip items. This will not validate whether skipped values are
|
||||||
// of the same type or not, same behavior as C++
|
// of the same type or not, same behavior as C++
|
||||||
|
|
|
@ -33,7 +33,7 @@ func Format(m proto.Message) string {
|
||||||
return MarshalOptions{Multiline: true}.Format(m)
|
return MarshalOptions{Multiline: true}.Format(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal writes the given proto.Message in textproto format using default
|
// Marshal writes the given [proto.Message] in textproto format using default
|
||||||
// options. Do not depend on the output being stable. It may change over time
|
// options. Do not depend on the output being stable. It may change over time
|
||||||
// across different versions of the program.
|
// across different versions of the program.
|
||||||
func Marshal(m proto.Message) ([]byte, error) {
|
func Marshal(m proto.Message) ([]byte, error) {
|
||||||
|
@ -97,7 +97,7 @@ func (o MarshalOptions) Format(m proto.Message) string {
|
||||||
return string(b)
|
return string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal writes the given proto.Message in textproto format using options in
|
// Marshal writes the given [proto.Message] in textproto format using options in
|
||||||
// MarshalOptions object. Do not depend on the output being stable. It may
|
// MarshalOptions object. Do not depend on the output being stable. It may
|
||||||
// change over time across different versions of the program.
|
// change over time across different versions of the program.
|
||||||
func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) {
|
func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// See https://protobuf.dev/programming-guides/encoding.
|
// See https://protobuf.dev/programming-guides/encoding.
|
||||||
//
|
//
|
||||||
// For marshaling and unmarshaling entire protobuf messages,
|
// For marshaling and unmarshaling entire protobuf messages,
|
||||||
// use the "google.golang.org/protobuf/proto" package instead.
|
// use the [google.golang.org/protobuf/proto] package instead.
|
||||||
package protowire
|
package protowire
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -87,7 +87,7 @@ func ParseError(n int) error {
|
||||||
|
|
||||||
// ConsumeField parses an entire field record (both tag and value) and returns
|
// ConsumeField parses an entire field record (both tag and value) and returns
|
||||||
// the field number, the wire type, and the total length.
|
// the field number, the wire type, and the total length.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
//
|
//
|
||||||
// The total length includes the tag header and the end group marker (if the
|
// The total length includes the tag header and the end group marker (if the
|
||||||
// field is a group).
|
// field is a group).
|
||||||
|
@ -104,8 +104,8 @@ func ConsumeField(b []byte) (Number, Type, int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeFieldValue parses a field value and returns its length.
|
// ConsumeFieldValue parses a field value and returns its length.
|
||||||
// This assumes that the field Number and wire Type have already been parsed.
|
// This assumes that the field [Number] and wire [Type] have already been parsed.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
//
|
//
|
||||||
// When parsing a group, the length includes the end group marker and
|
// When parsing a group, the length includes the end group marker and
|
||||||
// the end group is verified to match the starting field number.
|
// the end group is verified to match the starting field number.
|
||||||
|
@ -164,7 +164,7 @@ func AppendTag(b []byte, num Number, typ Type) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeTag parses b as a varint-encoded tag, reporting its length.
|
// ConsumeTag parses b as a varint-encoded tag, reporting its length.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
func ConsumeTag(b []byte) (Number, Type, int) {
|
func ConsumeTag(b []byte) (Number, Type, int) {
|
||||||
v, n := ConsumeVarint(b)
|
v, n := ConsumeVarint(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
@ -263,7 +263,7 @@ func AppendVarint(b []byte, v uint64) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeVarint parses b as a varint-encoded uint64, reporting its length.
|
// ConsumeVarint parses b as a varint-encoded uint64, reporting its length.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
func ConsumeVarint(b []byte) (v uint64, n int) {
|
func ConsumeVarint(b []byte) (v uint64, n int) {
|
||||||
var y uint64
|
var y uint64
|
||||||
if len(b) <= 0 {
|
if len(b) <= 0 {
|
||||||
|
@ -384,7 +384,7 @@ func AppendFixed32(b []byte, v uint32) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeFixed32 parses b as a little-endian uint32, reporting its length.
|
// ConsumeFixed32 parses b as a little-endian uint32, reporting its length.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
func ConsumeFixed32(b []byte) (v uint32, n int) {
|
func ConsumeFixed32(b []byte) (v uint32, n int) {
|
||||||
if len(b) < 4 {
|
if len(b) < 4 {
|
||||||
return 0, errCodeTruncated
|
return 0, errCodeTruncated
|
||||||
|
@ -412,7 +412,7 @@ func AppendFixed64(b []byte, v uint64) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeFixed64 parses b as a little-endian uint64, reporting its length.
|
// ConsumeFixed64 parses b as a little-endian uint64, reporting its length.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
func ConsumeFixed64(b []byte) (v uint64, n int) {
|
func ConsumeFixed64(b []byte) (v uint64, n int) {
|
||||||
if len(b) < 8 {
|
if len(b) < 8 {
|
||||||
return 0, errCodeTruncated
|
return 0, errCodeTruncated
|
||||||
|
@ -432,7 +432,7 @@ func AppendBytes(b []byte, v []byte) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeBytes parses b as a length-prefixed bytes value, reporting its length.
|
// ConsumeBytes parses b as a length-prefixed bytes value, reporting its length.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
func ConsumeBytes(b []byte) (v []byte, n int) {
|
func ConsumeBytes(b []byte) (v []byte, n int) {
|
||||||
m, n := ConsumeVarint(b)
|
m, n := ConsumeVarint(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
@ -456,7 +456,7 @@ func AppendString(b []byte, v string) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConsumeString parses b as a length-prefixed bytes value, reporting its length.
|
// ConsumeString parses b as a length-prefixed bytes value, reporting its length.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
func ConsumeString(b []byte) (v string, n int) {
|
func ConsumeString(b []byte) (v string, n int) {
|
||||||
bb, n := ConsumeBytes(b)
|
bb, n := ConsumeBytes(b)
|
||||||
return string(bb), n
|
return string(bb), n
|
||||||
|
@ -471,7 +471,7 @@ func AppendGroup(b []byte, num Number, v []byte) []byte {
|
||||||
// ConsumeGroup parses b as a group value until the trailing end group marker,
|
// ConsumeGroup parses b as a group value until the trailing end group marker,
|
||||||
// and verifies that the end marker matches the provided num. The value v
|
// and verifies that the end marker matches the provided num. The value v
|
||||||
// does not contain the end marker, while the length does contain the end marker.
|
// does not contain the end marker, while the length does contain the end marker.
|
||||||
// This returns a negative length upon an error (see ParseError).
|
// This returns a negative length upon an error (see [ParseError]).
|
||||||
func ConsumeGroup(num Number, b []byte) (v []byte, n int) {
|
func ConsumeGroup(num Number, b []byte) (v []byte, n int) {
|
||||||
n = ConsumeFieldValue(num, StartGroupType, b)
|
n = ConsumeFieldValue(num, StartGroupType, b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
@ -495,8 +495,8 @@ func SizeGroup(num Number, n int) int {
|
||||||
return n + SizeTag(num)
|
return n + SizeTag(num)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeTag decodes the field Number and wire Type from its unified form.
|
// DecodeTag decodes the field [Number] and wire [Type] from its unified form.
|
||||||
// The Number is -1 if the decoded field number overflows int32.
|
// The [Number] is -1 if the decoded field number overflows int32.
|
||||||
// Other than overflow, this does not check for field number validity.
|
// Other than overflow, this does not check for field number validity.
|
||||||
func DecodeTag(x uint64) (Number, Type) {
|
func DecodeTag(x uint64) (Number, Type) {
|
||||||
// NOTE: MessageSet allows for larger field numbers than normal.
|
// NOTE: MessageSet allows for larger field numbers than normal.
|
||||||
|
@ -506,7 +506,7 @@ func DecodeTag(x uint64) (Number, Type) {
|
||||||
return Number(x >> 3), Type(x & 7)
|
return Number(x >> 3), Type(x & 7)
|
||||||
}
|
}
|
||||||
|
|
||||||
// EncodeTag encodes the field Number and wire Type into its unified form.
|
// EncodeTag encodes the field [Number] and wire [Type] into its unified form.
|
||||||
func EncodeTag(num Number, typ Type) uint64 {
|
func EncodeTag(num Number, typ Type) uint64 {
|
||||||
return uint64(num)<<3 | uint64(typ&7)
|
return uint64(num)<<3 | uint64(typ&7)
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,13 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
||||||
case protoreflect.FileImports:
|
case protoreflect.FileImports:
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
var rs records
|
var rs records
|
||||||
rs.Append(reflect.ValueOf(vs.Get(i)), "Path", "Package", "IsPublic", "IsWeak")
|
rv := reflect.ValueOf(vs.Get(i))
|
||||||
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Path"), "Path"},
|
||||||
|
{rv.MethodByName("Package"), "Package"},
|
||||||
|
{rv.MethodByName("IsPublic"), "IsPublic"},
|
||||||
|
{rv.MethodByName("IsWeak"), "IsWeak"},
|
||||||
|
}...)
|
||||||
ss = append(ss, "{"+rs.Join()+"}")
|
ss = append(ss, "{"+rs.Join()+"}")
|
||||||
}
|
}
|
||||||
return start + joinStrings(ss, allowMulti) + end
|
return start + joinStrings(ss, allowMulti) + end
|
||||||
|
@ -92,34 +98,26 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string {
|
||||||
for i := 0; i < vs.Len(); i++ {
|
for i := 0; i < vs.Len(); i++ {
|
||||||
m := reflect.ValueOf(vs).MethodByName("Get")
|
m := reflect.ValueOf(vs).MethodByName("Get")
|
||||||
v := m.Call([]reflect.Value{reflect.ValueOf(i)})[0].Interface()
|
v := m.Call([]reflect.Value{reflect.ValueOf(i)})[0].Interface()
|
||||||
ss = append(ss, formatDescOpt(v.(protoreflect.Descriptor), false, allowMulti && !isEnumValue))
|
ss = append(ss, formatDescOpt(v.(protoreflect.Descriptor), false, allowMulti && !isEnumValue, nil))
|
||||||
}
|
}
|
||||||
return start + joinStrings(ss, allowMulti && isEnumValue) + end
|
return start + joinStrings(ss, allowMulti && isEnumValue) + end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// descriptorAccessors is a list of accessors to print for each descriptor.
|
type methodAndName struct {
|
||||||
//
|
method reflect.Value
|
||||||
// Do not print all accessors since some contain redundant information,
|
name string
|
||||||
// while others are pointers that we do not want to follow since the descriptor
|
|
||||||
// is actually a cyclic graph.
|
|
||||||
//
|
|
||||||
// Using a list allows us to print the accessors in a sensible order.
|
|
||||||
var descriptorAccessors = map[reflect.Type][]string{
|
|
||||||
reflect.TypeOf((*protoreflect.FileDescriptor)(nil)).Elem(): {"Path", "Package", "Imports", "Messages", "Enums", "Extensions", "Services"},
|
|
||||||
reflect.TypeOf((*protoreflect.MessageDescriptor)(nil)).Elem(): {"IsMapEntry", "Fields", "Oneofs", "ReservedNames", "ReservedRanges", "RequiredNumbers", "ExtensionRanges", "Messages", "Enums", "Extensions"},
|
|
||||||
reflect.TypeOf((*protoreflect.FieldDescriptor)(nil)).Elem(): {"Number", "Cardinality", "Kind", "HasJSONName", "JSONName", "HasPresence", "IsExtension", "IsPacked", "IsWeak", "IsList", "IsMap", "MapKey", "MapValue", "HasDefault", "Default", "ContainingOneof", "ContainingMessage", "Message", "Enum"},
|
|
||||||
reflect.TypeOf((*protoreflect.OneofDescriptor)(nil)).Elem(): {"Fields"}, // not directly used; must keep in sync with formatDescOpt
|
|
||||||
reflect.TypeOf((*protoreflect.EnumDescriptor)(nil)).Elem(): {"Values", "ReservedNames", "ReservedRanges"},
|
|
||||||
reflect.TypeOf((*protoreflect.EnumValueDescriptor)(nil)).Elem(): {"Number"},
|
|
||||||
reflect.TypeOf((*protoreflect.ServiceDescriptor)(nil)).Elem(): {"Methods"},
|
|
||||||
reflect.TypeOf((*protoreflect.MethodDescriptor)(nil)).Elem(): {"Input", "Output", "IsStreamingClient", "IsStreamingServer"},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func FormatDesc(s fmt.State, r rune, t protoreflect.Descriptor) {
|
func FormatDesc(s fmt.State, r rune, t protoreflect.Descriptor) {
|
||||||
io.WriteString(s, formatDescOpt(t, true, r == 'v' && (s.Flag('+') || s.Flag('#'))))
|
io.WriteString(s, formatDescOpt(t, true, r == 'v' && (s.Flag('+') || s.Flag('#')), nil))
|
||||||
}
|
}
|
||||||
func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool) string {
|
|
||||||
|
func InternalFormatDescOptForTesting(t protoreflect.Descriptor, isRoot, allowMulti bool, record func(string)) string {
|
||||||
|
return formatDescOpt(t, isRoot, allowMulti, record)
|
||||||
|
}
|
||||||
|
|
||||||
|
func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool, record func(string)) string {
|
||||||
rv := reflect.ValueOf(t)
|
rv := reflect.ValueOf(t)
|
||||||
rt := rv.MethodByName("ProtoType").Type().In(0)
|
rt := rv.MethodByName("ProtoType").Type().In(0)
|
||||||
|
|
||||||
|
@ -129,26 +127,60 @@ func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
_, isFile := t.(protoreflect.FileDescriptor)
|
_, isFile := t.(protoreflect.FileDescriptor)
|
||||||
rs := records{allowMulti: allowMulti}
|
rs := records{
|
||||||
|
allowMulti: allowMulti,
|
||||||
|
record: record,
|
||||||
|
}
|
||||||
if t.IsPlaceholder() {
|
if t.IsPlaceholder() {
|
||||||
if isFile {
|
if isFile {
|
||||||
rs.Append(rv, "Path", "Package", "IsPlaceholder")
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Path"), "Path"},
|
||||||
|
{rv.MethodByName("Package"), "Package"},
|
||||||
|
{rv.MethodByName("IsPlaceholder"), "IsPlaceholder"},
|
||||||
|
}...)
|
||||||
} else {
|
} else {
|
||||||
rs.Append(rv, "FullName", "IsPlaceholder")
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("FullName"), "FullName"},
|
||||||
|
{rv.MethodByName("IsPlaceholder"), "IsPlaceholder"},
|
||||||
|
}...)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch {
|
switch {
|
||||||
case isFile:
|
case isFile:
|
||||||
rs.Append(rv, "Syntax")
|
rs.Append(rv, methodAndName{rv.MethodByName("Syntax"), "Syntax"})
|
||||||
case isRoot:
|
case isRoot:
|
||||||
rs.Append(rv, "Syntax", "FullName")
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Syntax"), "Syntax"},
|
||||||
|
{rv.MethodByName("FullName"), "FullName"},
|
||||||
|
}...)
|
||||||
default:
|
default:
|
||||||
rs.Append(rv, "Name")
|
rs.Append(rv, methodAndName{rv.MethodByName("Name"), "Name"})
|
||||||
}
|
}
|
||||||
switch t := t.(type) {
|
switch t := t.(type) {
|
||||||
case protoreflect.FieldDescriptor:
|
case protoreflect.FieldDescriptor:
|
||||||
for _, s := range descriptorAccessors[rt] {
|
accessors := []methodAndName{
|
||||||
switch s {
|
{rv.MethodByName("Number"), "Number"},
|
||||||
|
{rv.MethodByName("Cardinality"), "Cardinality"},
|
||||||
|
{rv.MethodByName("Kind"), "Kind"},
|
||||||
|
{rv.MethodByName("HasJSONName"), "HasJSONName"},
|
||||||
|
{rv.MethodByName("JSONName"), "JSONName"},
|
||||||
|
{rv.MethodByName("HasPresence"), "HasPresence"},
|
||||||
|
{rv.MethodByName("IsExtension"), "IsExtension"},
|
||||||
|
{rv.MethodByName("IsPacked"), "IsPacked"},
|
||||||
|
{rv.MethodByName("IsWeak"), "IsWeak"},
|
||||||
|
{rv.MethodByName("IsList"), "IsList"},
|
||||||
|
{rv.MethodByName("IsMap"), "IsMap"},
|
||||||
|
{rv.MethodByName("MapKey"), "MapKey"},
|
||||||
|
{rv.MethodByName("MapValue"), "MapValue"},
|
||||||
|
{rv.MethodByName("HasDefault"), "HasDefault"},
|
||||||
|
{rv.MethodByName("Default"), "Default"},
|
||||||
|
{rv.MethodByName("ContainingOneof"), "ContainingOneof"},
|
||||||
|
{rv.MethodByName("ContainingMessage"), "ContainingMessage"},
|
||||||
|
{rv.MethodByName("Message"), "Message"},
|
||||||
|
{rv.MethodByName("Enum"), "Enum"},
|
||||||
|
}
|
||||||
|
for _, s := range accessors {
|
||||||
|
switch s.name {
|
||||||
case "MapKey":
|
case "MapKey":
|
||||||
if k := t.MapKey(); k != nil {
|
if k := t.MapKey(); k != nil {
|
||||||
rs.recs = append(rs.recs, [2]string{"MapKey", k.Kind().String()})
|
rs.recs = append(rs.recs, [2]string{"MapKey", k.Kind().String()})
|
||||||
|
@ -157,20 +189,20 @@ func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool) string {
|
||||||
if v := t.MapValue(); v != nil {
|
if v := t.MapValue(); v != nil {
|
||||||
switch v.Kind() {
|
switch v.Kind() {
|
||||||
case protoreflect.EnumKind:
|
case protoreflect.EnumKind:
|
||||||
rs.recs = append(rs.recs, [2]string{"MapValue", string(v.Enum().FullName())})
|
rs.AppendRecs("MapValue", [2]string{"MapValue", string(v.Enum().FullName())})
|
||||||
case protoreflect.MessageKind, protoreflect.GroupKind:
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
rs.recs = append(rs.recs, [2]string{"MapValue", string(v.Message().FullName())})
|
rs.AppendRecs("MapValue", [2]string{"MapValue", string(v.Message().FullName())})
|
||||||
default:
|
default:
|
||||||
rs.recs = append(rs.recs, [2]string{"MapValue", v.Kind().String()})
|
rs.AppendRecs("MapValue", [2]string{"MapValue", v.Kind().String()})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "ContainingOneof":
|
case "ContainingOneof":
|
||||||
if od := t.ContainingOneof(); od != nil {
|
if od := t.ContainingOneof(); od != nil {
|
||||||
rs.recs = append(rs.recs, [2]string{"Oneof", string(od.Name())})
|
rs.AppendRecs("ContainingOneof", [2]string{"Oneof", string(od.Name())})
|
||||||
}
|
}
|
||||||
case "ContainingMessage":
|
case "ContainingMessage":
|
||||||
if t.IsExtension() {
|
if t.IsExtension() {
|
||||||
rs.recs = append(rs.recs, [2]string{"Extendee", string(t.ContainingMessage().FullName())})
|
rs.AppendRecs("ContainingMessage", [2]string{"Extendee", string(t.ContainingMessage().FullName())})
|
||||||
}
|
}
|
||||||
case "Message":
|
case "Message":
|
||||||
if !t.IsMap() {
|
if !t.IsMap() {
|
||||||
|
@ -187,13 +219,61 @@ func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool) string {
|
||||||
ss = append(ss, string(fs.Get(i).Name()))
|
ss = append(ss, string(fs.Get(i).Name()))
|
||||||
}
|
}
|
||||||
if len(ss) > 0 {
|
if len(ss) > 0 {
|
||||||
rs.recs = append(rs.recs, [2]string{"Fields", "[" + joinStrings(ss, false) + "]"})
|
rs.AppendRecs("Fields", [2]string{"Fields", "[" + joinStrings(ss, false) + "]"})
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
rs.Append(rv, descriptorAccessors[rt]...)
|
case protoreflect.FileDescriptor:
|
||||||
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Path"), "Path"},
|
||||||
|
{rv.MethodByName("Package"), "Package"},
|
||||||
|
{rv.MethodByName("Imports"), "Imports"},
|
||||||
|
{rv.MethodByName("Messages"), "Messages"},
|
||||||
|
{rv.MethodByName("Enums"), "Enums"},
|
||||||
|
{rv.MethodByName("Extensions"), "Extensions"},
|
||||||
|
{rv.MethodByName("Services"), "Services"},
|
||||||
|
}...)
|
||||||
|
|
||||||
|
case protoreflect.MessageDescriptor:
|
||||||
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("IsMapEntry"), "IsMapEntry"},
|
||||||
|
{rv.MethodByName("Fields"), "Fields"},
|
||||||
|
{rv.MethodByName("Oneofs"), "Oneofs"},
|
||||||
|
{rv.MethodByName("ReservedNames"), "ReservedNames"},
|
||||||
|
{rv.MethodByName("ReservedRanges"), "ReservedRanges"},
|
||||||
|
{rv.MethodByName("RequiredNumbers"), "RequiredNumbers"},
|
||||||
|
{rv.MethodByName("ExtensionRanges"), "ExtensionRanges"},
|
||||||
|
{rv.MethodByName("Messages"), "Messages"},
|
||||||
|
{rv.MethodByName("Enums"), "Enums"},
|
||||||
|
{rv.MethodByName("Extensions"), "Extensions"},
|
||||||
|
}...)
|
||||||
|
|
||||||
|
case protoreflect.EnumDescriptor:
|
||||||
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Values"), "Values"},
|
||||||
|
{rv.MethodByName("ReservedNames"), "ReservedNames"},
|
||||||
|
{rv.MethodByName("ReservedRanges"), "ReservedRanges"},
|
||||||
|
}...)
|
||||||
|
|
||||||
|
case protoreflect.EnumValueDescriptor:
|
||||||
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Number"), "Number"},
|
||||||
|
}...)
|
||||||
|
|
||||||
|
case protoreflect.ServiceDescriptor:
|
||||||
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Methods"), "Methods"},
|
||||||
|
}...)
|
||||||
|
|
||||||
|
case protoreflect.MethodDescriptor:
|
||||||
|
rs.Append(rv, []methodAndName{
|
||||||
|
{rv.MethodByName("Input"), "Input"},
|
||||||
|
{rv.MethodByName("Output"), "Output"},
|
||||||
|
{rv.MethodByName("IsStreamingClient"), "IsStreamingClient"},
|
||||||
|
{rv.MethodByName("IsStreamingServer"), "IsStreamingServer"},
|
||||||
|
}...)
|
||||||
}
|
}
|
||||||
if rv.MethodByName("GoType").IsValid() {
|
if m := rv.MethodByName("GoType"); m.IsValid() {
|
||||||
rs.Append(rv, "GoType")
|
rs.Append(rv, methodAndName{m, "GoType"})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return start + rs.Join() + end
|
return start + rs.Join() + end
|
||||||
|
@ -202,19 +282,34 @@ func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool) string {
|
||||||
type records struct {
|
type records struct {
|
||||||
recs [][2]string
|
recs [][2]string
|
||||||
allowMulti bool
|
allowMulti bool
|
||||||
|
|
||||||
|
// record is a function that will be called for every Append() or
|
||||||
|
// AppendRecs() call, to be used for testing with the
|
||||||
|
// InternalFormatDescOptForTesting function.
|
||||||
|
record func(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rs *records) Append(v reflect.Value, accessors ...string) {
|
func (rs *records) AppendRecs(fieldName string, newRecs [2]string) {
|
||||||
|
if rs.record != nil {
|
||||||
|
rs.record(fieldName)
|
||||||
|
}
|
||||||
|
rs.recs = append(rs.recs, newRecs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rs *records) Append(v reflect.Value, accessors ...methodAndName) {
|
||||||
for _, a := range accessors {
|
for _, a := range accessors {
|
||||||
|
if rs.record != nil {
|
||||||
|
rs.record(a.name)
|
||||||
|
}
|
||||||
var rv reflect.Value
|
var rv reflect.Value
|
||||||
if m := v.MethodByName(a); m.IsValid() {
|
if a.method.IsValid() {
|
||||||
rv = m.Call(nil)[0]
|
rv = a.method.Call(nil)[0]
|
||||||
}
|
}
|
||||||
if v.Kind() == reflect.Struct && !rv.IsValid() {
|
if v.Kind() == reflect.Struct && !rv.IsValid() {
|
||||||
rv = v.FieldByName(a)
|
rv = v.FieldByName(a.name)
|
||||||
}
|
}
|
||||||
if !rv.IsValid() {
|
if !rv.IsValid() {
|
||||||
panic(fmt.Sprintf("unknown accessor: %v.%s", v.Type(), a))
|
panic(fmt.Sprintf("unknown accessor: %v.%s", v.Type(), a.name))
|
||||||
}
|
}
|
||||||
if _, ok := rv.Interface().(protoreflect.Value); ok {
|
if _, ok := rv.Interface().(protoreflect.Value); ok {
|
||||||
rv = rv.MethodByName("Interface").Call(nil)[0]
|
rv = rv.MethodByName("Interface").Call(nil)[0]
|
||||||
|
@ -261,7 +356,7 @@ func (rs *records) Append(v reflect.Value, accessors ...string) {
|
||||||
default:
|
default:
|
||||||
s = fmt.Sprint(v)
|
s = fmt.Sprint(v)
|
||||||
}
|
}
|
||||||
rs.recs = append(rs.recs, [2]string{a, s})
|
rs.recs = append(rs.recs, [2]string{a.name, s})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
vendor/google.golang.org/protobuf/internal/editiondefaults/defaults.go
generated
vendored
Normal file
12
vendor/google.golang.org/protobuf/internal/editiondefaults/defaults.go
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Package editiondefaults contains the binary representation of the editions
|
||||||
|
// defaults.
|
||||||
|
package editiondefaults
|
||||||
|
|
||||||
|
import _ "embed"
|
||||||
|
|
||||||
|
//go:embed editions_defaults.binpb
|
||||||
|
var Defaults []byte
|
4
vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb
generated
vendored
Normal file
4
vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
(0ж
|
||||||
|
(0з
|
||||||
|
(0и ж(и
|
|
@ -121,7 +121,7 @@ func (d *Decoder) Read() (Token, error) {
|
||||||
|
|
||||||
case ObjectClose:
|
case ObjectClose:
|
||||||
if len(d.openStack) == 0 ||
|
if len(d.openStack) == 0 ||
|
||||||
d.lastToken.kind == comma ||
|
d.lastToken.kind&(Name|comma) != 0 ||
|
||||||
d.openStack[len(d.openStack)-1] != ObjectOpen {
|
d.openStack[len(d.openStack)-1] != ObjectOpen {
|
||||||
return Token{}, d.newSyntaxError(tok.pos, unexpectedFmt, tok.RawString())
|
return Token{}, d.newSyntaxError(tok.pos, unexpectedFmt, tok.RawString())
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,11 +21,26 @@ import (
|
||||||
"google.golang.org/protobuf/reflect/protoregistry"
|
"google.golang.org/protobuf/reflect/protoregistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Edition is an Enum for proto2.Edition
|
||||||
|
type Edition int32
|
||||||
|
|
||||||
|
// These values align with the value of Enum in descriptor.proto which allows
|
||||||
|
// direct conversion between the proto enum and this enum.
|
||||||
|
const (
|
||||||
|
EditionUnknown Edition = 0
|
||||||
|
EditionProto2 Edition = 998
|
||||||
|
EditionProto3 Edition = 999
|
||||||
|
Edition2023 Edition = 1000
|
||||||
|
EditionUnsupported Edition = 100000
|
||||||
|
)
|
||||||
|
|
||||||
// The types in this file may have a suffix:
|
// The types in this file may have a suffix:
|
||||||
// • L0: Contains fields common to all descriptors (except File) and
|
// • L0: Contains fields common to all descriptors (except File) and
|
||||||
// must be initialized up front.
|
// must be initialized up front.
|
||||||
// • L1: Contains fields specific to a descriptor and
|
// • L1: Contains fields specific to a descriptor and
|
||||||
// must be initialized up front.
|
// must be initialized up front. If the associated proto uses Editions, the
|
||||||
|
// Editions features must always be resolved. If not explicitly set, the
|
||||||
|
// appropriate default must be resolved and set.
|
||||||
// • L2: Contains fields that are lazily initialized when constructing
|
// • L2: Contains fields that are lazily initialized when constructing
|
||||||
// from the raw file descriptor. When constructing as a literal, the L2
|
// from the raw file descriptor. When constructing as a literal, the L2
|
||||||
// fields must be initialized up front.
|
// fields must be initialized up front.
|
||||||
|
@ -44,6 +59,7 @@ type (
|
||||||
}
|
}
|
||||||
FileL1 struct {
|
FileL1 struct {
|
||||||
Syntax protoreflect.Syntax
|
Syntax protoreflect.Syntax
|
||||||
|
Edition Edition // Only used if Syntax == Editions
|
||||||
Path string
|
Path string
|
||||||
Package protoreflect.FullName
|
Package protoreflect.FullName
|
||||||
|
|
||||||
|
@ -51,12 +67,41 @@ type (
|
||||||
Messages Messages
|
Messages Messages
|
||||||
Extensions Extensions
|
Extensions Extensions
|
||||||
Services Services
|
Services Services
|
||||||
|
|
||||||
|
EditionFeatures EditionFeatures
|
||||||
}
|
}
|
||||||
FileL2 struct {
|
FileL2 struct {
|
||||||
Options func() protoreflect.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Imports FileImports
|
Imports FileImports
|
||||||
Locations SourceLocations
|
Locations SourceLocations
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EditionFeatures struct {
|
||||||
|
// IsFieldPresence is true if field_presence is EXPLICIT
|
||||||
|
// https://protobuf.dev/editions/features/#field_presence
|
||||||
|
IsFieldPresence bool
|
||||||
|
// IsFieldPresence is true if field_presence is LEGACY_REQUIRED
|
||||||
|
// https://protobuf.dev/editions/features/#field_presence
|
||||||
|
IsLegacyRequired bool
|
||||||
|
// IsOpenEnum is true if enum_type is OPEN
|
||||||
|
// https://protobuf.dev/editions/features/#enum_type
|
||||||
|
IsOpenEnum bool
|
||||||
|
// IsPacked is true if repeated_field_encoding is PACKED
|
||||||
|
// https://protobuf.dev/editions/features/#repeated_field_encoding
|
||||||
|
IsPacked bool
|
||||||
|
// IsUTF8Validated is true if utf_validation is VERIFY
|
||||||
|
// https://protobuf.dev/editions/features/#utf8_validation
|
||||||
|
IsUTF8Validated bool
|
||||||
|
// IsDelimitedEncoded is true if message_encoding is DELIMITED
|
||||||
|
// https://protobuf.dev/editions/features/#message_encoding
|
||||||
|
IsDelimitedEncoded bool
|
||||||
|
// IsJSONCompliant is true if json_format is ALLOW
|
||||||
|
// https://protobuf.dev/editions/features/#json_format
|
||||||
|
IsJSONCompliant bool
|
||||||
|
// GenerateLegacyUnmarshalJSON determines if the plugin generates the
|
||||||
|
// UnmarshalJSON([]byte) error method for enums.
|
||||||
|
GenerateLegacyUnmarshalJSON bool
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (fd *File) ParentFile() protoreflect.FileDescriptor { return fd }
|
func (fd *File) ParentFile() protoreflect.FileDescriptor { return fd }
|
||||||
|
@ -117,6 +162,8 @@ type (
|
||||||
}
|
}
|
||||||
EnumL1 struct {
|
EnumL1 struct {
|
||||||
eagerValues bool // controls whether EnumL2.Values is already populated
|
eagerValues bool // controls whether EnumL2.Values is already populated
|
||||||
|
|
||||||
|
EditionFeatures EditionFeatures
|
||||||
}
|
}
|
||||||
EnumL2 struct {
|
EnumL2 struct {
|
||||||
Options func() protoreflect.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
|
@ -178,6 +225,8 @@ type (
|
||||||
Extensions Extensions
|
Extensions Extensions
|
||||||
IsMapEntry bool // promoted from google.protobuf.MessageOptions
|
IsMapEntry bool // promoted from google.protobuf.MessageOptions
|
||||||
IsMessageSet bool // promoted from google.protobuf.MessageOptions
|
IsMessageSet bool // promoted from google.protobuf.MessageOptions
|
||||||
|
|
||||||
|
EditionFeatures EditionFeatures
|
||||||
}
|
}
|
||||||
MessageL2 struct {
|
MessageL2 struct {
|
||||||
Options func() protoreflect.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
|
@ -210,6 +259,8 @@ type (
|
||||||
ContainingOneof protoreflect.OneofDescriptor // must be consistent with Message.Oneofs.Fields
|
ContainingOneof protoreflect.OneofDescriptor // must be consistent with Message.Oneofs.Fields
|
||||||
Enum protoreflect.EnumDescriptor
|
Enum protoreflect.EnumDescriptor
|
||||||
Message protoreflect.MessageDescriptor
|
Message protoreflect.MessageDescriptor
|
||||||
|
|
||||||
|
EditionFeatures EditionFeatures
|
||||||
}
|
}
|
||||||
|
|
||||||
Oneof struct {
|
Oneof struct {
|
||||||
|
@ -219,6 +270,8 @@ type (
|
||||||
OneofL1 struct {
|
OneofL1 struct {
|
||||||
Options func() protoreflect.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
Fields OneofFields // must be consistent with Message.Fields.ContainingOneof
|
Fields OneofFields // must be consistent with Message.Fields.ContainingOneof
|
||||||
|
|
||||||
|
EditionFeatures EditionFeatures
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -268,23 +321,36 @@ func (fd *Field) Options() protoreflect.ProtoMessage {
|
||||||
}
|
}
|
||||||
func (fd *Field) Number() protoreflect.FieldNumber { return fd.L1.Number }
|
func (fd *Field) Number() protoreflect.FieldNumber { return fd.L1.Number }
|
||||||
func (fd *Field) Cardinality() protoreflect.Cardinality { return fd.L1.Cardinality }
|
func (fd *Field) Cardinality() protoreflect.Cardinality { return fd.L1.Cardinality }
|
||||||
func (fd *Field) Kind() protoreflect.Kind { return fd.L1.Kind }
|
func (fd *Field) Kind() protoreflect.Kind {
|
||||||
func (fd *Field) HasJSONName() bool { return fd.L1.StringName.hasJSON }
|
return fd.L1.Kind
|
||||||
func (fd *Field) JSONName() string { return fd.L1.StringName.getJSON(fd) }
|
}
|
||||||
func (fd *Field) TextName() string { return fd.L1.StringName.getText(fd) }
|
func (fd *Field) HasJSONName() bool { return fd.L1.StringName.hasJSON }
|
||||||
|
func (fd *Field) JSONName() string { return fd.L1.StringName.getJSON(fd) }
|
||||||
|
func (fd *Field) TextName() string { return fd.L1.StringName.getText(fd) }
|
||||||
func (fd *Field) HasPresence() bool {
|
func (fd *Field) HasPresence() bool {
|
||||||
return fd.L1.Cardinality != protoreflect.Repeated && (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 || fd.L1.Message != nil || fd.L1.ContainingOneof != nil)
|
if fd.L1.Cardinality == protoreflect.Repeated {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
explicitFieldPresence := fd.Syntax() == protoreflect.Editions && fd.L1.EditionFeatures.IsFieldPresence
|
||||||
|
return fd.Syntax() == protoreflect.Proto2 || explicitFieldPresence || fd.L1.Message != nil || fd.L1.ContainingOneof != nil
|
||||||
}
|
}
|
||||||
func (fd *Field) HasOptionalKeyword() bool {
|
func (fd *Field) HasOptionalKeyword() bool {
|
||||||
return (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional
|
return (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional
|
||||||
}
|
}
|
||||||
func (fd *Field) IsPacked() bool {
|
func (fd *Field) IsPacked() bool {
|
||||||
if !fd.L1.HasPacked && fd.L0.ParentFile.L1.Syntax != protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Repeated {
|
if fd.L1.Cardinality != protoreflect.Repeated {
|
||||||
switch fd.L1.Kind {
|
return false
|
||||||
case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind:
|
}
|
||||||
default:
|
switch fd.L1.Kind {
|
||||||
return true
|
case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
}
|
return false
|
||||||
|
}
|
||||||
|
if fd.L0.ParentFile.L1.Syntax == protoreflect.Editions {
|
||||||
|
return fd.L1.EditionFeatures.IsPacked
|
||||||
|
}
|
||||||
|
if fd.L0.ParentFile.L1.Syntax == protoreflect.Proto3 {
|
||||||
|
// proto3 repeated fields are packed by default.
|
||||||
|
return !fd.L1.HasPacked || fd.L1.IsPacked
|
||||||
}
|
}
|
||||||
return fd.L1.IsPacked
|
return fd.L1.IsPacked
|
||||||
}
|
}
|
||||||
|
@ -333,6 +399,9 @@ func (fd *Field) ProtoType(protoreflect.FieldDescriptor) {}
|
||||||
// WARNING: This method is exempt from the compatibility promise and may be
|
// WARNING: This method is exempt from the compatibility promise and may be
|
||||||
// removed in the future without warning.
|
// removed in the future without warning.
|
||||||
func (fd *Field) EnforceUTF8() bool {
|
func (fd *Field) EnforceUTF8() bool {
|
||||||
|
if fd.L0.ParentFile.L1.Syntax == protoreflect.Editions {
|
||||||
|
return fd.L1.EditionFeatures.IsUTF8Validated
|
||||||
|
}
|
||||||
if fd.L1.HasEnforceUTF8 {
|
if fd.L1.HasEnforceUTF8 {
|
||||||
return fd.L1.EnforceUTF8
|
return fd.L1.EnforceUTF8
|
||||||
}
|
}
|
||||||
|
@ -359,10 +428,11 @@ type (
|
||||||
L2 *ExtensionL2 // protected by fileDesc.once
|
L2 *ExtensionL2 // protected by fileDesc.once
|
||||||
}
|
}
|
||||||
ExtensionL1 struct {
|
ExtensionL1 struct {
|
||||||
Number protoreflect.FieldNumber
|
Number protoreflect.FieldNumber
|
||||||
Extendee protoreflect.MessageDescriptor
|
Extendee protoreflect.MessageDescriptor
|
||||||
Cardinality protoreflect.Cardinality
|
Cardinality protoreflect.Cardinality
|
||||||
Kind protoreflect.Kind
|
Kind protoreflect.Kind
|
||||||
|
EditionFeatures EditionFeatures
|
||||||
}
|
}
|
||||||
ExtensionL2 struct {
|
ExtensionL2 struct {
|
||||||
Options func() protoreflect.ProtoMessage
|
Options func() protoreflect.ProtoMessage
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
package filedesc
|
package filedesc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"google.golang.org/protobuf/encoding/protowire"
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
|
@ -98,6 +99,7 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||||
var prevField protoreflect.FieldNumber
|
var prevField protoreflect.FieldNumber
|
||||||
var numEnums, numMessages, numExtensions, numServices int
|
var numEnums, numMessages, numExtensions, numServices int
|
||||||
var posEnums, posMessages, posExtensions, posServices int
|
var posEnums, posMessages, posExtensions, posServices int
|
||||||
|
var options []byte
|
||||||
b0 := b
|
b0 := b
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
num, typ, n := protowire.ConsumeTag(b)
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
|
@ -113,6 +115,8 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||||
fd.L1.Syntax = protoreflect.Proto2
|
fd.L1.Syntax = protoreflect.Proto2
|
||||||
case "proto3":
|
case "proto3":
|
||||||
fd.L1.Syntax = protoreflect.Proto3
|
fd.L1.Syntax = protoreflect.Proto3
|
||||||
|
case "editions":
|
||||||
|
fd.L1.Syntax = protoreflect.Editions
|
||||||
default:
|
default:
|
||||||
panic("invalid syntax")
|
panic("invalid syntax")
|
||||||
}
|
}
|
||||||
|
@ -120,6 +124,8 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||||
fd.L1.Path = sb.MakeString(v)
|
fd.L1.Path = sb.MakeString(v)
|
||||||
case genid.FileDescriptorProto_Package_field_number:
|
case genid.FileDescriptorProto_Package_field_number:
|
||||||
fd.L1.Package = protoreflect.FullName(sb.MakeString(v))
|
fd.L1.Package = protoreflect.FullName(sb.MakeString(v))
|
||||||
|
case genid.FileDescriptorProto_Options_field_number:
|
||||||
|
options = v
|
||||||
case genid.FileDescriptorProto_EnumType_field_number:
|
case genid.FileDescriptorProto_EnumType_field_number:
|
||||||
if prevField != genid.FileDescriptorProto_EnumType_field_number {
|
if prevField != genid.FileDescriptorProto_EnumType_field_number {
|
||||||
if numEnums > 0 {
|
if numEnums > 0 {
|
||||||
|
@ -154,6 +160,13 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||||
numServices++
|
numServices++
|
||||||
}
|
}
|
||||||
prevField = num
|
prevField = num
|
||||||
|
case protowire.VarintType:
|
||||||
|
v, m := protowire.ConsumeVarint(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FileDescriptorProto_Edition_field_number:
|
||||||
|
fd.L1.Edition = Edition(v)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
|
@ -166,6 +179,15 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||||
fd.L1.Syntax = protoreflect.Proto2
|
fd.L1.Syntax = protoreflect.Proto2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if fd.L1.Syntax == protoreflect.Editions {
|
||||||
|
fd.L1.EditionFeatures = getFeaturesFor(fd.L1.Edition)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse editions features from options if any
|
||||||
|
if options != nil {
|
||||||
|
fd.unmarshalSeedOptions(options)
|
||||||
|
}
|
||||||
|
|
||||||
// Must allocate all declarations before parsing each descriptor type
|
// Must allocate all declarations before parsing each descriptor type
|
||||||
// to ensure we handled all descriptors in "flattened ordering".
|
// to ensure we handled all descriptors in "flattened ordering".
|
||||||
if numEnums > 0 {
|
if numEnums > 0 {
|
||||||
|
@ -219,6 +241,28 @@ func (fd *File) unmarshalSeed(b []byte) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (fd *File) unmarshalSeedOptions(b []byte) {
|
||||||
|
for b := b; len(b) > 0; {
|
||||||
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
|
b = b[n:]
|
||||||
|
switch typ {
|
||||||
|
case protowire.BytesType:
|
||||||
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FileOptions_Features_field_number:
|
||||||
|
if fd.Syntax() != protoreflect.Editions {
|
||||||
|
panic(fmt.Sprintf("invalid descriptor: using edition features in a proto with syntax %s", fd.Syntax()))
|
||||||
|
}
|
||||||
|
fd.L1.EditionFeatures = unmarshalFeatureSet(v, fd.L1.EditionFeatures)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
|
b = b[m:]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
|
||||||
ed.L0.ParentFile = pf
|
ed.L0.ParentFile = pf
|
||||||
ed.L0.Parent = pd
|
ed.L0.Parent = pd
|
||||||
|
@ -275,6 +319,7 @@ func (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protor
|
||||||
md.L0.ParentFile = pf
|
md.L0.ParentFile = pf
|
||||||
md.L0.Parent = pd
|
md.L0.Parent = pd
|
||||||
md.L0.Index = i
|
md.L0.Index = i
|
||||||
|
md.L1.EditionFeatures = featuresFromParentDesc(md.Parent())
|
||||||
|
|
||||||
var prevField protoreflect.FieldNumber
|
var prevField protoreflect.FieldNumber
|
||||||
var numEnums, numMessages, numExtensions int
|
var numEnums, numMessages, numExtensions int
|
||||||
|
@ -380,6 +425,13 @@ func (md *Message) unmarshalSeedOptions(b []byte) {
|
||||||
case genid.MessageOptions_MessageSetWireFormat_field_number:
|
case genid.MessageOptions_MessageSetWireFormat_field_number:
|
||||||
md.L1.IsMessageSet = protowire.DecodeBool(v)
|
md.L1.IsMessageSet = protowire.DecodeBool(v)
|
||||||
}
|
}
|
||||||
|
case protowire.BytesType:
|
||||||
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.MessageOptions_Features_field_number:
|
||||||
|
md.L1.EditionFeatures = unmarshalFeatureSet(v, md.L1.EditionFeatures)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
|
|
|
@ -414,6 +414,7 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoref
|
||||||
fd.L0.ParentFile = pf
|
fd.L0.ParentFile = pf
|
||||||
fd.L0.Parent = pd
|
fd.L0.Parent = pd
|
||||||
fd.L0.Index = i
|
fd.L0.Index = i
|
||||||
|
fd.L1.EditionFeatures = featuresFromParentDesc(fd.Parent())
|
||||||
|
|
||||||
var rawTypeName []byte
|
var rawTypeName []byte
|
||||||
var rawOptions []byte
|
var rawOptions []byte
|
||||||
|
@ -465,6 +466,12 @@ func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoref
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if fd.Syntax() == protoreflect.Editions && fd.L1.Kind == protoreflect.MessageKind && fd.L1.EditionFeatures.IsDelimitedEncoded {
|
||||||
|
fd.L1.Kind = protoreflect.GroupKind
|
||||||
|
}
|
||||||
|
if fd.Syntax() == protoreflect.Editions && fd.L1.EditionFeatures.IsLegacyRequired {
|
||||||
|
fd.L1.Cardinality = protoreflect.Required
|
||||||
|
}
|
||||||
if rawTypeName != nil {
|
if rawTypeName != nil {
|
||||||
name := makeFullName(sb, rawTypeName)
|
name := makeFullName(sb, rawTypeName)
|
||||||
switch fd.L1.Kind {
|
switch fd.L1.Kind {
|
||||||
|
@ -497,6 +504,13 @@ func (fd *Field) unmarshalOptions(b []byte) {
|
||||||
fd.L1.HasEnforceUTF8 = true
|
fd.L1.HasEnforceUTF8 = true
|
||||||
fd.L1.EnforceUTF8 = protowire.DecodeBool(v)
|
fd.L1.EnforceUTF8 = protowire.DecodeBool(v)
|
||||||
}
|
}
|
||||||
|
case protowire.BytesType:
|
||||||
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FieldOptions_Features_field_number:
|
||||||
|
fd.L1.EditionFeatures = unmarshalFeatureSet(v, fd.L1.EditionFeatures)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
|
@ -534,6 +548,7 @@ func (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoref
|
||||||
func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {
|
func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||||
var rawTypeName []byte
|
var rawTypeName []byte
|
||||||
var rawOptions []byte
|
var rawOptions []byte
|
||||||
|
xd.L1.EditionFeatures = featuresFromParentDesc(xd.L1.Extendee)
|
||||||
xd.L2 = new(ExtensionL2)
|
xd.L2 = new(ExtensionL2)
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
num, typ, n := protowire.ConsumeTag(b)
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
|
@ -565,6 +580,12 @@ func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if xd.Syntax() == protoreflect.Editions && xd.L1.Kind == protoreflect.MessageKind && xd.L1.EditionFeatures.IsDelimitedEncoded {
|
||||||
|
xd.L1.Kind = protoreflect.GroupKind
|
||||||
|
}
|
||||||
|
if xd.Syntax() == protoreflect.Editions && xd.L1.EditionFeatures.IsLegacyRequired {
|
||||||
|
xd.L1.Cardinality = protoreflect.Required
|
||||||
|
}
|
||||||
if rawTypeName != nil {
|
if rawTypeName != nil {
|
||||||
name := makeFullName(sb, rawTypeName)
|
name := makeFullName(sb, rawTypeName)
|
||||||
switch xd.L1.Kind {
|
switch xd.L1.Kind {
|
||||||
|
@ -589,6 +610,13 @@ func (xd *Extension) unmarshalOptions(b []byte) {
|
||||||
case genid.FieldOptions_Packed_field_number:
|
case genid.FieldOptions_Packed_field_number:
|
||||||
xd.L2.IsPacked = protowire.DecodeBool(v)
|
xd.L2.IsPacked = protowire.DecodeBool(v)
|
||||||
}
|
}
|
||||||
|
case protowire.BytesType:
|
||||||
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FieldOptions_Features_field_number:
|
||||||
|
xd.L1.EditionFeatures = unmarshalFeatureSet(v, xd.L1.EditionFeatures)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
m := protowire.ConsumeFieldValue(num, typ, b)
|
m := protowire.ConsumeFieldValue(num, typ, b)
|
||||||
b = b[m:]
|
b = b[m:]
|
||||||
|
|
|
@ -0,0 +1,142 @@
|
||||||
|
// Copyright 2024 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package filedesc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/encoding/protowire"
|
||||||
|
"google.golang.org/protobuf/internal/editiondefaults"
|
||||||
|
"google.golang.org/protobuf/internal/genid"
|
||||||
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
var defaultsCache = make(map[Edition]EditionFeatures)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
unmarshalEditionDefaults(editiondefaults.Defaults)
|
||||||
|
}
|
||||||
|
|
||||||
|
func unmarshalGoFeature(b []byte, parent EditionFeatures) EditionFeatures {
|
||||||
|
for len(b) > 0 {
|
||||||
|
num, _, n := protowire.ConsumeTag(b)
|
||||||
|
b = b[n:]
|
||||||
|
switch num {
|
||||||
|
case genid.GoFeatures_LegacyUnmarshalJsonEnum_field_number:
|
||||||
|
v, m := protowire.ConsumeVarint(b)
|
||||||
|
b = b[m:]
|
||||||
|
parent.GenerateLegacyUnmarshalJSON = protowire.DecodeBool(v)
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("unkown field number %d while unmarshalling GoFeatures", num))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return parent
|
||||||
|
}
|
||||||
|
|
||||||
|
func unmarshalFeatureSet(b []byte, parent EditionFeatures) EditionFeatures {
|
||||||
|
for len(b) > 0 {
|
||||||
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
|
b = b[n:]
|
||||||
|
switch typ {
|
||||||
|
case protowire.VarintType:
|
||||||
|
v, m := protowire.ConsumeVarint(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FeatureSet_FieldPresence_field_number:
|
||||||
|
parent.IsFieldPresence = v == genid.FeatureSet_EXPLICIT_enum_value || v == genid.FeatureSet_LEGACY_REQUIRED_enum_value
|
||||||
|
parent.IsLegacyRequired = v == genid.FeatureSet_LEGACY_REQUIRED_enum_value
|
||||||
|
case genid.FeatureSet_EnumType_field_number:
|
||||||
|
parent.IsOpenEnum = v == genid.FeatureSet_OPEN_enum_value
|
||||||
|
case genid.FeatureSet_RepeatedFieldEncoding_field_number:
|
||||||
|
parent.IsPacked = v == genid.FeatureSet_PACKED_enum_value
|
||||||
|
case genid.FeatureSet_Utf8Validation_field_number:
|
||||||
|
parent.IsUTF8Validated = v == genid.FeatureSet_VERIFY_enum_value
|
||||||
|
case genid.FeatureSet_MessageEncoding_field_number:
|
||||||
|
parent.IsDelimitedEncoded = v == genid.FeatureSet_DELIMITED_enum_value
|
||||||
|
case genid.FeatureSet_JsonFormat_field_number:
|
||||||
|
parent.IsJSONCompliant = v == genid.FeatureSet_ALLOW_enum_value
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("unkown field number %d while unmarshalling FeatureSet", num))
|
||||||
|
}
|
||||||
|
case protowire.BytesType:
|
||||||
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.GoFeatures_LegacyUnmarshalJsonEnum_field_number:
|
||||||
|
parent = unmarshalGoFeature(v, parent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent
|
||||||
|
}
|
||||||
|
|
||||||
|
func featuresFromParentDesc(parentDesc protoreflect.Descriptor) EditionFeatures {
|
||||||
|
var parentFS EditionFeatures
|
||||||
|
switch p := parentDesc.(type) {
|
||||||
|
case *File:
|
||||||
|
parentFS = p.L1.EditionFeatures
|
||||||
|
case *Message:
|
||||||
|
parentFS = p.L1.EditionFeatures
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("unknown parent type %T", parentDesc))
|
||||||
|
}
|
||||||
|
return parentFS
|
||||||
|
}
|
||||||
|
|
||||||
|
func unmarshalEditionDefault(b []byte) {
|
||||||
|
var ed Edition
|
||||||
|
var fs EditionFeatures
|
||||||
|
for len(b) > 0 {
|
||||||
|
num, typ, n := protowire.ConsumeTag(b)
|
||||||
|
b = b[n:]
|
||||||
|
switch typ {
|
||||||
|
case protowire.VarintType:
|
||||||
|
v, m := protowire.ConsumeVarint(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_number:
|
||||||
|
ed = Edition(v)
|
||||||
|
}
|
||||||
|
case protowire.BytesType:
|
||||||
|
v, m := protowire.ConsumeBytes(b)
|
||||||
|
b = b[m:]
|
||||||
|
switch num {
|
||||||
|
case genid.FeatureSetDefaults_FeatureSetEditionDefault_Features_field_number:
|
||||||
|
fs = unmarshalFeatureSet(v, fs)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defaultsCache[ed] = fs
|
||||||
|
}
|
||||||
|
|
||||||
|
func unmarshalEditionDefaults(b []byte) {
|
||||||
|
for len(b) > 0 {
|
||||||
|
num, _, n := protowire.ConsumeTag(b)
|
||||||
|
b = b[n:]
|
||||||
|
switch num {
|
||||||
|
case genid.FeatureSetDefaults_Defaults_field_number:
|
||||||
|
def, m := protowire.ConsumeBytes(b)
|
||||||
|
b = b[m:]
|
||||||
|
unmarshalEditionDefault(def)
|
||||||
|
case genid.FeatureSetDefaults_MinimumEdition_field_number,
|
||||||
|
genid.FeatureSetDefaults_MaximumEdition_field_number:
|
||||||
|
// We don't care about the minimum and maximum editions. If the
|
||||||
|
// edition we are looking for later on is not in the cache we know
|
||||||
|
// it is outside of the range between minimum and maximum edition.
|
||||||
|
_, m := protowire.ConsumeVarint(b)
|
||||||
|
b = b[m:]
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("unkown field number %d while unmarshalling EditionDefault", num))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func getFeaturesFor(ed Edition) EditionFeatures {
|
||||||
|
if def, ok := defaultsCache[ed]; ok {
|
||||||
|
return def
|
||||||
|
}
|
||||||
|
panic(fmt.Sprintf("unsupported edition: %v", ed))
|
||||||
|
}
|
|
@ -12,6 +12,27 @@ import (
|
||||||
|
|
||||||
const File_google_protobuf_descriptor_proto = "google/protobuf/descriptor.proto"
|
const File_google_protobuf_descriptor_proto = "google/protobuf/descriptor.proto"
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.Edition.
|
||||||
|
const (
|
||||||
|
Edition_enum_fullname = "google.protobuf.Edition"
|
||||||
|
Edition_enum_name = "Edition"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.Edition.
|
||||||
|
const (
|
||||||
|
Edition_EDITION_UNKNOWN_enum_value = 0
|
||||||
|
Edition_EDITION_PROTO2_enum_value = 998
|
||||||
|
Edition_EDITION_PROTO3_enum_value = 999
|
||||||
|
Edition_EDITION_2023_enum_value = 1000
|
||||||
|
Edition_EDITION_2024_enum_value = 1001
|
||||||
|
Edition_EDITION_1_TEST_ONLY_enum_value = 1
|
||||||
|
Edition_EDITION_2_TEST_ONLY_enum_value = 2
|
||||||
|
Edition_EDITION_99997_TEST_ONLY_enum_value = 99997
|
||||||
|
Edition_EDITION_99998_TEST_ONLY_enum_value = 99998
|
||||||
|
Edition_EDITION_99999_TEST_ONLY_enum_value = 99999
|
||||||
|
Edition_EDITION_MAX_enum_value = 2147483647
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.FileDescriptorSet.
|
// Names for google.protobuf.FileDescriptorSet.
|
||||||
const (
|
const (
|
||||||
FileDescriptorSet_message_name protoreflect.Name = "FileDescriptorSet"
|
FileDescriptorSet_message_name protoreflect.Name = "FileDescriptorSet"
|
||||||
|
@ -81,7 +102,7 @@ const (
|
||||||
FileDescriptorProto_Options_field_number protoreflect.FieldNumber = 8
|
FileDescriptorProto_Options_field_number protoreflect.FieldNumber = 8
|
||||||
FileDescriptorProto_SourceCodeInfo_field_number protoreflect.FieldNumber = 9
|
FileDescriptorProto_SourceCodeInfo_field_number protoreflect.FieldNumber = 9
|
||||||
FileDescriptorProto_Syntax_field_number protoreflect.FieldNumber = 12
|
FileDescriptorProto_Syntax_field_number protoreflect.FieldNumber = 12
|
||||||
FileDescriptorProto_Edition_field_number protoreflect.FieldNumber = 13
|
FileDescriptorProto_Edition_field_number protoreflect.FieldNumber = 14
|
||||||
)
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.DescriptorProto.
|
// Names for google.protobuf.DescriptorProto.
|
||||||
|
@ -184,10 +205,12 @@ const (
|
||||||
const (
|
const (
|
||||||
ExtensionRangeOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
ExtensionRangeOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
ExtensionRangeOptions_Declaration_field_name protoreflect.Name = "declaration"
|
ExtensionRangeOptions_Declaration_field_name protoreflect.Name = "declaration"
|
||||||
|
ExtensionRangeOptions_Features_field_name protoreflect.Name = "features"
|
||||||
ExtensionRangeOptions_Verification_field_name protoreflect.Name = "verification"
|
ExtensionRangeOptions_Verification_field_name protoreflect.Name = "verification"
|
||||||
|
|
||||||
ExtensionRangeOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.uninterpreted_option"
|
ExtensionRangeOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.uninterpreted_option"
|
||||||
ExtensionRangeOptions_Declaration_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.declaration"
|
ExtensionRangeOptions_Declaration_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.declaration"
|
||||||
|
ExtensionRangeOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.features"
|
||||||
ExtensionRangeOptions_Verification_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.verification"
|
ExtensionRangeOptions_Verification_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.verification"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -195,6 +218,7 @@ const (
|
||||||
const (
|
const (
|
||||||
ExtensionRangeOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
ExtensionRangeOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
ExtensionRangeOptions_Declaration_field_number protoreflect.FieldNumber = 2
|
ExtensionRangeOptions_Declaration_field_number protoreflect.FieldNumber = 2
|
||||||
|
ExtensionRangeOptions_Features_field_number protoreflect.FieldNumber = 50
|
||||||
ExtensionRangeOptions_Verification_field_number protoreflect.FieldNumber = 3
|
ExtensionRangeOptions_Verification_field_number protoreflect.FieldNumber = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -204,6 +228,12 @@ const (
|
||||||
ExtensionRangeOptions_VerificationState_enum_name = "VerificationState"
|
ExtensionRangeOptions_VerificationState_enum_name = "VerificationState"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.ExtensionRangeOptions.VerificationState.
|
||||||
|
const (
|
||||||
|
ExtensionRangeOptions_DECLARATION_enum_value = 0
|
||||||
|
ExtensionRangeOptions_UNVERIFIED_enum_value = 1
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.ExtensionRangeOptions.Declaration.
|
// Names for google.protobuf.ExtensionRangeOptions.Declaration.
|
||||||
const (
|
const (
|
||||||
ExtensionRangeOptions_Declaration_message_name protoreflect.Name = "Declaration"
|
ExtensionRangeOptions_Declaration_message_name protoreflect.Name = "Declaration"
|
||||||
|
@ -212,29 +242,26 @@ const (
|
||||||
|
|
||||||
// Field names for google.protobuf.ExtensionRangeOptions.Declaration.
|
// Field names for google.protobuf.ExtensionRangeOptions.Declaration.
|
||||||
const (
|
const (
|
||||||
ExtensionRangeOptions_Declaration_Number_field_name protoreflect.Name = "number"
|
ExtensionRangeOptions_Declaration_Number_field_name protoreflect.Name = "number"
|
||||||
ExtensionRangeOptions_Declaration_FullName_field_name protoreflect.Name = "full_name"
|
ExtensionRangeOptions_Declaration_FullName_field_name protoreflect.Name = "full_name"
|
||||||
ExtensionRangeOptions_Declaration_Type_field_name protoreflect.Name = "type"
|
ExtensionRangeOptions_Declaration_Type_field_name protoreflect.Name = "type"
|
||||||
ExtensionRangeOptions_Declaration_IsRepeated_field_name protoreflect.Name = "is_repeated"
|
ExtensionRangeOptions_Declaration_Reserved_field_name protoreflect.Name = "reserved"
|
||||||
ExtensionRangeOptions_Declaration_Reserved_field_name protoreflect.Name = "reserved"
|
ExtensionRangeOptions_Declaration_Repeated_field_name protoreflect.Name = "repeated"
|
||||||
ExtensionRangeOptions_Declaration_Repeated_field_name protoreflect.Name = "repeated"
|
|
||||||
|
|
||||||
ExtensionRangeOptions_Declaration_Number_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.number"
|
ExtensionRangeOptions_Declaration_Number_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.number"
|
||||||
ExtensionRangeOptions_Declaration_FullName_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.full_name"
|
ExtensionRangeOptions_Declaration_FullName_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.full_name"
|
||||||
ExtensionRangeOptions_Declaration_Type_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.type"
|
ExtensionRangeOptions_Declaration_Type_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.type"
|
||||||
ExtensionRangeOptions_Declaration_IsRepeated_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.is_repeated"
|
ExtensionRangeOptions_Declaration_Reserved_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.reserved"
|
||||||
ExtensionRangeOptions_Declaration_Reserved_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.reserved"
|
ExtensionRangeOptions_Declaration_Repeated_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.repeated"
|
||||||
ExtensionRangeOptions_Declaration_Repeated_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.repeated"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Field numbers for google.protobuf.ExtensionRangeOptions.Declaration.
|
// Field numbers for google.protobuf.ExtensionRangeOptions.Declaration.
|
||||||
const (
|
const (
|
||||||
ExtensionRangeOptions_Declaration_Number_field_number protoreflect.FieldNumber = 1
|
ExtensionRangeOptions_Declaration_Number_field_number protoreflect.FieldNumber = 1
|
||||||
ExtensionRangeOptions_Declaration_FullName_field_number protoreflect.FieldNumber = 2
|
ExtensionRangeOptions_Declaration_FullName_field_number protoreflect.FieldNumber = 2
|
||||||
ExtensionRangeOptions_Declaration_Type_field_number protoreflect.FieldNumber = 3
|
ExtensionRangeOptions_Declaration_Type_field_number protoreflect.FieldNumber = 3
|
||||||
ExtensionRangeOptions_Declaration_IsRepeated_field_number protoreflect.FieldNumber = 4
|
ExtensionRangeOptions_Declaration_Reserved_field_number protoreflect.FieldNumber = 5
|
||||||
ExtensionRangeOptions_Declaration_Reserved_field_number protoreflect.FieldNumber = 5
|
ExtensionRangeOptions_Declaration_Repeated_field_number protoreflect.FieldNumber = 6
|
||||||
ExtensionRangeOptions_Declaration_Repeated_field_number protoreflect.FieldNumber = 6
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.FieldDescriptorProto.
|
// Names for google.protobuf.FieldDescriptorProto.
|
||||||
|
@ -291,12 +318,41 @@ const (
|
||||||
FieldDescriptorProto_Type_enum_name = "Type"
|
FieldDescriptorProto_Type_enum_name = "Type"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FieldDescriptorProto.Type.
|
||||||
|
const (
|
||||||
|
FieldDescriptorProto_TYPE_DOUBLE_enum_value = 1
|
||||||
|
FieldDescriptorProto_TYPE_FLOAT_enum_value = 2
|
||||||
|
FieldDescriptorProto_TYPE_INT64_enum_value = 3
|
||||||
|
FieldDescriptorProto_TYPE_UINT64_enum_value = 4
|
||||||
|
FieldDescriptorProto_TYPE_INT32_enum_value = 5
|
||||||
|
FieldDescriptorProto_TYPE_FIXED64_enum_value = 6
|
||||||
|
FieldDescriptorProto_TYPE_FIXED32_enum_value = 7
|
||||||
|
FieldDescriptorProto_TYPE_BOOL_enum_value = 8
|
||||||
|
FieldDescriptorProto_TYPE_STRING_enum_value = 9
|
||||||
|
FieldDescriptorProto_TYPE_GROUP_enum_value = 10
|
||||||
|
FieldDescriptorProto_TYPE_MESSAGE_enum_value = 11
|
||||||
|
FieldDescriptorProto_TYPE_BYTES_enum_value = 12
|
||||||
|
FieldDescriptorProto_TYPE_UINT32_enum_value = 13
|
||||||
|
FieldDescriptorProto_TYPE_ENUM_enum_value = 14
|
||||||
|
FieldDescriptorProto_TYPE_SFIXED32_enum_value = 15
|
||||||
|
FieldDescriptorProto_TYPE_SFIXED64_enum_value = 16
|
||||||
|
FieldDescriptorProto_TYPE_SINT32_enum_value = 17
|
||||||
|
FieldDescriptorProto_TYPE_SINT64_enum_value = 18
|
||||||
|
)
|
||||||
|
|
||||||
// Full and short names for google.protobuf.FieldDescriptorProto.Label.
|
// Full and short names for google.protobuf.FieldDescriptorProto.Label.
|
||||||
const (
|
const (
|
||||||
FieldDescriptorProto_Label_enum_fullname = "google.protobuf.FieldDescriptorProto.Label"
|
FieldDescriptorProto_Label_enum_fullname = "google.protobuf.FieldDescriptorProto.Label"
|
||||||
FieldDescriptorProto_Label_enum_name = "Label"
|
FieldDescriptorProto_Label_enum_name = "Label"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FieldDescriptorProto.Label.
|
||||||
|
const (
|
||||||
|
FieldDescriptorProto_LABEL_OPTIONAL_enum_value = 1
|
||||||
|
FieldDescriptorProto_LABEL_REPEATED_enum_value = 3
|
||||||
|
FieldDescriptorProto_LABEL_REQUIRED_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.OneofDescriptorProto.
|
// Names for google.protobuf.OneofDescriptorProto.
|
||||||
const (
|
const (
|
||||||
OneofDescriptorProto_message_name protoreflect.Name = "OneofDescriptorProto"
|
OneofDescriptorProto_message_name protoreflect.Name = "OneofDescriptorProto"
|
||||||
|
@ -468,7 +524,6 @@ const (
|
||||||
FileOptions_CcGenericServices_field_name protoreflect.Name = "cc_generic_services"
|
FileOptions_CcGenericServices_field_name protoreflect.Name = "cc_generic_services"
|
||||||
FileOptions_JavaGenericServices_field_name protoreflect.Name = "java_generic_services"
|
FileOptions_JavaGenericServices_field_name protoreflect.Name = "java_generic_services"
|
||||||
FileOptions_PyGenericServices_field_name protoreflect.Name = "py_generic_services"
|
FileOptions_PyGenericServices_field_name protoreflect.Name = "py_generic_services"
|
||||||
FileOptions_PhpGenericServices_field_name protoreflect.Name = "php_generic_services"
|
|
||||||
FileOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
FileOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
||||||
FileOptions_CcEnableArenas_field_name protoreflect.Name = "cc_enable_arenas"
|
FileOptions_CcEnableArenas_field_name protoreflect.Name = "cc_enable_arenas"
|
||||||
FileOptions_ObjcClassPrefix_field_name protoreflect.Name = "objc_class_prefix"
|
FileOptions_ObjcClassPrefix_field_name protoreflect.Name = "objc_class_prefix"
|
||||||
|
@ -478,6 +533,7 @@ const (
|
||||||
FileOptions_PhpNamespace_field_name protoreflect.Name = "php_namespace"
|
FileOptions_PhpNamespace_field_name protoreflect.Name = "php_namespace"
|
||||||
FileOptions_PhpMetadataNamespace_field_name protoreflect.Name = "php_metadata_namespace"
|
FileOptions_PhpMetadataNamespace_field_name protoreflect.Name = "php_metadata_namespace"
|
||||||
FileOptions_RubyPackage_field_name protoreflect.Name = "ruby_package"
|
FileOptions_RubyPackage_field_name protoreflect.Name = "ruby_package"
|
||||||
|
FileOptions_Features_field_name protoreflect.Name = "features"
|
||||||
FileOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
FileOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
FileOptions_JavaPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_package"
|
FileOptions_JavaPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_package"
|
||||||
|
@ -490,7 +546,6 @@ const (
|
||||||
FileOptions_CcGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.cc_generic_services"
|
FileOptions_CcGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.cc_generic_services"
|
||||||
FileOptions_JavaGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_generic_services"
|
FileOptions_JavaGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_generic_services"
|
||||||
FileOptions_PyGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.py_generic_services"
|
FileOptions_PyGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.py_generic_services"
|
||||||
FileOptions_PhpGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_generic_services"
|
|
||||||
FileOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.deprecated"
|
FileOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.deprecated"
|
||||||
FileOptions_CcEnableArenas_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.cc_enable_arenas"
|
FileOptions_CcEnableArenas_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.cc_enable_arenas"
|
||||||
FileOptions_ObjcClassPrefix_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.objc_class_prefix"
|
FileOptions_ObjcClassPrefix_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.objc_class_prefix"
|
||||||
|
@ -500,6 +555,7 @@ const (
|
||||||
FileOptions_PhpNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_namespace"
|
FileOptions_PhpNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_namespace"
|
||||||
FileOptions_PhpMetadataNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_metadata_namespace"
|
FileOptions_PhpMetadataNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_metadata_namespace"
|
||||||
FileOptions_RubyPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.ruby_package"
|
FileOptions_RubyPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.ruby_package"
|
||||||
|
FileOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.features"
|
||||||
FileOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.uninterpreted_option"
|
FileOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -515,7 +571,6 @@ const (
|
||||||
FileOptions_CcGenericServices_field_number protoreflect.FieldNumber = 16
|
FileOptions_CcGenericServices_field_number protoreflect.FieldNumber = 16
|
||||||
FileOptions_JavaGenericServices_field_number protoreflect.FieldNumber = 17
|
FileOptions_JavaGenericServices_field_number protoreflect.FieldNumber = 17
|
||||||
FileOptions_PyGenericServices_field_number protoreflect.FieldNumber = 18
|
FileOptions_PyGenericServices_field_number protoreflect.FieldNumber = 18
|
||||||
FileOptions_PhpGenericServices_field_number protoreflect.FieldNumber = 42
|
|
||||||
FileOptions_Deprecated_field_number protoreflect.FieldNumber = 23
|
FileOptions_Deprecated_field_number protoreflect.FieldNumber = 23
|
||||||
FileOptions_CcEnableArenas_field_number protoreflect.FieldNumber = 31
|
FileOptions_CcEnableArenas_field_number protoreflect.FieldNumber = 31
|
||||||
FileOptions_ObjcClassPrefix_field_number protoreflect.FieldNumber = 36
|
FileOptions_ObjcClassPrefix_field_number protoreflect.FieldNumber = 36
|
||||||
|
@ -525,6 +580,7 @@ const (
|
||||||
FileOptions_PhpNamespace_field_number protoreflect.FieldNumber = 41
|
FileOptions_PhpNamespace_field_number protoreflect.FieldNumber = 41
|
||||||
FileOptions_PhpMetadataNamespace_field_number protoreflect.FieldNumber = 44
|
FileOptions_PhpMetadataNamespace_field_number protoreflect.FieldNumber = 44
|
||||||
FileOptions_RubyPackage_field_number protoreflect.FieldNumber = 45
|
FileOptions_RubyPackage_field_number protoreflect.FieldNumber = 45
|
||||||
|
FileOptions_Features_field_number protoreflect.FieldNumber = 50
|
||||||
FileOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
FileOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -534,6 +590,13 @@ const (
|
||||||
FileOptions_OptimizeMode_enum_name = "OptimizeMode"
|
FileOptions_OptimizeMode_enum_name = "OptimizeMode"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FileOptions.OptimizeMode.
|
||||||
|
const (
|
||||||
|
FileOptions_SPEED_enum_value = 1
|
||||||
|
FileOptions_CODE_SIZE_enum_value = 2
|
||||||
|
FileOptions_LITE_RUNTIME_enum_value = 3
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.MessageOptions.
|
// Names for google.protobuf.MessageOptions.
|
||||||
const (
|
const (
|
||||||
MessageOptions_message_name protoreflect.Name = "MessageOptions"
|
MessageOptions_message_name protoreflect.Name = "MessageOptions"
|
||||||
|
@ -547,6 +610,7 @@ const (
|
||||||
MessageOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
MessageOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
||||||
MessageOptions_MapEntry_field_name protoreflect.Name = "map_entry"
|
MessageOptions_MapEntry_field_name protoreflect.Name = "map_entry"
|
||||||
MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_name protoreflect.Name = "deprecated_legacy_json_field_conflicts"
|
MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_name protoreflect.Name = "deprecated_legacy_json_field_conflicts"
|
||||||
|
MessageOptions_Features_field_name protoreflect.Name = "features"
|
||||||
MessageOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
MessageOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
MessageOptions_MessageSetWireFormat_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.message_set_wire_format"
|
MessageOptions_MessageSetWireFormat_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.message_set_wire_format"
|
||||||
|
@ -554,6 +618,7 @@ const (
|
||||||
MessageOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated"
|
MessageOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated"
|
||||||
MessageOptions_MapEntry_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.map_entry"
|
MessageOptions_MapEntry_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.map_entry"
|
||||||
MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated_legacy_json_field_conflicts"
|
MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated_legacy_json_field_conflicts"
|
||||||
|
MessageOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.features"
|
||||||
MessageOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.uninterpreted_option"
|
MessageOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -564,6 +629,7 @@ const (
|
||||||
MessageOptions_Deprecated_field_number protoreflect.FieldNumber = 3
|
MessageOptions_Deprecated_field_number protoreflect.FieldNumber = 3
|
||||||
MessageOptions_MapEntry_field_number protoreflect.FieldNumber = 7
|
MessageOptions_MapEntry_field_number protoreflect.FieldNumber = 7
|
||||||
MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_number protoreflect.FieldNumber = 11
|
MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_number protoreflect.FieldNumber = 11
|
||||||
|
MessageOptions_Features_field_number protoreflect.FieldNumber = 12
|
||||||
MessageOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
MessageOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -584,8 +650,9 @@ const (
|
||||||
FieldOptions_Weak_field_name protoreflect.Name = "weak"
|
FieldOptions_Weak_field_name protoreflect.Name = "weak"
|
||||||
FieldOptions_DebugRedact_field_name protoreflect.Name = "debug_redact"
|
FieldOptions_DebugRedact_field_name protoreflect.Name = "debug_redact"
|
||||||
FieldOptions_Retention_field_name protoreflect.Name = "retention"
|
FieldOptions_Retention_field_name protoreflect.Name = "retention"
|
||||||
FieldOptions_Target_field_name protoreflect.Name = "target"
|
|
||||||
FieldOptions_Targets_field_name protoreflect.Name = "targets"
|
FieldOptions_Targets_field_name protoreflect.Name = "targets"
|
||||||
|
FieldOptions_EditionDefaults_field_name protoreflect.Name = "edition_defaults"
|
||||||
|
FieldOptions_Features_field_name protoreflect.Name = "features"
|
||||||
FieldOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
FieldOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
FieldOptions_Ctype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.ctype"
|
FieldOptions_Ctype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.ctype"
|
||||||
|
@ -597,8 +664,9 @@ const (
|
||||||
FieldOptions_Weak_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.weak"
|
FieldOptions_Weak_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.weak"
|
||||||
FieldOptions_DebugRedact_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.debug_redact"
|
FieldOptions_DebugRedact_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.debug_redact"
|
||||||
FieldOptions_Retention_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.retention"
|
FieldOptions_Retention_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.retention"
|
||||||
FieldOptions_Target_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.target"
|
|
||||||
FieldOptions_Targets_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.targets"
|
FieldOptions_Targets_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.targets"
|
||||||
|
FieldOptions_EditionDefaults_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.edition_defaults"
|
||||||
|
FieldOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.features"
|
||||||
FieldOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.uninterpreted_option"
|
FieldOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -613,8 +681,9 @@ const (
|
||||||
FieldOptions_Weak_field_number protoreflect.FieldNumber = 10
|
FieldOptions_Weak_field_number protoreflect.FieldNumber = 10
|
||||||
FieldOptions_DebugRedact_field_number protoreflect.FieldNumber = 16
|
FieldOptions_DebugRedact_field_number protoreflect.FieldNumber = 16
|
||||||
FieldOptions_Retention_field_number protoreflect.FieldNumber = 17
|
FieldOptions_Retention_field_number protoreflect.FieldNumber = 17
|
||||||
FieldOptions_Target_field_number protoreflect.FieldNumber = 18
|
|
||||||
FieldOptions_Targets_field_number protoreflect.FieldNumber = 19
|
FieldOptions_Targets_field_number protoreflect.FieldNumber = 19
|
||||||
|
FieldOptions_EditionDefaults_field_number protoreflect.FieldNumber = 20
|
||||||
|
FieldOptions_Features_field_number protoreflect.FieldNumber = 21
|
||||||
FieldOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
FieldOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -624,24 +693,80 @@ const (
|
||||||
FieldOptions_CType_enum_name = "CType"
|
FieldOptions_CType_enum_name = "CType"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FieldOptions.CType.
|
||||||
|
const (
|
||||||
|
FieldOptions_STRING_enum_value = 0
|
||||||
|
FieldOptions_CORD_enum_value = 1
|
||||||
|
FieldOptions_STRING_PIECE_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
// Full and short names for google.protobuf.FieldOptions.JSType.
|
// Full and short names for google.protobuf.FieldOptions.JSType.
|
||||||
const (
|
const (
|
||||||
FieldOptions_JSType_enum_fullname = "google.protobuf.FieldOptions.JSType"
|
FieldOptions_JSType_enum_fullname = "google.protobuf.FieldOptions.JSType"
|
||||||
FieldOptions_JSType_enum_name = "JSType"
|
FieldOptions_JSType_enum_name = "JSType"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FieldOptions.JSType.
|
||||||
|
const (
|
||||||
|
FieldOptions_JS_NORMAL_enum_value = 0
|
||||||
|
FieldOptions_JS_STRING_enum_value = 1
|
||||||
|
FieldOptions_JS_NUMBER_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
// Full and short names for google.protobuf.FieldOptions.OptionRetention.
|
// Full and short names for google.protobuf.FieldOptions.OptionRetention.
|
||||||
const (
|
const (
|
||||||
FieldOptions_OptionRetention_enum_fullname = "google.protobuf.FieldOptions.OptionRetention"
|
FieldOptions_OptionRetention_enum_fullname = "google.protobuf.FieldOptions.OptionRetention"
|
||||||
FieldOptions_OptionRetention_enum_name = "OptionRetention"
|
FieldOptions_OptionRetention_enum_name = "OptionRetention"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FieldOptions.OptionRetention.
|
||||||
|
const (
|
||||||
|
FieldOptions_RETENTION_UNKNOWN_enum_value = 0
|
||||||
|
FieldOptions_RETENTION_RUNTIME_enum_value = 1
|
||||||
|
FieldOptions_RETENTION_SOURCE_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
// Full and short names for google.protobuf.FieldOptions.OptionTargetType.
|
// Full and short names for google.protobuf.FieldOptions.OptionTargetType.
|
||||||
const (
|
const (
|
||||||
FieldOptions_OptionTargetType_enum_fullname = "google.protobuf.FieldOptions.OptionTargetType"
|
FieldOptions_OptionTargetType_enum_fullname = "google.protobuf.FieldOptions.OptionTargetType"
|
||||||
FieldOptions_OptionTargetType_enum_name = "OptionTargetType"
|
FieldOptions_OptionTargetType_enum_name = "OptionTargetType"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FieldOptions.OptionTargetType.
|
||||||
|
const (
|
||||||
|
FieldOptions_TARGET_TYPE_UNKNOWN_enum_value = 0
|
||||||
|
FieldOptions_TARGET_TYPE_FILE_enum_value = 1
|
||||||
|
FieldOptions_TARGET_TYPE_EXTENSION_RANGE_enum_value = 2
|
||||||
|
FieldOptions_TARGET_TYPE_MESSAGE_enum_value = 3
|
||||||
|
FieldOptions_TARGET_TYPE_FIELD_enum_value = 4
|
||||||
|
FieldOptions_TARGET_TYPE_ONEOF_enum_value = 5
|
||||||
|
FieldOptions_TARGET_TYPE_ENUM_enum_value = 6
|
||||||
|
FieldOptions_TARGET_TYPE_ENUM_ENTRY_enum_value = 7
|
||||||
|
FieldOptions_TARGET_TYPE_SERVICE_enum_value = 8
|
||||||
|
FieldOptions_TARGET_TYPE_METHOD_enum_value = 9
|
||||||
|
)
|
||||||
|
|
||||||
|
// Names for google.protobuf.FieldOptions.EditionDefault.
|
||||||
|
const (
|
||||||
|
FieldOptions_EditionDefault_message_name protoreflect.Name = "EditionDefault"
|
||||||
|
FieldOptions_EditionDefault_message_fullname protoreflect.FullName = "google.protobuf.FieldOptions.EditionDefault"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field names for google.protobuf.FieldOptions.EditionDefault.
|
||||||
|
const (
|
||||||
|
FieldOptions_EditionDefault_Edition_field_name protoreflect.Name = "edition"
|
||||||
|
FieldOptions_EditionDefault_Value_field_name protoreflect.Name = "value"
|
||||||
|
|
||||||
|
FieldOptions_EditionDefault_Edition_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.EditionDefault.edition"
|
||||||
|
FieldOptions_EditionDefault_Value_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.EditionDefault.value"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.FieldOptions.EditionDefault.
|
||||||
|
const (
|
||||||
|
FieldOptions_EditionDefault_Edition_field_number protoreflect.FieldNumber = 3
|
||||||
|
FieldOptions_EditionDefault_Value_field_number protoreflect.FieldNumber = 2
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.OneofOptions.
|
// Names for google.protobuf.OneofOptions.
|
||||||
const (
|
const (
|
||||||
OneofOptions_message_name protoreflect.Name = "OneofOptions"
|
OneofOptions_message_name protoreflect.Name = "OneofOptions"
|
||||||
|
@ -650,13 +775,16 @@ const (
|
||||||
|
|
||||||
// Field names for google.protobuf.OneofOptions.
|
// Field names for google.protobuf.OneofOptions.
|
||||||
const (
|
const (
|
||||||
|
OneofOptions_Features_field_name protoreflect.Name = "features"
|
||||||
OneofOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
OneofOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
|
OneofOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.OneofOptions.features"
|
||||||
OneofOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.OneofOptions.uninterpreted_option"
|
OneofOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.OneofOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Field numbers for google.protobuf.OneofOptions.
|
// Field numbers for google.protobuf.OneofOptions.
|
||||||
const (
|
const (
|
||||||
|
OneofOptions_Features_field_number protoreflect.FieldNumber = 1
|
||||||
OneofOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
OneofOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -671,11 +799,13 @@ const (
|
||||||
EnumOptions_AllowAlias_field_name protoreflect.Name = "allow_alias"
|
EnumOptions_AllowAlias_field_name protoreflect.Name = "allow_alias"
|
||||||
EnumOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
EnumOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
||||||
EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_name protoreflect.Name = "deprecated_legacy_json_field_conflicts"
|
EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_name protoreflect.Name = "deprecated_legacy_json_field_conflicts"
|
||||||
|
EnumOptions_Features_field_name protoreflect.Name = "features"
|
||||||
EnumOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
EnumOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
EnumOptions_AllowAlias_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.allow_alias"
|
EnumOptions_AllowAlias_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.allow_alias"
|
||||||
EnumOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated"
|
EnumOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated"
|
||||||
EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated_legacy_json_field_conflicts"
|
EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated_legacy_json_field_conflicts"
|
||||||
|
EnumOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.features"
|
||||||
EnumOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.uninterpreted_option"
|
EnumOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -684,6 +814,7 @@ const (
|
||||||
EnumOptions_AllowAlias_field_number protoreflect.FieldNumber = 2
|
EnumOptions_AllowAlias_field_number protoreflect.FieldNumber = 2
|
||||||
EnumOptions_Deprecated_field_number protoreflect.FieldNumber = 3
|
EnumOptions_Deprecated_field_number protoreflect.FieldNumber = 3
|
||||||
EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_number protoreflect.FieldNumber = 6
|
EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_number protoreflect.FieldNumber = 6
|
||||||
|
EnumOptions_Features_field_number protoreflect.FieldNumber = 7
|
||||||
EnumOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
EnumOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -696,15 +827,21 @@ const (
|
||||||
// Field names for google.protobuf.EnumValueOptions.
|
// Field names for google.protobuf.EnumValueOptions.
|
||||||
const (
|
const (
|
||||||
EnumValueOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
EnumValueOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
||||||
|
EnumValueOptions_Features_field_name protoreflect.Name = "features"
|
||||||
|
EnumValueOptions_DebugRedact_field_name protoreflect.Name = "debug_redact"
|
||||||
EnumValueOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
EnumValueOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
EnumValueOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.deprecated"
|
EnumValueOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.deprecated"
|
||||||
|
EnumValueOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.features"
|
||||||
|
EnumValueOptions_DebugRedact_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.debug_redact"
|
||||||
EnumValueOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.uninterpreted_option"
|
EnumValueOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Field numbers for google.protobuf.EnumValueOptions.
|
// Field numbers for google.protobuf.EnumValueOptions.
|
||||||
const (
|
const (
|
||||||
EnumValueOptions_Deprecated_field_number protoreflect.FieldNumber = 1
|
EnumValueOptions_Deprecated_field_number protoreflect.FieldNumber = 1
|
||||||
|
EnumValueOptions_Features_field_number protoreflect.FieldNumber = 2
|
||||||
|
EnumValueOptions_DebugRedact_field_number protoreflect.FieldNumber = 3
|
||||||
EnumValueOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
EnumValueOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -716,15 +853,18 @@ const (
|
||||||
|
|
||||||
// Field names for google.protobuf.ServiceOptions.
|
// Field names for google.protobuf.ServiceOptions.
|
||||||
const (
|
const (
|
||||||
|
ServiceOptions_Features_field_name protoreflect.Name = "features"
|
||||||
ServiceOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
ServiceOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
||||||
ServiceOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
ServiceOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
|
ServiceOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.features"
|
||||||
ServiceOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.deprecated"
|
ServiceOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.deprecated"
|
||||||
ServiceOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.uninterpreted_option"
|
ServiceOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Field numbers for google.protobuf.ServiceOptions.
|
// Field numbers for google.protobuf.ServiceOptions.
|
||||||
const (
|
const (
|
||||||
|
ServiceOptions_Features_field_number protoreflect.FieldNumber = 34
|
||||||
ServiceOptions_Deprecated_field_number protoreflect.FieldNumber = 33
|
ServiceOptions_Deprecated_field_number protoreflect.FieldNumber = 33
|
||||||
ServiceOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
ServiceOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
@ -739,10 +879,12 @@ const (
|
||||||
const (
|
const (
|
||||||
MethodOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
MethodOptions_Deprecated_field_name protoreflect.Name = "deprecated"
|
||||||
MethodOptions_IdempotencyLevel_field_name protoreflect.Name = "idempotency_level"
|
MethodOptions_IdempotencyLevel_field_name protoreflect.Name = "idempotency_level"
|
||||||
|
MethodOptions_Features_field_name protoreflect.Name = "features"
|
||||||
MethodOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
MethodOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
|
||||||
|
|
||||||
MethodOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.deprecated"
|
MethodOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.deprecated"
|
||||||
MethodOptions_IdempotencyLevel_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.idempotency_level"
|
MethodOptions_IdempotencyLevel_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.idempotency_level"
|
||||||
|
MethodOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.features"
|
||||||
MethodOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.uninterpreted_option"
|
MethodOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.uninterpreted_option"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -750,6 +892,7 @@ const (
|
||||||
const (
|
const (
|
||||||
MethodOptions_Deprecated_field_number protoreflect.FieldNumber = 33
|
MethodOptions_Deprecated_field_number protoreflect.FieldNumber = 33
|
||||||
MethodOptions_IdempotencyLevel_field_number protoreflect.FieldNumber = 34
|
MethodOptions_IdempotencyLevel_field_number protoreflect.FieldNumber = 34
|
||||||
|
MethodOptions_Features_field_number protoreflect.FieldNumber = 35
|
||||||
MethodOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
MethodOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -759,6 +902,13 @@ const (
|
||||||
MethodOptions_IdempotencyLevel_enum_name = "IdempotencyLevel"
|
MethodOptions_IdempotencyLevel_enum_name = "IdempotencyLevel"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.MethodOptions.IdempotencyLevel.
|
||||||
|
const (
|
||||||
|
MethodOptions_IDEMPOTENCY_UNKNOWN_enum_value = 0
|
||||||
|
MethodOptions_NO_SIDE_EFFECTS_enum_value = 1
|
||||||
|
MethodOptions_IDEMPOTENT_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.UninterpretedOption.
|
// Names for google.protobuf.UninterpretedOption.
|
||||||
const (
|
const (
|
||||||
UninterpretedOption_message_name protoreflect.Name = "UninterpretedOption"
|
UninterpretedOption_message_name protoreflect.Name = "UninterpretedOption"
|
||||||
|
@ -816,6 +966,163 @@ const (
|
||||||
UninterpretedOption_NamePart_IsExtension_field_number protoreflect.FieldNumber = 2
|
UninterpretedOption_NamePart_IsExtension_field_number protoreflect.FieldNumber = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Names for google.protobuf.FeatureSet.
|
||||||
|
const (
|
||||||
|
FeatureSet_message_name protoreflect.Name = "FeatureSet"
|
||||||
|
FeatureSet_message_fullname protoreflect.FullName = "google.protobuf.FeatureSet"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field names for google.protobuf.FeatureSet.
|
||||||
|
const (
|
||||||
|
FeatureSet_FieldPresence_field_name protoreflect.Name = "field_presence"
|
||||||
|
FeatureSet_EnumType_field_name protoreflect.Name = "enum_type"
|
||||||
|
FeatureSet_RepeatedFieldEncoding_field_name protoreflect.Name = "repeated_field_encoding"
|
||||||
|
FeatureSet_Utf8Validation_field_name protoreflect.Name = "utf8_validation"
|
||||||
|
FeatureSet_MessageEncoding_field_name protoreflect.Name = "message_encoding"
|
||||||
|
FeatureSet_JsonFormat_field_name protoreflect.Name = "json_format"
|
||||||
|
|
||||||
|
FeatureSet_FieldPresence_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.field_presence"
|
||||||
|
FeatureSet_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enum_type"
|
||||||
|
FeatureSet_RepeatedFieldEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.repeated_field_encoding"
|
||||||
|
FeatureSet_Utf8Validation_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.utf8_validation"
|
||||||
|
FeatureSet_MessageEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.message_encoding"
|
||||||
|
FeatureSet_JsonFormat_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.json_format"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.FeatureSet.
|
||||||
|
const (
|
||||||
|
FeatureSet_FieldPresence_field_number protoreflect.FieldNumber = 1
|
||||||
|
FeatureSet_EnumType_field_number protoreflect.FieldNumber = 2
|
||||||
|
FeatureSet_RepeatedFieldEncoding_field_number protoreflect.FieldNumber = 3
|
||||||
|
FeatureSet_Utf8Validation_field_number protoreflect.FieldNumber = 4
|
||||||
|
FeatureSet_MessageEncoding_field_number protoreflect.FieldNumber = 5
|
||||||
|
FeatureSet_JsonFormat_field_number protoreflect.FieldNumber = 6
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.FeatureSet.FieldPresence.
|
||||||
|
const (
|
||||||
|
FeatureSet_FieldPresence_enum_fullname = "google.protobuf.FeatureSet.FieldPresence"
|
||||||
|
FeatureSet_FieldPresence_enum_name = "FieldPresence"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FeatureSet.FieldPresence.
|
||||||
|
const (
|
||||||
|
FeatureSet_FIELD_PRESENCE_UNKNOWN_enum_value = 0
|
||||||
|
FeatureSet_EXPLICIT_enum_value = 1
|
||||||
|
FeatureSet_IMPLICIT_enum_value = 2
|
||||||
|
FeatureSet_LEGACY_REQUIRED_enum_value = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.FeatureSet.EnumType.
|
||||||
|
const (
|
||||||
|
FeatureSet_EnumType_enum_fullname = "google.protobuf.FeatureSet.EnumType"
|
||||||
|
FeatureSet_EnumType_enum_name = "EnumType"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FeatureSet.EnumType.
|
||||||
|
const (
|
||||||
|
FeatureSet_ENUM_TYPE_UNKNOWN_enum_value = 0
|
||||||
|
FeatureSet_OPEN_enum_value = 1
|
||||||
|
FeatureSet_CLOSED_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.FeatureSet.RepeatedFieldEncoding.
|
||||||
|
const (
|
||||||
|
FeatureSet_RepeatedFieldEncoding_enum_fullname = "google.protobuf.FeatureSet.RepeatedFieldEncoding"
|
||||||
|
FeatureSet_RepeatedFieldEncoding_enum_name = "RepeatedFieldEncoding"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FeatureSet.RepeatedFieldEncoding.
|
||||||
|
const (
|
||||||
|
FeatureSet_REPEATED_FIELD_ENCODING_UNKNOWN_enum_value = 0
|
||||||
|
FeatureSet_PACKED_enum_value = 1
|
||||||
|
FeatureSet_EXPANDED_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.FeatureSet.Utf8Validation.
|
||||||
|
const (
|
||||||
|
FeatureSet_Utf8Validation_enum_fullname = "google.protobuf.FeatureSet.Utf8Validation"
|
||||||
|
FeatureSet_Utf8Validation_enum_name = "Utf8Validation"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FeatureSet.Utf8Validation.
|
||||||
|
const (
|
||||||
|
FeatureSet_UTF8_VALIDATION_UNKNOWN_enum_value = 0
|
||||||
|
FeatureSet_VERIFY_enum_value = 2
|
||||||
|
FeatureSet_NONE_enum_value = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.FeatureSet.MessageEncoding.
|
||||||
|
const (
|
||||||
|
FeatureSet_MessageEncoding_enum_fullname = "google.protobuf.FeatureSet.MessageEncoding"
|
||||||
|
FeatureSet_MessageEncoding_enum_name = "MessageEncoding"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FeatureSet.MessageEncoding.
|
||||||
|
const (
|
||||||
|
FeatureSet_MESSAGE_ENCODING_UNKNOWN_enum_value = 0
|
||||||
|
FeatureSet_LENGTH_PREFIXED_enum_value = 1
|
||||||
|
FeatureSet_DELIMITED_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// Full and short names for google.protobuf.FeatureSet.JsonFormat.
|
||||||
|
const (
|
||||||
|
FeatureSet_JsonFormat_enum_fullname = "google.protobuf.FeatureSet.JsonFormat"
|
||||||
|
FeatureSet_JsonFormat_enum_name = "JsonFormat"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.FeatureSet.JsonFormat.
|
||||||
|
const (
|
||||||
|
FeatureSet_JSON_FORMAT_UNKNOWN_enum_value = 0
|
||||||
|
FeatureSet_ALLOW_enum_value = 1
|
||||||
|
FeatureSet_LEGACY_BEST_EFFORT_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// Names for google.protobuf.FeatureSetDefaults.
|
||||||
|
const (
|
||||||
|
FeatureSetDefaults_message_name protoreflect.Name = "FeatureSetDefaults"
|
||||||
|
FeatureSetDefaults_message_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field names for google.protobuf.FeatureSetDefaults.
|
||||||
|
const (
|
||||||
|
FeatureSetDefaults_Defaults_field_name protoreflect.Name = "defaults"
|
||||||
|
FeatureSetDefaults_MinimumEdition_field_name protoreflect.Name = "minimum_edition"
|
||||||
|
FeatureSetDefaults_MaximumEdition_field_name protoreflect.Name = "maximum_edition"
|
||||||
|
|
||||||
|
FeatureSetDefaults_Defaults_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.defaults"
|
||||||
|
FeatureSetDefaults_MinimumEdition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.minimum_edition"
|
||||||
|
FeatureSetDefaults_MaximumEdition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.maximum_edition"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.FeatureSetDefaults.
|
||||||
|
const (
|
||||||
|
FeatureSetDefaults_Defaults_field_number protoreflect.FieldNumber = 1
|
||||||
|
FeatureSetDefaults_MinimumEdition_field_number protoreflect.FieldNumber = 4
|
||||||
|
FeatureSetDefaults_MaximumEdition_field_number protoreflect.FieldNumber = 5
|
||||||
|
)
|
||||||
|
|
||||||
|
// Names for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.
|
||||||
|
const (
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_message_name protoreflect.Name = "FeatureSetEditionDefault"
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_message_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field names for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.
|
||||||
|
const (
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_name protoreflect.Name = "edition"
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_Features_field_name protoreflect.Name = "features"
|
||||||
|
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition"
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_Features_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.
|
||||||
|
const (
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_number protoreflect.FieldNumber = 3
|
||||||
|
FeatureSetDefaults_FeatureSetEditionDefault_Features_field_number protoreflect.FieldNumber = 2
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.SourceCodeInfo.
|
// Names for google.protobuf.SourceCodeInfo.
|
||||||
const (
|
const (
|
||||||
SourceCodeInfo_message_name protoreflect.Name = "SourceCodeInfo"
|
SourceCodeInfo_message_name protoreflect.Name = "SourceCodeInfo"
|
||||||
|
@ -917,3 +1224,10 @@ const (
|
||||||
GeneratedCodeInfo_Annotation_Semantic_enum_fullname = "google.protobuf.GeneratedCodeInfo.Annotation.Semantic"
|
GeneratedCodeInfo_Annotation_Semantic_enum_fullname = "google.protobuf.GeneratedCodeInfo.Annotation.Semantic"
|
||||||
GeneratedCodeInfo_Annotation_Semantic_enum_name = "Semantic"
|
GeneratedCodeInfo_Annotation_Semantic_enum_name = "Semantic"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.GeneratedCodeInfo.Annotation.Semantic.
|
||||||
|
const (
|
||||||
|
GeneratedCodeInfo_Annotation_NONE_enum_value = 0
|
||||||
|
GeneratedCodeInfo_Annotation_SET_enum_value = 1
|
||||||
|
GeneratedCodeInfo_Annotation_ALIAS_enum_value = 2
|
||||||
|
)
|
||||||
|
|
31
vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go
generated
vendored
Normal file
31
vendor/google.golang.org/protobuf/internal/genid/go_features_gen.go
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Code generated by generate-protos. DO NOT EDIT.
|
||||||
|
|
||||||
|
package genid
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
const File_reflect_protodesc_proto_go_features_proto = "reflect/protodesc/proto/go_features.proto"
|
||||||
|
|
||||||
|
// Names for google.protobuf.GoFeatures.
|
||||||
|
const (
|
||||||
|
GoFeatures_message_name protoreflect.Name = "GoFeatures"
|
||||||
|
GoFeatures_message_fullname protoreflect.FullName = "google.protobuf.GoFeatures"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field names for google.protobuf.GoFeatures.
|
||||||
|
const (
|
||||||
|
GoFeatures_LegacyUnmarshalJsonEnum_field_name protoreflect.Name = "legacy_unmarshal_json_enum"
|
||||||
|
|
||||||
|
GoFeatures_LegacyUnmarshalJsonEnum_field_fullname protoreflect.FullName = "google.protobuf.GoFeatures.legacy_unmarshal_json_enum"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Field numbers for google.protobuf.GoFeatures.
|
||||||
|
const (
|
||||||
|
GoFeatures_LegacyUnmarshalJsonEnum_field_number protoreflect.FieldNumber = 1
|
||||||
|
)
|
|
@ -18,6 +18,11 @@ const (
|
||||||
NullValue_enum_name = "NullValue"
|
NullValue_enum_name = "NullValue"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.NullValue.
|
||||||
|
const (
|
||||||
|
NullValue_NULL_VALUE_enum_value = 0
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.Struct.
|
// Names for google.protobuf.Struct.
|
||||||
const (
|
const (
|
||||||
Struct_message_name protoreflect.Name = "Struct"
|
Struct_message_name protoreflect.Name = "Struct"
|
||||||
|
|
|
@ -18,6 +18,13 @@ const (
|
||||||
Syntax_enum_name = "Syntax"
|
Syntax_enum_name = "Syntax"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.Syntax.
|
||||||
|
const (
|
||||||
|
Syntax_SYNTAX_PROTO2_enum_value = 0
|
||||||
|
Syntax_SYNTAX_PROTO3_enum_value = 1
|
||||||
|
Syntax_SYNTAX_EDITIONS_enum_value = 2
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.Type.
|
// Names for google.protobuf.Type.
|
||||||
const (
|
const (
|
||||||
Type_message_name protoreflect.Name = "Type"
|
Type_message_name protoreflect.Name = "Type"
|
||||||
|
@ -105,12 +112,43 @@ const (
|
||||||
Field_Kind_enum_name = "Kind"
|
Field_Kind_enum_name = "Kind"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.Field.Kind.
|
||||||
|
const (
|
||||||
|
Field_TYPE_UNKNOWN_enum_value = 0
|
||||||
|
Field_TYPE_DOUBLE_enum_value = 1
|
||||||
|
Field_TYPE_FLOAT_enum_value = 2
|
||||||
|
Field_TYPE_INT64_enum_value = 3
|
||||||
|
Field_TYPE_UINT64_enum_value = 4
|
||||||
|
Field_TYPE_INT32_enum_value = 5
|
||||||
|
Field_TYPE_FIXED64_enum_value = 6
|
||||||
|
Field_TYPE_FIXED32_enum_value = 7
|
||||||
|
Field_TYPE_BOOL_enum_value = 8
|
||||||
|
Field_TYPE_STRING_enum_value = 9
|
||||||
|
Field_TYPE_GROUP_enum_value = 10
|
||||||
|
Field_TYPE_MESSAGE_enum_value = 11
|
||||||
|
Field_TYPE_BYTES_enum_value = 12
|
||||||
|
Field_TYPE_UINT32_enum_value = 13
|
||||||
|
Field_TYPE_ENUM_enum_value = 14
|
||||||
|
Field_TYPE_SFIXED32_enum_value = 15
|
||||||
|
Field_TYPE_SFIXED64_enum_value = 16
|
||||||
|
Field_TYPE_SINT32_enum_value = 17
|
||||||
|
Field_TYPE_SINT64_enum_value = 18
|
||||||
|
)
|
||||||
|
|
||||||
// Full and short names for google.protobuf.Field.Cardinality.
|
// Full and short names for google.protobuf.Field.Cardinality.
|
||||||
const (
|
const (
|
||||||
Field_Cardinality_enum_fullname = "google.protobuf.Field.Cardinality"
|
Field_Cardinality_enum_fullname = "google.protobuf.Field.Cardinality"
|
||||||
Field_Cardinality_enum_name = "Cardinality"
|
Field_Cardinality_enum_name = "Cardinality"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Enum values for google.protobuf.Field.Cardinality.
|
||||||
|
const (
|
||||||
|
Field_CARDINALITY_UNKNOWN_enum_value = 0
|
||||||
|
Field_CARDINALITY_OPTIONAL_enum_value = 1
|
||||||
|
Field_CARDINALITY_REQUIRED_enum_value = 2
|
||||||
|
Field_CARDINALITY_REPEATED_enum_value = 3
|
||||||
|
)
|
||||||
|
|
||||||
// Names for google.protobuf.Enum.
|
// Names for google.protobuf.Enum.
|
||||||
const (
|
const (
|
||||||
Enum_message_name protoreflect.Name = "Enum"
|
Enum_message_name protoreflect.Name = "Enum"
|
||||||
|
|
|
@ -21,26 +21,18 @@ type extensionFieldInfo struct {
|
||||||
validation validationInfo
|
validation validationInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
var legacyExtensionFieldInfoCache sync.Map // map[protoreflect.ExtensionType]*extensionFieldInfo
|
|
||||||
|
|
||||||
func getExtensionFieldInfo(xt protoreflect.ExtensionType) *extensionFieldInfo {
|
func getExtensionFieldInfo(xt protoreflect.ExtensionType) *extensionFieldInfo {
|
||||||
if xi, ok := xt.(*ExtensionInfo); ok {
|
if xi, ok := xt.(*ExtensionInfo); ok {
|
||||||
xi.lazyInit()
|
xi.lazyInit()
|
||||||
return xi.info
|
return xi.info
|
||||||
}
|
}
|
||||||
return legacyLoadExtensionFieldInfo(xt)
|
// Ideally we'd cache the resulting *extensionFieldInfo so we don't have to
|
||||||
}
|
// recompute this metadata repeatedly. But without support for something like
|
||||||
|
// weak references, such a cache would pin temporary values (like dynamic
|
||||||
// legacyLoadExtensionFieldInfo dynamically loads a *ExtensionInfo for xt.
|
// extension types, constructed for the duration of a user request) to the
|
||||||
func legacyLoadExtensionFieldInfo(xt protoreflect.ExtensionType) *extensionFieldInfo {
|
// heap forever, causing memory usage of the cache to grow unbounded.
|
||||||
if xi, ok := legacyExtensionFieldInfoCache.Load(xt); ok {
|
// See discussion in https://github.com/golang/protobuf/issues/1521.
|
||||||
return xi.(*extensionFieldInfo)
|
return makeExtensionFieldInfo(xt.TypeDescriptor())
|
||||||
}
|
|
||||||
e := makeExtensionFieldInfo(xt.TypeDescriptor())
|
|
||||||
if e, ok := legacyMessageTypeCache.LoadOrStore(xt, e); ok {
|
|
||||||
return e.(*extensionFieldInfo)
|
|
||||||
}
|
|
||||||
return e
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeExtensionFieldInfo(xd protoreflect.ExtensionDescriptor) *extensionFieldInfo {
|
func makeExtensionFieldInfo(xd protoreflect.ExtensionDescriptor) *extensionFieldInfo {
|
||||||
|
|
|
@ -162,11 +162,20 @@ func appendBoolSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions
|
||||||
func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.BoolSlice()
|
sp := p.BoolSlice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := 0
|
||||||
|
for _, v := range b {
|
||||||
|
if v < 0x80 {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count > 0 {
|
||||||
|
p.growBoolSlice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
var v uint64
|
var v uint64
|
||||||
var n int
|
var n int
|
||||||
|
@ -732,11 +741,20 @@ func appendInt32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOption
|
||||||
func consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Int32Slice()
|
sp := p.Int32Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := 0
|
||||||
|
for _, v := range b {
|
||||||
|
if v < 0x80 {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count > 0 {
|
||||||
|
p.growInt32Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
var v uint64
|
var v uint64
|
||||||
var n int
|
var n int
|
||||||
|
@ -1138,11 +1156,20 @@ func appendSint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio
|
||||||
func consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Int32Slice()
|
sp := p.Int32Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := 0
|
||||||
|
for _, v := range b {
|
||||||
|
if v < 0x80 {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count > 0 {
|
||||||
|
p.growInt32Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
var v uint64
|
var v uint64
|
||||||
var n int
|
var n int
|
||||||
|
@ -1544,11 +1571,20 @@ func appendUint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio
|
||||||
func consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Uint32Slice()
|
sp := p.Uint32Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := 0
|
||||||
|
for _, v := range b {
|
||||||
|
if v < 0x80 {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count > 0 {
|
||||||
|
p.growUint32Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
var v uint64
|
var v uint64
|
||||||
var n int
|
var n int
|
||||||
|
@ -1950,11 +1986,20 @@ func appendInt64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOption
|
||||||
func consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Int64Slice()
|
sp := p.Int64Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := 0
|
||||||
|
for _, v := range b {
|
||||||
|
if v < 0x80 {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count > 0 {
|
||||||
|
p.growInt64Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
var v uint64
|
var v uint64
|
||||||
var n int
|
var n int
|
||||||
|
@ -2356,11 +2401,20 @@ func appendSint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio
|
||||||
func consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Int64Slice()
|
sp := p.Int64Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := 0
|
||||||
|
for _, v := range b {
|
||||||
|
if v < 0x80 {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count > 0 {
|
||||||
|
p.growInt64Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
var v uint64
|
var v uint64
|
||||||
var n int
|
var n int
|
||||||
|
@ -2762,11 +2816,20 @@ func appendUint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio
|
||||||
func consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Uint64Slice()
|
sp := p.Uint64Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := 0
|
||||||
|
for _, v := range b {
|
||||||
|
if v < 0x80 {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if count > 0 {
|
||||||
|
p.growUint64Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
var v uint64
|
var v uint64
|
||||||
var n int
|
var n int
|
||||||
|
@ -3145,11 +3208,15 @@ func appendSfixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOpt
|
||||||
func consumeSfixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeSfixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Int32Slice()
|
sp := p.Int32Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := len(b) / protowire.SizeFixed32()
|
||||||
|
if count > 0 {
|
||||||
|
p.growInt32Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
v, n := protowire.ConsumeFixed32(b)
|
v, n := protowire.ConsumeFixed32(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
@ -3461,11 +3528,15 @@ func appendFixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOpti
|
||||||
func consumeFixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeFixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Uint32Slice()
|
sp := p.Uint32Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := len(b) / protowire.SizeFixed32()
|
||||||
|
if count > 0 {
|
||||||
|
p.growUint32Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
v, n := protowire.ConsumeFixed32(b)
|
v, n := protowire.ConsumeFixed32(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
@ -3777,11 +3848,15 @@ func appendFloatSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOption
|
||||||
func consumeFloatSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeFloatSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Float32Slice()
|
sp := p.Float32Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := len(b) / protowire.SizeFixed32()
|
||||||
|
if count > 0 {
|
||||||
|
p.growFloat32Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
v, n := protowire.ConsumeFixed32(b)
|
v, n := protowire.ConsumeFixed32(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
@ -4093,11 +4168,15 @@ func appendSfixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOpt
|
||||||
func consumeSfixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeSfixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Int64Slice()
|
sp := p.Int64Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := len(b) / protowire.SizeFixed64()
|
||||||
|
if count > 0 {
|
||||||
|
p.growInt64Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
v, n := protowire.ConsumeFixed64(b)
|
v, n := protowire.ConsumeFixed64(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
@ -4409,11 +4488,15 @@ func appendFixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOpti
|
||||||
func consumeFixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeFixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Uint64Slice()
|
sp := p.Uint64Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := len(b) / protowire.SizeFixed64()
|
||||||
|
if count > 0 {
|
||||||
|
p.growUint64Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
v, n := protowire.ConsumeFixed64(b)
|
v, n := protowire.ConsumeFixed64(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
@ -4725,11 +4808,15 @@ func appendDoubleSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptio
|
||||||
func consumeDoubleSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
func consumeDoubleSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
|
||||||
sp := p.Float64Slice()
|
sp := p.Float64Slice()
|
||||||
if wtyp == protowire.BytesType {
|
if wtyp == protowire.BytesType {
|
||||||
s := *sp
|
|
||||||
b, n := protowire.ConsumeBytes(b)
|
b, n := protowire.ConsumeBytes(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
return out, errDecode
|
return out, errDecode
|
||||||
}
|
}
|
||||||
|
count := len(b) / protowire.SizeFixed64()
|
||||||
|
if count > 0 {
|
||||||
|
p.growFloat64Slice(count)
|
||||||
|
}
|
||||||
|
s := *sp
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
v, n := protowire.ConsumeFixed64(b)
|
v, n := protowire.ConsumeFixed64(b)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
|
|
@ -197,7 +197,7 @@ func fieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) (*MessageInfo,
|
||||||
return getMessageInfo(ft), makeMessageFieldCoder(fd, ft)
|
return getMessageInfo(ft), makeMessageFieldCoder(fd, ft)
|
||||||
case fd.Kind() == protoreflect.GroupKind:
|
case fd.Kind() == protoreflect.GroupKind:
|
||||||
return getMessageInfo(ft), makeGroupFieldCoder(fd, ft)
|
return getMessageInfo(ft), makeGroupFieldCoder(fd, ft)
|
||||||
case fd.Syntax() == protoreflect.Proto3 && fd.ContainingOneof() == nil:
|
case !fd.HasPresence() && fd.ContainingOneof() == nil:
|
||||||
// Populated oneof fields always encode even if set to the zero value,
|
// Populated oneof fields always encode even if set to the zero value,
|
||||||
// which normally are not encoded in proto3.
|
// which normally are not encoded in proto3.
|
||||||
switch fd.Kind() {
|
switch fd.Kind() {
|
||||||
|
|
|
@ -206,13 +206,18 @@ func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName
|
||||||
|
|
||||||
// Obtain a list of oneof wrapper types.
|
// Obtain a list of oneof wrapper types.
|
||||||
var oneofWrappers []reflect.Type
|
var oneofWrappers []reflect.Type
|
||||||
for _, method := range []string{"XXX_OneofFuncs", "XXX_OneofWrappers"} {
|
methods := make([]reflect.Method, 0, 2)
|
||||||
if fn, ok := t.MethodByName(method); ok {
|
if m, ok := t.MethodByName("XXX_OneofFuncs"); ok {
|
||||||
for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {
|
methods = append(methods, m)
|
||||||
if vs, ok := v.Interface().([]interface{}); ok {
|
}
|
||||||
for _, v := range vs {
|
if m, ok := t.MethodByName("XXX_OneofWrappers"); ok {
|
||||||
oneofWrappers = append(oneofWrappers, reflect.TypeOf(v))
|
methods = append(methods, m)
|
||||||
}
|
}
|
||||||
|
for _, fn := range methods {
|
||||||
|
for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {
|
||||||
|
if vs, ok := v.Interface().([]interface{}); ok {
|
||||||
|
for _, v := range vs {
|
||||||
|
oneofWrappers = append(oneofWrappers, reflect.TypeOf(v))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,12 +192,17 @@ fieldLoop:
|
||||||
|
|
||||||
// Derive a mapping of oneof wrappers to fields.
|
// Derive a mapping of oneof wrappers to fields.
|
||||||
oneofWrappers := mi.OneofWrappers
|
oneofWrappers := mi.OneofWrappers
|
||||||
for _, method := range []string{"XXX_OneofFuncs", "XXX_OneofWrappers"} {
|
methods := make([]reflect.Method, 0, 2)
|
||||||
if fn, ok := reflect.PtrTo(t).MethodByName(method); ok {
|
if m, ok := reflect.PtrTo(t).MethodByName("XXX_OneofFuncs"); ok {
|
||||||
for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {
|
methods = append(methods, m)
|
||||||
if vs, ok := v.Interface().([]interface{}); ok {
|
}
|
||||||
oneofWrappers = vs
|
if m, ok := reflect.PtrTo(t).MethodByName("XXX_OneofWrappers"); ok {
|
||||||
}
|
methods = append(methods, m)
|
||||||
|
}
|
||||||
|
for _, fn := range methods {
|
||||||
|
for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {
|
||||||
|
if vs, ok := v.Interface().([]interface{}); ok {
|
||||||
|
oneofWrappers = vs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -538,6 +538,6 @@ func isZero(v reflect.Value) bool {
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
panic(&reflect.ValueError{"reflect.Value.IsZero", v.Kind()})
|
panic(&reflect.ValueError{Method: "reflect.Value.IsZero", Kind: v.Kind()})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,6 +159,42 @@ func (p pointer) SetPointer(v pointer) {
|
||||||
p.v.Elem().Set(v.v)
|
p.v.Elem().Set(v.v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func growSlice(p pointer, addCap int) {
|
||||||
|
// TODO: Once we only support Go 1.20 and newer, use reflect.Grow.
|
||||||
|
in := p.v.Elem()
|
||||||
|
out := reflect.MakeSlice(in.Type(), in.Len(), in.Len()+addCap)
|
||||||
|
reflect.Copy(out, in)
|
||||||
|
p.v.Elem().Set(out)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growBoolSlice(addCap int) {
|
||||||
|
growSlice(p, addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growInt32Slice(addCap int) {
|
||||||
|
growSlice(p, addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growUint32Slice(addCap int) {
|
||||||
|
growSlice(p, addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growInt64Slice(addCap int) {
|
||||||
|
growSlice(p, addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growUint64Slice(addCap int) {
|
||||||
|
growSlice(p, addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growFloat64Slice(addCap int) {
|
||||||
|
growSlice(p, addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growFloat32Slice(addCap int) {
|
||||||
|
growSlice(p, addCap)
|
||||||
|
}
|
||||||
|
|
||||||
func (Export) MessageStateOf(p Pointer) *messageState { panic("not supported") }
|
func (Export) MessageStateOf(p Pointer) *messageState { panic("not supported") }
|
||||||
func (ms *messageState) pointer() pointer { panic("not supported") }
|
func (ms *messageState) pointer() pointer { panic("not supported") }
|
||||||
func (ms *messageState) messageInfo() *MessageInfo { panic("not supported") }
|
func (ms *messageState) messageInfo() *MessageInfo { panic("not supported") }
|
||||||
|
|
|
@ -138,6 +138,46 @@ func (p pointer) SetPointer(v pointer) {
|
||||||
*(*unsafe.Pointer)(p.p) = (unsafe.Pointer)(v.p)
|
*(*unsafe.Pointer)(p.p) = (unsafe.Pointer)(v.p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p pointer) growBoolSlice(addCap int) {
|
||||||
|
sp := p.BoolSlice()
|
||||||
|
s := make([]bool, 0, addCap+len(*sp))
|
||||||
|
s = s[:len(*sp)]
|
||||||
|
copy(s, *sp)
|
||||||
|
*sp = s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growInt32Slice(addCap int) {
|
||||||
|
sp := p.Int32Slice()
|
||||||
|
s := make([]int32, 0, addCap+len(*sp))
|
||||||
|
s = s[:len(*sp)]
|
||||||
|
copy(s, *sp)
|
||||||
|
*sp = s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growUint32Slice(addCap int) {
|
||||||
|
p.growInt32Slice(addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growFloat32Slice(addCap int) {
|
||||||
|
p.growInt32Slice(addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growInt64Slice(addCap int) {
|
||||||
|
sp := p.Int64Slice()
|
||||||
|
s := make([]int64, 0, addCap+len(*sp))
|
||||||
|
s = s[:len(*sp)]
|
||||||
|
copy(s, *sp)
|
||||||
|
*sp = s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growUint64Slice(addCap int) {
|
||||||
|
p.growInt64Slice(addCap)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p pointer) growFloat64Slice(addCap int) {
|
||||||
|
p.growInt64Slice(addCap)
|
||||||
|
}
|
||||||
|
|
||||||
// Static check that MessageState does not exceed the size of a pointer.
|
// Static check that MessageState does not exceed the size of a pointer.
|
||||||
const _ = uint(unsafe.Sizeof(unsafe.Pointer(nil)) - unsafe.Sizeof(MessageState{}))
|
const _ = uint(unsafe.Sizeof(unsafe.Pointer(nil)) - unsafe.Sizeof(MessageState{}))
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import (
|
||||||
|
|
||||||
// EnforceUTF8 reports whether to enforce strict UTF-8 validation.
|
// EnforceUTF8 reports whether to enforce strict UTF-8 validation.
|
||||||
func EnforceUTF8(fd protoreflect.FieldDescriptor) bool {
|
func EnforceUTF8(fd protoreflect.FieldDescriptor) bool {
|
||||||
if flags.ProtoLegacy {
|
if flags.ProtoLegacy || fd.Syntax() == protoreflect.Editions {
|
||||||
if fd, ok := fd.(interface{ EnforceUTF8() bool }); ok {
|
if fd, ok := fd.(interface{ EnforceUTF8() bool }); ok {
|
||||||
return fd.EnforceUTF8()
|
return fd.EnforceUTF8()
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build !purego && !appengine
|
//go:build !purego && !appengine && !go1.21
|
||||||
// +build !purego,!appengine
|
// +build !purego,!appengine,!go1.21
|
||||||
|
|
||||||
package strs
|
package strs
|
||||||
|
|
74
vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go
generated
vendored
Normal file
74
vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go
generated
vendored
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !purego && !appengine && go1.21
|
||||||
|
// +build !purego,!appengine,go1.21
|
||||||
|
|
||||||
|
package strs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UnsafeString returns an unsafe string reference of b.
|
||||||
|
// The caller must treat the input slice as immutable.
|
||||||
|
//
|
||||||
|
// WARNING: Use carefully. The returned result must not leak to the end user
|
||||||
|
// unless the input slice is provably immutable.
|
||||||
|
func UnsafeString(b []byte) string {
|
||||||
|
return unsafe.String(unsafe.SliceData(b), len(b))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnsafeBytes returns an unsafe bytes slice reference of s.
|
||||||
|
// The caller must treat returned slice as immutable.
|
||||||
|
//
|
||||||
|
// WARNING: Use carefully. The returned result must not leak to the end user.
|
||||||
|
func UnsafeBytes(s string) []byte {
|
||||||
|
return unsafe.Slice(unsafe.StringData(s), len(s))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Builder builds a set of strings with shared lifetime.
|
||||||
|
// This differs from strings.Builder, which is for building a single string.
|
||||||
|
type Builder struct {
|
||||||
|
buf []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
// AppendFullName is equivalent to protoreflect.FullName.Append,
|
||||||
|
// but optimized for large batches where each name has a shared lifetime.
|
||||||
|
func (sb *Builder) AppendFullName(prefix protoreflect.FullName, name protoreflect.Name) protoreflect.FullName {
|
||||||
|
n := len(prefix) + len(".") + len(name)
|
||||||
|
if len(prefix) == 0 {
|
||||||
|
n -= len(".")
|
||||||
|
}
|
||||||
|
sb.grow(n)
|
||||||
|
sb.buf = append(sb.buf, prefix...)
|
||||||
|
sb.buf = append(sb.buf, '.')
|
||||||
|
sb.buf = append(sb.buf, name...)
|
||||||
|
return protoreflect.FullName(sb.last(n))
|
||||||
|
}
|
||||||
|
|
||||||
|
// MakeString is equivalent to string(b), but optimized for large batches
|
||||||
|
// with a shared lifetime.
|
||||||
|
func (sb *Builder) MakeString(b []byte) string {
|
||||||
|
sb.grow(len(b))
|
||||||
|
sb.buf = append(sb.buf, b...)
|
||||||
|
return sb.last(len(b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sb *Builder) grow(n int) {
|
||||||
|
if cap(sb.buf)-len(sb.buf) >= n {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unlike strings.Builder, we do not need to copy over the contents
|
||||||
|
// of the old buffer since our builder provides no API for
|
||||||
|
// retrieving previously created strings.
|
||||||
|
sb.buf = make([]byte, 0, 2*(cap(sb.buf)+n))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sb *Builder) last(n int) string {
|
||||||
|
return UnsafeString(sb.buf[len(sb.buf)-n:])
|
||||||
|
}
|
|
@ -51,7 +51,7 @@ import (
|
||||||
// 10. Send out the CL for review and submit it.
|
// 10. Send out the CL for review and submit it.
|
||||||
const (
|
const (
|
||||||
Major = 1
|
Major = 1
|
||||||
Minor = 31
|
Minor = 33
|
||||||
Patch = 0
|
Patch = 0
|
||||||
PreRelease = ""
|
PreRelease = ""
|
||||||
)
|
)
|
||||||
|
|
|
@ -69,7 +69,7 @@ func (o UnmarshalOptions) Unmarshal(b []byte, m Message) error {
|
||||||
// UnmarshalState parses a wire-format message and places the result in m.
|
// UnmarshalState parses a wire-format message and places the result in m.
|
||||||
//
|
//
|
||||||
// This method permits fine-grained control over the unmarshaler.
|
// This method permits fine-grained control over the unmarshaler.
|
||||||
// Most users should use Unmarshal instead.
|
// Most users should use [Unmarshal] instead.
|
||||||
func (o UnmarshalOptions) UnmarshalState(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
func (o UnmarshalOptions) UnmarshalState(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||||
if o.RecursionLimit == 0 {
|
if o.RecursionLimit == 0 {
|
||||||
o.RecursionLimit = protowire.DefaultRecursionLimit
|
o.RecursionLimit = protowire.DefaultRecursionLimit
|
||||||
|
|
|
@ -18,27 +18,27 @@
|
||||||
// This package contains functions to convert to and from the wire format,
|
// This package contains functions to convert to and from the wire format,
|
||||||
// an efficient binary serialization of protocol buffers.
|
// an efficient binary serialization of protocol buffers.
|
||||||
//
|
//
|
||||||
// • Size reports the size of a message in the wire format.
|
// - [Size] reports the size of a message in the wire format.
|
||||||
//
|
//
|
||||||
// • Marshal converts a message to the wire format.
|
// - [Marshal] converts a message to the wire format.
|
||||||
// The MarshalOptions type provides more control over wire marshaling.
|
// The [MarshalOptions] type provides more control over wire marshaling.
|
||||||
//
|
//
|
||||||
// • Unmarshal converts a message from the wire format.
|
// - [Unmarshal] converts a message from the wire format.
|
||||||
// The UnmarshalOptions type provides more control over wire unmarshaling.
|
// The [UnmarshalOptions] type provides more control over wire unmarshaling.
|
||||||
//
|
//
|
||||||
// # Basic message operations
|
// # Basic message operations
|
||||||
//
|
//
|
||||||
// • Clone makes a deep copy of a message.
|
// - [Clone] makes a deep copy of a message.
|
||||||
//
|
//
|
||||||
// • Merge merges the content of a message into another.
|
// - [Merge] merges the content of a message into another.
|
||||||
//
|
//
|
||||||
// • Equal compares two messages. For more control over comparisons
|
// - [Equal] compares two messages. For more control over comparisons
|
||||||
// and detailed reporting of differences, see package
|
// and detailed reporting of differences, see package
|
||||||
// "google.golang.org/protobuf/testing/protocmp".
|
// [google.golang.org/protobuf/testing/protocmp].
|
||||||
//
|
//
|
||||||
// • Reset clears the content of a message.
|
// - [Reset] clears the content of a message.
|
||||||
//
|
//
|
||||||
// • CheckInitialized reports whether all required fields in a message are set.
|
// - [CheckInitialized] reports whether all required fields in a message are set.
|
||||||
//
|
//
|
||||||
// # Optional scalar constructors
|
// # Optional scalar constructors
|
||||||
//
|
//
|
||||||
|
@ -46,9 +46,9 @@
|
||||||
// as pointers to a value. For example, an optional string field has the
|
// as pointers to a value. For example, an optional string field has the
|
||||||
// Go type *string.
|
// Go type *string.
|
||||||
//
|
//
|
||||||
// • Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, and String
|
// - [Bool], [Int32], [Int64], [Uint32], [Uint64], [Float32], [Float64], and [String]
|
||||||
// take a value and return a pointer to a new instance of it,
|
// take a value and return a pointer to a new instance of it,
|
||||||
// to simplify construction of optional field values.
|
// to simplify construction of optional field values.
|
||||||
//
|
//
|
||||||
// Generated enum types usually have an Enum method which performs the
|
// Generated enum types usually have an Enum method which performs the
|
||||||
// same operation.
|
// same operation.
|
||||||
|
@ -57,29 +57,29 @@
|
||||||
//
|
//
|
||||||
// # Extension accessors
|
// # Extension accessors
|
||||||
//
|
//
|
||||||
// • HasExtension, GetExtension, SetExtension, and ClearExtension
|
// - [HasExtension], [GetExtension], [SetExtension], and [ClearExtension]
|
||||||
// access extension field values in a protocol buffer message.
|
// access extension field values in a protocol buffer message.
|
||||||
//
|
//
|
||||||
// Extension fields are only supported in proto2.
|
// Extension fields are only supported in proto2.
|
||||||
//
|
//
|
||||||
// # Related packages
|
// # Related packages
|
||||||
//
|
//
|
||||||
// • Package "google.golang.org/protobuf/encoding/protojson" converts messages to
|
// - Package [google.golang.org/protobuf/encoding/protojson] converts messages to
|
||||||
// and from JSON.
|
// and from JSON.
|
||||||
//
|
//
|
||||||
// • Package "google.golang.org/protobuf/encoding/prototext" converts messages to
|
// - Package [google.golang.org/protobuf/encoding/prototext] converts messages to
|
||||||
// and from the text format.
|
// and from the text format.
|
||||||
//
|
//
|
||||||
// • Package "google.golang.org/protobuf/reflect/protoreflect" provides a
|
// - Package [google.golang.org/protobuf/reflect/protoreflect] provides a
|
||||||
// reflection interface for protocol buffer data types.
|
// reflection interface for protocol buffer data types.
|
||||||
//
|
//
|
||||||
// • Package "google.golang.org/protobuf/testing/protocmp" provides features
|
// - Package [google.golang.org/protobuf/testing/protocmp] provides features
|
||||||
// to compare protocol buffer messages with the "github.com/google/go-cmp/cmp"
|
// to compare protocol buffer messages with the [github.com/google/go-cmp/cmp]
|
||||||
// package.
|
// package.
|
||||||
//
|
//
|
||||||
// • Package "google.golang.org/protobuf/types/dynamicpb" provides a dynamic
|
// - Package [google.golang.org/protobuf/types/dynamicpb] provides a dynamic
|
||||||
// message type, suitable for working with messages where the protocol buffer
|
// message type, suitable for working with messages where the protocol buffer
|
||||||
// type is only known at runtime.
|
// type is only known at runtime.
|
||||||
//
|
//
|
||||||
// This module contains additional packages for more specialized use cases.
|
// This module contains additional packages for more specialized use cases.
|
||||||
// Consult the individual package documentation for details.
|
// Consult the individual package documentation for details.
|
||||||
|
|
|
@ -129,7 +129,7 @@ func (o MarshalOptions) MarshalAppend(b []byte, m Message) ([]byte, error) {
|
||||||
// MarshalState returns the wire-format encoding of a message.
|
// MarshalState returns the wire-format encoding of a message.
|
||||||
//
|
//
|
||||||
// This method permits fine-grained control over the marshaler.
|
// This method permits fine-grained control over the marshaler.
|
||||||
// Most users should use Marshal instead.
|
// Most users should use [Marshal] instead.
|
||||||
func (o MarshalOptions) MarshalState(in protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
func (o MarshalOptions) MarshalState(in protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
||||||
return o.marshal(in.Buf, in.Message)
|
return o.marshal(in.Buf, in.Message)
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ func HasExtension(m Message, xt protoreflect.ExtensionType) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearExtension clears an extension field such that subsequent
|
// ClearExtension clears an extension field such that subsequent
|
||||||
// HasExtension calls return false.
|
// [HasExtension] calls return false.
|
||||||
// It panics if m is invalid or if xt does not extend m.
|
// It panics if m is invalid or if xt does not extend m.
|
||||||
func ClearExtension(m Message, xt protoreflect.ExtensionType) {
|
func ClearExtension(m Message, xt protoreflect.ExtensionType) {
|
||||||
m.ProtoReflect().Clear(xt.TypeDescriptor())
|
m.ProtoReflect().Clear(xt.TypeDescriptor())
|
||||||
|
|
|
@ -21,7 +21,7 @@ import (
|
||||||
// The unknown fields of src are appended to the unknown fields of dst.
|
// The unknown fields of src are appended to the unknown fields of dst.
|
||||||
//
|
//
|
||||||
// It is semantically equivalent to unmarshaling the encoded form of src
|
// It is semantically equivalent to unmarshaling the encoded form of src
|
||||||
// into dst with the UnmarshalOptions.Merge option specified.
|
// into dst with the [UnmarshalOptions.Merge] option specified.
|
||||||
func Merge(dst, src Message) {
|
func Merge(dst, src Message) {
|
||||||
// TODO: Should nil src be treated as semantically equivalent to a
|
// TODO: Should nil src be treated as semantically equivalent to a
|
||||||
// untyped, read-only, empty message? What about a nil dst?
|
// untyped, read-only, empty message? What about a nil dst?
|
||||||
|
|
|
@ -15,18 +15,20 @@ import (
|
||||||
// protobuf module that accept a Message, except where otherwise specified.
|
// protobuf module that accept a Message, except where otherwise specified.
|
||||||
//
|
//
|
||||||
// This is the v2 interface definition for protobuf messages.
|
// This is the v2 interface definition for protobuf messages.
|
||||||
// The v1 interface definition is "github.com/golang/protobuf/proto".Message.
|
// The v1 interface definition is [github.com/golang/protobuf/proto.Message].
|
||||||
//
|
//
|
||||||
// To convert a v1 message to a v2 message,
|
// - To convert a v1 message to a v2 message,
|
||||||
// use "github.com/golang/protobuf/proto".MessageV2.
|
// use [google.golang.org/protobuf/protoadapt.MessageV2Of].
|
||||||
// To convert a v2 message to a v1 message,
|
// - To convert a v2 message to a v1 message,
|
||||||
// use "github.com/golang/protobuf/proto".MessageV1.
|
// use [google.golang.org/protobuf/protoadapt.MessageV1Of].
|
||||||
type Message = protoreflect.ProtoMessage
|
type Message = protoreflect.ProtoMessage
|
||||||
|
|
||||||
// Error matches all errors produced by packages in the protobuf module.
|
// Error matches all errors produced by packages in the protobuf module
|
||||||
|
// according to [errors.Is].
|
||||||
//
|
//
|
||||||
// That is, errors.Is(err, Error) reports whether an error is produced
|
// Example usage:
|
||||||
// by this module.
|
//
|
||||||
|
// if errors.Is(err, proto.Error) { ... }
|
||||||
var Error error
|
var Error error
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// Package protodesc provides functionality for converting
|
// Package protodesc provides functionality for converting
|
||||||
// FileDescriptorProto messages to/from protoreflect.FileDescriptor values.
|
// FileDescriptorProto messages to/from [protoreflect.FileDescriptor] values.
|
||||||
//
|
//
|
||||||
// The google.protobuf.FileDescriptorProto is a protobuf message that describes
|
// The google.protobuf.FileDescriptorProto is a protobuf message that describes
|
||||||
// the type information for a .proto file in a form that is easily serializable.
|
// the type information for a .proto file in a form that is easily serializable.
|
||||||
// The protoreflect.FileDescriptor is a more structured representation of
|
// The [protoreflect.FileDescriptor] is a more structured representation of
|
||||||
// the FileDescriptorProto message where references and remote dependencies
|
// the FileDescriptorProto message where references and remote dependencies
|
||||||
// can be directly followed.
|
// can be directly followed.
|
||||||
package protodesc
|
package protodesc
|
||||||
|
@ -24,11 +24,11 @@ import (
|
||||||
"google.golang.org/protobuf/types/descriptorpb"
|
"google.golang.org/protobuf/types/descriptorpb"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Resolver is the resolver used by NewFile to resolve dependencies.
|
// Resolver is the resolver used by [NewFile] to resolve dependencies.
|
||||||
// The enums and messages provided must belong to some parent file,
|
// The enums and messages provided must belong to some parent file,
|
||||||
// which is also registered.
|
// which is also registered.
|
||||||
//
|
//
|
||||||
// It is implemented by protoregistry.Files.
|
// It is implemented by [protoregistry.Files].
|
||||||
type Resolver interface {
|
type Resolver interface {
|
||||||
FindFileByPath(string) (protoreflect.FileDescriptor, error)
|
FindFileByPath(string) (protoreflect.FileDescriptor, error)
|
||||||
FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error)
|
FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error)
|
||||||
|
@ -61,19 +61,19 @@ type FileOptions struct {
|
||||||
AllowUnresolvable bool
|
AllowUnresolvable bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFile creates a new protoreflect.FileDescriptor from the provided
|
// NewFile creates a new [protoreflect.FileDescriptor] from the provided
|
||||||
// file descriptor message. See FileOptions.New for more information.
|
// file descriptor message. See [FileOptions.New] for more information.
|
||||||
func NewFile(fd *descriptorpb.FileDescriptorProto, r Resolver) (protoreflect.FileDescriptor, error) {
|
func NewFile(fd *descriptorpb.FileDescriptorProto, r Resolver) (protoreflect.FileDescriptor, error) {
|
||||||
return FileOptions{}.New(fd, r)
|
return FileOptions{}.New(fd, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFiles creates a new protoregistry.Files from the provided
|
// NewFiles creates a new [protoregistry.Files] from the provided
|
||||||
// FileDescriptorSet message. See FileOptions.NewFiles for more information.
|
// FileDescriptorSet message. See [FileOptions.NewFiles] for more information.
|
||||||
func NewFiles(fd *descriptorpb.FileDescriptorSet) (*protoregistry.Files, error) {
|
func NewFiles(fd *descriptorpb.FileDescriptorSet) (*protoregistry.Files, error) {
|
||||||
return FileOptions{}.NewFiles(fd)
|
return FileOptions{}.NewFiles(fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates a new protoreflect.FileDescriptor from the provided
|
// New creates a new [protoreflect.FileDescriptor] from the provided
|
||||||
// file descriptor message. The file must represent a valid proto file according
|
// file descriptor message. The file must represent a valid proto file according
|
||||||
// to protobuf semantics. The returned descriptor is a deep copy of the input.
|
// to protobuf semantics. The returned descriptor is a deep copy of the input.
|
||||||
//
|
//
|
||||||
|
@ -93,9 +93,15 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot
|
||||||
f.L1.Syntax = protoreflect.Proto2
|
f.L1.Syntax = protoreflect.Proto2
|
||||||
case "proto3":
|
case "proto3":
|
||||||
f.L1.Syntax = protoreflect.Proto3
|
f.L1.Syntax = protoreflect.Proto3
|
||||||
|
case "editions":
|
||||||
|
f.L1.Syntax = protoreflect.Editions
|
||||||
|
f.L1.Edition = fromEditionProto(fd.GetEdition())
|
||||||
default:
|
default:
|
||||||
return nil, errors.New("invalid syntax: %q", fd.GetSyntax())
|
return nil, errors.New("invalid syntax: %q", fd.GetSyntax())
|
||||||
}
|
}
|
||||||
|
if f.L1.Syntax == protoreflect.Editions && (fd.GetEdition() < SupportedEditionsMinimum || fd.GetEdition() > SupportedEditionsMaximum) {
|
||||||
|
return nil, errors.New("use of edition %v not yet supported by the Go Protobuf runtime", fd.GetEdition())
|
||||||
|
}
|
||||||
f.L1.Path = fd.GetName()
|
f.L1.Path = fd.GetName()
|
||||||
if f.L1.Path == "" {
|
if f.L1.Path == "" {
|
||||||
return nil, errors.New("file path must be populated")
|
return nil, errors.New("file path must be populated")
|
||||||
|
@ -108,6 +114,9 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot
|
||||||
opts = proto.Clone(opts).(*descriptorpb.FileOptions)
|
opts = proto.Clone(opts).(*descriptorpb.FileOptions)
|
||||||
f.L2.Options = func() protoreflect.ProtoMessage { return opts }
|
f.L2.Options = func() protoreflect.ProtoMessage { return opts }
|
||||||
}
|
}
|
||||||
|
if f.L1.Syntax == protoreflect.Editions {
|
||||||
|
initFileDescFromFeatureSet(f, fd.GetOptions().GetFeatures())
|
||||||
|
}
|
||||||
|
|
||||||
f.L2.Imports = make(filedesc.FileImports, len(fd.GetDependency()))
|
f.L2.Imports = make(filedesc.FileImports, len(fd.GetDependency()))
|
||||||
for _, i := range fd.GetPublicDependency() {
|
for _, i := range fd.GetPublicDependency() {
|
||||||
|
@ -231,7 +240,7 @@ func (is importSet) importPublic(imps protoreflect.FileImports) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFiles creates a new protoregistry.Files from the provided
|
// NewFiles creates a new [protoregistry.Files] from the provided
|
||||||
// FileDescriptorSet message. The descriptor set must include only
|
// FileDescriptorSet message. The descriptor set must include only
|
||||||
// valid files according to protobuf semantics. The returned descriptors
|
// valid files according to protobuf semantics. The returned descriptors
|
||||||
// are a deep copy of the input.
|
// are a deep copy of the input.
|
||||||
|
|
|
@ -28,6 +28,7 @@ func (r descsByName) initEnumDeclarations(eds []*descriptorpb.EnumDescriptorProt
|
||||||
opts = proto.Clone(opts).(*descriptorpb.EnumOptions)
|
opts = proto.Clone(opts).(*descriptorpb.EnumOptions)
|
||||||
e.L2.Options = func() protoreflect.ProtoMessage { return opts }
|
e.L2.Options = func() protoreflect.ProtoMessage { return opts }
|
||||||
}
|
}
|
||||||
|
e.L1.EditionFeatures = mergeEditionFeatures(parent, ed.GetOptions().GetFeatures())
|
||||||
for _, s := range ed.GetReservedName() {
|
for _, s := range ed.GetReservedName() {
|
||||||
e.L2.ReservedNames.List = append(e.L2.ReservedNames.List, protoreflect.Name(s))
|
e.L2.ReservedNames.List = append(e.L2.ReservedNames.List, protoreflect.Name(s))
|
||||||
}
|
}
|
||||||
|
@ -68,6 +69,9 @@ func (r descsByName) initMessagesDeclarations(mds []*descriptorpb.DescriptorProt
|
||||||
if m.L0, err = r.makeBase(m, parent, md.GetName(), i, sb); err != nil {
|
if m.L0, err = r.makeBase(m, parent, md.GetName(), i, sb); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if m.Base.L0.ParentFile.Syntax() == protoreflect.Editions {
|
||||||
|
m.L1.EditionFeatures = mergeEditionFeatures(parent, md.GetOptions().GetFeatures())
|
||||||
|
}
|
||||||
if opts := md.GetOptions(); opts != nil {
|
if opts := md.GetOptions(); opts != nil {
|
||||||
opts = proto.Clone(opts).(*descriptorpb.MessageOptions)
|
opts = proto.Clone(opts).(*descriptorpb.MessageOptions)
|
||||||
m.L2.Options = func() protoreflect.ProtoMessage { return opts }
|
m.L2.Options = func() protoreflect.ProtoMessage { return opts }
|
||||||
|
@ -114,6 +118,27 @@ func (r descsByName) initMessagesDeclarations(mds []*descriptorpb.DescriptorProt
|
||||||
return ms, nil
|
return ms, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// canBePacked returns whether the field can use packed encoding:
|
||||||
|
// https://protobuf.dev/programming-guides/encoding/#packed
|
||||||
|
func canBePacked(fd *descriptorpb.FieldDescriptorProto) bool {
|
||||||
|
if fd.GetLabel() != descriptorpb.FieldDescriptorProto_LABEL_REPEATED {
|
||||||
|
return false // not a repeated field
|
||||||
|
}
|
||||||
|
|
||||||
|
switch protoreflect.Kind(fd.GetType()) {
|
||||||
|
case protoreflect.MessageKind, protoreflect.GroupKind:
|
||||||
|
return false // not a scalar type field
|
||||||
|
|
||||||
|
case protoreflect.StringKind, protoreflect.BytesKind:
|
||||||
|
// string and bytes can explicitly not be declared as packed,
|
||||||
|
// see https://protobuf.dev/programming-guides/encoding/#packed
|
||||||
|
return false
|
||||||
|
|
||||||
|
default:
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (fs []filedesc.Field, err error) {
|
func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDescriptorProto, parent protoreflect.Descriptor, sb *strs.Builder) (fs []filedesc.Field, err error) {
|
||||||
fs = make([]filedesc.Field, len(fds)) // allocate up-front to ensure stable pointers
|
fs = make([]filedesc.Field, len(fds)) // allocate up-front to ensure stable pointers
|
||||||
for i, fd := range fds {
|
for i, fd := range fds {
|
||||||
|
@ -137,6 +162,34 @@ func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDesc
|
||||||
if fd.JsonName != nil {
|
if fd.JsonName != nil {
|
||||||
f.L1.StringName.InitJSON(fd.GetJsonName())
|
f.L1.StringName.InitJSON(fd.GetJsonName())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if f.Base.L0.ParentFile.Syntax() == protoreflect.Editions {
|
||||||
|
f.L1.EditionFeatures = mergeEditionFeatures(parent, fd.GetOptions().GetFeatures())
|
||||||
|
|
||||||
|
if f.L1.EditionFeatures.IsLegacyRequired {
|
||||||
|
f.L1.Cardinality = protoreflect.Required
|
||||||
|
}
|
||||||
|
// We reuse the existing field because the old option `[packed =
|
||||||
|
// true]` is mutually exclusive with the editions feature.
|
||||||
|
if canBePacked(fd) {
|
||||||
|
f.L1.HasPacked = true
|
||||||
|
f.L1.IsPacked = f.L1.EditionFeatures.IsPacked
|
||||||
|
}
|
||||||
|
|
||||||
|
// We pretend this option is always explicitly set because the only
|
||||||
|
// use of HasEnforceUTF8 is to determine whether to use EnforceUTF8
|
||||||
|
// or to return the appropriate default.
|
||||||
|
// When using editions we either parse the option or resolve the
|
||||||
|
// appropriate default here (instead of later when this option is
|
||||||
|
// requested from the descriptor).
|
||||||
|
// In proto2/proto3 syntax HasEnforceUTF8 might be false.
|
||||||
|
f.L1.HasEnforceUTF8 = true
|
||||||
|
f.L1.EnforceUTF8 = f.L1.EditionFeatures.IsUTF8Validated
|
||||||
|
|
||||||
|
if f.L1.Kind == protoreflect.MessageKind && f.L1.EditionFeatures.IsDelimitedEncoded {
|
||||||
|
f.L1.Kind = protoreflect.GroupKind
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return fs, nil
|
return fs, nil
|
||||||
}
|
}
|
||||||
|
@ -151,6 +204,9 @@ func (r descsByName) initOneofsFromDescriptorProto(ods []*descriptorpb.OneofDesc
|
||||||
if opts := od.GetOptions(); opts != nil {
|
if opts := od.GetOptions(); opts != nil {
|
||||||
opts = proto.Clone(opts).(*descriptorpb.OneofOptions)
|
opts = proto.Clone(opts).(*descriptorpb.OneofOptions)
|
||||||
o.L1.Options = func() protoreflect.ProtoMessage { return opts }
|
o.L1.Options = func() protoreflect.ProtoMessage { return opts }
|
||||||
|
if parent.Syntax() == protoreflect.Editions {
|
||||||
|
o.L1.EditionFeatures = mergeEditionFeatures(parent, opts.GetFeatures())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return os, nil
|
return os, nil
|
||||||
|
|
|
@ -276,8 +276,8 @@ func unmarshalDefault(s string, fd protoreflect.FieldDescriptor, allowUnresolvab
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return v, ev, err
|
return v, ev, err
|
||||||
}
|
}
|
||||||
if fd.Syntax() == protoreflect.Proto3 {
|
if !fd.HasPresence() {
|
||||||
return v, ev, errors.New("cannot be specified under proto3 semantics")
|
return v, ev, errors.New("cannot be specified with implicit field presence")
|
||||||
}
|
}
|
||||||
if fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind || fd.Cardinality() == protoreflect.Repeated {
|
if fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind || fd.Cardinality() == protoreflect.Repeated {
|
||||||
return v, ev, errors.New("cannot be specified on composite types")
|
return v, ev, errors.New("cannot be specified on composite types")
|
||||||
|
|
|
@ -107,7 +107,7 @@ func validateMessageDeclarations(ms []filedesc.Message, mds []*descriptorpb.Desc
|
||||||
if isMessageSet && !flags.ProtoLegacy {
|
if isMessageSet && !flags.ProtoLegacy {
|
||||||
return errors.New("message %q is a MessageSet, which is a legacy proto1 feature that is no longer supported", m.FullName())
|
return errors.New("message %q is a MessageSet, which is a legacy proto1 feature that is no longer supported", m.FullName())
|
||||||
}
|
}
|
||||||
if isMessageSet && (m.Syntax() != protoreflect.Proto2 || m.Fields().Len() > 0 || m.ExtensionRanges().Len() == 0) {
|
if isMessageSet && (m.Syntax() == protoreflect.Proto3 || m.Fields().Len() > 0 || m.ExtensionRanges().Len() == 0) {
|
||||||
return errors.New("message %q is an invalid proto1 MessageSet", m.FullName())
|
return errors.New("message %q is an invalid proto1 MessageSet", m.FullName())
|
||||||
}
|
}
|
||||||
if m.Syntax() == protoreflect.Proto3 {
|
if m.Syntax() == protoreflect.Proto3 {
|
||||||
|
@ -314,8 +314,8 @@ func checkValidGroup(fd protoreflect.FieldDescriptor) error {
|
||||||
switch {
|
switch {
|
||||||
case fd.Kind() != protoreflect.GroupKind:
|
case fd.Kind() != protoreflect.GroupKind:
|
||||||
return nil
|
return nil
|
||||||
case fd.Syntax() != protoreflect.Proto2:
|
case fd.Syntax() == protoreflect.Proto3:
|
||||||
return errors.New("invalid under proto2 semantics")
|
return errors.New("invalid under proto3 semantics")
|
||||||
case md == nil || md.IsPlaceholder():
|
case md == nil || md.IsPlaceholder():
|
||||||
return errors.New("message must be resolvable")
|
return errors.New("message must be resolvable")
|
||||||
case fd.FullName().Parent() != md.FullName().Parent():
|
case fd.FullName().Parent() != md.FullName().Parent():
|
||||||
|
|
|
@ -0,0 +1,148 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package protodesc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/internal/editiondefaults"
|
||||||
|
"google.golang.org/protobuf/internal/filedesc"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
|
"google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
"google.golang.org/protobuf/types/descriptorpb"
|
||||||
|
gofeaturespb "google.golang.org/protobuf/types/gofeaturespb"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
SupportedEditionsMinimum = descriptorpb.Edition_EDITION_PROTO2
|
||||||
|
SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2023
|
||||||
|
)
|
||||||
|
|
||||||
|
var defaults = &descriptorpb.FeatureSetDefaults{}
|
||||||
|
var defaultsCacheMu sync.Mutex
|
||||||
|
var defaultsCache = make(map[filedesc.Edition]*descriptorpb.FeatureSet)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
err := proto.Unmarshal(editiondefaults.Defaults, defaults)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "unmarshal editions defaults: %v\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func fromEditionProto(epb descriptorpb.Edition) filedesc.Edition {
|
||||||
|
return filedesc.Edition(epb)
|
||||||
|
}
|
||||||
|
|
||||||
|
func toEditionProto(ed filedesc.Edition) descriptorpb.Edition {
|
||||||
|
switch ed {
|
||||||
|
case filedesc.EditionUnknown:
|
||||||
|
return descriptorpb.Edition_EDITION_UNKNOWN
|
||||||
|
case filedesc.EditionProto2:
|
||||||
|
return descriptorpb.Edition_EDITION_PROTO2
|
||||||
|
case filedesc.EditionProto3:
|
||||||
|
return descriptorpb.Edition_EDITION_PROTO3
|
||||||
|
case filedesc.Edition2023:
|
||||||
|
return descriptorpb.Edition_EDITION_2023
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("unknown value for edition: %v", ed))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func getFeatureSetFor(ed filedesc.Edition) *descriptorpb.FeatureSet {
|
||||||
|
defaultsCacheMu.Lock()
|
||||||
|
defer defaultsCacheMu.Unlock()
|
||||||
|
if def, ok := defaultsCache[ed]; ok {
|
||||||
|
return def
|
||||||
|
}
|
||||||
|
edpb := toEditionProto(ed)
|
||||||
|
if defaults.GetMinimumEdition() > edpb || defaults.GetMaximumEdition() < edpb {
|
||||||
|
// This should never happen protodesc.(FileOptions).New would fail when
|
||||||
|
// initializing the file descriptor.
|
||||||
|
// This most likely means the embedded defaults were not updated.
|
||||||
|
fmt.Fprintf(os.Stderr, "internal error: unsupported edition %v (did you forget to update the embedded defaults (i.e. the bootstrap descriptor proto)?)\n", edpb)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
fs := defaults.GetDefaults()[0].GetFeatures()
|
||||||
|
// Using a linear search for now.
|
||||||
|
// Editions are guaranteed to be sorted and thus we could use a binary search.
|
||||||
|
// Given that there are only a handful of editions (with one more per year)
|
||||||
|
// there is not much reason to use a binary search.
|
||||||
|
for _, def := range defaults.GetDefaults() {
|
||||||
|
if def.GetEdition() <= edpb {
|
||||||
|
fs = def.GetFeatures()
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defaultsCache[ed] = fs
|
||||||
|
return fs
|
||||||
|
}
|
||||||
|
|
||||||
|
// mergeEditionFeatures merges the parent and child feature sets. This function
|
||||||
|
// should be used when initializing Go descriptors from descriptor protos which
|
||||||
|
// is why the parent is a filedesc.EditionsFeatures (Go representation) while
|
||||||
|
// the child is a descriptorproto.FeatureSet (protoc representation).
|
||||||
|
// Any feature set by the child overwrites what is set by the parent.
|
||||||
|
func mergeEditionFeatures(parentDesc protoreflect.Descriptor, child *descriptorpb.FeatureSet) filedesc.EditionFeatures {
|
||||||
|
var parentFS filedesc.EditionFeatures
|
||||||
|
switch p := parentDesc.(type) {
|
||||||
|
case *filedesc.File:
|
||||||
|
parentFS = p.L1.EditionFeatures
|
||||||
|
case *filedesc.Message:
|
||||||
|
parentFS = p.L1.EditionFeatures
|
||||||
|
default:
|
||||||
|
panic(fmt.Sprintf("unknown parent type %T", parentDesc))
|
||||||
|
}
|
||||||
|
if child == nil {
|
||||||
|
return parentFS
|
||||||
|
}
|
||||||
|
if fp := child.FieldPresence; fp != nil {
|
||||||
|
parentFS.IsFieldPresence = *fp == descriptorpb.FeatureSet_LEGACY_REQUIRED ||
|
||||||
|
*fp == descriptorpb.FeatureSet_EXPLICIT
|
||||||
|
parentFS.IsLegacyRequired = *fp == descriptorpb.FeatureSet_LEGACY_REQUIRED
|
||||||
|
}
|
||||||
|
if et := child.EnumType; et != nil {
|
||||||
|
parentFS.IsOpenEnum = *et == descriptorpb.FeatureSet_OPEN
|
||||||
|
}
|
||||||
|
|
||||||
|
if rfe := child.RepeatedFieldEncoding; rfe != nil {
|
||||||
|
parentFS.IsPacked = *rfe == descriptorpb.FeatureSet_PACKED
|
||||||
|
}
|
||||||
|
|
||||||
|
if utf8val := child.Utf8Validation; utf8val != nil {
|
||||||
|
parentFS.IsUTF8Validated = *utf8val == descriptorpb.FeatureSet_VERIFY
|
||||||
|
}
|
||||||
|
|
||||||
|
if me := child.MessageEncoding; me != nil {
|
||||||
|
parentFS.IsDelimitedEncoded = *me == descriptorpb.FeatureSet_DELIMITED
|
||||||
|
}
|
||||||
|
|
||||||
|
if jf := child.JsonFormat; jf != nil {
|
||||||
|
parentFS.IsJSONCompliant = *jf == descriptorpb.FeatureSet_ALLOW
|
||||||
|
}
|
||||||
|
|
||||||
|
if goFeatures, ok := proto.GetExtension(child, gofeaturespb.E_Go).(*gofeaturespb.GoFeatures); ok && goFeatures != nil {
|
||||||
|
if luje := goFeatures.LegacyUnmarshalJsonEnum; luje != nil {
|
||||||
|
parentFS.GenerateLegacyUnmarshalJSON = *luje
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parentFS
|
||||||
|
}
|
||||||
|
|
||||||
|
// initFileDescFromFeatureSet initializes editions related fields in fd based
|
||||||
|
// on fs. If fs is nil it is assumed to be an empty featureset and all fields
|
||||||
|
// will be initialized with the appropriate default. fd.L1.Edition must be set
|
||||||
|
// before calling this function.
|
||||||
|
func initFileDescFromFeatureSet(fd *filedesc.File, fs *descriptorpb.FeatureSet) {
|
||||||
|
dfs := getFeatureSetFor(fd.L1.Edition)
|
||||||
|
// initialize the featureset with the defaults
|
||||||
|
fd.L1.EditionFeatures = mergeEditionFeatures(fd, dfs)
|
||||||
|
// overwrite any options explicitly specified
|
||||||
|
fd.L1.EditionFeatures = mergeEditionFeatures(fd, fs)
|
||||||
|
}
|
|
@ -16,7 +16,7 @@ import (
|
||||||
"google.golang.org/protobuf/types/descriptorpb"
|
"google.golang.org/protobuf/types/descriptorpb"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ToFileDescriptorProto copies a protoreflect.FileDescriptor into a
|
// ToFileDescriptorProto copies a [protoreflect.FileDescriptor] into a
|
||||||
// google.protobuf.FileDescriptorProto message.
|
// google.protobuf.FileDescriptorProto message.
|
||||||
func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {
|
func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {
|
||||||
p := &descriptorpb.FileDescriptorProto{
|
p := &descriptorpb.FileDescriptorProto{
|
||||||
|
@ -70,13 +70,13 @@ func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileD
|
||||||
for i, exts := 0, file.Extensions(); i < exts.Len(); i++ {
|
for i, exts := 0, file.Extensions(); i < exts.Len(); i++ {
|
||||||
p.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))
|
p.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))
|
||||||
}
|
}
|
||||||
if syntax := file.Syntax(); syntax != protoreflect.Proto2 {
|
if syntax := file.Syntax(); syntax != protoreflect.Proto2 && syntax.IsValid() {
|
||||||
p.Syntax = proto.String(file.Syntax().String())
|
p.Syntax = proto.String(file.Syntax().String())
|
||||||
}
|
}
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDescriptorProto copies a protoreflect.MessageDescriptor into a
|
// ToDescriptorProto copies a [protoreflect.MessageDescriptor] into a
|
||||||
// google.protobuf.DescriptorProto message.
|
// google.protobuf.DescriptorProto message.
|
||||||
func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {
|
func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {
|
||||||
p := &descriptorpb.DescriptorProto{
|
p := &descriptorpb.DescriptorProto{
|
||||||
|
@ -119,7 +119,7 @@ func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.Des
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToFieldDescriptorProto copies a protoreflect.FieldDescriptor into a
|
// ToFieldDescriptorProto copies a [protoreflect.FieldDescriptor] into a
|
||||||
// google.protobuf.FieldDescriptorProto message.
|
// google.protobuf.FieldDescriptorProto message.
|
||||||
func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {
|
func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {
|
||||||
p := &descriptorpb.FieldDescriptorProto{
|
p := &descriptorpb.FieldDescriptorProto{
|
||||||
|
@ -168,7 +168,7 @@ func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.Fi
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToOneofDescriptorProto copies a protoreflect.OneofDescriptor into a
|
// ToOneofDescriptorProto copies a [protoreflect.OneofDescriptor] into a
|
||||||
// google.protobuf.OneofDescriptorProto message.
|
// google.protobuf.OneofDescriptorProto message.
|
||||||
func ToOneofDescriptorProto(oneof protoreflect.OneofDescriptor) *descriptorpb.OneofDescriptorProto {
|
func ToOneofDescriptorProto(oneof protoreflect.OneofDescriptor) *descriptorpb.OneofDescriptorProto {
|
||||||
return &descriptorpb.OneofDescriptorProto{
|
return &descriptorpb.OneofDescriptorProto{
|
||||||
|
@ -177,7 +177,7 @@ func ToOneofDescriptorProto(oneof protoreflect.OneofDescriptor) *descriptorpb.On
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToEnumDescriptorProto copies a protoreflect.EnumDescriptor into a
|
// ToEnumDescriptorProto copies a [protoreflect.EnumDescriptor] into a
|
||||||
// google.protobuf.EnumDescriptorProto message.
|
// google.protobuf.EnumDescriptorProto message.
|
||||||
func ToEnumDescriptorProto(enum protoreflect.EnumDescriptor) *descriptorpb.EnumDescriptorProto {
|
func ToEnumDescriptorProto(enum protoreflect.EnumDescriptor) *descriptorpb.EnumDescriptorProto {
|
||||||
p := &descriptorpb.EnumDescriptorProto{
|
p := &descriptorpb.EnumDescriptorProto{
|
||||||
|
@ -200,7 +200,7 @@ func ToEnumDescriptorProto(enum protoreflect.EnumDescriptor) *descriptorpb.EnumD
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToEnumValueDescriptorProto copies a protoreflect.EnumValueDescriptor into a
|
// ToEnumValueDescriptorProto copies a [protoreflect.EnumValueDescriptor] into a
|
||||||
// google.protobuf.EnumValueDescriptorProto message.
|
// google.protobuf.EnumValueDescriptorProto message.
|
||||||
func ToEnumValueDescriptorProto(value protoreflect.EnumValueDescriptor) *descriptorpb.EnumValueDescriptorProto {
|
func ToEnumValueDescriptorProto(value protoreflect.EnumValueDescriptor) *descriptorpb.EnumValueDescriptorProto {
|
||||||
return &descriptorpb.EnumValueDescriptorProto{
|
return &descriptorpb.EnumValueDescriptorProto{
|
||||||
|
@ -210,7 +210,7 @@ func ToEnumValueDescriptorProto(value protoreflect.EnumValueDescriptor) *descrip
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToServiceDescriptorProto copies a protoreflect.ServiceDescriptor into a
|
// ToServiceDescriptorProto copies a [protoreflect.ServiceDescriptor] into a
|
||||||
// google.protobuf.ServiceDescriptorProto message.
|
// google.protobuf.ServiceDescriptorProto message.
|
||||||
func ToServiceDescriptorProto(service protoreflect.ServiceDescriptor) *descriptorpb.ServiceDescriptorProto {
|
func ToServiceDescriptorProto(service protoreflect.ServiceDescriptor) *descriptorpb.ServiceDescriptorProto {
|
||||||
p := &descriptorpb.ServiceDescriptorProto{
|
p := &descriptorpb.ServiceDescriptorProto{
|
||||||
|
@ -223,7 +223,7 @@ func ToServiceDescriptorProto(service protoreflect.ServiceDescriptor) *descripto
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToMethodDescriptorProto copies a protoreflect.MethodDescriptor into a
|
// ToMethodDescriptorProto copies a [protoreflect.MethodDescriptor] into a
|
||||||
// google.protobuf.MethodDescriptorProto message.
|
// google.protobuf.MethodDescriptorProto message.
|
||||||
func ToMethodDescriptorProto(method protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {
|
func ToMethodDescriptorProto(method protoreflect.MethodDescriptor) *descriptorpb.MethodDescriptorProto {
|
||||||
p := &descriptorpb.MethodDescriptorProto{
|
p := &descriptorpb.MethodDescriptorProto{
|
||||||
|
|
|
@ -10,46 +10,46 @@
|
||||||
//
|
//
|
||||||
// # Protocol Buffer Descriptors
|
// # Protocol Buffer Descriptors
|
||||||
//
|
//
|
||||||
// Protobuf descriptors (e.g., EnumDescriptor or MessageDescriptor)
|
// Protobuf descriptors (e.g., [EnumDescriptor] or [MessageDescriptor])
|
||||||
// are immutable objects that represent protobuf type information.
|
// are immutable objects that represent protobuf type information.
|
||||||
// They are wrappers around the messages declared in descriptor.proto.
|
// They are wrappers around the messages declared in descriptor.proto.
|
||||||
// Protobuf descriptors alone lack any information regarding Go types.
|
// Protobuf descriptors alone lack any information regarding Go types.
|
||||||
//
|
//
|
||||||
// Enums and messages generated by this module implement Enum and ProtoMessage,
|
// Enums and messages generated by this module implement [Enum] and [ProtoMessage],
|
||||||
// where the Descriptor and ProtoReflect.Descriptor accessors respectively
|
// where the Descriptor and ProtoReflect.Descriptor accessors respectively
|
||||||
// return the protobuf descriptor for the values.
|
// return the protobuf descriptor for the values.
|
||||||
//
|
//
|
||||||
// The protobuf descriptor interfaces are not meant to be implemented by
|
// The protobuf descriptor interfaces are not meant to be implemented by
|
||||||
// user code since they might need to be extended in the future to support
|
// user code since they might need to be extended in the future to support
|
||||||
// additions to the protobuf language.
|
// additions to the protobuf language.
|
||||||
// The "google.golang.org/protobuf/reflect/protodesc" package converts between
|
// The [google.golang.org/protobuf/reflect/protodesc] package converts between
|
||||||
// google.protobuf.DescriptorProto messages and protobuf descriptors.
|
// google.protobuf.DescriptorProto messages and protobuf descriptors.
|
||||||
//
|
//
|
||||||
// # Go Type Descriptors
|
// # Go Type Descriptors
|
||||||
//
|
//
|
||||||
// A type descriptor (e.g., EnumType or MessageType) is a constructor for
|
// A type descriptor (e.g., [EnumType] or [MessageType]) is a constructor for
|
||||||
// a concrete Go type that represents the associated protobuf descriptor.
|
// a concrete Go type that represents the associated protobuf descriptor.
|
||||||
// There is commonly a one-to-one relationship between protobuf descriptors and
|
// There is commonly a one-to-one relationship between protobuf descriptors and
|
||||||
// Go type descriptors, but it can potentially be a one-to-many relationship.
|
// Go type descriptors, but it can potentially be a one-to-many relationship.
|
||||||
//
|
//
|
||||||
// Enums and messages generated by this module implement Enum and ProtoMessage,
|
// Enums and messages generated by this module implement [Enum] and [ProtoMessage],
|
||||||
// where the Type and ProtoReflect.Type accessors respectively
|
// where the Type and ProtoReflect.Type accessors respectively
|
||||||
// return the protobuf descriptor for the values.
|
// return the protobuf descriptor for the values.
|
||||||
//
|
//
|
||||||
// The "google.golang.org/protobuf/types/dynamicpb" package can be used to
|
// The [google.golang.org/protobuf/types/dynamicpb] package can be used to
|
||||||
// create Go type descriptors from protobuf descriptors.
|
// create Go type descriptors from protobuf descriptors.
|
||||||
//
|
//
|
||||||
// # Value Interfaces
|
// # Value Interfaces
|
||||||
//
|
//
|
||||||
// The Enum and Message interfaces provide a reflective view over an
|
// The [Enum] and [Message] interfaces provide a reflective view over an
|
||||||
// enum or message instance. For enums, it provides the ability to retrieve
|
// enum or message instance. For enums, it provides the ability to retrieve
|
||||||
// the enum value number for any concrete enum type. For messages, it provides
|
// the enum value number for any concrete enum type. For messages, it provides
|
||||||
// the ability to access or manipulate fields of the message.
|
// the ability to access or manipulate fields of the message.
|
||||||
//
|
//
|
||||||
// To convert a proto.Message to a protoreflect.Message, use the
|
// To convert a [google.golang.org/protobuf/proto.Message] to a [protoreflect.Message], use the
|
||||||
// former's ProtoReflect method. Since the ProtoReflect method is new to the
|
// former's ProtoReflect method. Since the ProtoReflect method is new to the
|
||||||
// v2 message interface, it may not be present on older message implementations.
|
// v2 message interface, it may not be present on older message implementations.
|
||||||
// The "github.com/golang/protobuf/proto".MessageReflect function can be used
|
// The [github.com/golang/protobuf/proto.MessageReflect] function can be used
|
||||||
// to obtain a reflective view on older messages.
|
// to obtain a reflective view on older messages.
|
||||||
//
|
//
|
||||||
// # Relationships
|
// # Relationships
|
||||||
|
@ -71,12 +71,12 @@
|
||||||
// │ │
|
// │ │
|
||||||
// └────────────────── Type() ───────┘
|
// └────────────────── Type() ───────┘
|
||||||
//
|
//
|
||||||
// • An EnumType describes a concrete Go enum type.
|
// • An [EnumType] describes a concrete Go enum type.
|
||||||
// It has an EnumDescriptor and can construct an Enum instance.
|
// It has an EnumDescriptor and can construct an Enum instance.
|
||||||
//
|
//
|
||||||
// • An EnumDescriptor describes an abstract protobuf enum type.
|
// • An [EnumDescriptor] describes an abstract protobuf enum type.
|
||||||
//
|
//
|
||||||
// • An Enum is a concrete enum instance. Generated enums implement Enum.
|
// • An [Enum] is a concrete enum instance. Generated enums implement Enum.
|
||||||
//
|
//
|
||||||
// ┌──────────────── New() ─────────────────┐
|
// ┌──────────────── New() ─────────────────┐
|
||||||
// │ │
|
// │ │
|
||||||
|
@ -90,24 +90,26 @@
|
||||||
// │ │
|
// │ │
|
||||||
// └─────────────────── Type() ─────────┘
|
// └─────────────────── Type() ─────────┘
|
||||||
//
|
//
|
||||||
// • A MessageType describes a concrete Go message type.
|
// • A [MessageType] describes a concrete Go message type.
|
||||||
// It has a MessageDescriptor and can construct a Message instance.
|
// It has a [MessageDescriptor] and can construct a [Message] instance.
|
||||||
// Just as how Go's reflect.Type is a reflective description of a Go type,
|
// Just as how Go's [reflect.Type] is a reflective description of a Go type,
|
||||||
// a MessageType is a reflective description of a Go type for a protobuf message.
|
// a [MessageType] is a reflective description of a Go type for a protobuf message.
|
||||||
//
|
//
|
||||||
// • A MessageDescriptor describes an abstract protobuf message type.
|
// • A [MessageDescriptor] describes an abstract protobuf message type.
|
||||||
// It has no understanding of Go types. In order to construct a MessageType
|
// It has no understanding of Go types. In order to construct a [MessageType]
|
||||||
// from just a MessageDescriptor, you can consider looking up the message type
|
// from just a [MessageDescriptor], you can consider looking up the message type
|
||||||
// in the global registry using protoregistry.GlobalTypes.FindMessageByName
|
// in the global registry using the FindMessageByName method on
|
||||||
// or constructing a dynamic MessageType using dynamicpb.NewMessageType.
|
// [google.golang.org/protobuf/reflect/protoregistry.GlobalTypes]
|
||||||
|
// or constructing a dynamic [MessageType] using
|
||||||
|
// [google.golang.org/protobuf/types/dynamicpb.NewMessageType].
|
||||||
//
|
//
|
||||||
// • A Message is a reflective view over a concrete message instance.
|
// • A [Message] is a reflective view over a concrete message instance.
|
||||||
// Generated messages implement ProtoMessage, which can convert to a Message.
|
// Generated messages implement [ProtoMessage], which can convert to a [Message].
|
||||||
// Just as how Go's reflect.Value is a reflective view over a Go value,
|
// Just as how Go's [reflect.Value] is a reflective view over a Go value,
|
||||||
// a Message is a reflective view over a concrete protobuf message instance.
|
// a [Message] is a reflective view over a concrete protobuf message instance.
|
||||||
// Using Go reflection as an analogy, the ProtoReflect method is similar to
|
// Using Go reflection as an analogy, the [ProtoMessage.ProtoReflect] method is similar to
|
||||||
// calling reflect.ValueOf, and the Message.Interface method is similar to
|
// calling [reflect.ValueOf], and the [Message.Interface] method is similar to
|
||||||
// calling reflect.Value.Interface.
|
// calling [reflect.Value.Interface].
|
||||||
//
|
//
|
||||||
// ┌── TypeDescriptor() ──┐ ┌───── Descriptor() ─────┐
|
// ┌── TypeDescriptor() ──┐ ┌───── Descriptor() ─────┐
|
||||||
// │ V │ V
|
// │ V │ V
|
||||||
|
@ -119,15 +121,15 @@
|
||||||
// │ │
|
// │ │
|
||||||
// └────── implements ────────┘
|
// └────── implements ────────┘
|
||||||
//
|
//
|
||||||
// • An ExtensionType describes a concrete Go implementation of an extension.
|
// • An [ExtensionType] describes a concrete Go implementation of an extension.
|
||||||
// It has an ExtensionTypeDescriptor and can convert to/from
|
// It has an [ExtensionTypeDescriptor] and can convert to/from
|
||||||
// abstract Values and Go values.
|
// an abstract [Value] and a Go value.
|
||||||
//
|
//
|
||||||
// • An ExtensionTypeDescriptor is an ExtensionDescriptor
|
// • An [ExtensionTypeDescriptor] is an [ExtensionDescriptor]
|
||||||
// which also has an ExtensionType.
|
// which also has an [ExtensionType].
|
||||||
//
|
//
|
||||||
// • An ExtensionDescriptor describes an abstract protobuf extension field and
|
// • An [ExtensionDescriptor] describes an abstract protobuf extension field and
|
||||||
// may not always be an ExtensionTypeDescriptor.
|
// may not always be an [ExtensionTypeDescriptor].
|
||||||
package protoreflect
|
package protoreflect
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -142,7 +144,7 @@ type doNotImplement pragma.DoNotImplement
|
||||||
|
|
||||||
// ProtoMessage is the top-level interface that all proto messages implement.
|
// ProtoMessage is the top-level interface that all proto messages implement.
|
||||||
// This is declared in the protoreflect package to avoid a cyclic dependency;
|
// This is declared in the protoreflect package to avoid a cyclic dependency;
|
||||||
// use the proto.Message type instead, which aliases this type.
|
// use the [google.golang.org/protobuf/proto.Message] type instead, which aliases this type.
|
||||||
type ProtoMessage interface{ ProtoReflect() Message }
|
type ProtoMessage interface{ ProtoReflect() Message }
|
||||||
|
|
||||||
// Syntax is the language version of the proto file.
|
// Syntax is the language version of the proto file.
|
||||||
|
@ -151,8 +153,9 @@ type Syntax syntax
|
||||||
type syntax int8 // keep exact type opaque as the int type may change
|
type syntax int8 // keep exact type opaque as the int type may change
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Proto2 Syntax = 2
|
Proto2 Syntax = 2
|
||||||
Proto3 Syntax = 3
|
Proto3 Syntax = 3
|
||||||
|
Editions Syntax = 4
|
||||||
)
|
)
|
||||||
|
|
||||||
// IsValid reports whether the syntax is valid.
|
// IsValid reports whether the syntax is valid.
|
||||||
|
@ -172,6 +175,8 @@ func (s Syntax) String() string {
|
||||||
return "proto2"
|
return "proto2"
|
||||||
case Proto3:
|
case Proto3:
|
||||||
return "proto3"
|
return "proto3"
|
||||||
|
case Editions:
|
||||||
|
return "editions"
|
||||||
default:
|
default:
|
||||||
return fmt.Sprintf("<unknown:%d>", s)
|
return fmt.Sprintf("<unknown:%d>", s)
|
||||||
}
|
}
|
||||||
|
@ -436,7 +441,7 @@ type Names interface {
|
||||||
// FullName is a qualified name that uniquely identifies a proto declaration.
|
// FullName is a qualified name that uniquely identifies a proto declaration.
|
||||||
// A qualified name is the concatenation of the proto package along with the
|
// A qualified name is the concatenation of the proto package along with the
|
||||||
// fully-declared name (i.e., name of parent preceding the name of the child),
|
// fully-declared name (i.e., name of parent preceding the name of the child),
|
||||||
// with a '.' delimiter placed between each Name.
|
// with a '.' delimiter placed between each [Name].
|
||||||
//
|
//
|
||||||
// This should not have any leading or trailing dots.
|
// This should not have any leading or trailing dots.
|
||||||
type FullName string // e.g., "google.protobuf.Field.Kind"
|
type FullName string // e.g., "google.protobuf.Field.Kind"
|
||||||
|
@ -480,7 +485,7 @@ func isLetterDigit(c byte) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name returns the short name, which is the last identifier segment.
|
// Name returns the short name, which is the last identifier segment.
|
||||||
// A single segment FullName is the Name itself.
|
// A single segment FullName is the [Name] itself.
|
||||||
func (n FullName) Name() Name {
|
func (n FullName) Name() Name {
|
||||||
if i := strings.LastIndexByte(string(n), '.'); i >= 0 {
|
if i := strings.LastIndexByte(string(n), '.'); i >= 0 {
|
||||||
return Name(n[i+1:])
|
return Name(n[i+1:])
|
||||||
|
|
|
@ -35,7 +35,7 @@ func (p *SourcePath) appendFileDescriptorProto(b []byte) []byte {
|
||||||
b = p.appendSingularField(b, "source_code_info", (*SourcePath).appendSourceCodeInfo)
|
b = p.appendSingularField(b, "source_code_info", (*SourcePath).appendSourceCodeInfo)
|
||||||
case 12:
|
case 12:
|
||||||
b = p.appendSingularField(b, "syntax", nil)
|
b = p.appendSingularField(b, "syntax", nil)
|
||||||
case 13:
|
case 14:
|
||||||
b = p.appendSingularField(b, "edition", nil)
|
b = p.appendSingularField(b, "edition", nil)
|
||||||
}
|
}
|
||||||
return b
|
return b
|
||||||
|
@ -160,8 +160,6 @@ func (p *SourcePath) appendFileOptions(b []byte) []byte {
|
||||||
b = p.appendSingularField(b, "java_generic_services", nil)
|
b = p.appendSingularField(b, "java_generic_services", nil)
|
||||||
case 18:
|
case 18:
|
||||||
b = p.appendSingularField(b, "py_generic_services", nil)
|
b = p.appendSingularField(b, "py_generic_services", nil)
|
||||||
case 42:
|
|
||||||
b = p.appendSingularField(b, "php_generic_services", nil)
|
|
||||||
case 23:
|
case 23:
|
||||||
b = p.appendSingularField(b, "deprecated", nil)
|
b = p.appendSingularField(b, "deprecated", nil)
|
||||||
case 31:
|
case 31:
|
||||||
|
@ -180,6 +178,8 @@ func (p *SourcePath) appendFileOptions(b []byte) []byte {
|
||||||
b = p.appendSingularField(b, "php_metadata_namespace", nil)
|
b = p.appendSingularField(b, "php_metadata_namespace", nil)
|
||||||
case 45:
|
case 45:
|
||||||
b = p.appendSingularField(b, "ruby_package", nil)
|
b = p.appendSingularField(b, "ruby_package", nil)
|
||||||
|
case 50:
|
||||||
|
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||||
case 999:
|
case 999:
|
||||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||||
}
|
}
|
||||||
|
@ -240,6 +240,8 @@ func (p *SourcePath) appendMessageOptions(b []byte) []byte {
|
||||||
b = p.appendSingularField(b, "map_entry", nil)
|
b = p.appendSingularField(b, "map_entry", nil)
|
||||||
case 11:
|
case 11:
|
||||||
b = p.appendSingularField(b, "deprecated_legacy_json_field_conflicts", nil)
|
b = p.appendSingularField(b, "deprecated_legacy_json_field_conflicts", nil)
|
||||||
|
case 12:
|
||||||
|
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||||
case 999:
|
case 999:
|
||||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||||
}
|
}
|
||||||
|
@ -285,6 +287,8 @@ func (p *SourcePath) appendEnumOptions(b []byte) []byte {
|
||||||
b = p.appendSingularField(b, "deprecated", nil)
|
b = p.appendSingularField(b, "deprecated", nil)
|
||||||
case 6:
|
case 6:
|
||||||
b = p.appendSingularField(b, "deprecated_legacy_json_field_conflicts", nil)
|
b = p.appendSingularField(b, "deprecated_legacy_json_field_conflicts", nil)
|
||||||
|
case 7:
|
||||||
|
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||||
case 999:
|
case 999:
|
||||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||||
}
|
}
|
||||||
|
@ -330,6 +334,8 @@ func (p *SourcePath) appendServiceOptions(b []byte) []byte {
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
switch (*p)[0] {
|
switch (*p)[0] {
|
||||||
|
case 34:
|
||||||
|
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||||
case 33:
|
case 33:
|
||||||
b = p.appendSingularField(b, "deprecated", nil)
|
b = p.appendSingularField(b, "deprecated", nil)
|
||||||
case 999:
|
case 999:
|
||||||
|
@ -361,16 +367,39 @@ func (p *SourcePath) appendFieldOptions(b []byte) []byte {
|
||||||
b = p.appendSingularField(b, "debug_redact", nil)
|
b = p.appendSingularField(b, "debug_redact", nil)
|
||||||
case 17:
|
case 17:
|
||||||
b = p.appendSingularField(b, "retention", nil)
|
b = p.appendSingularField(b, "retention", nil)
|
||||||
case 18:
|
|
||||||
b = p.appendSingularField(b, "target", nil)
|
|
||||||
case 19:
|
case 19:
|
||||||
b = p.appendRepeatedField(b, "targets", nil)
|
b = p.appendRepeatedField(b, "targets", nil)
|
||||||
|
case 20:
|
||||||
|
b = p.appendRepeatedField(b, "edition_defaults", (*SourcePath).appendFieldOptions_EditionDefault)
|
||||||
|
case 21:
|
||||||
|
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||||
case 999:
|
case 999:
|
||||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||||
}
|
}
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *SourcePath) appendFeatureSet(b []byte) []byte {
|
||||||
|
if len(*p) == 0 {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
switch (*p)[0] {
|
||||||
|
case 1:
|
||||||
|
b = p.appendSingularField(b, "field_presence", nil)
|
||||||
|
case 2:
|
||||||
|
b = p.appendSingularField(b, "enum_type", nil)
|
||||||
|
case 3:
|
||||||
|
b = p.appendSingularField(b, "repeated_field_encoding", nil)
|
||||||
|
case 4:
|
||||||
|
b = p.appendSingularField(b, "utf8_validation", nil)
|
||||||
|
case 5:
|
||||||
|
b = p.appendSingularField(b, "message_encoding", nil)
|
||||||
|
case 6:
|
||||||
|
b = p.appendSingularField(b, "json_format", nil)
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
func (p *SourcePath) appendUninterpretedOption(b []byte) []byte {
|
func (p *SourcePath) appendUninterpretedOption(b []byte) []byte {
|
||||||
if len(*p) == 0 {
|
if len(*p) == 0 {
|
||||||
return b
|
return b
|
||||||
|
@ -422,6 +451,8 @@ func (p *SourcePath) appendExtensionRangeOptions(b []byte) []byte {
|
||||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||||
case 2:
|
case 2:
|
||||||
b = p.appendRepeatedField(b, "declaration", (*SourcePath).appendExtensionRangeOptions_Declaration)
|
b = p.appendRepeatedField(b, "declaration", (*SourcePath).appendExtensionRangeOptions_Declaration)
|
||||||
|
case 50:
|
||||||
|
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||||
case 3:
|
case 3:
|
||||||
b = p.appendSingularField(b, "verification", nil)
|
b = p.appendSingularField(b, "verification", nil)
|
||||||
}
|
}
|
||||||
|
@ -433,6 +464,8 @@ func (p *SourcePath) appendOneofOptions(b []byte) []byte {
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
switch (*p)[0] {
|
switch (*p)[0] {
|
||||||
|
case 1:
|
||||||
|
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||||
case 999:
|
case 999:
|
||||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||||
}
|
}
|
||||||
|
@ -446,6 +479,10 @@ func (p *SourcePath) appendEnumValueOptions(b []byte) []byte {
|
||||||
switch (*p)[0] {
|
switch (*p)[0] {
|
||||||
case 1:
|
case 1:
|
||||||
b = p.appendSingularField(b, "deprecated", nil)
|
b = p.appendSingularField(b, "deprecated", nil)
|
||||||
|
case 2:
|
||||||
|
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||||
|
case 3:
|
||||||
|
b = p.appendSingularField(b, "debug_redact", nil)
|
||||||
case 999:
|
case 999:
|
||||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||||
}
|
}
|
||||||
|
@ -461,12 +498,27 @@ func (p *SourcePath) appendMethodOptions(b []byte) []byte {
|
||||||
b = p.appendSingularField(b, "deprecated", nil)
|
b = p.appendSingularField(b, "deprecated", nil)
|
||||||
case 34:
|
case 34:
|
||||||
b = p.appendSingularField(b, "idempotency_level", nil)
|
b = p.appendSingularField(b, "idempotency_level", nil)
|
||||||
|
case 35:
|
||||||
|
b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
|
||||||
case 999:
|
case 999:
|
||||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||||
}
|
}
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *SourcePath) appendFieldOptions_EditionDefault(b []byte) []byte {
|
||||||
|
if len(*p) == 0 {
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
switch (*p)[0] {
|
||||||
|
case 3:
|
||||||
|
b = p.appendSingularField(b, "edition", nil)
|
||||||
|
case 2:
|
||||||
|
b = p.appendSingularField(b, "value", nil)
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
func (p *SourcePath) appendUninterpretedOption_NamePart(b []byte) []byte {
|
func (p *SourcePath) appendUninterpretedOption_NamePart(b []byte) []byte {
|
||||||
if len(*p) == 0 {
|
if len(*p) == 0 {
|
||||||
return b
|
return b
|
||||||
|
@ -491,8 +543,6 @@ func (p *SourcePath) appendExtensionRangeOptions_Declaration(b []byte) []byte {
|
||||||
b = p.appendSingularField(b, "full_name", nil)
|
b = p.appendSingularField(b, "full_name", nil)
|
||||||
case 3:
|
case 3:
|
||||||
b = p.appendSingularField(b, "type", nil)
|
b = p.appendSingularField(b, "type", nil)
|
||||||
case 4:
|
|
||||||
b = p.appendSingularField(b, "is_repeated", nil)
|
|
||||||
case 5:
|
case 5:
|
||||||
b = p.appendSingularField(b, "reserved", nil)
|
b = p.appendSingularField(b, "reserved", nil)
|
||||||
case 6:
|
case 6:
|
||||||
|
|
|
@ -12,7 +12,7 @@ package protoreflect
|
||||||
// exactly identical. However, it is possible for the same semantically
|
// exactly identical. However, it is possible for the same semantically
|
||||||
// identical proto type to be represented by multiple type descriptors.
|
// identical proto type to be represented by multiple type descriptors.
|
||||||
//
|
//
|
||||||
// For example, suppose we have t1 and t2 which are both MessageDescriptors.
|
// For example, suppose we have t1 and t2 which are both an [MessageDescriptor].
|
||||||
// If t1 == t2, then the types are definitely equal and all accessors return
|
// If t1 == t2, then the types are definitely equal and all accessors return
|
||||||
// the same information. However, if t1 != t2, then it is still possible that
|
// the same information. However, if t1 != t2, then it is still possible that
|
||||||
// they still represent the same proto type (e.g., t1.FullName == t2.FullName).
|
// they still represent the same proto type (e.g., t1.FullName == t2.FullName).
|
||||||
|
@ -115,7 +115,7 @@ type Descriptor interface {
|
||||||
// corresponds with the google.protobuf.FileDescriptorProto message.
|
// corresponds with the google.protobuf.FileDescriptorProto message.
|
||||||
//
|
//
|
||||||
// Top-level declarations:
|
// Top-level declarations:
|
||||||
// EnumDescriptor, MessageDescriptor, FieldDescriptor, and/or ServiceDescriptor.
|
// [EnumDescriptor], [MessageDescriptor], [FieldDescriptor], and/or [ServiceDescriptor].
|
||||||
type FileDescriptor interface {
|
type FileDescriptor interface {
|
||||||
Descriptor // Descriptor.FullName is identical to Package
|
Descriptor // Descriptor.FullName is identical to Package
|
||||||
|
|
||||||
|
@ -180,8 +180,8 @@ type FileImport struct {
|
||||||
// corresponds with the google.protobuf.DescriptorProto message.
|
// corresponds with the google.protobuf.DescriptorProto message.
|
||||||
//
|
//
|
||||||
// Nested declarations:
|
// Nested declarations:
|
||||||
// FieldDescriptor, OneofDescriptor, FieldDescriptor, EnumDescriptor,
|
// [FieldDescriptor], [OneofDescriptor], [FieldDescriptor], [EnumDescriptor],
|
||||||
// and/or MessageDescriptor.
|
// and/or [MessageDescriptor].
|
||||||
type MessageDescriptor interface {
|
type MessageDescriptor interface {
|
||||||
Descriptor
|
Descriptor
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ type MessageDescriptor interface {
|
||||||
ExtensionRanges() FieldRanges
|
ExtensionRanges() FieldRanges
|
||||||
// ExtensionRangeOptions returns the ith extension range options.
|
// ExtensionRangeOptions returns the ith extension range options.
|
||||||
//
|
//
|
||||||
// To avoid a dependency cycle, this method returns a proto.Message value,
|
// To avoid a dependency cycle, this method returns a proto.Message] value,
|
||||||
// which always contains a google.protobuf.ExtensionRangeOptions message.
|
// which always contains a google.protobuf.ExtensionRangeOptions message.
|
||||||
// This method returns a typed nil-pointer if no options are present.
|
// This method returns a typed nil-pointer if no options are present.
|
||||||
// The caller must import the descriptorpb package to use this.
|
// The caller must import the descriptorpb package to use this.
|
||||||
|
@ -231,9 +231,9 @@ type MessageDescriptor interface {
|
||||||
}
|
}
|
||||||
type isMessageDescriptor interface{ ProtoType(MessageDescriptor) }
|
type isMessageDescriptor interface{ ProtoType(MessageDescriptor) }
|
||||||
|
|
||||||
// MessageType encapsulates a MessageDescriptor with a concrete Go implementation.
|
// MessageType encapsulates a [MessageDescriptor] with a concrete Go implementation.
|
||||||
// It is recommended that implementations of this interface also implement the
|
// It is recommended that implementations of this interface also implement the
|
||||||
// MessageFieldTypes interface.
|
// [MessageFieldTypes] interface.
|
||||||
type MessageType interface {
|
type MessageType interface {
|
||||||
// New returns a newly allocated empty message.
|
// New returns a newly allocated empty message.
|
||||||
// It may return nil for synthetic messages representing a map entry.
|
// It may return nil for synthetic messages representing a map entry.
|
||||||
|
@ -249,19 +249,19 @@ type MessageType interface {
|
||||||
Descriptor() MessageDescriptor
|
Descriptor() MessageDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
// MessageFieldTypes extends a MessageType by providing type information
|
// MessageFieldTypes extends a [MessageType] by providing type information
|
||||||
// regarding enums and messages referenced by the message fields.
|
// regarding enums and messages referenced by the message fields.
|
||||||
type MessageFieldTypes interface {
|
type MessageFieldTypes interface {
|
||||||
MessageType
|
MessageType
|
||||||
|
|
||||||
// Enum returns the EnumType for the ith field in Descriptor.Fields.
|
// Enum returns the EnumType for the ith field in MessageDescriptor.Fields.
|
||||||
// It returns nil if the ith field is not an enum kind.
|
// It returns nil if the ith field is not an enum kind.
|
||||||
// It panics if out of bounds.
|
// It panics if out of bounds.
|
||||||
//
|
//
|
||||||
// Invariant: mt.Enum(i).Descriptor() == mt.Descriptor().Fields(i).Enum()
|
// Invariant: mt.Enum(i).Descriptor() == mt.Descriptor().Fields(i).Enum()
|
||||||
Enum(i int) EnumType
|
Enum(i int) EnumType
|
||||||
|
|
||||||
// Message returns the MessageType for the ith field in Descriptor.Fields.
|
// Message returns the MessageType for the ith field in MessageDescriptor.Fields.
|
||||||
// It returns nil if the ith field is not a message or group kind.
|
// It returns nil if the ith field is not a message or group kind.
|
||||||
// It panics if out of bounds.
|
// It panics if out of bounds.
|
||||||
//
|
//
|
||||||
|
@ -286,8 +286,8 @@ type MessageDescriptors interface {
|
||||||
// corresponds with the google.protobuf.FieldDescriptorProto message.
|
// corresponds with the google.protobuf.FieldDescriptorProto message.
|
||||||
//
|
//
|
||||||
// It is used for both normal fields defined within the parent message
|
// It is used for both normal fields defined within the parent message
|
||||||
// (e.g., MessageDescriptor.Fields) and fields that extend some remote message
|
// (e.g., [MessageDescriptor.Fields]) and fields that extend some remote message
|
||||||
// (e.g., FileDescriptor.Extensions or MessageDescriptor.Extensions).
|
// (e.g., [FileDescriptor.Extensions] or [MessageDescriptor.Extensions]).
|
||||||
type FieldDescriptor interface {
|
type FieldDescriptor interface {
|
||||||
Descriptor
|
Descriptor
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ type FieldDescriptor interface {
|
||||||
// IsMap reports whether this field represents a map,
|
// IsMap reports whether this field represents a map,
|
||||||
// where the value type for the associated field is a Map.
|
// where the value type for the associated field is a Map.
|
||||||
// It is equivalent to checking whether Cardinality is Repeated,
|
// It is equivalent to checking whether Cardinality is Repeated,
|
||||||
// that the Kind is MessageKind, and that Message.IsMapEntry reports true.
|
// that the Kind is MessageKind, and that MessageDescriptor.IsMapEntry reports true.
|
||||||
IsMap() bool
|
IsMap() bool
|
||||||
|
|
||||||
// MapKey returns the field descriptor for the key in the map entry.
|
// MapKey returns the field descriptor for the key in the map entry.
|
||||||
|
@ -419,7 +419,7 @@ type OneofDescriptor interface {
|
||||||
|
|
||||||
// IsSynthetic reports whether this is a synthetic oneof created to support
|
// IsSynthetic reports whether this is a synthetic oneof created to support
|
||||||
// proto3 optional semantics. If true, Fields contains exactly one field
|
// proto3 optional semantics. If true, Fields contains exactly one field
|
||||||
// with HasOptionalKeyword specified.
|
// with FieldDescriptor.HasOptionalKeyword specified.
|
||||||
IsSynthetic() bool
|
IsSynthetic() bool
|
||||||
|
|
||||||
// Fields is a list of fields belonging to this oneof.
|
// Fields is a list of fields belonging to this oneof.
|
||||||
|
@ -442,10 +442,10 @@ type OneofDescriptors interface {
|
||||||
doNotImplement
|
doNotImplement
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExtensionDescriptor is an alias of FieldDescriptor for documentation.
|
// ExtensionDescriptor is an alias of [FieldDescriptor] for documentation.
|
||||||
type ExtensionDescriptor = FieldDescriptor
|
type ExtensionDescriptor = FieldDescriptor
|
||||||
|
|
||||||
// ExtensionTypeDescriptor is an ExtensionDescriptor with an associated ExtensionType.
|
// ExtensionTypeDescriptor is an [ExtensionDescriptor] with an associated [ExtensionType].
|
||||||
type ExtensionTypeDescriptor interface {
|
type ExtensionTypeDescriptor interface {
|
||||||
ExtensionDescriptor
|
ExtensionDescriptor
|
||||||
|
|
||||||
|
@ -470,12 +470,12 @@ type ExtensionDescriptors interface {
|
||||||
doNotImplement
|
doNotImplement
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExtensionType encapsulates an ExtensionDescriptor with a concrete
|
// ExtensionType encapsulates an [ExtensionDescriptor] with a concrete
|
||||||
// Go implementation. The nested field descriptor must be for a extension field.
|
// Go implementation. The nested field descriptor must be for a extension field.
|
||||||
//
|
//
|
||||||
// While a normal field is a member of the parent message that it is declared
|
// While a normal field is a member of the parent message that it is declared
|
||||||
// within (see Descriptor.Parent), an extension field is a member of some other
|
// within (see [Descriptor.Parent]), an extension field is a member of some other
|
||||||
// target message (see ExtensionDescriptor.Extendee) and may have no
|
// target message (see [FieldDescriptor.ContainingMessage]) and may have no
|
||||||
// relationship with the parent. However, the full name of an extension field is
|
// relationship with the parent. However, the full name of an extension field is
|
||||||
// relative to the parent that it is declared within.
|
// relative to the parent that it is declared within.
|
||||||
//
|
//
|
||||||
|
@ -532,7 +532,7 @@ type ExtensionType interface {
|
||||||
// corresponds with the google.protobuf.EnumDescriptorProto message.
|
// corresponds with the google.protobuf.EnumDescriptorProto message.
|
||||||
//
|
//
|
||||||
// Nested declarations:
|
// Nested declarations:
|
||||||
// EnumValueDescriptor.
|
// [EnumValueDescriptor].
|
||||||
type EnumDescriptor interface {
|
type EnumDescriptor interface {
|
||||||
Descriptor
|
Descriptor
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ type EnumDescriptor interface {
|
||||||
}
|
}
|
||||||
type isEnumDescriptor interface{ ProtoType(EnumDescriptor) }
|
type isEnumDescriptor interface{ ProtoType(EnumDescriptor) }
|
||||||
|
|
||||||
// EnumType encapsulates an EnumDescriptor with a concrete Go implementation.
|
// EnumType encapsulates an [EnumDescriptor] with a concrete Go implementation.
|
||||||
type EnumType interface {
|
type EnumType interface {
|
||||||
// New returns an instance of this enum type with its value set to n.
|
// New returns an instance of this enum type with its value set to n.
|
||||||
New(n EnumNumber) Enum
|
New(n EnumNumber) Enum
|
||||||
|
@ -610,7 +610,7 @@ type EnumValueDescriptors interface {
|
||||||
// ServiceDescriptor describes a service and
|
// ServiceDescriptor describes a service and
|
||||||
// corresponds with the google.protobuf.ServiceDescriptorProto message.
|
// corresponds with the google.protobuf.ServiceDescriptorProto message.
|
||||||
//
|
//
|
||||||
// Nested declarations: MethodDescriptor.
|
// Nested declarations: [MethodDescriptor].
|
||||||
type ServiceDescriptor interface {
|
type ServiceDescriptor interface {
|
||||||
Descriptor
|
Descriptor
|
||||||
|
|
||||||
|
|
|
@ -27,16 +27,16 @@ type Enum interface {
|
||||||
// Message is a reflective interface for a concrete message value,
|
// Message is a reflective interface for a concrete message value,
|
||||||
// encapsulating both type and value information for the message.
|
// encapsulating both type and value information for the message.
|
||||||
//
|
//
|
||||||
// Accessor/mutators for individual fields are keyed by FieldDescriptor.
|
// Accessor/mutators for individual fields are keyed by [FieldDescriptor].
|
||||||
// For non-extension fields, the descriptor must exactly match the
|
// For non-extension fields, the descriptor must exactly match the
|
||||||
// field known by the parent message.
|
// field known by the parent message.
|
||||||
// For extension fields, the descriptor must implement ExtensionTypeDescriptor,
|
// For extension fields, the descriptor must implement [ExtensionTypeDescriptor],
|
||||||
// extend the parent message (i.e., have the same message FullName), and
|
// extend the parent message (i.e., have the same message [FullName]), and
|
||||||
// be within the parent's extension range.
|
// be within the parent's extension range.
|
||||||
//
|
//
|
||||||
// Each field Value can be a scalar or a composite type (Message, List, or Map).
|
// Each field [Value] can be a scalar or a composite type ([Message], [List], or [Map]).
|
||||||
// See Value for the Go types associated with a FieldDescriptor.
|
// See [Value] for the Go types associated with a [FieldDescriptor].
|
||||||
// Providing a Value that is invalid or of an incorrect type panics.
|
// Providing a [Value] that is invalid or of an incorrect type panics.
|
||||||
type Message interface {
|
type Message interface {
|
||||||
// Descriptor returns message descriptor, which contains only the protobuf
|
// Descriptor returns message descriptor, which contains only the protobuf
|
||||||
// type information for the message.
|
// type information for the message.
|
||||||
|
@ -152,7 +152,7 @@ type Message interface {
|
||||||
// This method may return nil.
|
// This method may return nil.
|
||||||
//
|
//
|
||||||
// The returned methods type is identical to
|
// The returned methods type is identical to
|
||||||
// "google.golang.org/protobuf/runtime/protoiface".Methods.
|
// google.golang.org/protobuf/runtime/protoiface.Methods.
|
||||||
// Consult the protoiface package documentation for details.
|
// Consult the protoiface package documentation for details.
|
||||||
ProtoMethods() *methods
|
ProtoMethods() *methods
|
||||||
}
|
}
|
||||||
|
@ -175,8 +175,8 @@ func (b RawFields) IsValid() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// List is a zero-indexed, ordered list.
|
// List is a zero-indexed, ordered list.
|
||||||
// The element Value type is determined by FieldDescriptor.Kind.
|
// The element [Value] type is determined by [FieldDescriptor.Kind].
|
||||||
// Providing a Value that is invalid or of an incorrect type panics.
|
// Providing a [Value] that is invalid or of an incorrect type panics.
|
||||||
type List interface {
|
type List interface {
|
||||||
// Len reports the number of entries in the List.
|
// Len reports the number of entries in the List.
|
||||||
// Get, Set, and Truncate panic with out of bound indexes.
|
// Get, Set, and Truncate panic with out of bound indexes.
|
||||||
|
@ -226,9 +226,9 @@ type List interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map is an unordered, associative map.
|
// Map is an unordered, associative map.
|
||||||
// The entry MapKey type is determined by FieldDescriptor.MapKey.Kind.
|
// The entry [MapKey] type is determined by [FieldDescriptor.MapKey].Kind.
|
||||||
// The entry Value type is determined by FieldDescriptor.MapValue.Kind.
|
// The entry [Value] type is determined by [FieldDescriptor.MapValue].Kind.
|
||||||
// Providing a MapKey or Value that is invalid or of an incorrect type panics.
|
// Providing a [MapKey] or [Value] that is invalid or of an incorrect type panics.
|
||||||
type Map interface {
|
type Map interface {
|
||||||
// Len reports the number of elements in the map.
|
// Len reports the number of elements in the map.
|
||||||
Len() int
|
Len() int
|
||||||
|
|
|
@ -24,19 +24,19 @@ import (
|
||||||
// Unlike the == operator, a NaN is equal to another NaN.
|
// Unlike the == operator, a NaN is equal to another NaN.
|
||||||
//
|
//
|
||||||
// - Enums are equal if they contain the same number.
|
// - Enums are equal if they contain the same number.
|
||||||
// Since Value does not contain an enum descriptor,
|
// Since [Value] does not contain an enum descriptor,
|
||||||
// enum values do not consider the type of the enum.
|
// enum values do not consider the type of the enum.
|
||||||
//
|
//
|
||||||
// - Other scalar values are equal if they contain the same value.
|
// - Other scalar values are equal if they contain the same value.
|
||||||
//
|
//
|
||||||
// - Message values are equal if they belong to the same message descriptor,
|
// - [Message] values are equal if they belong to the same message descriptor,
|
||||||
// have the same set of populated known and extension field values,
|
// have the same set of populated known and extension field values,
|
||||||
// and the same set of unknown fields values.
|
// and the same set of unknown fields values.
|
||||||
//
|
//
|
||||||
// - Lists are equal if they are the same length and
|
// - [List] values are equal if they are the same length and
|
||||||
// each corresponding element is equal.
|
// each corresponding element is equal.
|
||||||
//
|
//
|
||||||
// - Maps are equal if they have the same set of keys and
|
// - [Map] values are equal if they have the same set of keys and
|
||||||
// the corresponding value for each key is equal.
|
// the corresponding value for each key is equal.
|
||||||
func (v1 Value) Equal(v2 Value) bool {
|
func (v1 Value) Equal(v2 Value) bool {
|
||||||
return equalValue(v1, v2)
|
return equalValue(v1, v2)
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
// Value is a union where only one Go type may be set at a time.
|
// Value is a union where only one Go type may be set at a time.
|
||||||
// The Value is used to represent all possible values a field may take.
|
// The Value is used to represent all possible values a field may take.
|
||||||
// The following shows which Go type is used to represent each proto Kind:
|
// The following shows which Go type is used to represent each proto [Kind]:
|
||||||
//
|
//
|
||||||
// ╔════════════╤═════════════════════════════════════╗
|
// ╔════════════╤═════════════════════════════════════╗
|
||||||
// ║ Go type │ Protobuf kind ║
|
// ║ Go type │ Protobuf kind ║
|
||||||
|
@ -31,22 +31,22 @@ import (
|
||||||
//
|
//
|
||||||
// Multiple protobuf Kinds may be represented by a single Go type if the type
|
// Multiple protobuf Kinds may be represented by a single Go type if the type
|
||||||
// can losslessly represent the information for the proto kind. For example,
|
// can losslessly represent the information for the proto kind. For example,
|
||||||
// Int64Kind, Sint64Kind, and Sfixed64Kind are all represented by int64,
|
// [Int64Kind], [Sint64Kind], and [Sfixed64Kind] are all represented by int64,
|
||||||
// but use different integer encoding methods.
|
// but use different integer encoding methods.
|
||||||
//
|
//
|
||||||
// The List or Map types are used if the field cardinality is repeated.
|
// The [List] or [Map] types are used if the field cardinality is repeated.
|
||||||
// A field is a List if FieldDescriptor.IsList reports true.
|
// A field is a [List] if [FieldDescriptor.IsList] reports true.
|
||||||
// A field is a Map if FieldDescriptor.IsMap reports true.
|
// A field is a [Map] if [FieldDescriptor.IsMap] reports true.
|
||||||
//
|
//
|
||||||
// Converting to/from a Value and a concrete Go value panics on type mismatch.
|
// Converting to/from a Value and a concrete Go value panics on type mismatch.
|
||||||
// For example, ValueOf("hello").Int() panics because this attempts to
|
// For example, [ValueOf]("hello").Int() panics because this attempts to
|
||||||
// retrieve an int64 from a string.
|
// retrieve an int64 from a string.
|
||||||
//
|
//
|
||||||
// List, Map, and Message Values are called "composite" values.
|
// [List], [Map], and [Message] Values are called "composite" values.
|
||||||
//
|
//
|
||||||
// A composite Value may alias (reference) memory at some location,
|
// A composite Value may alias (reference) memory at some location,
|
||||||
// such that changes to the Value updates the that location.
|
// such that changes to the Value updates the that location.
|
||||||
// A composite value acquired with a Mutable method, such as Message.Mutable,
|
// A composite value acquired with a Mutable method, such as [Message.Mutable],
|
||||||
// always references the source object.
|
// always references the source object.
|
||||||
//
|
//
|
||||||
// For example:
|
// For example:
|
||||||
|
@ -65,7 +65,7 @@ import (
|
||||||
// // appending to the List here may or may not modify the message.
|
// // appending to the List here may or may not modify the message.
|
||||||
// list.Append(protoreflect.ValueOfInt32(0))
|
// list.Append(protoreflect.ValueOfInt32(0))
|
||||||
//
|
//
|
||||||
// Some operations, such as Message.Get, may return an "empty, read-only"
|
// Some operations, such as [Message.Get], may return an "empty, read-only"
|
||||||
// composite Value. Modifying an empty, read-only value panics.
|
// composite Value. Modifying an empty, read-only value panics.
|
||||||
type Value value
|
type Value value
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ func (v Value) Float() float64 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns v as a string. Since this method implements fmt.Stringer,
|
// String returns v as a string. Since this method implements [fmt.Stringer],
|
||||||
// this returns the formatted string value for any non-string type.
|
// this returns the formatted string value for any non-string type.
|
||||||
func (v Value) String() string {
|
func (v Value) String() string {
|
||||||
switch v.typ {
|
switch v.typ {
|
||||||
|
@ -327,7 +327,7 @@ func (v Value) Bytes() []byte {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enum returns v as a EnumNumber and panics if the type is not a EnumNumber.
|
// Enum returns v as a [EnumNumber] and panics if the type is not a [EnumNumber].
|
||||||
func (v Value) Enum() EnumNumber {
|
func (v Value) Enum() EnumNumber {
|
||||||
switch v.typ {
|
switch v.typ {
|
||||||
case enumType:
|
case enumType:
|
||||||
|
@ -337,7 +337,7 @@ func (v Value) Enum() EnumNumber {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Message returns v as a Message and panics if the type is not a Message.
|
// Message returns v as a [Message] and panics if the type is not a [Message].
|
||||||
func (v Value) Message() Message {
|
func (v Value) Message() Message {
|
||||||
switch vi := v.getIface().(type) {
|
switch vi := v.getIface().(type) {
|
||||||
case Message:
|
case Message:
|
||||||
|
@ -347,7 +347,7 @@ func (v Value) Message() Message {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List returns v as a List and panics if the type is not a List.
|
// List returns v as a [List] and panics if the type is not a [List].
|
||||||
func (v Value) List() List {
|
func (v Value) List() List {
|
||||||
switch vi := v.getIface().(type) {
|
switch vi := v.getIface().(type) {
|
||||||
case List:
|
case List:
|
||||||
|
@ -357,7 +357,7 @@ func (v Value) List() List {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map returns v as a Map and panics if the type is not a Map.
|
// Map returns v as a [Map] and panics if the type is not a [Map].
|
||||||
func (v Value) Map() Map {
|
func (v Value) Map() Map {
|
||||||
switch vi := v.getIface().(type) {
|
switch vi := v.getIface().(type) {
|
||||||
case Map:
|
case Map:
|
||||||
|
@ -367,7 +367,7 @@ func (v Value) Map() Map {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MapKey returns v as a MapKey and panics for invalid MapKey types.
|
// MapKey returns v as a [MapKey] and panics for invalid [MapKey] types.
|
||||||
func (v Value) MapKey() MapKey {
|
func (v Value) MapKey() MapKey {
|
||||||
switch v.typ {
|
switch v.typ {
|
||||||
case boolType, int32Type, int64Type, uint32Type, uint64Type, stringType:
|
case boolType, int32Type, int64Type, uint32Type, uint64Type, stringType:
|
||||||
|
@ -378,8 +378,8 @@ func (v Value) MapKey() MapKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MapKey is used to index maps, where the Go type of the MapKey must match
|
// MapKey is used to index maps, where the Go type of the MapKey must match
|
||||||
// the specified key Kind (see MessageDescriptor.IsMapEntry).
|
// the specified key [Kind] (see [MessageDescriptor.IsMapEntry]).
|
||||||
// The following shows what Go type is used to represent each proto Kind:
|
// The following shows what Go type is used to represent each proto [Kind]:
|
||||||
//
|
//
|
||||||
// ╔═════════╤═════════════════════════════════════╗
|
// ╔═════════╤═════════════════════════════════════╗
|
||||||
// ║ Go type │ Protobuf kind ║
|
// ║ Go type │ Protobuf kind ║
|
||||||
|
@ -392,13 +392,13 @@ func (v Value) MapKey() MapKey {
|
||||||
// ║ string │ StringKind ║
|
// ║ string │ StringKind ║
|
||||||
// ╚═════════╧═════════════════════════════════════╝
|
// ╚═════════╧═════════════════════════════════════╝
|
||||||
//
|
//
|
||||||
// A MapKey is constructed and accessed through a Value:
|
// A MapKey is constructed and accessed through a [Value]:
|
||||||
//
|
//
|
||||||
// k := ValueOf("hash").MapKey() // convert string to MapKey
|
// k := ValueOf("hash").MapKey() // convert string to MapKey
|
||||||
// s := k.String() // convert MapKey to string
|
// s := k.String() // convert MapKey to string
|
||||||
//
|
//
|
||||||
// The MapKey is a strict subset of valid types used in Value;
|
// The MapKey is a strict subset of valid types used in [Value];
|
||||||
// converting a Value to a MapKey with an invalid type panics.
|
// converting a [Value] to a MapKey with an invalid type panics.
|
||||||
type MapKey value
|
type MapKey value
|
||||||
|
|
||||||
// IsValid reports whether k is populated with a value.
|
// IsValid reports whether k is populated with a value.
|
||||||
|
@ -426,13 +426,13 @@ func (k MapKey) Uint() uint64 {
|
||||||
return Value(k).Uint()
|
return Value(k).Uint()
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns k as a string. Since this method implements fmt.Stringer,
|
// String returns k as a string. Since this method implements [fmt.Stringer],
|
||||||
// this returns the formatted string value for any non-string type.
|
// this returns the formatted string value for any non-string type.
|
||||||
func (k MapKey) String() string {
|
func (k MapKey) String() string {
|
||||||
return Value(k).String()
|
return Value(k).String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Value returns k as a Value.
|
// Value returns k as a [Value].
|
||||||
func (k MapKey) Value() Value {
|
func (k MapKey) Value() Value {
|
||||||
return Value(k)
|
return Value(k)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build !purego && !appengine
|
//go:build !purego && !appengine && !go1.21
|
||||||
// +build !purego,!appengine
|
// +build !purego,!appengine,!go1.21
|
||||||
|
|
||||||
package protoreflect
|
package protoreflect
|
||||||
|
|
87
vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go
generated
vendored
Normal file
87
vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
// Copyright 2018 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !purego && !appengine && go1.21
|
||||||
|
// +build !purego,!appengine,go1.21
|
||||||
|
|
||||||
|
package protoreflect
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/internal/pragma"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
ifaceHeader struct {
|
||||||
|
_ [0]interface{} // if interfaces have greater alignment than unsafe.Pointer, this will enforce it.
|
||||||
|
Type unsafe.Pointer
|
||||||
|
Data unsafe.Pointer
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
nilType = typeOf(nil)
|
||||||
|
boolType = typeOf(*new(bool))
|
||||||
|
int32Type = typeOf(*new(int32))
|
||||||
|
int64Type = typeOf(*new(int64))
|
||||||
|
uint32Type = typeOf(*new(uint32))
|
||||||
|
uint64Type = typeOf(*new(uint64))
|
||||||
|
float32Type = typeOf(*new(float32))
|
||||||
|
float64Type = typeOf(*new(float64))
|
||||||
|
stringType = typeOf(*new(string))
|
||||||
|
bytesType = typeOf(*new([]byte))
|
||||||
|
enumType = typeOf(*new(EnumNumber))
|
||||||
|
)
|
||||||
|
|
||||||
|
// typeOf returns a pointer to the Go type information.
|
||||||
|
// The pointer is comparable and equal if and only if the types are identical.
|
||||||
|
func typeOf(t interface{}) unsafe.Pointer {
|
||||||
|
return (*ifaceHeader)(unsafe.Pointer(&t)).Type
|
||||||
|
}
|
||||||
|
|
||||||
|
// value is a union where only one type can be represented at a time.
|
||||||
|
// The struct is 24B large on 64-bit systems and requires the minimum storage
|
||||||
|
// necessary to represent each possible type.
|
||||||
|
//
|
||||||
|
// The Go GC needs to be able to scan variables containing pointers.
|
||||||
|
// As such, pointers and non-pointers cannot be intermixed.
|
||||||
|
type value struct {
|
||||||
|
pragma.DoNotCompare // 0B
|
||||||
|
|
||||||
|
// typ stores the type of the value as a pointer to the Go type.
|
||||||
|
typ unsafe.Pointer // 8B
|
||||||
|
|
||||||
|
// ptr stores the data pointer for a String, Bytes, or interface value.
|
||||||
|
ptr unsafe.Pointer // 8B
|
||||||
|
|
||||||
|
// num stores a Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, or
|
||||||
|
// Enum value as a raw uint64.
|
||||||
|
//
|
||||||
|
// It is also used to store the length of a String or Bytes value;
|
||||||
|
// the capacity is ignored.
|
||||||
|
num uint64 // 8B
|
||||||
|
}
|
||||||
|
|
||||||
|
func valueOfString(v string) Value {
|
||||||
|
return Value{typ: stringType, ptr: unsafe.Pointer(unsafe.StringData(v)), num: uint64(len(v))}
|
||||||
|
}
|
||||||
|
func valueOfBytes(v []byte) Value {
|
||||||
|
return Value{typ: bytesType, ptr: unsafe.Pointer(unsafe.SliceData(v)), num: uint64(len(v))}
|
||||||
|
}
|
||||||
|
func valueOfIface(v interface{}) Value {
|
||||||
|
p := (*ifaceHeader)(unsafe.Pointer(&v))
|
||||||
|
return Value{typ: p.Type, ptr: p.Data}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v Value) getString() string {
|
||||||
|
return unsafe.String((*byte)(v.ptr), v.num)
|
||||||
|
}
|
||||||
|
func (v Value) getBytes() []byte {
|
||||||
|
return unsafe.Slice((*byte)(v.ptr), v.num)
|
||||||
|
}
|
||||||
|
func (v Value) getIface() (x interface{}) {
|
||||||
|
*(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr}
|
||||||
|
return x
|
||||||
|
}
|
|
@ -5,12 +5,12 @@
|
||||||
// Package protoregistry provides data structures to register and lookup
|
// Package protoregistry provides data structures to register and lookup
|
||||||
// protobuf descriptor types.
|
// protobuf descriptor types.
|
||||||
//
|
//
|
||||||
// The Files registry contains file descriptors and provides the ability
|
// The [Files] registry contains file descriptors and provides the ability
|
||||||
// to iterate over the files or lookup a specific descriptor within the files.
|
// to iterate over the files or lookup a specific descriptor within the files.
|
||||||
// Files only contains protobuf descriptors and has no understanding of Go
|
// [Files] only contains protobuf descriptors and has no understanding of Go
|
||||||
// type information that may be associated with each descriptor.
|
// type information that may be associated with each descriptor.
|
||||||
//
|
//
|
||||||
// The Types registry contains descriptor types for which there is a known
|
// The [Types] registry contains descriptor types for which there is a known
|
||||||
// Go type associated with that descriptor. It provides the ability to iterate
|
// Go type associated with that descriptor. It provides the ability to iterate
|
||||||
// over the registered types or lookup a type by name.
|
// over the registered types or lookup a type by name.
|
||||||
package protoregistry
|
package protoregistry
|
||||||
|
@ -218,7 +218,7 @@ func (r *Files) checkGenProtoConflict(path string) {
|
||||||
|
|
||||||
// FindDescriptorByName looks up a descriptor by the full name.
|
// FindDescriptorByName looks up a descriptor by the full name.
|
||||||
//
|
//
|
||||||
// This returns (nil, NotFound) if not found.
|
// This returns (nil, [NotFound]) if not found.
|
||||||
func (r *Files) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) {
|
func (r *Files) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) {
|
||||||
if r == nil {
|
if r == nil {
|
||||||
return nil, NotFound
|
return nil, NotFound
|
||||||
|
@ -310,7 +310,7 @@ func (s *nameSuffix) Pop() (name protoreflect.Name) {
|
||||||
|
|
||||||
// FindFileByPath looks up a file by the path.
|
// FindFileByPath looks up a file by the path.
|
||||||
//
|
//
|
||||||
// This returns (nil, NotFound) if not found.
|
// This returns (nil, [NotFound]) if not found.
|
||||||
// This returns an error if multiple files have the same path.
|
// This returns an error if multiple files have the same path.
|
||||||
func (r *Files) FindFileByPath(path string) (protoreflect.FileDescriptor, error) {
|
func (r *Files) FindFileByPath(path string) (protoreflect.FileDescriptor, error) {
|
||||||
if r == nil {
|
if r == nil {
|
||||||
|
@ -431,7 +431,7 @@ func rangeTopLevelDescriptors(fd protoreflect.FileDescriptor, f func(protoreflec
|
||||||
// A compliant implementation must deterministically return the same type
|
// A compliant implementation must deterministically return the same type
|
||||||
// if no error is encountered.
|
// if no error is encountered.
|
||||||
//
|
//
|
||||||
// The Types type implements this interface.
|
// The [Types] type implements this interface.
|
||||||
type MessageTypeResolver interface {
|
type MessageTypeResolver interface {
|
||||||
// FindMessageByName looks up a message by its full name.
|
// FindMessageByName looks up a message by its full name.
|
||||||
// E.g., "google.protobuf.Any"
|
// E.g., "google.protobuf.Any"
|
||||||
|
@ -451,7 +451,7 @@ type MessageTypeResolver interface {
|
||||||
// A compliant implementation must deterministically return the same type
|
// A compliant implementation must deterministically return the same type
|
||||||
// if no error is encountered.
|
// if no error is encountered.
|
||||||
//
|
//
|
||||||
// The Types type implements this interface.
|
// The [Types] type implements this interface.
|
||||||
type ExtensionTypeResolver interface {
|
type ExtensionTypeResolver interface {
|
||||||
// FindExtensionByName looks up a extension field by the field's full name.
|
// FindExtensionByName looks up a extension field by the field's full name.
|
||||||
// Note that this is the full name of the field as determined by
|
// Note that this is the full name of the field as determined by
|
||||||
|
@ -590,7 +590,7 @@ func (r *Types) register(kind string, desc protoreflect.Descriptor, typ interfac
|
||||||
// FindEnumByName looks up an enum by its full name.
|
// FindEnumByName looks up an enum by its full name.
|
||||||
// E.g., "google.protobuf.Field.Kind".
|
// E.g., "google.protobuf.Field.Kind".
|
||||||
//
|
//
|
||||||
// This returns (nil, NotFound) if not found.
|
// This returns (nil, [NotFound]) if not found.
|
||||||
func (r *Types) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumType, error) {
|
func (r *Types) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumType, error) {
|
||||||
if r == nil {
|
if r == nil {
|
||||||
return nil, NotFound
|
return nil, NotFound
|
||||||
|
@ -611,7 +611,7 @@ func (r *Types) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumTyp
|
||||||
// FindMessageByName looks up a message by its full name,
|
// FindMessageByName looks up a message by its full name,
|
||||||
// e.g. "google.protobuf.Any".
|
// e.g. "google.protobuf.Any".
|
||||||
//
|
//
|
||||||
// This returns (nil, NotFound) if not found.
|
// This returns (nil, [NotFound]) if not found.
|
||||||
func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) {
|
func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) {
|
||||||
if r == nil {
|
if r == nil {
|
||||||
return nil, NotFound
|
return nil, NotFound
|
||||||
|
@ -632,7 +632,7 @@ func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.M
|
||||||
// FindMessageByURL looks up a message by a URL identifier.
|
// FindMessageByURL looks up a message by a URL identifier.
|
||||||
// See documentation on google.protobuf.Any.type_url for the URL format.
|
// See documentation on google.protobuf.Any.type_url for the URL format.
|
||||||
//
|
//
|
||||||
// This returns (nil, NotFound) if not found.
|
// This returns (nil, [NotFound]) if not found.
|
||||||
func (r *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) {
|
func (r *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) {
|
||||||
// This function is similar to FindMessageByName but
|
// This function is similar to FindMessageByName but
|
||||||
// truncates anything before and including '/' in the URL.
|
// truncates anything before and including '/' in the URL.
|
||||||
|
@ -662,7 +662,7 @@ func (r *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) {
|
||||||
// where the extension is declared and is unrelated to the full name of the
|
// where the extension is declared and is unrelated to the full name of the
|
||||||
// message being extended.
|
// message being extended.
|
||||||
//
|
//
|
||||||
// This returns (nil, NotFound) if not found.
|
// This returns (nil, [NotFound]) if not found.
|
||||||
func (r *Types) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) {
|
func (r *Types) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) {
|
||||||
if r == nil {
|
if r == nil {
|
||||||
return nil, NotFound
|
return nil, NotFound
|
||||||
|
@ -703,7 +703,7 @@ func (r *Types) FindExtensionByName(field protoreflect.FullName) (protoreflect.E
|
||||||
// FindExtensionByNumber looks up a extension field by the field number
|
// FindExtensionByNumber looks up a extension field by the field number
|
||||||
// within some parent message, identified by full name.
|
// within some parent message, identified by full name.
|
||||||
//
|
//
|
||||||
// This returns (nil, NotFound) if not found.
|
// This returns (nil, [NotFound]) if not found.
|
||||||
func (r *Types) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) {
|
func (r *Types) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) {
|
||||||
if r == nil {
|
if r == nil {
|
||||||
return nil, NotFound
|
return nil, NotFound
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
177
vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go
generated
vendored
Normal file
177
vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go
generated
vendored
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2023 Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file or at
|
||||||
|
// https://developers.google.com/open-source/licenses/bsd
|
||||||
|
|
||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// source: reflect/protodesc/proto/go_features.proto
|
||||||
|
|
||||||
|
package proto
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
descriptorpb "google.golang.org/protobuf/types/descriptorpb"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GoFeatures struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
// Whether or not to generate the deprecated UnmarshalJSON method for enums.
|
||||||
|
LegacyUnmarshalJsonEnum *bool `protobuf:"varint,1,opt,name=legacy_unmarshal_json_enum,json=legacyUnmarshalJsonEnum" json:"legacy_unmarshal_json_enum,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GoFeatures) Reset() {
|
||||||
|
*x = GoFeatures{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_reflect_protodesc_proto_go_features_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GoFeatures) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GoFeatures) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GoFeatures) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_reflect_protodesc_proto_go_features_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use GoFeatures.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GoFeatures) Descriptor() ([]byte, []int) {
|
||||||
|
return file_reflect_protodesc_proto_go_features_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GoFeatures) GetLegacyUnmarshalJsonEnum() bool {
|
||||||
|
if x != nil && x.LegacyUnmarshalJsonEnum != nil {
|
||||||
|
return *x.LegacyUnmarshalJsonEnum
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_reflect_protodesc_proto_go_features_proto_extTypes = []protoimpl.ExtensionInfo{
|
||||||
|
{
|
||||||
|
ExtendedType: (*descriptorpb.FeatureSet)(nil),
|
||||||
|
ExtensionType: (*GoFeatures)(nil),
|
||||||
|
Field: 1002,
|
||||||
|
Name: "google.protobuf.go",
|
||||||
|
Tag: "bytes,1002,opt,name=go",
|
||||||
|
Filename: "reflect/protodesc/proto/go_features.proto",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extension fields to descriptorpb.FeatureSet.
|
||||||
|
var (
|
||||||
|
// optional google.protobuf.GoFeatures go = 1002;
|
||||||
|
E_Go = &file_reflect_protodesc_proto_go_features_proto_extTypes[0]
|
||||||
|
)
|
||||||
|
|
||||||
|
var File_reflect_protodesc_proto_go_features_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_reflect_protodesc_proto_go_features_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x29, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x64,
|
||||||
|
0x65, 0x73, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x5f, 0x66, 0x65, 0x61,
|
||||||
|
0x74, 0x75, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f,
|
||||||
|
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x1a, 0x20, 0x67, 0x6f,
|
||||||
|
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65,
|
||||||
|
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6a,
|
||||||
|
0x0a, 0x0a, 0x47, 0x6f, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x5c, 0x0a, 0x1a,
|
||||||
|
0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x5f, 0x75, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68, 0x61, 0x6c,
|
||||||
|
0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
|
||||||
|
0x42, 0x1f, 0x88, 0x01, 0x01, 0x98, 0x01, 0x06, 0xa2, 0x01, 0x09, 0x12, 0x04, 0x74, 0x72, 0x75,
|
||||||
|
0x65, 0x18, 0xe6, 0x07, 0xa2, 0x01, 0x0a, 0x12, 0x05, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x18, 0xe7,
|
||||||
|
0x07, 0x52, 0x17, 0x6c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x55, 0x6e, 0x6d, 0x61, 0x72, 0x73, 0x68,
|
||||||
|
0x61, 0x6c, 0x4a, 0x73, 0x6f, 0x6e, 0x45, 0x6e, 0x75, 0x6d, 0x3a, 0x49, 0x0a, 0x02, 0x67, 0x6f,
|
||||||
|
0x12, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||||
|
0x75, 0x66, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x74, 0x18, 0xea, 0x07,
|
||||||
|
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
|
||||||
|
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x47, 0x6f, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65,
|
||||||
|
0x73, 0x52, 0x02, 0x67, 0x6f, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
|
||||||
|
0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
|
0x62, 0x75, 0x66, 0x2f, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x64, 0x65, 0x73, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_reflect_protodesc_proto_go_features_proto_rawDescOnce sync.Once
|
||||||
|
file_reflect_protodesc_proto_go_features_proto_rawDescData = file_reflect_protodesc_proto_go_features_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_reflect_protodesc_proto_go_features_proto_rawDescGZIP() []byte {
|
||||||
|
file_reflect_protodesc_proto_go_features_proto_rawDescOnce.Do(func() {
|
||||||
|
file_reflect_protodesc_proto_go_features_proto_rawDescData = protoimpl.X.CompressGZIP(file_reflect_protodesc_proto_go_features_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_reflect_protodesc_proto_go_features_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_reflect_protodesc_proto_go_features_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
|
var file_reflect_protodesc_proto_go_features_proto_goTypes = []interface{}{
|
||||||
|
(*GoFeatures)(nil), // 0: google.protobuf.GoFeatures
|
||||||
|
(*descriptorpb.FeatureSet)(nil), // 1: google.protobuf.FeatureSet
|
||||||
|
}
|
||||||
|
var file_reflect_protodesc_proto_go_features_proto_depIdxs = []int32{
|
||||||
|
1, // 0: google.protobuf.go:extendee -> google.protobuf.FeatureSet
|
||||||
|
0, // 1: google.protobuf.go:type_name -> google.protobuf.GoFeatures
|
||||||
|
2, // [2:2] is the sub-list for method output_type
|
||||||
|
2, // [2:2] is the sub-list for method input_type
|
||||||
|
1, // [1:2] is the sub-list for extension type_name
|
||||||
|
0, // [0:1] is the sub-list for extension extendee
|
||||||
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_reflect_protodesc_proto_go_features_proto_init() }
|
||||||
|
func file_reflect_protodesc_proto_go_features_proto_init() {
|
||||||
|
if File_reflect_protodesc_proto_go_features_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_reflect_protodesc_proto_go_features_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*GoFeatures); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_reflect_protodesc_proto_go_features_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 1,
|
||||||
|
NumExtensions: 1,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_reflect_protodesc_proto_go_features_proto_goTypes,
|
||||||
|
DependencyIndexes: file_reflect_protodesc_proto_go_features_proto_depIdxs,
|
||||||
|
MessageInfos: file_reflect_protodesc_proto_go_features_proto_msgTypes,
|
||||||
|
ExtensionInfos: file_reflect_protodesc_proto_go_features_proto_extTypes,
|
||||||
|
}.Build()
|
||||||
|
File_reflect_protodesc_proto_go_features_proto = out.File
|
||||||
|
file_reflect_protodesc_proto_go_features_proto_rawDesc = nil
|
||||||
|
file_reflect_protodesc_proto_go_features_proto_goTypes = nil
|
||||||
|
file_reflect_protodesc_proto_go_features_proto_depIdxs = nil
|
||||||
|
}
|
28
vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.proto
generated
vendored
Normal file
28
vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.proto
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
// Protocol Buffers - Google's data interchange format
|
||||||
|
// Copyright 2023 Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file or at
|
||||||
|
// https://developers.google.com/open-source/licenses/bsd
|
||||||
|
|
||||||
|
syntax = "proto2";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
import "google/protobuf/descriptor.proto";
|
||||||
|
|
||||||
|
option go_package = "google.golang.org/protobuf/types/gofeaturespb";
|
||||||
|
|
||||||
|
extend google.protobuf.FeatureSet {
|
||||||
|
optional GoFeatures go = 1002;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GoFeatures {
|
||||||
|
// Whether or not to generate the deprecated UnmarshalJSON method for enums.
|
||||||
|
optional bool legacy_unmarshal_json_enum = 1 [
|
||||||
|
retention = RETENTION_RUNTIME,
|
||||||
|
targets = TARGET_TYPE_ENUM,
|
||||||
|
edition_defaults = { edition: EDITION_PROTO2, value: "true" },
|
||||||
|
edition_defaults = { edition: EDITION_PROTO3, value: "false" }
|
||||||
|
];
|
||||||
|
}
|
|
@ -237,7 +237,8 @@ type Any struct {
|
||||||
//
|
//
|
||||||
// Note: this functionality is not currently available in the official
|
// Note: this functionality is not currently available in the official
|
||||||
// protobuf release, and it is not used for type URLs beginning with
|
// protobuf release, and it is not used for type URLs beginning with
|
||||||
// type.googleapis.com.
|
// type.googleapis.com. As of May 2023, there are no widely used type server
|
||||||
|
// implementations and no plans to implement one.
|
||||||
//
|
//
|
||||||
// Schemes other than `http`, `https` (or the empty scheme) might be
|
// Schemes other than `http`, `https` (or the empty scheme) might be
|
||||||
// used with implementation specific semantics.
|
// used with implementation specific semantics.
|
||||||
|
|
|
@ -21,8 +21,8 @@ github.com/beorn7/perks/quantile
|
||||||
# github.com/cespare/xxhash/v2 v2.2.0
|
# github.com/cespare/xxhash/v2 v2.2.0
|
||||||
## explicit; go 1.11
|
## explicit; go 1.11
|
||||||
github.com/cespare/xxhash/v2
|
github.com/cespare/xxhash/v2
|
||||||
# github.com/containerd/containerd v1.7.13
|
# github.com/containerd/containerd v1.7.14
|
||||||
## explicit; go 1.19
|
## explicit; go 1.21
|
||||||
github.com/containerd/containerd/errdefs
|
github.com/containerd/containerd/errdefs
|
||||||
github.com/containerd/containerd/log
|
github.com/containerd/containerd/log
|
||||||
github.com/containerd/containerd/pkg/userns
|
github.com/containerd/containerd/pkg/userns
|
||||||
|
@ -53,7 +53,7 @@ github.com/docker/distribution/registry/client/transport
|
||||||
github.com/docker/distribution/registry/storage/cache
|
github.com/docker/distribution/registry/storage/cache
|
||||||
github.com/docker/distribution/registry/storage/cache/memory
|
github.com/docker/distribution/registry/storage/cache/memory
|
||||||
github.com/docker/distribution/uuid
|
github.com/docker/distribution/uuid
|
||||||
# github.com/docker/docker v26.0.0-rc2+incompatible
|
# github.com/docker/docker v26.0.0-rc2.0.20240316145409-70e46f2c7c2d+incompatible
|
||||||
## explicit
|
## explicit
|
||||||
github.com/docker/docker/api
|
github.com/docker/docker/api
|
||||||
github.com/docker/docker/api/types
|
github.com/docker/docker/api/types
|
||||||
|
@ -133,8 +133,8 @@ github.com/gogo/protobuf/proto
|
||||||
github.com/gogo/protobuf/protoc-gen-gogo/descriptor
|
github.com/gogo/protobuf/protoc-gen-gogo/descriptor
|
||||||
github.com/gogo/protobuf/sortkeys
|
github.com/gogo/protobuf/sortkeys
|
||||||
github.com/gogo/protobuf/types
|
github.com/gogo/protobuf/types
|
||||||
# github.com/golang/protobuf v1.5.3
|
# github.com/golang/protobuf v1.5.4
|
||||||
## explicit; go 1.9
|
## explicit; go 1.17
|
||||||
github.com/golang/protobuf/jsonpb
|
github.com/golang/protobuf/jsonpb
|
||||||
github.com/golang/protobuf/proto
|
github.com/golang/protobuf/proto
|
||||||
github.com/golang/protobuf/ptypes
|
github.com/golang/protobuf/ptypes
|
||||||
|
@ -418,14 +418,15 @@ google.golang.org/grpc/serviceconfig
|
||||||
google.golang.org/grpc/stats
|
google.golang.org/grpc/stats
|
||||||
google.golang.org/grpc/status
|
google.golang.org/grpc/status
|
||||||
google.golang.org/grpc/tap
|
google.golang.org/grpc/tap
|
||||||
# google.golang.org/protobuf v1.31.0
|
# google.golang.org/protobuf v1.33.0
|
||||||
## explicit; go 1.11
|
## explicit; go 1.17
|
||||||
google.golang.org/protobuf/encoding/protojson
|
google.golang.org/protobuf/encoding/protojson
|
||||||
google.golang.org/protobuf/encoding/prototext
|
google.golang.org/protobuf/encoding/prototext
|
||||||
google.golang.org/protobuf/encoding/protowire
|
google.golang.org/protobuf/encoding/protowire
|
||||||
google.golang.org/protobuf/internal/descfmt
|
google.golang.org/protobuf/internal/descfmt
|
||||||
google.golang.org/protobuf/internal/descopts
|
google.golang.org/protobuf/internal/descopts
|
||||||
google.golang.org/protobuf/internal/detrand
|
google.golang.org/protobuf/internal/detrand
|
||||||
|
google.golang.org/protobuf/internal/editiondefaults
|
||||||
google.golang.org/protobuf/internal/encoding/defval
|
google.golang.org/protobuf/internal/encoding/defval
|
||||||
google.golang.org/protobuf/internal/encoding/json
|
google.golang.org/protobuf/internal/encoding/json
|
||||||
google.golang.org/protobuf/internal/encoding/messageset
|
google.golang.org/protobuf/internal/encoding/messageset
|
||||||
|
@ -449,6 +450,7 @@ google.golang.org/protobuf/reflect/protoregistry
|
||||||
google.golang.org/protobuf/runtime/protoiface
|
google.golang.org/protobuf/runtime/protoiface
|
||||||
google.golang.org/protobuf/runtime/protoimpl
|
google.golang.org/protobuf/runtime/protoimpl
|
||||||
google.golang.org/protobuf/types/descriptorpb
|
google.golang.org/protobuf/types/descriptorpb
|
||||||
|
google.golang.org/protobuf/types/gofeaturespb
|
||||||
google.golang.org/protobuf/types/known/anypb
|
google.golang.org/protobuf/types/known/anypb
|
||||||
google.golang.org/protobuf/types/known/durationpb
|
google.golang.org/protobuf/types/known/durationpb
|
||||||
google.golang.org/protobuf/types/known/timestamppb
|
google.golang.org/protobuf/types/known/timestamppb
|
||||||
|
|
Loading…
Reference in New Issue