Comments (9)
If you are using reflect mode, just make sure that you have installed the same version of this package as the one defined in your go.mod.
from mock.
The same problem that ash2k encountered also happens to me. This occurs when both v0.2.0 and v0.3.0 are installed in the same environment. The problem can be solved by uninstalling either one of these versions.
from mock.
I think it was a somewhat unrelated issue. I tried upgrading 0.2.0 -> 0.3.0 and at the same time adding -typed
. It doesn't work this way, at least didn't work for me. I upgraded to 0.3.0 first and then now added -typed
. Haven't finished fixing the tests, but mock generation succeeded. Sorry for the noise.
from mock.
Switching to source mode instead of reflect mode resolved this for me. I ultimately had to switch to source mode anyways as I'm using generics in my interfaces now that v0.3.0 has been released.
from mock.
I'm having this issue and the mockgen version is the same between the binary and our go.mod yet it keeps on failing. It works fine under macOS but on our containers it fails consistently.
We are on v0.2.0 and cannot upgrade until #104 is fixed as it would cause massive churn in source control since we use an absolute path when specifying the output option, and everyone has a different home directory.
from mock.
I ran into this same issue today 🐞 👍
from mock.
I'm getting similar errors without -mod=vendor
. This started with v0.3.0.
It cannot find one of the application packages:
prog.go:14:2: no required module provides package gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v16/cmd/agentk/agentkapp: go.mod file not found in current directory or any parent directory; see 'go help modules'
prog.go:12:2: no required module provides package go.uber.org/mock/mockgen/model: go.mod file not found in current directory or any parent directory; see 'go help modules'
2023/09/21 03:52:18 Loading input failed: exit status 1
exit status 1
from mock.
Make sure the mockgen
version you installed is the same one in your go.mod
from mock.
It turns out that, one of the reasons, this fails is that on laptop we had copies of gomock_reflect_....
folders, and we had one accidentally added to source control a while back. Deleting the unwanted gomock_reflect_....
folder from source control removed the only go file that imported "go.uber.org/mock/mockgen/model"
and then breaking our pipelines. Our fix was to add a test/mockgen_compat/main.go
file that does nothing else but importing "go.uber.org/mock/mockgen/model"
and the pipelines are happy again.
from mock.
Related Issues (20)
- Release schedule HOT 2
- Improve default failed equality match output to more clearly show diffs HOT 1
- Add a helper method for inline setup of mocks HOT 1
- Flag `-write_generate_directive` produces wrong paths in the directive
- Generating mocks on a file with a dot import creates a compilation error
- Support specifying interfaces to mock when using source mode
- Error when mock generating dot import file with different package name
- Able to insert copyright file which already has comments into the header HOT 2
- The use of `reflect.DeepEqual()` inside `Eq()` matcher is not trivial but not documented.
- Allow control over matching order of call expectations HOT 3
- Aliased imports don't propagate well in the generated mocks (at least in source mode) HOT 13
- Nilaway complains about generated mock HOT 2
- FPL Evolution Level 3 Chargers Missing in Mapbox API
- Import shadowing breaks generated code HOT 1
- invocation from timer triggered go routine will report data race HOT 2
- Relative path as parameter values for -source and -destination HOT 3
- Generating mocks (reflect mode) fails if interface contains methods with generic types HOT 2
- Conflict of argument name and imported package name results in compilation error
- Generate mock return an error while trying to parse a imported package name alias
- mockgen could be faster by invoking go list with different parameters.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mock.