I didn't expect vendor/modules.txt to contain the nested modules within it nor having those nested modules be vendored into the top level vendor folder.
What did you see instead?
Nested submodules are vendored.
We currently get around this by postprocessing the modules.txt and the vendor directory. I realize that nested modules might not be a great idea (it has caused me a number of headaches) however for code living in the same repo the current go mod vendor behavior of vendoring our own code doesn't make much sense to me. Is this intended behavior or just something that isn't protected against.
The text was updated successfully, but these errors were encountered:
Is this intended behavior or just something that isn't protected against.
At the moment, this is working as designed: go mod vendor doesn't know (or particularly care) about the overall repo structure — it just knows where the main module is and vendors in the dependencies of the main module wherever they are found.
Omitting same-repo dependencies is one of the use-cases I had in mind for partial vendoring (#30240).
@shoenig, we don't have any specific plans to work on this. If this feature is important to you, some more detail on your use-case (especially the alternatives you considered and the problems with those alternatives) would be helpful.
At the moment, the big question is whether the added convenience is worth the added complexity (of both the implementation and the documentation).