Local modules not updating in go.mod

569 views
Skip to first unread message

Nikhilesh Susarla

unread,
Apr 5, 2022, 5:10:01 AM4/5/22
to golang-nuts
Hi, 

I have a local package Z under X/Y folder
So, to use the local package Z, I changed in the go.mod of the other package which wants to use it. 

replace X/Y/Z => ../Z
After that if I run go mod tidy.
This should ideally create an entry in requires with X/Y/Z v0.0.0-00010101000000-000000000000 but it is bringing back from the internet and adding that module
X/Y/Z v0.6.0

I was able to replace for other couple of local packages.
But one of them isn't happening. 

Any help on how and why it is not happening.

Thank you
Susarla Nikhilesh.

Bryan C. Mills

unread,
Apr 6, 2022, 5:05:24 PM4/6/22
to golang-nuts
`replace` substitutes the source code for a given version of a module (or all versions of the module); it does not replace the nodes for that module in the module requirement graph.

For local development of interdependent modules, I would suggest using a go.work file instead. (For the most part that shouldn't require interim changes to any module's go.mod file.)

Reply all
Reply to author
Forward
0 new messages