Skip to content

Installation Methods

Landon Clipp edited this page Jun 21, 2024 · 3 revisions

go install

When installing mockery, we recommend you download one of the pre-built binaries on the Releases page. The reason for this is that many environment-specific factors when compiling from source are removed as a requirement, meaning that the binaries we provide will always run on your machine (minus any OS's or architectures we don't generate builds for). This is the maximally reliable method for installation, and we highly recommend that you cache the distributions on your site-specific caching proxies if available.

If you choose to compile mockery from source, such as with go install, you may need to upgrade your environment to have at least the version of Go declared in this project's go.mod, even if you are creating mocks for an older version of Go. If your version of Go is at least that specified in this project's go.mod, then compiling mockery from source should produce a working binary, and the mocks it generates should be compatible with the version of Go used in your project, i.e. if the interfaces you are mocking work with a given version of Go, then the generated mocks should be compatible with that same version.

Please note that in v2 of this project, go install might break if you run an outdated version of Golang. This will often happen if we add new language feature support. While we support go install in this project, we recommend against using it for this reason.

Clone this wiki locally