dep init --override-source

Created on 1 Sep 2017  路  12Comments  路  Source: golang/dep

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
enhancement init

Most helpful comment

Oh :-)

All 12 comments

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

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

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?

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?

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.

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

Oh :-)

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

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

-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 https://github.com/golang/dep/issues/1124 to really go forward with this.

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

yeah - workin on that 馃槃

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sdboyer picture sdboyer  路  40Comments

wallrj picture wallrj  路  27Comments

sdboyer picture sdboyer  路  46Comments

pbennett picture pbennett  路  30Comments

sttts picture sttts  路  25Comments