dep: constraint "source" usage #1446
Description
What version of dep
are you using (dep version
)?
dep:
version : v0.3.2
build date : 2017-10-19
git hash : 8ddfc8a
go version : go1.9
go compiler : gc
platform : darwin/amd64
What dep
command did you run?
I am running dep ensure
.
We have our code (basically the same code) hosted with two different services -
(a) Our code is on the public Github.com
(b) A second version of our code is in a privately hosted bitbucket (not visible to the external world)
Some of our dependencies (these are also packages that we own) are also hosted with github.com and bitbucket.
Our Go source files have statements like - import github.com/ourUser/ourRepo/ourPackage
Using Gopkg.toml
, I am trying to see if we can make our Bitbucket version of the code hit our Bitbucket version of the dependencies, and not the Github.com versions (though the import statements in Go files say "github.com").
I am trying - in Gopkg.toml
[[constraint]]
name = "github.com/ourUser/ourRepo"
source = "bitbucket.baz.qux.us:7999/ourUser/ourRepo"
I also tried [[override]]
- same result.
What did you expect to see?
I expect that, even though the Go source files say import github.com/ourUser/ourRepo
, the bitbucket version of the package, i.e. bitbucket.baz.qux.us:7999/ourUser/ourRepo
, should be downloaded to the vendor
directory and referenced in the calling code.
I expect that, once the code from bitbucket.baz.qux.us:7999/ourUser/ourRepo
is downloaded to the vendor
directory, the code compilation using go build
works without any changes to the source code (which has import github.com/ourUser/ourRepo
statements).
What did you see instead?
The following error message is shown when I run dep ensure
.
ensure Solve(): "bitbucket.baz.qux.us:7999/ourUser/ourRepo" is not a valid import path
The repository (that I have obfuscated) does exist on our bitbucket server. The repo in question is publicly visible, and has a master
branch.
Hence I believe it is some syntactical issue wherein the parser is expecting a particular format etc.