Skip to content
This repository was archived by the owner on Aug 25, 2018. It is now read-only.

When fetching a dependency, automatically remove their vendor/ #68

Open
tarnfeld opened this issue Aug 8, 2016 · 3 comments
Open

When fetching a dependency, automatically remove their vendor/ #68

tarnfeld opened this issue Aug 8, 2016 · 3 comments

Comments

@tarnfeld
Copy link

tarnfeld commented Aug 8, 2016

Sometimes when importing code from external applications, they have committed the vendor/ folder. Perhaps they didn't intend use as a library, but you'd still like to import some code of functions.

In this case, it's possible to see type/interface errors with return values because code inside the dependency will use their version of the interface, and code outside will not. When installing a dependency, could we automatically look for the vendor/ folder, and delete it?

@jchv
Copy link

jchv commented Aug 23, 2016

I agree with this. I'm currently using multiple packages per repository and it's hard to picture how vendoring may impact this. To exemplify why it's a hard case, think of it this way: two repositories may well depend on eachother so as long as there's no circular dependencies between packages. Thus, two repositories could theoretically vendor each-other. While this can (and in many/most/all? cases, should) be solved by splitting repositories up, it's still an interesting case that works nearly perfectly with traditional go get. But if both projects are using vendoring, they could land in each other's vendor folders.

A sane solution to this would be to flatten all vendoring intelligently, or just delete the entire vendor folder and treat it as if there was no vendor folder as proposed here.

(Note: I haven't tried any of this due to my concerns, so some of them may well be invalid.)

@peter-mogensen
Copy link

I think there's very good arguments for never having libraries vendor code.
https://peter.bourgon.org/go-best-practices-2016/#dependency-management
If something is not a library and does vendor and you want to use it as a library, I'd say there's a conflict you have to resolve manually.

@philwinder
Copy link

I've just hit this issue with gvt, and is exactly why I recommend glide over gvt, because that has a -v option that is able to flatten sub-dependencies.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants