Thomas Skardal

Hello, computer.

Use local changes in go libraries by using replace in go.mod

July 12, 2021

Every now and then I have to search my way back to this blogpost to figure out how to test changes in library code without publishing a new version of it.

Add this manually to go.mod

replace github.com/<user>/<project> => /Users/<your-user>/path/to/local/codebase

or run go mod edit -replace like this:

go mod edit -replace github.com/<user>/<project>=/Users/<your-user>/path/to/local/codebase

I’ll just leave the link here for future reference:

https://thewebivore.com/using-replace-in-go-mod-to-point-to-your-local-module/