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

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

WBOY
Release: 2024-02-10 20:50:18
forward
528 people have browsed it

如何在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!

source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template