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

dep ensure does not accept -v with -update #1458

Closed
davecheney opened this issue Dec 17, 2017 · 5 comments · Fixed by #1486
Closed

dep ensure does not accept -v with -update #1458

davecheney opened this issue Dec 17, 2017 · 5 comments · Fixed by #1486

Comments

@davecheney
Copy link
Contributor

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

v0.3.2-83-g13df5561

What dep command did you run?

dep ensure -update k8s.io/client-go@6.0.0 -v

What did you expect to see?

verbose output of the update process

What did you see instead?

Invalid arguments passed to ensure -update:

  ✗ could not infer project root from dependency path: -v: "-v" is not a valid import path
  ✗ version constraint ^6.0.0 passed for k8s.io/client-go, but -update follows constraints declared in Gopkg.toml, not CLI arguments

update arguments validation failed

@avgeorge
Copy link

Setting -v first works as expected for me.
Try dep ensure -v -update k8s.io/client-go@6.0.0.
Trying to set -v after -update gives me the first error you see ("could not infer project root ...")

@carolynvs carolynvs added the bug label Dec 22, 2017
@carolynvs
Copy link
Collaborator

Thanks for reporting the bug in our flag parsing!

@awoodbeck
Copy link
Contributor

I can take this one. The stdlib flag package stops parsing command line options once it encounters an argument that isn't a flag. Short of using an alternative flag package or augmenting the way dep uses the flag package, the correct fix for this issue may simply be updating cmd.Args() to ensure the optional -v flag precedes the optional [<spec>...] argument.

@davecheney
Copy link
Contributor Author

davecheney commented Dec 27, 2017 via email

@awoodbeck
Copy link
Contributor

@davecheney I think we were talking about the same thing but my terminology was different. The -v option is in the sub command's flag set and shows up in the list of options. But its use isn't detailed in the sub command's syntax. The PR I just proposed addresses this.

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