jjzjj

GithubRepository

全部标签

go - 嵌套接口(interface) : X does not implement Y (Wrong type for Z method)

在一个包中我有一个接口(interface)Repository有一个方法GetReporter返回一个接口(interface)Reporter.这是由一个函数使用Execute这需要Repository并得到它的Reporter通过GetReporter功能。在另一个包中我有一个结构GithubRepository有一个方法GetReporter返回GithubReporter.在第三个包中,我想调用Execute使用GithubRepository在包#1外运行实例。我正在尝试让包1和包2彼此独立,而不是从另一个导入某些东西。第三个包应该结合前两个。Golang返回:cannot