fix(codec): MarshalInterface should err when UnmarshalInterface will fail (#12964)

## Description

Closes: #12894 



---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules)
- [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [x] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
This commit is contained in:
Matt Kocubinski 2022-08-19 13:42:55 -05:00 committed by GitHub
parent f430528ebc
commit 28a7e33bc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 1009 additions and 118 deletions

View File

@ -109,6 +109,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (appModule) Remove `Route`, `QuerierRoute` and `LegacyQuerierHandler` from AppModule Interface.
* (x/modules) Remove all LegacyQueries and related code from modules
* (store) [#11825](https://github.com/cosmos/cosmos-sdk/pull/11825) Make extension snapshotter interface safer to use, renamed the util function `WriteExtensionItem` to `WriteExtensionPayload`.
* (codec) [#12964](https://github.com/cosmos/cosmos-sdk/pull/12964) `ProtoCodec.MarshalInterface` now returns an error when serializing unregistered types and a subsequent `ProtoCodec.UnmarshalInterface` would fail.
### CLI Breaking Changes

View File

@ -176,3 +176,7 @@ func (f failingInterfaceRegistry) ListAllInterfaces() []string {
func (f failingInterfaceRegistry) ListImplementations(ifaceTypeURL string) []string {
panic("cannot be called")
}
func (f failingInterfaceRegistry) EnsureRegistered(iface interface{}) error {
panic("cannot be called")
}

View File

@ -0,0 +1,31 @@
package client
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestFailingInterfaceRegistry(t *testing.T) {
reg := failingInterfaceRegistry{}
require.Error(t, reg.UnpackAny(nil, nil))
_, err := reg.Resolve("")
require.Error(t, err)
require.Panics(t, func() {
reg.RegisterInterface("", nil)
})
require.Panics(t, func() {
reg.RegisterImplementations(nil, nil)
})
require.Panics(t, func() {
reg.ListAllInterfaces()
})
require.Panics(t, func() {
reg.ListImplementations("")
})
require.Panics(t, func() {
reg.EnsureRegistered(nil)
})
}

View File

@ -26,35 +26,47 @@ func NewTestInterfaceRegistry() types.InterfaceRegistry {
}
func TestMarshalAny(t *testing.T) {
catRegistry := types.NewInterfaceRegistry()
catRegistry.RegisterImplementations((*testdata.Animal)(nil), &testdata.Cat{})
registry := types.NewInterfaceRegistry()
cdc := codec.NewProtoCodec(registry)
kitty := &testdata.Cat{Moniker: "Kitty"}
bz, err := cdc.MarshalInterface(kitty)
emptyBz, err := cdc.MarshalInterface(kitty)
require.ErrorContains(t, err, "does not have a registered interface")
catBz, err := codec.NewProtoCodec(catRegistry).MarshalInterface(kitty)
require.NoError(t, err)
require.NotEmpty(t, catBz)
var animal testdata.Animal
// empty registry should fail
err = cdc.UnmarshalInterface(bz, &animal)
require.Error(t, err)
// deserializing cat bytes should error in an empty registry
err = cdc.UnmarshalInterface(catBz, &animal)
require.ErrorContains(t, err, "no registered implementations of type testdata.Animal")
// deserializing an empty byte array will return nil, but no error
err = cdc.UnmarshalInterface(emptyBz, &animal)
require.Nil(t, animal)
require.NoError(t, err)
// wrong type registration should fail
registry.RegisterImplementations((*testdata.Animal)(nil), &testdata.Dog{})
err = cdc.UnmarshalInterface(bz, &animal)
err = cdc.UnmarshalInterface(catBz, &animal)
require.Error(t, err)
// should pass
registry = NewTestInterfaceRegistry()
cdc = codec.NewProtoCodec(registry)
err = cdc.UnmarshalInterface(bz, &animal)
err = cdc.UnmarshalInterface(catBz, &animal)
require.NoError(t, err)
require.Equal(t, kitty, animal)
// nil should fail
registry = NewTestInterfaceRegistry()
err = cdc.UnmarshalInterface(bz, nil)
err = cdc.UnmarshalInterface(catBz, nil)
require.Error(t, err)
}

View File

@ -194,6 +194,10 @@ func (pc *ProtoCodec) MarshalInterface(i gogoproto.Message) ([]byte, error) {
if err != nil {
return nil, err
}
err = pc.interfaceRegistry.EnsureRegistered(i)
if err != nil {
return nil, err
}
return pc.Marshal(any)
}

View File

@ -3,6 +3,7 @@ package codec_test
import (
"errors"
"fmt"
"reflect"
"testing"
"github.com/gogo/protobuf/proto"
@ -46,6 +47,70 @@ func (lpm *lyingProtoMarshaler) Size() int {
return lpm.falseSize
}
func TestEnsureRegistered(t *testing.T) {
interfaceRegistry := types.NewInterfaceRegistry()
cat := &testdata.Cat{Moniker: "Garfield"}
err := interfaceRegistry.EnsureRegistered(*cat)
require.ErrorContains(t, err, "testdata.Cat is not a pointer")
err = interfaceRegistry.EnsureRegistered(cat)
require.ErrorContains(t, err, "testdata.Cat does not have a registered interface")
interfaceRegistry.RegisterInterface("testdata.Animal",
(*testdata.Animal)(nil),
&testdata.Cat{},
)
require.NoError(t, interfaceRegistry.EnsureRegistered(cat))
}
func TestProtoCodecMarshal(t *testing.T) {
interfaceRegistry := types.NewInterfaceRegistry()
interfaceRegistry.RegisterInterface("testdata.Animal",
(*testdata.Animal)(nil),
&testdata.Cat{},
)
cdc := codec.NewProtoCodec(interfaceRegistry)
cartonRegistry := types.NewInterfaceRegistry()
cartonRegistry.RegisterInterface("testdata.Cartoon",
(*testdata.Cartoon)(nil),
&testdata.Bird{},
)
cartoonCdc := codec.NewProtoCodec(cartonRegistry)
cat := &testdata.Cat{Moniker: "Garfield", Lives: 6}
bird := &testdata.Bird{Species: "Passerina ciris"}
require.NoError(t, interfaceRegistry.EnsureRegistered(cat))
var (
animal testdata.Animal
cartoon testdata.Cartoon
)
// sanity check
require.True(t, reflect.TypeOf(cat).Implements(reflect.TypeOf((*testdata.Animal)(nil)).Elem()))
bz, err := cdc.MarshalInterface(cat)
require.NoError(t, err)
err = cdc.UnmarshalInterface(bz, &animal)
require.NoError(t, err)
bz, err = cdc.MarshalInterface(bird)
require.ErrorContains(t, err, "does not have a registered interface")
bz, err = cartoonCdc.MarshalInterface(bird)
require.NoError(t, err)
err = cdc.UnmarshalInterface(bz, &cartoon)
require.ErrorContains(t, err, "no registered implementations")
err = cartoonCdc.UnmarshalInterface(bz, &cartoon)
require.NoError(t, err)
}
func TestProtoCodecUnmarshalLengthPrefixedChecks(t *testing.T) {
cdc := codec.NewProtoCodec(createTestInterfaceRegistry())

View File

@ -52,6 +52,9 @@ type InterfaceRegistry interface {
// ListImplementations lists the valid type URLs for the given interface name that can be used
// for the provided interface type URL.
ListImplementations(ifaceTypeURL string) []string
// EnsureRegistered ensures there is a registered interface for the given concrete type.
EnsureRegistered(iface interface{}) error
}
// UnpackInterfacesMessage is meant to extend protobuf types (which implement
@ -81,6 +84,7 @@ type UnpackInterfacesMessage interface {
type interfaceRegistry struct {
interfaceNames map[string]reflect.Type
interfaceImpls map[reflect.Type]interfaceMap
implInterfaces map[reflect.Type]reflect.Type
typeURLMap map[string]reflect.Type
}
@ -91,6 +95,7 @@ func NewInterfaceRegistry() InterfaceRegistry {
return &interfaceRegistry{
interfaceNames: map[string]reflect.Type{},
interfaceImpls: map[reflect.Type]interfaceMap{},
implInterfaces: map[reflect.Type]reflect.Type{},
typeURLMap: map[string]reflect.Type{},
}
}
@ -100,10 +105,26 @@ func (registry *interfaceRegistry) RegisterInterface(protoName string, iface int
if typ.Elem().Kind() != reflect.Interface {
panic(fmt.Errorf("%T is not an interface type", iface))
}
registry.interfaceNames[protoName] = typ
registry.RegisterImplementations(iface, impls...)
}
// EnsureRegistered ensures there is a registered interface for the given concrete type.
//
// Returns an error if not, and nil if so.
func (registry *interfaceRegistry) EnsureRegistered(impl interface{}) error {
if reflect.ValueOf(impl).Kind() != reflect.Ptr {
return fmt.Errorf("%T is not a pointer", impl)
}
if _, found := registry.implInterfaces[reflect.TypeOf(impl)]; !found {
return fmt.Errorf("%T does not have a registered interface", impl)
}
return nil
}
// RegisterImplementations registers a concrete proto Message which implements
// the given interface.
//
@ -162,7 +183,7 @@ func (registry *interfaceRegistry) registerImpl(iface interface{}, typeURL strin
imap[typeURL] = implType
registry.typeURLMap[typeURL] = implType
registry.implInterfaces[implType] = ityp
registry.interfaceImpls[ityp] = imap
}

View File

@ -79,11 +79,15 @@ func (suite *PKSuite) TestMarshalProto() {
/**** test structure marshalling with codec ****/
pk = PubKey{}
emptyRegistry := types.NewInterfaceRegistry()
emptyCodec := codec.NewProtoCodec(emptyRegistry)
registry := types.NewInterfaceRegistry()
cdc := codec.NewProtoCodec(registry)
bz, err = cdc.Marshal(suite.pk)
RegisterInterfaces(registry)
pubkeyCodec := codec.NewProtoCodec(registry)
bz, err = emptyCodec.Marshal(suite.pk)
require.NoError(err)
require.NoError(cdc.Unmarshal(bz, &pk))
require.NoError(emptyCodec.Unmarshal(bz, &pk))
require.True(pk.Equals(suite.pk))
const bufSize = 100
@ -101,17 +105,17 @@ func (suite *PKSuite) TestMarshalProto() {
require.Equal(bz, bz2[(bufSize-pk.Size()):])
/**** test interface marshalling ****/
bz, err = cdc.MarshalInterface(suite.pk)
bz, err = pubkeyCodec.MarshalInterface(suite.pk)
require.NoError(err)
var pkI cryptotypes.PubKey
err = cdc.UnmarshalInterface(bz, &pkI)
err = emptyCodec.UnmarshalInterface(bz, &pkI)
require.EqualError(err, "no registered implementations of type types.PubKey")
RegisterInterfaces(registry)
require.NoError(cdc.UnmarshalInterface(bz, &pkI))
RegisterInterfaces(emptyRegistry)
require.NoError(emptyCodec.UnmarshalInterface(bz, &pkI))
require.True(pkI.Equals(suite.pk))
require.Error(cdc.UnmarshalInterface(bz, nil), "nil should fail")
require.Error(emptyCodec.UnmarshalInterface(bz, nil), "nil should fail")
}
func (suite *PKSuite) TestSize() {

View File

@ -9,12 +9,13 @@ github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmx
github.com/consensys/bavard v0.1.8-0.20210915155054-088da2f7f54a/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI=
github.com/consensys/gnark-crypto v0.5.3/go.mod h1:hOdPlWQV1gDLp7faZVeg8Y0iEPFaOUnCc4XeCCk96p0=
github.com/cosmos/cosmos-sdk/db v1.0.0-beta.1/go.mod h1:JUMM2MxF9wuwzRWZJjb8BjXsn1BmPmdBd3a75pIct4I=
github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA=
github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
github.com/ethereum/go-ethereum v1.10.19/go.mod h1:IJBNMtzKcNHPtllYihy6BL2IgK1u+32JriaTbdt4v+w=
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64=
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90 h1:WXb3TSNmHp2vHoCroCIB1foO/yQ36swABL8aOVeDpgg=
github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4=

View File

@ -17,10 +17,20 @@ type Animal interface {
Greet() string
}
func (c Cat) Greet() string {
type Cartoon interface {
proto.Message
Identify() string
}
func (c *Cat) Greet() string {
return fmt.Sprintf("Meow, my name is %s", c.Moniker)
}
func (c *Bird) Identify() string {
return "This is Tweety."
}
func (d Dog) Greet() string {
return fmt.Sprintf("Roof, my name is %s", d.Name)
}

View File

@ -128,6 +128,58 @@ func (m *Cat) GetLives() int32 {
return 0
}
type Bird struct {
Species string `protobuf:"bytes,1,opt,name=species,proto3" json:"species,omitempty"`
Color int32 `protobuf:"varint,2,opt,name=color,proto3" json:"color,omitempty"`
}
func (m *Bird) Reset() { *m = Bird{} }
func (m *Bird) String() string { return proto.CompactTextString(m) }
func (*Bird) ProtoMessage() {}
func (*Bird) Descriptor() ([]byte, []int) {
return fileDescriptor_40c4782d007dfce9, []int{2}
}
func (m *Bird) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Bird) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Bird.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Bird) XXX_Merge(src proto.Message) {
xxx_messageInfo_Bird.Merge(m, src)
}
func (m *Bird) XXX_Size() int {
return m.Size()
}
func (m *Bird) XXX_DiscardUnknown() {
xxx_messageInfo_Bird.DiscardUnknown(m)
}
var xxx_messageInfo_Bird proto.InternalMessageInfo
func (m *Bird) GetSpecies() string {
if m != nil {
return m.Species
}
return ""
}
func (m *Bird) GetColor() int32 {
if m != nil {
return m.Color
}
return 0
}
type HasAnimal struct {
Animal *types.Any `protobuf:"bytes,1,opt,name=animal,proto3" json:"animal,omitempty"`
X int64 `protobuf:"varint,2,opt,name=x,proto3" json:"x,omitempty"`
@ -137,7 +189,7 @@ func (m *HasAnimal) Reset() { *m = HasAnimal{} }
func (m *HasAnimal) String() string { return proto.CompactTextString(m) }
func (*HasAnimal) ProtoMessage() {}
func (*HasAnimal) Descriptor() ([]byte, []int) {
return fileDescriptor_40c4782d007dfce9, []int{2}
return fileDescriptor_40c4782d007dfce9, []int{3}
}
func (m *HasAnimal) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -188,7 +240,7 @@ func (m *HasHasAnimal) Reset() { *m = HasHasAnimal{} }
func (m *HasHasAnimal) String() string { return proto.CompactTextString(m) }
func (*HasHasAnimal) ProtoMessage() {}
func (*HasHasAnimal) Descriptor() ([]byte, []int) {
return fileDescriptor_40c4782d007dfce9, []int{3}
return fileDescriptor_40c4782d007dfce9, []int{4}
}
func (m *HasHasAnimal) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -232,7 +284,7 @@ func (m *HasHasHasAnimal) Reset() { *m = HasHasHasAnimal{} }
func (m *HasHasHasAnimal) String() string { return proto.CompactTextString(m) }
func (*HasHasHasAnimal) ProtoMessage() {}
func (*HasHasHasAnimal) Descriptor() ([]byte, []int) {
return fileDescriptor_40c4782d007dfce9, []int{4}
return fileDescriptor_40c4782d007dfce9, []int{5}
}
func (m *HasHasHasAnimal) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -279,7 +331,7 @@ func (m *BadMultiSignature) Reset() { *m = BadMultiSignature{} }
func (m *BadMultiSignature) String() string { return proto.CompactTextString(m) }
func (*BadMultiSignature) ProtoMessage() {}
func (*BadMultiSignature) Descriptor() ([]byte, []int) {
return fileDescriptor_40c4782d007dfce9, []int{5}
return fileDescriptor_40c4782d007dfce9, []int{6}
}
func (m *BadMultiSignature) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -333,7 +385,7 @@ func (m *TableModel) Reset() { *m = TableModel{} }
func (m *TableModel) String() string { return proto.CompactTextString(m) }
func (*TableModel) ProtoMessage() {}
func (*TableModel) Descriptor() ([]byte, []int) {
return fileDescriptor_40c4782d007dfce9, []int{6}
return fileDescriptor_40c4782d007dfce9, []int{7}
}
func (m *TableModel) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -393,6 +445,7 @@ func (m *TableModel) GetMetadata() []byte {
func init() {
proto.RegisterType((*Dog)(nil), "testdata.Dog")
proto.RegisterType((*Cat)(nil), "testdata.Cat")
proto.RegisterType((*Bird)(nil), "testdata.Bird")
proto.RegisterType((*HasAnimal)(nil), "testdata.HasAnimal")
proto.RegisterType((*HasHasAnimal)(nil), "testdata.HasHasAnimal")
proto.RegisterType((*HasHasHasAnimal)(nil), "testdata.HasHasHasAnimal")
@ -403,34 +456,35 @@ func init() {
func init() { proto.RegisterFile("testdata.proto", fileDescriptor_40c4782d007dfce9) }
var fileDescriptor_40c4782d007dfce9 = []byte{
// 419 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xb1, 0x6e, 0xdb, 0x30,
0x10, 0x35, 0x2d, 0xd9, 0x8d, 0xaf, 0x82, 0x82, 0x12, 0x46, 0xa1, 0x7a, 0x50, 0x0d, 0x2d, 0xf5,
0xd0, 0x48, 0x40, 0x83, 0x2e, 0xd9, 0x92, 0x14, 0xad, 0x17, 0x2f, 0x6a, 0xa7, 0x2e, 0x01, 0x65,
0x32, 0x12, 0x11, 0x52, 0x2c, 0x44, 0xaa, 0x48, 0xfa, 0x15, 0xfd, 0x85, 0xfe, 0x4d, 0x47, 0x8f,
0x1d, 0x0b, 0xfb, 0x47, 0x0a, 0x51, 0x92, 0xed, 0xa1, 0x83, 0x27, 0xbe, 0xf7, 0xee, 0xde, 0xe3,
0x81, 0x3c, 0xf0, 0x0d, 0xd3, 0x86, 0x12, 0x43, 0xe2, 0x6f, 0x95, 0x32, 0x0a, 0x9f, 0xf5, 0x7c,
0x36, 0xcd, 0x55, 0xae, 0xac, 0x98, 0x34, 0xa8, 0xad, 0xcf, 0x5e, 0xe5, 0x4a, 0xe5, 0x82, 0x25,
0x96, 0x65, 0xf5, 0x7d, 0x42, 0xca, 0xa7, 0xb6, 0x14, 0x5d, 0x80, 0xf3, 0x41, 0xe5, 0x18, 0x83,
0xab, 0xf9, 0x0f, 0x16, 0xa0, 0x39, 0x5a, 0x4c, 0x52, 0x8b, 0x1b, 0xad, 0x24, 0x92, 0x05, 0xc3,
0x56, 0x6b, 0x70, 0xf4, 0x1e, 0x9c, 0x5b, 0x62, 0x70, 0x00, 0xcf, 0xa4, 0x2a, 0xf9, 0x03, 0xab,
0x3a, 0x47, 0x4f, 0xf1, 0x14, 0x46, 0x82, 0x7f, 0x67, 0xda, 0xba, 0x46, 0x69, 0x4b, 0xa2, 0x4f,
0x30, 0x59, 0x12, 0x7d, 0x5d, 0x72, 0x49, 0x04, 0x7e, 0x0b, 0x63, 0x62, 0x91, 0xf5, 0x3e, 0x7f,
0x37, 0x8d, 0xdb, 0xf1, 0xe2, 0x7e, 0xbc, 0xf8, 0xba, 0x7c, 0x4a, 0xbb, 0x1e, 0xec, 0x01, 0x7a,
0xb4, 0x61, 0x4e, 0x8a, 0x1e, 0xa3, 0x5b, 0xf0, 0x96, 0x44, 0x1f, 0xb2, 0x2e, 0x01, 0x0a, 0xa2,
0xef, 0x4e, 0xc8, 0x9b, 0x14, 0xbd, 0x29, 0x5a, 0xc1, 0x79, 0x1b, 0x72, 0xc8, 0xb9, 0x02, 0xbf,
0xc9, 0x39, 0x31, 0xcb, 0x2b, 0x8e, 0xbc, 0x51, 0x06, 0x2f, 0x6e, 0x08, 0x5d, 0xd5, 0xc2, 0xf0,
0xcf, 0x3c, 0x2f, 0x89, 0xa9, 0x2b, 0x86, 0x43, 0x00, 0xdd, 0x13, 0x1d, 0xa0, 0xb9, 0xb3, 0xf0,
0xd2, 0x23, 0x05, 0xbf, 0x81, 0x73, 0x49, 0x04, 0x5f, 0x73, 0x55, 0xeb, 0xbb, 0x7b, 0xce, 0x04,
0x0d, 0x46, 0x73, 0xb4, 0xf0, 0x52, 0x7f, 0x2f, 0x7f, 0x6c, 0xd4, 0x2b, 0x77, 0xf3, 0xeb, 0x35,
0x8a, 0x28, 0xc0, 0x17, 0x92, 0x09, 0xb6, 0x52, 0x94, 0x09, 0xec, 0xc3, 0x90, 0x53, 0x3b, 0xa1,
0x9b, 0x0e, 0x39, 0xfd, 0xdf, 0x4f, 0xe1, 0x97, 0x30, 0x2e, 0x6b, 0x99, 0xb1, 0x2a, 0x70, 0x6c,
0x5f, 0xc7, 0xf0, 0x0c, 0xce, 0x24, 0x33, 0xa4, 0xd9, 0x96, 0xc0, 0xb5, 0x37, 0xee, 0xf9, 0xcd,
0xf2, 0xf7, 0x36, 0x44, 0x9b, 0x6d, 0x88, 0xfe, 0x6e, 0x43, 0xf4, 0x73, 0x17, 0x0e, 0x36, 0xbb,
0x70, 0xf0, 0x67, 0x17, 0x0e, 0xbe, 0xc6, 0x39, 0x37, 0x45, 0x9d, 0xc5, 0x6b, 0x25, 0x93, 0xb5,
0xd2, 0x52, 0xe9, 0xee, 0xb8, 0xd0, 0xf4, 0x21, 0x69, 0xd6, 0xaf, 0x36, 0x5c, 0x24, 0xfd, 0x1e,
0x66, 0x63, 0xfb, 0x5e, 0x97, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x8f, 0xef, 0x9c, 0xaa,
0x02, 0x00, 0x00,
// 443 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x6e, 0xd3, 0x30,
0x1c, 0xc6, 0xeb, 0x26, 0x2d, 0xeb, 0x9f, 0xa8, 0x13, 0x56, 0x85, 0x42, 0x0f, 0x61, 0xca, 0x85,
0x1e, 0x58, 0x22, 0x31, 0xc1, 0x61, 0xb7, 0x75, 0x08, 0x7a, 0xe9, 0x25, 0x70, 0xe2, 0x32, 0x39,
0xb1, 0x97, 0x5a, 0x73, 0xe2, 0x29, 0x76, 0xd0, 0xc6, 0x53, 0xf0, 0x0a, 0xbc, 0x0d, 0xc7, 0x1e,
0x39, 0xa2, 0xf6, 0x45, 0x90, 0x9d, 0x78, 0xdb, 0x81, 0x43, 0x4f, 0xf9, 0xbe, 0xcf, 0xfe, 0x7d,
0x89, 0x9d, 0x3f, 0x4c, 0x35, 0x53, 0x9a, 0x12, 0x4d, 0x92, 0xdb, 0x46, 0x6a, 0x89, 0x8f, 0x9c,
0x9f, 0xcf, 0x4a, 0x59, 0x4a, 0x1b, 0xa6, 0x46, 0x75, 0xeb, 0xf3, 0x57, 0xa5, 0x94, 0xa5, 0x60,
0xa9, 0x75, 0x79, 0x7b, 0x9d, 0x92, 0xfa, 0xbe, 0x5b, 0x8a, 0x4f, 0xc1, 0xfb, 0x28, 0x4b, 0x8c,
0xc1, 0x57, 0xfc, 0x07, 0x0b, 0xd1, 0x09, 0x5a, 0x4c, 0x32, 0xab, 0x4d, 0x56, 0x93, 0x8a, 0x85,
0xc3, 0x2e, 0x33, 0x3a, 0x7e, 0x0f, 0xde, 0x25, 0xd1, 0x38, 0x84, 0x67, 0x95, 0xac, 0xf9, 0x0d,
0x6b, 0x7a, 0xc2, 0x59, 0x3c, 0x83, 0x91, 0xe0, 0xdf, 0x99, 0xb2, 0xd4, 0x28, 0xeb, 0x4c, 0xfc,
0x01, 0xfc, 0x25, 0x6f, 0xa8, 0xe1, 0xd4, 0x2d, 0x2b, 0x38, 0x53, 0x8e, 0xeb, 0xad, 0xe1, 0x0a,
0x29, 0x64, 0xe3, 0x38, 0x6b, 0xe2, 0xcf, 0x30, 0x59, 0x11, 0x75, 0x51, 0xf3, 0x8a, 0x08, 0xfc,
0x16, 0xc6, 0xc4, 0x2a, 0xcb, 0x3e, 0x7f, 0x37, 0x4b, 0xba, 0x63, 0x25, 0xee, 0x58, 0xc9, 0x45,
0x7d, 0x9f, 0xf5, 0x7b, 0x70, 0x00, 0xe8, 0xce, 0x96, 0x79, 0x19, 0xba, 0x8b, 0x2f, 0x21, 0x58,
0x11, 0xf5, 0xd8, 0x75, 0x06, 0xb0, 0x21, 0xea, 0xea, 0x80, 0xbe, 0xc9, 0xc6, 0x41, 0xf1, 0x1a,
0x8e, 0xbb, 0x92, 0xc7, 0x9e, 0x73, 0x98, 0x9a, 0x9e, 0x03, 0xbb, 0x82, 0xcd, 0x13, 0x36, 0xce,
0xe1, 0xc5, 0x92, 0xd0, 0x75, 0x2b, 0x34, 0xff, 0xc2, 0xcb, 0x9a, 0xe8, 0xb6, 0x61, 0x38, 0x02,
0x50, 0xce, 0x98, 0x4b, 0xf2, 0x16, 0x41, 0xf6, 0x24, 0xc1, 0x6f, 0xe0, 0xb8, 0x22, 0x82, 0x17,
0x5c, 0xb6, 0xea, 0xea, 0x9a, 0x33, 0x41, 0xc3, 0xd1, 0x09, 0x5a, 0x04, 0xd9, 0xf4, 0x21, 0xfe,
0x64, 0xd2, 0x73, 0x7f, 0xfb, 0xeb, 0x35, 0x8a, 0x29, 0xc0, 0x57, 0x92, 0x0b, 0xb6, 0x96, 0x94,
0x09, 0x3c, 0x85, 0x21, 0xa7, 0xf6, 0x0b, 0xfd, 0x6c, 0xc8, 0xe9, 0xff, 0xfe, 0x30, 0x7e, 0x09,
0xe3, 0xba, 0xad, 0x72, 0xd6, 0x84, 0x9e, 0xdd, 0xd7, 0x3b, 0x3c, 0x87, 0xa3, 0x8a, 0x69, 0x62,
0xa6, 0x2c, 0xf4, 0xed, 0x1b, 0x1f, 0xfc, 0x72, 0xf5, 0x7b, 0x17, 0xa1, 0xed, 0x2e, 0x42, 0x7f,
0x77, 0x11, 0xfa, 0xb9, 0x8f, 0x06, 0xdb, 0x7d, 0x34, 0xf8, 0xb3, 0x8f, 0x06, 0xdf, 0x92, 0x92,
0xeb, 0x4d, 0x9b, 0x27, 0x85, 0xac, 0xd2, 0x42, 0xaa, 0x4a, 0xaa, 0xfe, 0x71, 0xaa, 0xe8, 0x4d,
0x6a, 0xc6, 0xb6, 0xd5, 0x5c, 0xa4, 0x6e, 0x7e, 0xf3, 0xb1, 0xbd, 0xaf, 0xb3, 0x7f, 0x01, 0x00,
0x00, 0xff, 0xff, 0xbd, 0x48, 0xf9, 0x24, 0xe2, 0x02, 0x00, 0x00,
}
func (m *Dog) Marshal() (dAtA []byte, err error) {
@ -505,6 +559,41 @@ func (m *Cat) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *Bird) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Bird) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Bird) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Color != 0 {
i = encodeVarintTestdata(dAtA, i, uint64(m.Color))
i--
dAtA[i] = 0x10
}
if len(m.Species) > 0 {
i -= len(m.Species)
copy(dAtA[i:], m.Species)
i = encodeVarintTestdata(dAtA, i, uint64(len(m.Species)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *HasAnimal) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@ -749,6 +838,22 @@ func (m *Cat) Size() (n int) {
return n
}
func (m *Bird) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Species)
if l > 0 {
n += 1 + l + sovTestdata(uint64(l))
}
if m.Color != 0 {
n += 1 + sovTestdata(uint64(m.Color))
}
return n
}
func (m *HasAnimal) Size() (n int) {
if m == nil {
return 0
@ -1057,6 +1162,107 @@ func (m *Cat) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *Bird) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTestdata
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Bird: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Bird: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Species", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTestdata
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTestdata
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTestdata
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Species = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Color", wireType)
}
m.Color = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTestdata
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Color |= int32(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipTestdata(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTestdata
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *HasAnimal) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0

View File

@ -16,6 +16,11 @@ message Cat {
int32 lives = 2;
}
message Bird {
string species = 1;
int32 color = 2;
}
message HasAnimal {
google.protobuf.Any animal = 1;
int64 x = 2;

View File

@ -966,6 +966,474 @@ func (x *fastReflection_Cat) ProtoMethods() *protoiface.Methods {
}
}
var (
md_Bird protoreflect.MessageDescriptor
fd_Bird_species protoreflect.FieldDescriptor
fd_Bird_color protoreflect.FieldDescriptor
)
func init() {
file_testdata_proto_init()
md_Bird = File_testdata_proto.Messages().ByName("Bird")
fd_Bird_species = md_Bird.Fields().ByName("species")
fd_Bird_color = md_Bird.Fields().ByName("color")
}
var _ protoreflect.Message = (*fastReflection_Bird)(nil)
type fastReflection_Bird Bird
func (x *Bird) ProtoReflect() protoreflect.Message {
return (*fastReflection_Bird)(x)
}
func (x *Bird) slowProtoReflect() protoreflect.Message {
mi := &file_testdata_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
var _fastReflection_Bird_messageType fastReflection_Bird_messageType
var _ protoreflect.MessageType = fastReflection_Bird_messageType{}
type fastReflection_Bird_messageType struct{}
func (x fastReflection_Bird_messageType) Zero() protoreflect.Message {
return (*fastReflection_Bird)(nil)
}
func (x fastReflection_Bird_messageType) New() protoreflect.Message {
return new(fastReflection_Bird)
}
func (x fastReflection_Bird_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_Bird
}
// Descriptor returns message descriptor, which contains only the protobuf
// type information for the message.
func (x *fastReflection_Bird) Descriptor() protoreflect.MessageDescriptor {
return md_Bird
}
// Type returns the message type, which encapsulates both Go and protobuf
// type information. If the Go type information is not needed,
// it is recommended that the message descriptor be used instead.
func (x *fastReflection_Bird) Type() protoreflect.MessageType {
return _fastReflection_Bird_messageType
}
// New returns a newly allocated and mutable empty message.
func (x *fastReflection_Bird) New() protoreflect.Message {
return new(fastReflection_Bird)
}
// Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface.
func (x *fastReflection_Bird) Interface() protoreflect.ProtoMessage {
return (*Bird)(x)
}
// Range iterates over every populated field in an undefined order,
// calling f for each field descriptor and value encountered.
// Range returns immediately if f returns false.
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_Bird) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if x.Species != "" {
value := protoreflect.ValueOfString(x.Species)
if !f(fd_Bird_species, value) {
return
}
}
if x.Color != int32(0) {
value := protoreflect.ValueOfInt32(x.Color)
if !f(fd_Bird_color, value) {
return
}
}
}
// Has reports whether a field is populated.
//
// Some fields have the property of nullability where it is possible to
// distinguish between the default value of a field and whether the field
// was explicitly populated with the default value. Singular message fields,
// member fields of a oneof, and proto2 scalar fields are nullable. Such
// fields are populated only if explicitly set.
//
// In other cases (aside from the nullable cases above),
// a proto3 scalar field is populated if it contains a non-zero value, and
// a repeated field is populated if it is non-empty.
func (x *fastReflection_Bird) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "testdata.Bird.species":
return x.Species != ""
case "testdata.Bird.color":
return x.Color != int32(0)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: testdata.Bird"))
}
panic(fmt.Errorf("message testdata.Bird does not contain field %s", fd.FullName()))
}
}
// Clear clears the field such that a subsequent Has call reports false.
//
// Clearing an extension field clears both the extension type and value
// associated with the given field number.
//
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Bird) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "testdata.Bird.species":
x.Species = ""
case "testdata.Bird.color":
x.Color = int32(0)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: testdata.Bird"))
}
panic(fmt.Errorf("message testdata.Bird does not contain field %s", fd.FullName()))
}
}
// Get retrieves the value for a field.
//
// For unpopulated scalars, it returns the default value, where
// the default value of a bytes scalar is guaranteed to be a copy.
// For unpopulated composite types, it returns an empty, read-only view
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_Bird) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "testdata.Bird.species":
value := x.Species
return protoreflect.ValueOfString(value)
case "testdata.Bird.color":
value := x.Color
return protoreflect.ValueOfInt32(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: testdata.Bird"))
}
panic(fmt.Errorf("message testdata.Bird does not contain field %s", descriptor.FullName()))
}
}
// Set stores the value for a field.
//
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType.
// When setting a composite type, it is unspecified whether the stored value
// aliases the source's memory in any way. If the composite value is an
// empty, read-only value, then it panics.
//
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Bird) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "testdata.Bird.species":
x.Species = value.Interface().(string)
case "testdata.Bird.color":
x.Color = int32(value.Int())
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: testdata.Bird"))
}
panic(fmt.Errorf("message testdata.Bird does not contain field %s", fd.FullName()))
}
}
// Mutable returns a mutable reference to a composite type.
//
// If the field is unpopulated, it may allocate a composite value.
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType
// if not already stored.
// It panics if the field does not contain a composite type.
//
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Bird) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "testdata.Bird.species":
panic(fmt.Errorf("field species of message testdata.Bird is not mutable"))
case "testdata.Bird.color":
panic(fmt.Errorf("field color of message testdata.Bird is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: testdata.Bird"))
}
panic(fmt.Errorf("message testdata.Bird does not contain field %s", fd.FullName()))
}
}
// NewField returns a new value that is assignable to the field
// for the given descriptor. For scalars, this returns the default value.
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_Bird) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "testdata.Bird.species":
return protoreflect.ValueOfString("")
case "testdata.Bird.color":
return protoreflect.ValueOfInt32(int32(0))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: testdata.Bird"))
}
panic(fmt.Errorf("message testdata.Bird does not contain field %s", fd.FullName()))
}
}
// WhichOneof reports which field within the oneof is populated,
// returning nil if none are populated.
// It panics if the oneof descriptor does not belong to this message.
func (x *fastReflection_Bird) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() {
default:
panic(fmt.Errorf("%s is not a oneof field in testdata.Bird", d.FullName()))
}
panic("unreachable")
}
// GetUnknown retrieves the entire list of unknown fields.
// The caller may only mutate the contents of the RawFields
// if the mutated bytes are stored back into the message with SetUnknown.
func (x *fastReflection_Bird) GetUnknown() protoreflect.RawFields {
return x.unknownFields
}
// SetUnknown stores an entire list of unknown fields.
// The raw fields must be syntactically valid according to the wire format.
// An implementation may panic if this is not the case.
// Once stored, the caller must not mutate the content of the RawFields.
// An empty RawFields may be passed to clear the fields.
//
// SetUnknown is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Bird) SetUnknown(fields protoreflect.RawFields) {
x.unknownFields = fields
}
// IsValid reports whether the message is valid.
//
// An invalid message is an empty, read-only value.
//
// An invalid message often corresponds to a nil pointer of the concrete
// message type, but the details are implementation dependent.
// Validity is not part of the protobuf data model, and may not
// be preserved in marshaling or other operations.
func (x *fastReflection_Bird) IsValid() bool {
return x != nil
}
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
// This method may return nil.
//
// The returned methods type is identical to
// "google.golang.org/protobuf/runtime/protoiface".Methods.
// Consult the protoiface package documentation for details.
func (x *fastReflection_Bird) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*Bird)
if x == nil {
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: 0,
}
}
options := runtime.SizeInputToOptions(input)
_ = options
var n int
var l int
_ = l
l = len(x.Species)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.Color != 0 {
n += 1 + runtime.Sov(uint64(x.Color))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: n,
}
}
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
x := input.Message.Interface().(*Bird)
if x == nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
options := runtime.MarshalInputToOptions(input)
_ = options
size := options.Size(x)
dAtA := make([]byte, size)
i := len(dAtA)
_ = i
var l int
_ = l
if x.unknownFields != nil {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if x.Color != 0 {
i = runtime.EncodeVarint(dAtA, i, uint64(x.Color))
i--
dAtA[i] = 0x10
}
if len(x.Species) > 0 {
i -= len(x.Species)
copy(dAtA[i:], x.Species)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Species)))
i--
dAtA[i] = 0xa
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
input.Buf = dAtA
}
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
x := input.Message.Interface().(*Bird)
if x == nil {
return protoiface.UnmarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Flags: input.Flags,
}, nil
}
options := runtime.UnmarshalInputToOptions(input)
_ = options
dAtA := input.Buf
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Bird: wiretype end group for non-group")
}
if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Bird: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Species", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Species = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Color", wireType)
}
x.Color = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
x.Color |= int32(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
if err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if (iNdEx + skippy) > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if !options.DiscardUnknown {
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
}
iNdEx += skippy
}
}
if iNdEx > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
}
return &protoiface.Methods{
NoUnkeyedLiterals: struct{}{},
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
Size: size,
Marshal: marshal,
Unmarshal: unmarshal,
Merge: nil,
CheckInitialized: nil,
}
}
var (
md_HasAnimal protoreflect.MessageDescriptor
fd_HasAnimal_animal protoreflect.FieldDescriptor
@ -988,7 +1456,7 @@ func (x *HasAnimal) ProtoReflect() protoreflect.Message {
}
func (x *HasAnimal) slowProtoReflect() protoreflect.Message {
mi := &file_testdata_proto_msgTypes[2]
mi := &file_testdata_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1469,7 +1937,7 @@ func (x *HasHasAnimal) ProtoReflect() protoreflect.Message {
}
func (x *HasHasAnimal) slowProtoReflect() protoreflect.Message {
mi := &file_testdata_proto_msgTypes[3]
mi := &file_testdata_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1904,7 +2372,7 @@ func (x *HasHasHasAnimal) ProtoReflect() protoreflect.Message {
}
func (x *HasHasHasAnimal) slowProtoReflect() protoreflect.Message {
mi := &file_testdata_proto_msgTypes[4]
mi := &file_testdata_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -2387,7 +2855,7 @@ func (x *BadMultiSignature) ProtoReflect() protoreflect.Message {
}
func (x *BadMultiSignature) slowProtoReflect() protoreflect.Message {
mi := &file_testdata_proto_msgTypes[5]
mi := &file_testdata_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -2891,7 +3359,7 @@ func (x *TableModel) ProtoReflect() protoreflect.Message {
}
func (x *TableModel) slowProtoReflect() protoreflect.Message {
mi := &file_testdata_proto_msgTypes[6]
mi := &file_testdata_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -3546,6 +4014,49 @@ func (x *Cat) GetLives() int32 {
return 0
}
type Bird struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Species string `protobuf:"bytes,1,opt,name=species,proto3" json:"species,omitempty"`
Color int32 `protobuf:"varint,2,opt,name=color,proto3" json:"color,omitempty"`
}
func (x *Bird) Reset() {
*x = Bird{}
if protoimpl.UnsafeEnabled {
mi := &file_testdata_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Bird) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Bird) ProtoMessage() {}
// Deprecated: Use Bird.ProtoReflect.Descriptor instead.
func (*Bird) Descriptor() ([]byte, []int) {
return file_testdata_proto_rawDescGZIP(), []int{2}
}
func (x *Bird) GetSpecies() string {
if x != nil {
return x.Species
}
return ""
}
func (x *Bird) GetColor() int32 {
if x != nil {
return x.Color
}
return 0
}
type HasAnimal struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -3558,7 +4069,7 @@ type HasAnimal struct {
func (x *HasAnimal) Reset() {
*x = HasAnimal{}
if protoimpl.UnsafeEnabled {
mi := &file_testdata_proto_msgTypes[2]
mi := &file_testdata_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -3572,7 +4083,7 @@ func (*HasAnimal) ProtoMessage() {}
// Deprecated: Use HasAnimal.ProtoReflect.Descriptor instead.
func (*HasAnimal) Descriptor() ([]byte, []int) {
return file_testdata_proto_rawDescGZIP(), []int{2}
return file_testdata_proto_rawDescGZIP(), []int{3}
}
func (x *HasAnimal) GetAnimal() *anypb.Any {
@ -3600,7 +4111,7 @@ type HasHasAnimal struct {
func (x *HasHasAnimal) Reset() {
*x = HasHasAnimal{}
if protoimpl.UnsafeEnabled {
mi := &file_testdata_proto_msgTypes[3]
mi := &file_testdata_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -3614,7 +4125,7 @@ func (*HasHasAnimal) ProtoMessage() {}
// Deprecated: Use HasHasAnimal.ProtoReflect.Descriptor instead.
func (*HasHasAnimal) Descriptor() ([]byte, []int) {
return file_testdata_proto_rawDescGZIP(), []int{3}
return file_testdata_proto_rawDescGZIP(), []int{4}
}
func (x *HasHasAnimal) GetHasAnimal() *anypb.Any {
@ -3635,7 +4146,7 @@ type HasHasHasAnimal struct {
func (x *HasHasHasAnimal) Reset() {
*x = HasHasHasAnimal{}
if protoimpl.UnsafeEnabled {
mi := &file_testdata_proto_msgTypes[4]
mi := &file_testdata_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -3649,7 +4160,7 @@ func (*HasHasHasAnimal) ProtoMessage() {}
// Deprecated: Use HasHasHasAnimal.ProtoReflect.Descriptor instead.
func (*HasHasHasAnimal) Descriptor() ([]byte, []int) {
return file_testdata_proto_rawDescGZIP(), []int{4}
return file_testdata_proto_rawDescGZIP(), []int{5}
}
func (x *HasHasHasAnimal) GetHasHasAnimal() *anypb.Any {
@ -3672,7 +4183,7 @@ type BadMultiSignature struct {
func (x *BadMultiSignature) Reset() {
*x = BadMultiSignature{}
if protoimpl.UnsafeEnabled {
mi := &file_testdata_proto_msgTypes[5]
mi := &file_testdata_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -3686,7 +4197,7 @@ func (*BadMultiSignature) ProtoMessage() {}
// Deprecated: Use BadMultiSignature.ProtoReflect.Descriptor instead.
func (*BadMultiSignature) Descriptor() ([]byte, []int) {
return file_testdata_proto_rawDescGZIP(), []int{5}
return file_testdata_proto_rawDescGZIP(), []int{6}
}
func (x *BadMultiSignature) GetSignatures() [][]byte {
@ -3717,7 +4228,7 @@ type TableModel struct {
func (x *TableModel) Reset() {
*x = TableModel{}
if protoimpl.UnsafeEnabled {
mi := &file_testdata_proto_msgTypes[6]
mi := &file_testdata_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -3731,7 +4242,7 @@ func (*TableModel) ProtoMessage() {}
// Deprecated: Use TableModel.ProtoReflect.Descriptor instead.
func (*TableModel) Descriptor() ([]byte, []int) {
return file_testdata_proto_rawDescGZIP(), []int{6}
return file_testdata_proto_rawDescGZIP(), []int{7}
}
func (x *TableModel) GetId() uint64 {
@ -3776,43 +4287,46 @@ var file_testdata_proto_rawDesc = []byte{
0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x6e, 0x69, 0x6b, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x6d, 0x6f, 0x6e, 0x69, 0x6b, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6c,
0x69, 0x76, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x76, 0x65,
0x73, 0x22, 0x47, 0x0a, 0x09, 0x48, 0x61, 0x73, 0x41, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x12, 0x2c,
0x0a, 0x06, 0x61, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14,
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x41, 0x6e, 0x79, 0x52, 0x06, 0x61, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x12, 0x0c, 0x0a, 0x01,
0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x01, 0x78, 0x22, 0x43, 0x0a, 0x0c, 0x48, 0x61,
0x73, 0x48, 0x61, 0x73, 0x41, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x12, 0x33, 0x0a, 0x0a, 0x68, 0x61,
0x73, 0x5f, 0x61, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14,
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2e, 0x41, 0x6e, 0x79, 0x52, 0x09, 0x68, 0x61, 0x73, 0x41, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x22,
0x4d, 0x0a, 0x0f, 0x48, 0x61, 0x73, 0x48, 0x61, 0x73, 0x48, 0x61, 0x73, 0x41, 0x6e, 0x69, 0x6d,
0x61, 0x6c, 0x12, 0x3a, 0x0a, 0x0e, 0x68, 0x61, 0x73, 0x5f, 0x68, 0x61, 0x73, 0x5f, 0x61, 0x6e,
0x69, 0x6d, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79,
0x52, 0x0c, 0x68, 0x61, 0x73, 0x48, 0x61, 0x73, 0x41, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x22, 0x62,
0x0a, 0x11, 0x42, 0x61, 0x64, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74,
0x75, 0x72, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75,
0x72, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x6d, 0x61, 0x6c, 0x69, 0x63, 0x69, 0x6f, 0x75, 0x73,
0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x6d, 0x61,
0x6c, 0x69, 0x63, 0x69, 0x6f, 0x75, 0x73, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x3a, 0x04, 0xd0, 0xa1,
0x1f, 0x01, 0x22, 0x64, 0x0a, 0x0a, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x6c,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64,
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03,
0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08,
0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08,
0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x94, 0x01, 0x0a, 0x0c, 0x63, 0x6f, 0x6d,
0x2e, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x42, 0x0d, 0x54, 0x65, 0x73, 0x74, 0x64,
0x61, 0x74, 0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68,
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x75, 0x74, 0x69,
0x6c, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x75, 0x6c, 0x73, 0x61,
0x72, 0xa2, 0x02, 0x03, 0x54, 0x58, 0x58, 0xaa, 0x02, 0x08, 0x54, 0x65, 0x73, 0x74, 0x64, 0x61,
0x74, 0x61, 0xca, 0x02, 0x08, 0x54, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0xe2, 0x02, 0x14,
0x54, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x08, 0x54, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x73, 0x22, 0x36, 0x0a, 0x04, 0x42, 0x69, 0x72, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x70, 0x65,
0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x65, 0x63,
0x69, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01,
0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x22, 0x47, 0x0a, 0x09, 0x48, 0x61, 0x73,
0x41, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x12, 0x2c, 0x0a, 0x06, 0x61, 0x6e, 0x69, 0x6d, 0x61, 0x6c,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x06, 0x61, 0x6e,
0x69, 0x6d, 0x61, 0x6c, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
0x01, 0x78, 0x22, 0x43, 0x0a, 0x0c, 0x48, 0x61, 0x73, 0x48, 0x61, 0x73, 0x41, 0x6e, 0x69, 0x6d,
0x61, 0x6c, 0x12, 0x33, 0x0a, 0x0a, 0x68, 0x61, 0x73, 0x5f, 0x61, 0x6e, 0x69, 0x6d, 0x61, 0x6c,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x09, 0x68, 0x61,
0x73, 0x41, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x22, 0x4d, 0x0a, 0x0f, 0x48, 0x61, 0x73, 0x48, 0x61,
0x73, 0x48, 0x61, 0x73, 0x41, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x12, 0x3a, 0x0a, 0x0e, 0x68, 0x61,
0x73, 0x5f, 0x68, 0x61, 0x73, 0x5f, 0x61, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x0c, 0x68, 0x61, 0x73, 0x48, 0x61, 0x73,
0x41, 0x6e, 0x69, 0x6d, 0x61, 0x6c, 0x22, 0x62, 0x0a, 0x11, 0x42, 0x61, 0x64, 0x4d, 0x75, 0x6c,
0x74, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73,
0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52,
0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x6d,
0x61, 0x6c, 0x69, 0x63, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, 0x05,
0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x6d, 0x61, 0x6c, 0x69, 0x63, 0x69, 0x6f, 0x75, 0x73, 0x46,
0x69, 0x65, 0x6c, 0x64, 0x3a, 0x04, 0xd0, 0xa1, 0x1f, 0x01, 0x22, 0x64, 0x0a, 0x0a, 0x54, 0x61,
0x62, 0x6c, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06,
0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6e, 0x75,
0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
0x42, 0x94, 0x01, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74,
0x61, 0x42, 0x0d, 0x54, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x50, 0x01, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b,
0x2f, 0x74, 0x65, 0x73, 0x74, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x64, 0x61,
0x74, 0x61, 0x5f, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0xa2, 0x02, 0x03, 0x54, 0x58, 0x58, 0xaa,
0x02, 0x08, 0x54, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0xca, 0x02, 0x08, 0x54, 0x65, 0x73,
0x74, 0x64, 0x61, 0x74, 0x61, 0xe2, 0x02, 0x14, 0x54, 0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61,
0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x08, 0x54,
0x65, 0x73, 0x74, 0x64, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -3827,21 +4341,22 @@ func file_testdata_proto_rawDescGZIP() []byte {
return file_testdata_proto_rawDescData
}
var file_testdata_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_testdata_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_testdata_proto_goTypes = []interface{}{
(*Dog)(nil), // 0: testdata.Dog
(*Cat)(nil), // 1: testdata.Cat
(*HasAnimal)(nil), // 2: testdata.HasAnimal
(*HasHasAnimal)(nil), // 3: testdata.HasHasAnimal
(*HasHasHasAnimal)(nil), // 4: testdata.HasHasHasAnimal
(*BadMultiSignature)(nil), // 5: testdata.BadMultiSignature
(*TableModel)(nil), // 6: testdata.TableModel
(*anypb.Any)(nil), // 7: google.protobuf.Any
(*Bird)(nil), // 2: testdata.Bird
(*HasAnimal)(nil), // 3: testdata.HasAnimal
(*HasHasAnimal)(nil), // 4: testdata.HasHasAnimal
(*HasHasHasAnimal)(nil), // 5: testdata.HasHasHasAnimal
(*BadMultiSignature)(nil), // 6: testdata.BadMultiSignature
(*TableModel)(nil), // 7: testdata.TableModel
(*anypb.Any)(nil), // 8: google.protobuf.Any
}
var file_testdata_proto_depIdxs = []int32{
7, // 0: testdata.HasAnimal.animal:type_name -> google.protobuf.Any
7, // 1: testdata.HasHasAnimal.has_animal:type_name -> google.protobuf.Any
7, // 2: testdata.HasHasHasAnimal.has_has_animal:type_name -> google.protobuf.Any
8, // 0: testdata.HasAnimal.animal:type_name -> google.protobuf.Any
8, // 1: testdata.HasHasAnimal.has_animal:type_name -> google.protobuf.Any
8, // 2: testdata.HasHasHasAnimal.has_has_animal:type_name -> google.protobuf.Any
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
@ -3880,7 +4395,7 @@ func file_testdata_proto_init() {
}
}
file_testdata_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HasAnimal); i {
switch v := v.(*Bird); i {
case 0:
return &v.state
case 1:
@ -3892,7 +4407,7 @@ func file_testdata_proto_init() {
}
}
file_testdata_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HasHasAnimal); i {
switch v := v.(*HasAnimal); i {
case 0:
return &v.state
case 1:
@ -3904,7 +4419,7 @@ func file_testdata_proto_init() {
}
}
file_testdata_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HasHasHasAnimal); i {
switch v := v.(*HasHasAnimal); i {
case 0:
return &v.state
case 1:
@ -3916,7 +4431,7 @@ func file_testdata_proto_init() {
}
}
file_testdata_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BadMultiSignature); i {
switch v := v.(*HasHasHasAnimal); i {
case 0:
return &v.state
case 1:
@ -3928,6 +4443,18 @@ func file_testdata_proto_init() {
}
}
file_testdata_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BadMultiSignature); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_testdata_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TableModel); i {
case 0:
return &v.state
@ -3946,7 +4473,7 @@ func file_testdata_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_testdata_proto_rawDesc,
NumEnums: 0,
NumMessages: 7,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},