Closed vitaly-zdanevich closed 10 months ago
Looks like I found the root cause: my file name was interfaces.go
but vim-go was opening interface.go
- renaming of the file looks like fix it, but better to open not an interface file but test file on concrete line...
Vim-go gets the filename to put in the quickfix (and therefore the file to location to jump to) from the test failure. What's the output of go test
in this case?
With interfaces.go filename, I got this (cut related places):
--- PASS: TestSuite_GraphService/TestProcessUpdateUsersRequest/OK:_If_CUSTOMER_ADMIN_user_is_present_both_in_Crave_and_Graph_but_the_store_is_not_enabled,_that_user_should_
NOT_be_deleted_from_Crave (0.00s)
interface.go:74: Unexpected call to *client.MockClient.DeleteUser([context.TODO {1}]) at /home/vitaly/p/ri/svi/serv/service/crave/users.go:199 because: there are no expecte
d calls of the method "DeleteUser" for that receiver
github.com/golang/mock/gomock.(*Controller).Call.func1(0xc0001fc900, {0x89d480?, 0xc0001f2bb0}, {0x8d6214, 0xa}, {0xc0002204c0, 0x2, 0x2})
/home/vitaly/go/pkg/mod/github.com/golang/mock@v1.6.0/gomock/controller.go:231 +0x334
github.com/golang/mock/gomock.(*Controller).Call(0xc0001fc900, {0x89d480, 0xc0001f2bb0}, {0x8d6214, 0xa}, {0xc0002204c0, 0x2, 0x2})
/home/vitaly/go/pkg/mod/github.com/golang/mock@v1.6.0/gomock/controller.go:247 +0xad
github.com/River-Island/svi-services/pkg/crave/client/mocks.(*MockClient).DeleteUser(0xc0001f2bb0, {0x97d238?, 0xc000120018}, {0x8?})
/home/vitaly/p/ri/svi/serv/pkg/crave/client/mocks/interface.go:74 +0xee
github.com/River-Island/svi-services/service/crave.(*ProcessorService).deleteRetiredUsers(0xc0001fc960, {0x97d238, 0xc000120018}, 0x8?, 0x8bc8a0?, {0xc00015c6c0, 0x2, 0x0?})
/home/vitaly/p/ri/svi/serv/service/crave/users.go:199 +0x4a3
That go test
output indicates that the filename is interface.go
and that the error is on line 74.
Yes, interesting... Looks like we need to rename a few of our files - drop s
at the end...
I don't think you need to rename anything. I think the problem is in gomock, but I'm not quite sure what it is. The interface.go
file that go test
is referring to is /home/vitaly/p/ri/svi/serv/pkg/crave/client/mocks/interface.go
. It's just a coincidence that you also have a file named interfaces.go
.
Package name is where the error occurs.
The screenshot:
All my Vim configs https://gitlab.com/vitaly-zdanevich-configs/vim
vim-go version:
Vim version (first three lines from
:version
):VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Jun 17 2023 20:50:44) Included patches: 1-1503 Modified by Gentoo-9.0.1503
Go version (
go version
):go version go1.20.7 linux/amd64
Go environment
go env
Output:gopls version
gopls version
Output:vim-go configuration:
vim-go configuration
filetype detection configuration:
filetype detection