nomad-software / vend

A dependency vendor for Go programs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix vendoring of deps of go mod deps

andremarianiello opened this issue · comments

Currently, only modules in the required modules list are copied into the vendor directory. However, go mod vendor copies all dependencies. This includes modules in the requires modules list of dependencies that also use go modules. go build -mod=vendor will fail with missing dependencies after vend, but not after go mod vendor in this case.

I don't know what other dependencies it would copy other than the required ones. Have you any more information?

Here is an example:

Your module is module A. A uses go modules, so it has a go.mod file with its requirements. One of its requirements is module B. B also has a go.mod file. B's go.mod has a requirement of module C. In order to build with go build -mod=vendor, B and C must be copied into the vendor directory. go mod vendor does this by looking at the go.mod file in B to determine that C is needed. vend does not do this, so C does not get included in the vendor dir, so the build fails.

Does that make sense?

Right I get it. I'll need to take a closer look thanks.

Updated, see if that's any better.

I can't use vend in my project because it has a replaced module, so I can't test this myself, but if the fix works for you then I am fine with this being closed.

Yeah seems to work fine. It was that the module information didn't include the third party dependencies too. This is much more thorough now.