You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running mockery, it will error out saying there's no module providing github.com/my/pkg/tools. However, Go itself has no issues importing the package.
Expected Behavior
Expected mockery to behave the same way as Go.
Actual Behavior
Mockery fails with:
07 Sep 24 19:07 EDT ERR encountered error when loading package error="-: no required module provides package github.com/my/pkg/tools; to add it:\n\tgo get github.com/my/pkg/tools" dry-run=false version=v2.45.0
The text was updated successfully, but these errors were encountered:
Could you try deleting all // indirect dependencies while the replace directive is present in the go.mod file? Then, run go mod tidy to fetch the correct dependencies used by the replaced module.
Running go mod tidy while the replace directive exists (after manually deleting indirect dependencies) ensures that Go fetches the correct dependencies based on the specified replacement. Without this step, Go might retain incorrect indirect dependencies and fail to resolve the intended versions correctly.
This is how I resolved the issue when I encountered the same problem.
Description
When referencing a Go module that is being replaced using the
replace
directive in thego.mod
file, mockery fails to load the package.Mockery Version
v2.45.0
Go Version
v1.23.0
Installation Method
Steps to Reproduce
Start with a
go.mod
that usesreplace
:And then attempt to generate mocks for interfaces in that package:
When running mockery, it will error out saying there's no module providing
github.com/my/pkg/tools
. However, Go itself has no issues importing the package.Expected Behavior
Expected mockery to behave the same way as Go.
Actual Behavior
Mockery fails with:
The text was updated successfully, but these errors were encountered: