I am working on a go project, which has a dependency on original-project
. I now want to change the behavior in this project by modifying original-project
. So I cloned github.com/y/original-project
to github.com/x/my-version
and replaced all occurrence of github.com/y/original-project
with github.com/x/my-version
(including in mod.go
).
But I keep getting this error:
go: github.com/x/my-version@v0.5.2: parsing go.mod:
module declares its path as: github.com/y/original-project
but was required as: github.com/x/my-version
Even when I run go get -u -v -f all
or github.com/x/my-version
What could I be doing wrong?
I think the problem comes from the fact that the go.mod
of your cloned version of original-project
still says module github.com/y/original-project
. You should use the go.mod
replace
directive. It is meant for cases like yours exactly.
replace github.com/y/original-project => /path/to/x/my-version