// Chapter 29 example: this file does not compile, on purpose. A rock has no // describe method, so it cannot be used as a describer. Run it and read the // error, then add the missing method. // // Run with: go run exercises/29/04-missing-method.go package main import "fmt" type describer interface { describe() } type animal struct { name string } func (a animal) describe() { fmt.Printf("%s is an animal.\n", a.name) } type rock struct { weight int } func introduce(d describer) { d.describe() } func main() { introduce(animal{name: "Bug"}) introduce(rock{weight: 5}) }