您的pets接口需要一个功能
speak(name []byte) dog,但是您为dog类型编写的功能是
speak(name []byte)*dog。
func (d *dog) speak(name []byte) dog { d.dogs = append(d.dogs, string(name)) return *d}要么
type pets interface { speak(name []byte) *dog}type dog struct { dogs []string name string}func (d *dog) speak(name []byte) *dog { d.dogs = append(d.dogs, string(name)) return d}问题是
*dog和
dog是不同的类型。
*dog是指向的指针
dog。



