Error: used from two different module paths

I have a direct dependency in my go.mod file that used to be github.com/imdario/mergo

but the creators changed the name to dario.cat/mergo. I updated this dependency to the correct name in the direct dependency in my go.mod file, however, I also have an indirect dependency that is
github.com/imdario/mergo. So, to update this dependency to the new name I used a replace directive. But, I’m getting the error dario.cat/mergo@v1.0.0 use for two different module paths (dario.cat/mergo and github.com/imdario/mergo). How do I resolve this error since this module path has to be included in both the direct and indirect dependencies?

1 Like

Hi @Lauren_Wiltsek, welcome to the forum.

Without knowing the exact content of your current go.mod file, I would suggest to try the following:

  1. Ensure all import statements have been changed to the new import path.
  2. Remove the replace directive
  3. Run go mod tidy to clean up the go.mod file.

Let me know how it works out.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.