Why does this Type Assertion on a direct implemented interface fail?
问题 I am struggling with Go's Type Assertion mechanism. In the below example the Type Assertion for Qux.(Bar) fails. Why does a direct implementation of DoBar() at Qux not fullfill the Bar interface? package main import ( "fmt" ) type Nameable interface { Name() string } type Foo interface { Nameable DoFoo() string } type Bar interface { Nameable DoBar() string } type bar struct { name string } func (b bar) Name() string { return b.name } // Qux embeds bar and is expected to fullfill Nameable