package main import ( "fmt" ) type Reader interface { Read() } type Dog struct { name string sound string } type Cat struct { name string sound string } func callRead(r Reader) { r.Read() } func (d Dog) Read() { fmt.Printf("%v goes %v\n", d.name, d.sound) } func (c Cat) Read() { fmt.Printf("%v goes %v\n", c.name, c.sound) } func main() { d := Dog{"Max", "Woof"} c := Cat{"Mimi", "Meow"} callRead(d) callRead(c) }