Repository navigation
build: run mockery as a go tool (MK8S-516) - #91
Merged
Merged
Conversation
mockery was installed apart, at a version pinned twice (CI step and devcontainer), and a generator bump only reached them through a Renovate annotation. Declare it as a tool in go.mod and call it with go tool mockery: the version is pinned once, Renovate updates it with the other Go modules, and go generate works without installing anything. The generated mocks do not change. Refs: MK8S-516
riadelhajjaji-scality
approved these changes
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mockery is now a
toolingo.mod, run withgo tool mockery, instead of a binary installed apart in the CIgeneratejob.Problem
//go:generate mockerycalled amockerybinary that had to be installed first. It was installed in the CIgeneratejob, each with its own version and its own Renovate annotation on the GitHub release, so the version could drift between them, andgo generatefailed on a machine without it. The Go code generators of our other repos are tools ingo.mod(oapi-codegen in metalk8s-registry-node-agent, mockery in raidmgmt), updated by Renovate like any other module.What changes
go get -tool github.com/vektra/mockery/v3@v3.9.1: the version already used, now pinned once ingo.mod.//go:generate go tool mockery:go generate ./...works with Go alone.Install mockeryCI step is removed.Testing
go generate ./...with Go 1.27.4go build ./...,go vet ./...go test ./pkg/...Out of scope
Refs: MK8S-516