When converting to using glide to dep with a repo that uses goconvey for testing, dep appears to be cloning goconvey incorrectly. I created an example repo here: https://github.com/skisulli/dep-issue.
go version) and dep (git describe --tags) are you using?$ go version
go version go1.8.3 darwin/amd64
$ git describe --tags
v0.1.0-224-g88277ad
dep command did you run?I replaced the real absolute paths with $GOPATH in the output.
$ dep init -v
Importing configuration from glide. These are only initial constraints, and are further refined during the solve process.
Detected glide configuration files...
Loading $GOPATH/src/github.com/skisulli/dep-issue/glide.yaml
Loading $GOPATH/src/github.com/skisulli/dep-issue/glide.lock
Converting from glide.yaml and glide.lock...
Using 1.6.2 as initial constraint for imported dep github.com/smartystreets/goconvey/convey
Trying master (9e8dc3f) as initial lock for imported dep github.com/smartystreets/goconvey
Trying master (2b1d432) as initial lock for imported dep github.com/gopherjs/gopherjs
Trying v4.2.1 (77f1821) as initial lock for imported dep github.com/jtolds/gls
Root project is "github.com/skisulli/dep-issue"
1 transitively valid internal packages
1 external packages imported from 1 projects
(0) ✓ select (root)
(1) ? attempt github.com/smartystreets/goconvey/convey with 1 pkgs; 17 versions to try
(1) try github.com/smartystreets/goconvey/[email protected]
(1) ✓ select github.com/smartystreets/goconvey/[email protected] w/1 pkgs
(2) ? attempt github.com/jtolds/gls with 1 pkgs; at least 1 versions to try
(2) try github.com/jtolds/[email protected]
(2) ✓ select github.com/jtolds/[email protected] w/1 pkgs
(3) ? attempt github.com/gopherjs/gopherjs with 1 pkgs; at least 1 versions to try
(3) try github.com/gopherjs/gopherjs@master
(3) ✓ select github.com/gopherjs/gopherjs@master w/1 pkgs
(4) ? attempt github.com/smartystreets/goconvey with 7 pkgs; at least 1 versions to try
(4) try github.com/smartystreets/goconvey@master
(4) ✓ select github.com/smartystreets/goconvey@master w/9 pkgs
(5) ? attempt github.com/smartystreets/assertions with 1 pkgs; at least 1 versions to try
(5) try github.com/smartystreets/assertions@8d53f0381cdc56c7e0f06f4995d21cd04c5a53a8
(5) ✓ select github.com/smartystreets/assertions@8d53f0381cdc56c7e0f06f4995d21cd04c5a53a8 w/3 pkgs
✓ found solution with 15 packages from 5 projects
Solver wall times by segment:
b-list-pkgs: 1.135172521s
b-gmal: 957.375451ms
b-source-exists: 210.132153ms
satisfy: 875.108µs
select-atom: 753.894µs
select-root: 299.161µs
new-atom: 137.955µs
b-list-versions: 27.119µs
other: 19.122µs
b-deduce-proj-root: 7.492µs
TOTAL: 2.304799976s
Old vendor backed up to $GOPATH/src/github.com/skisulli/dep-issue/_vendor-20170717135913
$ make test
go test -v `go list ./... | grep -v /vendor/`
can't load package: package github.com/skisulli/dep-issue/vendor/github.com/smartystreets/goconvey/convey: found packages convey (assertions.go) and main (dependencies.go) in $GOPATH/src/github.com/skisulli/dep-issue/vendor/github.com/smartystreets/goconvey/convey
# github.com/skisulli/dep-issue
main_test.go:6:2: found packages convey (assertions.go) and main (dependencies.go) in $GOPATH/src/github.com/skisulli/dep-issue/vendor/github.com/smartystreets/goconvey/convey
FAIL github.com/skisulli/dep-issue [setup failed]
make: *** [test] Error 1
I expected my tests to pass as they did when ran with a vendor directory built with glide.
$ make test
go test -v `go list ./... | grep -v /vendor/`
=== RUN TestMain
The test doesn't matter for this example ✔
1 total assertion
--- PASS: TestMain (0.00s)
PASS
ok github.com/skisulli/dep-issue 0.007s
My tests failed. When looking into the error, the issue seems to stem from dep cloning github.com/smartystreets/goconvey into two places, /vendor/github.com/smartystreets/goconvey and /vendor/github.com/smartystreets/goconvey/convey.
$ make test
go test -v `go list ./... | grep -v /vendor/`
can't load package: package github.com/skisulli/dep-issue/vendor/github.com/smartystreets/goconvey/convey: found packages convey (assertions.go) and main (dependencies.go) in $GOPATH/src/github.com/skisulli/dep-issue/vendor/github.com/smartystreets/goconvey/convey
# github.com/skisulli/dep-issue
main_test.go:6:2: found packages convey (assertions.go) and main (dependencies.go) in $GOPATH/src/github.com/skisulli/dep-issue/vendor/github.com/smartystreets/goconvey/convey
FAIL github.com/skisulli/dep-issue [setup failed]
make: *** [test] Error 1
hi @skisulli - thanks for the issue!
Looks like we do have a bug here, but it's in the glide importer. Sorta, at least. Constraints must be declared on a project root, and github.com/smartystreets/goconvey/convey is not a root - github.com/smartystreets/goconvey is. The glide importer should check to make sure of that, and take some corrective action (perhaps, slicing it down to the root).
What really sucks is that I apparently forgot about getting the validation in to make sure that we only allow project roots in Gopkg.toml, before doing any other work. That would be #697, I think. We may only be able to make that a warning now, to preserve the backwards-compatibility guarantee 😢
@sdboyer thanks for the update. I was able to get it working by switching the constraint in the Gopkg.toml to be github.com/smartystreets/goconvey.
We ran into the same problem with the glide importer at gophercon. I have a fix locally that I just need to add tests for and then submit the PR.
Hey @carolynvs! Could you share the fix? Maybe someone would write the tests for you.
Oops, this was fixed in #898 and I forgot to close this issue. Are you still running into this problem on the latest build of dep?
No, I didn't test! It works fine now. Thanks!
Most helpful comment
We ran into the same problem with the glide importer at gophercon. I have a fix locally that I just need to add tests for and then submit the PR.