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

dep init --override-source #1111

Closed
sttts opened this issue Sep 1, 2017 · 12 comments
Closed

dep init --override-source #1111

sttts opened this issue Sep 1, 2017 · 12 comments

Comments

@sttts
Copy link

sttts commented Sep 1, 2017

It's impossible to run dep init on a repository which requires the use of an alternative source for a package.

What I would like to have is a syntax like:

$ dep init --override-source k8s.io/api=github.com/sttts/api

Alternatively, a pre-existing file with overrides would work:

$ dep init --overrides initial-Gopkg.toml
@carolynvs
Copy link
Collaborator

Since override has pretty special meaning, what about something that is similar to what dep ensure does already for specifying an alternate source?

dep init -source k8s.io/api:github.com/sttts/api

@sttts
Copy link
Author

sttts commented Sep 1, 2017

Sounds perfect. I wonder though whether we also need version overrides. Are there analogous flags? dep init -revision k8s.io/api=<sha>?

@carolynvs
Copy link
Collaborator

The syntax that ensure uses is dep ensure -add pkg:source@version.

Though upon thinking about it further, if we used a file, we could treat it just like any other external config (like glide/godep, etc) and not need to shoe horn this in.

Stepping back a bit, since k8's does use godep, I'm wondering if you are asking for this because I haven't get gotten the importers working for k8's yet (I swear that I'm making progress!) If that worked, would this still be a feature with a strong use case?

@sttts
Copy link
Author

sttts commented Sep 1, 2017

Actually, I noticed the missing --source option because I tried dep init on my local fork of k8s.io/client-go and didn't manage work around it.

But in fact this is a general problem I will have now, at least with --source:

I want to create a Gopkg.toml and ship it for all tagged releases in our published repos. For that we update all repos in parallel locally, do a lot rewriting, cherry-picking etc. And when this works without problems we push all of them at once. So to ship with golang/dep support I have to create one Gopkg.toml per repo in the current GOPATH. The point here is: dep init has to use the repos in the GOPATH as well for k8s.io dependencies because they are not pushed yet and the pushed version might not compile with the currently processed repo.

Does this make sense?

@sttts
Copy link
Author

sttts commented Sep 1, 2017

Actually, a --source with file:///../apimachinery links would be odd as well. The most natural flag would be something like dep init --use-gopath=true.

@carolynvs
Copy link
Collaborator

Are you looking to have dep inspect your gopath? Give dep init -gopath a try!

@sttts
Copy link
Author

sttts commented Sep 1, 2017

Oh :-)

@carolynvs
Copy link
Collaborator

Let me know if that works for you, and we can either close this or keep digging for a solution.

@sdboyer
Copy link
Member

sdboyer commented Sep 11, 2017

@sttts is -gopath good enough for this purpose - can we close this one up?

@sttts
Copy link
Author

sttts commented Sep 12, 2017

-gopath is for all packages, also non-k8s.io packages. But probably a godep restore + dep init -gopath will do the job. I am still blocked by #1124 to really go forward with this.

@sdboyer
Copy link
Member

sdboyer commented Sep 26, 2017

I am still blocked by #1124 to really go forward with this.

yeah - workin on that 😄

@sdboyer
Copy link
Member

sdboyer commented Oct 2, 2017

i think the original need here is met, even if @sttts' individual progress is blocked by the other issue. closing

@sdboyer sdboyer closed this as completed Oct 2, 2017
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