package mainimport ( "fmt")type User struct { Name string}func (this *User) name() string { return fmt.Sprintf("Name : %s ", this.Name)}type Data struct { s interface { //匿名接口 name() string }}func main() { var i interface { name() string } = &User{"Tom"} fmt.Println(i.name()) d := Data{&User{"Jack"}} fmt.Println(d.s.name())}