Closed mykytanikitenko closed 5 years ago
@mykytanikitenko is your project using modules and placed outside the GOPATH?
My project does not use go modules, it placed in gopath, by all dependencies are vendored
Any chance your project is hosted somewhere where I could see it?
Sorry, it's a closed-source project. Diff between previous mocks and new one all looks like
package mock_repo
import (
+ x "."
dbo "MY_PROJECT/cmd/datasets/internal/dbo"
- repo "MY_PROJECT/cmd/datasets/internal/repo"
db "MY_PROJECT/internal/db"
uuidv1 "MY_PROJECT/internal/pkg/uuidv1"
context "context"
@@ -38,9 +38,9 @@ func (m *MockDatasets) EXPECT() *MockDatasetsMockRecorder {
}
// Tx mocks base method
-func (m *MockDatasets) Tx(orm db.ORM) repo.Datasets {
+func (m *MockDatasets) Tx(orm db.ORM) x.Datasets {
ret := m.ctrl.Call(m, "Tx", orm)
- ret0, _ := ret[0].(repo.Datasets)
+ ret0, _ := ret[0].(x.Datasets)
return ret0
}
It use to have correct reference to interface, but started to substitute by "x" package
Do you know version what you upgraded from?
I can not be sure about mockgen binary, because I installed it using go install, but gomock vendored on revision = "c34cdb4725f4c3844d095133c6e40e448b86589b" version = "v1.1.1"
So I think it's 1.1.1 too
Are you seeing this problem with 1.2.0 or with Master?
If I took it from go get, it's from master, isn't it? I don't remember behaviour of go get
go get does grab master. Can you tell me the SHA?
Yes, I can. it's e698a2ea17fee71b248fc2bba82fc544c2017f9
I've found what's was wrong. Sorry, it's my fault, a million apologies. Thank you for your time. I have go installation in WSL and native windows. By some circumstances, $GOPATH was overridden and project became out of GOPATH and I did not noticed it. I had tried to install 1.1.1 version by reseting the reposiotry to commit with tag 1.1.1 and still had the same wrong behaviour, so I understood that problem was on my side.
Ah, I'm glad you figured it out!
In entire project I was generating mocks by putting go:generate comment above the interfaces declarations
//go:generate mockgen -source=$GOFILE -destination=../mock/mock_repo/$GOFILE
And it use to work perfectly till I updated the mockgen, which started to generate mocks with import declarations like
import x "."
what causes the import cycle what has broke all tests in my project.