如何在Golang中使用Mockery v0.0.0-dev?

huangapple go评论98阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2022年11月21日 13:14:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/74514507.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定