Go get cannot find local packages when using multiple modules in a repo

You can have local “sub” modules like you ask for by adding a require statement and a matching replace statement with a relative file path in go.mod.

In the “root” ./go.mod:

module example.com/localModule

require example.com/localModule/model v0.0.0

replace example.com/localModule/model v0.0.0 => ./model

Leave a Comment