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

dep: constraint "source" usage #1446

Closed
rohanbhattacharjee opened this issue Dec 11, 2017 · 2 comments
Closed

dep: constraint "source" usage #1446

rohanbhattacharjee opened this issue Dec 11, 2017 · 2 comments

Comments

@rohanbhattacharjee
Copy link

rohanbhattacharjee commented Dec 11, 2017

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.

@rohanbhattacharjee
Copy link
Author

rohanbhattacharjee commented Dec 11, 2017

On a related note ... the docs say that the name field for a constraint can only bethe root import path of the project being constrained. Is that stemming from some deeper design concern, or is it simply the limitation of the current implementation ?

The reason for this note is -
Ideally I would like to use a facility like the following -

[[constraint]]
  name = "github.com/ourUser/ourRepo/ourPackage"
  source = "bitbucket.baz.qux.us:7999/ourUser/ourRepo/ourPackage"
  branch = "master"

@rohanbhattacharjee rohanbhattacharjee changed the title dep source usage dep: constraint "source" usage Dec 11, 2017
@carolynvs
Copy link
Collaborator

The bug is that dep can't currently handle source values that contain a port. The main issue tracking this is #411 which has an open PR #1160.

I'm closing since we already have an issue to track this but please subscribe to the other issue and/or PR so that you know when we have a fix.

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

No branches or pull requests

2 participants