Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

dep init fails all the time but glide works #1526

Closed
zhexuany opened this issue Jan 13, 2018 · 4 comments
Closed

dep init fails all the time but glide works #1526

zhexuany opened this issue Jan 13, 2018 · 4 comments

Comments

@zhexuany
Copy link

What version of dep are you using (dep version)?

What dep command did you run?

dep init

What did you expect to see?

generated Gopkg files

What did you see instead?

failed to do so and report a lot of error on solving.

I works on a project A which depends on other two project B and C. Both B and C are using dep right now. When I try to migrate to dep, problems raise. After spent more than 3 hour on this, I gave up and try to use glide and it works.

From a point of view of user, dep init does not need to produce a correct dependencies. dep is better to be right about dependencies but I think it can tolerate some mistakes and let user to correct these rather than fail to generate Gopkg files.

@darkowlzz
Copy link
Collaborator

Hi, thanks for creating an issue for this. Can you share more details about the errors that you got on running dep init? Details about the errors could help in understanding which part of init is causing this issue.

@zhexuany
Copy link
Author

zhexuany commented Jan 14, 2018

Hello there,

The error generated by dep init is huge, but I can summarize these error.

Let's call the project I try to dep init is A. A has a direct dependency B and a transitive dependency C. In addition, B and C has a common dependency D. dep init select B at master but it can not select C at master becauseC disagrees x/net revision with B. So dep init iterates all version that C has and select a very old version. At this stage, dep init move to solve D. D doesn't have any release and it is not compatible with the old version dep just select for C. That is why dep init fails all the time.

I also tried -gopath flag and clone both B and C into to GOPATH. In addition, I also try to use constraint in Gopkg.toml in both B and C and push a branch to remote which can lock x/net but dep init still repeat the process I just described above. The error message is disagreement on network addr for golang.org/x/net: (58) https://github.com/golang/net.git from

I am looking for answer how to deal with this.

@sdboyer
Copy link
Member

sdboyer commented Jan 15, 2018

hi - sorry you're encountering this. couple things:

From a point of view of user, dep init does not need to produce a correct dependencies. dep is better to be right about dependencies but I think it can tolerate some mistakes and let user to correct these rather than fail to generate Gopkg files.

We very much agree, though the implementation is a tad tricky - deciding where to draw the line. But, there's a WIP PR here: #1280

The error message is disagreement on network addr for golang.org/x/net: (58) https://github.com/golang/net.git from

...ugh. This is exactly why i'm working on a big mountain of docs - that is a pointless source declaration (it's exactly what golang.org/x/net would work out to, anyway), but because someone made it, dep has to honor it, and now it's causing conflicts.

For now, you may have to hand-create Gopkg.toml. Here, though, is the WIP document on migrations in the new mountain of docs: https://github.com/sdboyer/dep/blob/83b71696622328e0f991f41bfcdb4558a02765d7/docs/migrating.md . that may help you navigate through the init process.

(closing as dup)

@sdboyer sdboyer closed this as completed Jan 15, 2018
@zhexuany
Copy link
Author

Ah, I did not do my job thoroughly. I did google about it, but nothing useful. Thanks for detailed explanation. You effects are really appreciated. Thanks!

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

No branches or pull requests

3 participants