I'm trying to understand interfaces in Go. I wrote this:
package main
import "fmt"
type Animal struct {
Name string
Ability string
}
type AbilityShower interface {
ShowAbility() string
}
func (a Animal) ShowAbility() string {
return fmt.Sprintf("%s can %s", a.Name, a.Ability)
}
func main() {
var Dog Animal = Animal{
Name: "Dog",
Ability: "Walk",
}
Dog.ShowAbility()
}
But when I run with go run main.go
nothing appears in the console. What am I doing incorrectly?