英文:
How to use Mockery v0.0.0-dev in Golang?
问题
我正在尝试使用mockery在Golang中生成模拟数据,该仓库要求使用v0.0.0-dev版本。
我运行了brew install mockery
,但这只安装了v2.15.0,因此无法生成v0.0.0-dev版本的模拟数据。我该如何使用/安装mockery v0.0.0-dev?关于这个问题在网上找不到太多信息。
英文:
I am trying to generate mocks in Golang using mockery, and the repo requires v0.0.0-dev.
I ran brew install mockery
but that only installs v2.15.0, and thus cannot generate mocks with v0.0.0-dev. How do I use/install mockery v0.0.0-dev? There is not much info online about this
答案1
得分: 1
v0.0.0-dev
是当debug.ReadBuildInfo
没有嵌入构建信息时,mockery使用的“_defaultSemVer
”。
在你的情况下,安装的二进制文件确实包含了该构建信息,因此是预期的最新版本2.15.0。
你应该将依赖项更改为使用实际的版本(或者如果必须的话,使用@latest
),而不是v0.0.0-dev
,这取决于mockery的构建方式。
英文:
v0.0.0-dev
is the "_defaultSemVer
" used by mockery when debug.ReadBuildInfo
has no embedded build information.
In your case, the binary installed does include said build information, hence the 2.15.0, which is the latest release, as expected.
You should change the dependency to use an actual version (or, if you have to, use the @latest
).
Not v0.0.0-dev
, which depends on how mockery was built.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论