In your case since you used short variable declaration to create kitty
, the type is inferred from the right-hand side expression, and type of kitty
will be the concrete type Cat
.
But since the Cat
concrete type (non-interface type) implements the Animal
interface type, you may assign a value of Cat
to a variable whose type is Animal
, like in this example:
kitty := Cat{}
var kitty2 Animal = kitty
"Implements" by spec means:
An interface type specifies a method set called its interface. A variable of interface type can store a value of any type with a method set that is any superset of the interface. Such a type is said to implement the interface.
Interface values, schemantically, contain a (value; type) pair, being the value stored in them, and their concrete type.
For more details about interface internals, read blog post: The Go Blog: The Laws of Reflection
And Go Data Structures: Interfaces (by Russ Cox).
For an introduction why interfaces are needed or how / when to use them, see Why are interfaces needed in Golang?