Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vendored submodule inception use case #16

Open
samv opened this issue Nov 4, 2016 · 0 comments
Open

Vendored submodule inception use case #16

samv opened this issue Nov 4, 2016 · 0 comments

Comments

@samv
Copy link
Contributor

samv commented Nov 4, 2016

In the case where you're vendoring a library which has vendored dependencies, building on the master project can cause problems (particularly if the vendored library shares types from third party libraries with the outer project). Go prefers to use the inner vendored directory, and sees either empty directories or cloned checkouts, depending on whether you cloned recursively or not.

I know that the standard approach for this is to not vendor dependencies in libraries, but I feel that forgoes some of the benefits of submodule-based vendoring (eg, build reproducibility & keeping change history for dependencies in one place, convenient per-project GOROOT automatically checked out by git submodule update, documenting the last tested version of a dependency, not necessarily breaking your workflow when a library makes an API incompatible change, etc).

Instead it should be super easy to ignore the library's vendoring and bypass it for a higher level project. This fits well with git submodule-based approaches to vendoring; whoever checks out the library can choose whether to use the vendored dependency with a recursive clone, or to rely on the master vendor directory.

My approach is to run this after git submodule update at the top level of each working tree:

git submodule foreach 'git submodule status | grep vendor | while read junk dirname
do
     [ ! -d "$dirname" ] || (echo "nuking `pwd`/$dirname"; rm -rf "$dirname")
     git update-index --assume-unchanged "$dirname"
done'

This seems like the sort of thing it should be possible to do more easily from vendetta. Any thoughts on the problem, solution or whether patches for this would be welcome?

@samv samv changed the title Vendetta inception use case Vendored submodule inception use case Nov 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant