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

dep init and dep ensure hang for direct dependencies that aren't remotely available #1622

Closed
jacobsimpson opened this issue Feb 3, 2018 · 4 comments

Comments

@jacobsimpson
Copy link

The problem affects both dep ensure and dep init. The root cause seems to be that my project directly imports another project, github.com/jacobsimpson/gobfile, which does not yet exist as a Github repository. I have it locally in my $GOPATH so builds work. I was able to confirm that a direct dependency on a non-existent Github project will hang both dep init and dep ensure by removing all dependencies on github.com/jacobsimpson/gobfile from my project, at which time dep worked as expected.

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

➜  dep version
dep:
 version     : v0.4.1
 build date  : 2018-01-27
 git hash    : 37d9ea0
 go version  : go1.9.3
 go compiler : gc
 platform    : darwin/amd64

What dep command did you run?

➜  dep ensure -v
Root project is "github.com/jacobsimpson/gob"
 5 transitively valid internal packages
 2 external packages imported from 2 projects
(0)   ✓ select (root)
(1)	? attempt github.com/spf13/pflag with 1 pkgs; at least 1 versions to try
(1)	    try github.com/spf13/pflag@v1.0.0
(1)	✓ select github.com/spf13/pflag@v1.0.0 w/1 pkgs

pstree for the hung process shows:

➜  pstree 30033
-+= 30033 jsimpson dep ensure -v
 \-+= 30065 jsimpson git ls-remote ssh://git@github.com/jacobsimpson/gobfile
   \--- 30069 jsimpson /usr/bin/ssh git@github.com git-upload-pack '/jacobsimpson/gobfile'
➜  rm -Rf Gopkg.* vendor
➜  dep init -v
Getting direct dependencies...
Checked 5 directories for packages.
Found 2 direct dependencies.

pstree for the hung process shows:

➜  pstree 31581
-+= 31581 jsimpson dep init -v
 \-+= 31592 jsimpson git ls-remote ssh://git@github.com/jacobsimpson/gobfile
   \--- 31593 jsimpson /usr/bin/ssh git@github.com git-upload-pack '/jacobsimpson/gobfile'

What did you expect to see?

Couple of things:

  1. -v option should show the package that is currently in progress. The -v output I saw from dep ensure lead me to believe that dep was hanging trying to update github.com/spf13/pflag. It was the pstree output that showed me the root cause. Once I saw dep was trying to download github.com/jacobsimpson/gobfile I knew why it was failing.
  2. Ideally dep would recognize a local package and let that substitute for trying to download something into vendor.
  3. dep should recognize that the package github.com/jacobsimpson/gobfile doesn't exist and produce an error message to that effect rather than hang trying to get it.

What did you see instead?

  • Hanging
@JackMordaunt
Copy link

Came here to post this exact issue. Infinite hanging really caught me off guard. The dep documentation also (afaik) does not address this issue, so as a first time dep user you can waste a lot of time trying to understand why dep init isn't working.

@smithaitufe
Copy link

@jacobsimpson I have been struggling to get dep init to work for three days now. I am grateful I stumbled on this.
Were you able to get it to work for you? If yes, can you share what you did?

@jacobsimpson
Copy link
Author

I created my project as a Github repository.

@mvdan
Copy link
Member

mvdan commented Sep 4, 2020

Dep was officially deprecated earlier this year, and the proposal to archive this repository was accepted. As such, I'm closing outstanding issues before archiving the repository. For any further comments, please use the proposal thread on the Go issue tracker. Thanks!

@mvdan mvdan closed this as completed Sep 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants