Repo with multiple modules and vendoring in main module: how to avoid constant re-vendoring?

125 views
Skip to first unread message

juliu...@gmail.com

unread,
Aug 2, 2019, 8:34:14 AM8/2/19
to golang-nuts
Hi,

I'm exploring splitting up the main Prometheus repo (https://github.com/prometheus/prometheus) into a main module and several library modules.

We'd like to avoid having to update versions in the main module's go.mod for any change to a local module, which I can already solve with "replace" pointing to a relative path in the same repo.

However, the main module also currently vendors all dependencies using "go mod vendor", and we build using "go build -mod=vendor", which *only* reads dependencies from the local "vendor/" dir and ignores go.mod. That means we'd still have to run "go mod vendor" after any change to a local module, to pick up those changes in the main module. Just deleting the repo-local modules from the "vendor/" dir doesn't help, since then those packages / modules aren't found at all. There doesn't seem to be a way to turn use vendoring only for non-local dependencies.

So: Any practical advice for how to minimize dep versioning maintenance work with between multiple modules in a repo when using vendoring?

Thanks!

Julius

Igor Maznitsa

unread,
Aug 9, 2019, 2:55:36 AM8/9/19
to golang-nuts
I am not sure that it is possible just out of the box, some guys use my maven plugin to work with multiple module projects because it makes some business in the area and uses maven repository to share sources.
Reply all
Reply to author
Forward
0 new messages