-
Notifications
You must be signed in to change notification settings - Fork 454
Godep breaks when go get fails to fetch a non-existing package in an existing repo #186
Comments
Further analysis, godep uses go get.
results in
which fails because clients/storage is not in master. However, the repo is properly downloaded. All that remains is the vcs revision being set to the correct version. (DL succeeds thanks to https://github.com/golang/go/blob/master/src/cmd/go/vcs.go#L697-L701) One potential fix would be to detect "cannot find package" in the error, traverse to the repo location (as identified in vcs.go or ending in .vcs), and performing the vcs revision from the root of the repo. A go get without -u should result in a successful package download at that point to verify it worked. Do you have any recommendations? I can help implement a fix for this. |
This is reasonable for a start. Another possibility would be to copy code from the go tool to download all packages in process. This would give much more control over this process, and let us fix one or two other issues as well. However, that would be a lot more work. For checking the error output of
|
I am ok with copying code over. I'll put together an initial attempt. |
@kr: Here is a working restore. I have given you access to github.com/fkautz/godep so we can collaborate on this more efficiently. @ahmetalpbalkan: pinging you since you were involved in earlier priv convo on this https://github.com/fkautz/godep/tree/restore-uses-inproc-with-fixed-repo-root There are currently two commits. The first is a naive copy from cmd/go to github.com/tools/godep/govcs. The second is a working restore. Once we get to a nice state, we can squash. A few things need to be done before this is ready for a PR and merge. 1: get needs to be modified to use govcs I also tried a few manual tests.
|
Also, this cmd/go was from 1.4.1. It is likely to fail in previous versions. If backwards compatibility is important, we should work our way backwards after pruning anything we don't want in the govcs package. |
@fkautz have you found a way to update this one yet? 😄 |
The branch listed above technically works, but needs some cleanup. We replicated cmd/go, publicly exposed some private fields/methods, and are able to pull and store properly. I'll get back onto this. |
Looks like the proposed solution branch vendors go code, which is probably a non-viable solution to this problem due to to having to keep it compatible with the installed go version (ignoring potential licensing issues). Would it be possible to instead pop off dir names when a |
Looks like that change is non-trivial due to the way Kind of a mess. Might be easier to add an option to |
@karlkfi that branch was the result of this comment above: #186 (comment) Here's some additional info: Premise: godep uses go get to check out the repo and git to rewind You can classify every repo into two categories.
Fortunately, golang provides a way to resolve the second issue by allowing the user to specify a repo. So, we need to solve the first problem.
So, godep calls go get. go get fails because it can check out the repo and then verifies the directory within the repo exists. So, the resulting fix I proposed basically downloads the repo, drops the directory not found exception, then rewinds to the correct version. Another way to fix this would be to take the hardcoded list and just make calls to git directly. |
This should now be fixed in v37. Please re-open if not. Thanks! |
Using godep @ 03595ab, I'm still observing the bug: # in some clean GOPATH...
go get github.com/openshift/origin
go get github.com/tools/godep
cd src/github.com/openshift/origin
$GOPATH/bin/godep restore -v Failures will eventually occur: ...
godep: error downloading dep (github.com/aws/aws-sdk-go/internal/endpoints): cannot find package "github.com/aws/aws-sdk-go/internal/endpoints" in any of:
/usr/lib/golang/src/github.com/aws/aws-sdk-go/internal/endpoints (from $GOROOT)
/home/vagrant/tmp/subbug/src/github.com/aws/aws-sdk-go/internal/endpoints (from $GOPATH)
godep: Downloading dependency (if needed): github.com/aws/aws-sdk-go/internal/protocol/ec2query
godep: error downloading dep (github.com/aws/aws-sdk-go/internal/protocol/ec2query): cannot find package "github.com/aws/aws-sdk-go/internal/protocol/ec2query" in any of:
/usr/lib/golang/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query (from $GOROOT)
/home/vagrant/tmp/subbug/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query (from $GOPATH)
... The {
"ImportPath": "github.com/aws/aws-sdk-go/internal/endpoints",
"Comment": "v0.9.9",
"Rev": "c4ae871ffc03691a7b039fa751a1e7afee56e920"
} Here, |
Docker just remove timeutils: moby/moby#18685 So this block will now refuse to {
"ImportPath": "github.com/docker/docker/pkg/timeutils",
"Comment": "v1.4.1-4045-g2b27fe1",
"Rev": "2b27fe17a1b3fb8472fde96d768fa70996adf201"
}, |
Fixes another issue reported in #186 where an entire package is missing. Don't bother restoring/downloading if already done.
Fixes another issue reported in #186 where an entire package is missing. Don't bother restoring/downloading if already done.
In the github.com/docker/distribution project, godep is setting an import package as:
instead of
The result is
The text was updated successfully, but these errors were encountered: