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

vendor: switch to dep #16275

Merged
merged 2 commits into from
Jun 12, 2017
Merged

vendor: switch to dep #16275

merged 2 commits into from
Jun 12, 2017

Conversation

dt
Copy link
Member

@dt dt commented Jun 1, 2017

So big question: is this a good idea?

dep is alpha and I think the dep developers would be the first to say it isn't
perfect: it still has plenty of bugs, unpolished cases and known-issues. That
said, the question to answer in evaluating if we should switch is not if dep is
perfect, but rather is if it is better, in our usage, than glide.

The primary motivator may well be the ability to dep ensure foo@rev. This has
been our single biggest issue with glide in practice, and it looks like dep will
offer a significant improvement here, since it only bumps foo (and anything else
needed to bump foo), not the world.

The biggest argument against switching now is probably dep's immaturity: dep is
still alpha and under pretty active design and development, so we'll certainly
find rough edges and bugs. We'll need to update our usage patterns as it evolves
upstream (though we'll obviously vendor it). If we waited, presumably more of
those bugs would be found and fixed before we ever hit them.

Two counter-arguments to that though are 1) we've found and filed bugs in every
tool we tried (govendor, gvt, glide and now dep), so waiting does not seems to
help much and 2) someone has to find those bugs. Indeed, it might actually
easier for us than many to be early adopters and debuggers, since as a FOSS
project, we can more easily link directly code samples, PRs, CI builds, etc.

Also, if we do identify places where dep could better serve our user-cases, by
giving feedback and examples early, we have better chance of dep's development
being able to take those into account and serve them more elegantly.

@rjnn
Copy link
Contributor

rjnn commented Jun 1, 2017

This change is Reviewable

@dt dt added the do-not-merge bors won't merge a PR with this label. label Jun 1, 2017
@benesch
Copy link
Contributor

benesch commented Jun 1, 2017

If I could LGTM on concept alone, I would.

@tamird
Copy link
Contributor

tamird commented Jun 1, 2017

Looks good to me, with a few comments. Is this sane to do?


Reviewed 13 of 13 files at r1.
Review status: all files reviewed at latest revision, 3 unresolved discussions, some commit checks failed.


Gopkg.toml, line 104 at r1 (raw file):

  revision = "7248742ae7127347a52ab9d215451c213b7b59da"

[[constraint]]

Comment?


vendor, line 1 at r1 (raw file):

Subproject commit 1f7655249788aa052d76a959be5b717c62703561

how come the content of vendor changed? I was imagining the diff would be -glide, +dep, but it looks like more than that.


pkg/cmd/github-post/testdata/stress-fatal, line 0 at r1 (raw file):
I think this was accidental.


Comments from Reviewable

@dt
Copy link
Member Author

dt commented Jun 1, 2017

Whoops, sorry folks, I should have clarified that this isn't ready yet, I just wanted to see the CI's reaction.

@dt
Copy link
Member Author

dt commented Jun 1, 2017

@tamird still not looking to get this mergeable right away (they might be refactoring the cli commands soon or something?) but I went ahead and wrote some words about why this might be sane, or at least not less sane than sticking with glide, in the PR desc.

@tamird
Copy link
Contributor

tamird commented Jun 1, 2017

If this works, I'm 👍 on it. The PR description (with typos etc fixed) should become the commit message and we should just merge this after an announcement on the forum.

Glide certainly seems like mostly abandonware now, so again, +1.


Review status: all files reviewed at latest revision, 3 unresolved discussions, some commit checks failed.


Comments from Reviewable

@dt
Copy link
Member Author

dt commented Jun 1, 2017

Review status: all files reviewed at latest revision, 3 unresolved discussions, some commit checks failed.


vendor, line 1 at r1 (raw file):

Previously, tamird (Tamir Duberstein) wrote…

how come the content of vendor changed? I was imagining the diff would be -glide, +dep, but it looks like more than that.

Yeah, I flattened all our glide.lock entries into one giant dep ensure command, in the hope that that would produce zero vendor changes... but dep seems to strip vendor: looks like it produces 288MB/17k files, whereas our current glide-produce vendor is 323MB/21k files.

We could try asking glide to do the same, to observe the glide-vs-dep diff (or lack thereof) in isolation.


Comments from Reviewable

@tamird
Copy link
Contributor

tamird commented Jun 1, 2017 via email

@dt
Copy link
Member Author

dt commented Jun 8, 2017

re-running the dep conversion on top of a vendor trimmed using glide i -v, eliminates a fair amount of the change, but not all of it: looks like a few libs are at a different version -- indeed, in Gopkg.lock, it shows e.g. genproto at aa2eb687b4d3e17154372564ad8d6bf11c3cf21f, but the initial ensure used to import glide.lock passed google.golang.org/genproto@bb3573be0c484136831138976d444b8754777aff. Still trying to figure out why.

@dt dt force-pushed the dep branch 2 times, most recently from d91ab2c to 09f68d2 Compare June 8, 2017 20:18
So big question: is this a good idea?

dep is alpha and I think the dep developers would be the first to say it isn't
perfect: it still has plenty of bugs, unpolished cases and known-issues. That
said, the question to answer in evaluating if we should switch is not if dep is
not if dep is perfect, but rather is if it is better, in our usage, than glide.

The primary motivator may well be the ability to `dep ensure foo@rev`. This has
been our single biggest issue with glide in practice, and it looks like dep will
offer a significant improvement here since it only bumps foo (and anything else
needed to bump foo), not the world.

The biggest argument against switching now is probably dep's immaturity: dep is
still alpha and under pretty active design and development, so we'll certainly
find rough edges and bugs. We'll need to update our usage patterns as it evolves
upstream (though we'll obviously vendor it). If we waited, presumably more of
those bugs would be found and fixed before we ever hit them.

Two counter-arguments to that though are 1) we've found and filed bugs in every
tool we tried (govendor, gvt, glide and now dep), so waiting does not seems to
help much and 2) *someone* has to find those bugs. Indeed, it might actually
easier for us than many to be early adopters and debuggers, since we're as an
FOSS project, we can easily link directly code samples, PRs, CI builds, etc.

Also, if we do identify places where `dep` could better serve our user-cases, by
giving feedback and examples early, we have better chance of dep's development
being able to take those into account and serve them more elegantly.
@dt
Copy link
Member Author

dt commented Jun 8, 2017

Edited Gopkg.lock by hand to set the initial version to match glide.lock and re-ran ensure on top of the stripped vendor -- the diff in vendor looks like what I'd expect now. I guess this is... RFAL? I'm still going to try to figure out why my initial mega-ensure didn't work as I expected, but hey, this is green now, and the diff looks about right.

@benesch
Copy link
Contributor

benesch commented Jun 9, 2017

The diff looks just about right to me, but where did github.com/petar/GoLLRB come from?

@dt
Copy link
Member Author

dt commented Jun 9, 2017

GoLLRB comes in via a standalone test util (pkg main) in google/btree, which comes in via etcd.

@benesch
Copy link
Contributor

benesch commented Jun 9, 2017

Right, but why only with dep? Different import resolution mechanism from Glide?

@dt
Copy link
Member Author

dt commented Jun 9, 2017

yeah, I'll bet glide ignored non-imported pkg main

@tamird
Copy link
Contributor

tamird commented Jun 9, 2017 via email

Copy link
Contributor

@benesch benesch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, LGTM!

@dt dt removed the do-not-merge bors won't merge a PR with this label. label Jun 9, 2017
@dt dt changed the title [do-not-merge] vendor: switch to dep vendor: switch to dep Jun 9, 2017
@dt dt requested a review from tamird June 9, 2017 15:00
@dt
Copy link
Member Author

dt commented Jun 9, 2017

So, indeed, it looks like dep ensure foo@rev doesn't respect rev if you don't actually depend on foo directly. I asked @sdboyer about this and it sounds like that might be expected and/or explicitly disallowed in some near future.

w.r.t the new GoLLRB dep: google/btree, which we get via etcd, depends on it -- the import is in a file that's // +build ignore'ed and package main, so maybe that's why glide was ignoring it, but I'm not sure.

@tamird
Copy link
Contributor

tamird commented Jun 9, 2017 via email

@sdboyer
Copy link

sdboyer commented Jun 9, 2017

w.r.t the new GoLLBR dep: google/btree, which we get via etcd, depends on it -- the import is in a file that's // +build ignore'ed and package main, so maybe that's why glide was ignoring it, but I'm not sure.

IIRC glide does ignore these, but dep does not (for now), so yeah, that's probably why it showed up.

You can always put github.com/petar/GoLLRB in the ignored list in Gopkg.toml 😄

@dt
Copy link
Member Author

dt commented Jun 9, 2017

Huh, actually we might need to "constrain" every dependency to branch=master if we want update to pick up upstream changes in between tagged releases, since in the absence of any explicit constraint, when dep ensure -update picks "the lastest version allowed", it picks the latest tagged release before master, and it looks like several upstreams do not tag frequently at all.

This is really unfortunate -- if we need excplicit constraints for every dependency just to make them updateable, we a) dramatically increase the chance of spurious conflicts (where previously we'd have happily deferred to an upstream's preference) and b) we have a de-normalization of our dep closure that is not mechanically maintained -- even though dep discovers edges on the fly from imports, when an import is added or removed, we now need to maintain this denomalization.

@tamird
Copy link
Contributor

tamird commented Jun 9, 2017 via email

@sdboyer
Copy link

sdboyer commented Jun 10, 2017

This is really unfortunate -- if we need excplicit constraints for every dependency just to make them updateable,

A small quibble, maybe, but the constraint type is probably more defining the track for updates. This is why I'm not necessarily the biggest fan of leaving deps unconstrained (golang/dep#213) - it allows for subtle track-switching in ways that might be surprising to users.

we a) dramatically increase the chance of spurious conflicts (where previously we'd have happily deferred to an upstream's preference) and b) we have a de-normalization of our dep closure that is not mechanically maintained -- even though dep discovers edges on the fly from imports, when an import is added or removed, we now need to maintain this denomalization.

Hmm...interesting. If this is your goal, then I think what you really might be after is preferred versions, maybe? They could allow you to specify less, but have a bit more stability by deferring to what your dependencies have locked.

It would be good to include this overall context in golang/dep#738 😄

@tamird
Copy link
Contributor

tamird commented Jun 10, 2017

:lgtm:


Reviewed 1 of 13 files at r2, 12 of 12 files at r3.
Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@dt dt merged commit 7e10b19 into cockroachdb:master Jun 12, 2017
@dt dt deleted the dep branch June 12, 2017 19:01
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

Successfully merging this pull request may close these issues.

5 participants