You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What did you do? (required: The issue will be closed when not provided)
In my Golang project, I had a package named service. In this package, I had a file where I was defining two interfaces: InterfaceParent and InterfaceChild. Each were defining their own functions, but the catch was that :InterfaceParent was embedded inside the interface definition of InterfaceChild, so it looked as follows:
type InterfaceParent interface {
bar()
}
type InterfaceChild interface {
InterfaceParent
foo()
}
After this was done, in a different package, I ran :GoImpl m *MockInterfaceChild github.com/organization123/project123/microservice123/service.InterfaceChild, but I ran into the following error:
I expected the :GoImpl m *MockInterfaceChild github.com/organization123/project123/microservice123/service.InterfaceChild to implement placeholders / stubs for the foo() function in InterfaceChild.
What happened instead?
I got an error instead: vim-go: unrecognized interface: service.InterfaceParent
The text was updated successfully, but these errors were encountered:
AhmedNSidd
changed the title
:GoImpl is unable to implement interfaces with embedded interfaces:GoImpl is unable to implement interfaces with embedded interfaces
Sep 24, 2024
I'll go ahead and close this issue since as mentioned before, this isn't directly related to vim-go, but I will mention that from doing some research online, it looks like there are alternatives to the :GoImpl command which is to use the :GoGenerate command in conjunction with the mockery tool to generate your mocks based off interfaces.
What did you do? (required: The issue will be closed when not provided)
In my Golang project, I had a package named
service
. In this package, I had a file where I was defining two interfaces:InterfaceParent
andInterfaceChild
. Each were defining their own functions, but the catch was that:InterfaceParent
was embedded inside the interface definition ofInterfaceChild
, so it looked as follows:After this was done, in a different package, I ran
:GoImpl m *MockInterfaceChild github.com/organization123/project123/microservice123/service.InterfaceChild
, but I ran into the following error:What did you expect to happen?
I expected the
:GoImpl m *MockInterfaceChild github.com/organization123/project123/microservice123/service.InterfaceChild
to implement placeholders / stubs for thefoo()
function inInterfaceChild
.What happened instead?
I got an error instead:
vim-go: unrecognized interface: service.InterfaceParent
Configuration (MUST fill this out):
vim-go version: ac1fb9611de435d80a6badcf8482cb1428449b10
vimrc
you used to reproduce:vimrc
Vim version (first three lines from
:version
):VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Jun 29 2024 05:34:37)
macOS version - arm64
Included patches: 1-2136, 2142
Go version (
go version
):go version go1.22.6 darwin/arm64
Go environment
go env
Output:gopls version
gopls version
Output:The text was updated successfully, but these errors were encountered: