我不知道出现以下编译错误的原因是什么。我将不胜感激任何帮助。
./router.go:190: cannot use listener (type webhooklistener.MyListener) as type webhook.Listener in field value:
webhooklistener.MyListener does not implement webhook.Listener (missing webhook.handle method)
have webhooklistener.handle()
want webhook.handle()
客户:
package webhook
type Listener interface {
handle()
}
type Client struct {
Listener Listener
}
听众:
package webhooklistener
type MyListener struct {
}
func (ll MyListener) handle() {
}
路由器:
listener := webhooklistener.MyListener{}
client := webhook.Client{listener} // COMPILATION ERROR
回首忆惘然
相关分类