-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
595 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Protocol Buffers for Go with Gadgets | ||
# | ||
# Copyright (c) 2013, The GoGo Authors. All rights reserved. | ||
# http://github.com/cosmos/gogoproto | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are | ||
# met: | ||
# | ||
# * Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# * Redistributions in binary form must reproduce the above | ||
# copyright notice, this list of conditions and the following disclaimer | ||
# in the documentation and/or other materials provided with the | ||
# distribution. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
regenerate: | ||
cd .. && (protoc --proto_path=../:../protobuf/:. --gogo_out=Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any:. testdata/testdata.proto) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package testdata | ||
|
||
// nolint | ||
|
||
import ( | ||
"fmt" | ||
"github.com/cosmos/gogoproto/proto" | ||
types "github.com/cosmos/gogoproto/types/any" | ||
) | ||
|
||
type Animal interface { | ||
proto.Message | ||
|
||
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) | ||
} | ||
|
||
var _ types.UnpackInterfacesMessage = HasAnimal{} | ||
|
||
func (m HasAnimal) UnpackInterfaces(unpacker types.AnyUnpacker) error { | ||
var animal Animal | ||
return unpacker.UnpackAny(m.Animal, &animal) | ||
} | ||
|
||
type HasAnimalI interface { | ||
TheAnimal() Animal | ||
} | ||
|
||
var _ HasAnimalI = &HasAnimal{} | ||
|
||
func (m HasAnimal) TheAnimal() Animal { | ||
return m.Animal.GetCachedValue().(Animal) | ||
} | ||
|
||
type HasHasAnimalI interface { | ||
TheHasAnimal() HasAnimalI | ||
} | ||
|
||
var _ HasHasAnimalI = &HasHasAnimal{} | ||
|
||
func (m HasHasAnimal) TheHasAnimal() HasAnimalI { | ||
return m.HasAnimal.GetCachedValue().(HasAnimalI) | ||
} | ||
|
||
var _ types.UnpackInterfacesMessage = HasHasAnimal{} | ||
|
||
func (m HasHasAnimal) UnpackInterfaces(unpacker types.AnyUnpacker) error { | ||
var animal HasAnimalI | ||
return unpacker.UnpackAny(m.HasAnimal, &animal) | ||
} | ||
|
||
type HasHasHasAnimalI interface { | ||
TheHasHasAnimal() HasHasAnimalI | ||
} | ||
|
||
var _ HasHasAnimalI = &HasHasAnimal{} | ||
|
||
func (m HasHasHasAnimal) TheHasHasAnimal() HasHasAnimalI { | ||
return m.HasHasAnimal.GetCachedValue().(HasHasAnimalI) | ||
} | ||
|
||
var _ types.UnpackInterfacesMessage = HasHasHasAnimal{} | ||
|
||
func (m HasHasHasAnimal) UnpackInterfaces(unpacker types.AnyUnpacker) error { | ||
var animal HasHasAnimalI | ||
return unpacker.UnpackAny(m.HasHasAnimal, &animal) | ||
} |
Oops, something went wrong.