Home  >  Article  >  Backend Development  >  How to use Mockery v0.0.0-dev in Golang?

How to use Mockery v0.0.0-dev in Golang?

WBOY
WBOYforward
2024-02-10 20:50:18462browse

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

php Editor Xigua will introduce you how to use Mockery v0.0.0-dev in Golang. Mockery is an open source library for creating and managing mock objects, which helps us mock dependencies during testing. Use Mockery to easily create and configure mock objects for unit testing. This article will provide you with detailed steps and sample code to help you get started quickly and effectively use Mockery for testing. Let’s explore together!

Question content

I am trying to use mocks to generate mocks in Golang and the repository requires v0.0.0-dev.

I ran brew install mockery but only v2.15.0 was installed, so I couldn't build the mock using v0.0.0-dev. How to use/install mockery v0.0.0-dev? There is not much information about this on the Internet

The solution

v0.0.0-dev is "_defaultSemVer ", Used when debug.ReadBuildInfo does not embed build information.

In your case, the installed binaries do contain the build information stated and are therefore 2.15.0, which is the expected latest version.

You should change your dependencies to use the actual version (or @latest if you must).
Not v0.0.0-dev, that depends on how the mock is built.

The above is the detailed content of How to use Mockery v0.0.0-dev in Golang?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete