Dep: Constraint inheritance between projects

Created on 10 Jul 2017  路  2Comments  路  Source: golang/dep

Are dependencies constraints inherited between projects ?
Does dep read Gopkg.toml from dependencies ?

I have 2 projects A and B.
Both use golang/dep, with a Gopkg.toml file.
B requires a library lib, with constraint branch = master.
A requires project B.

If I run dep status on B, I see the constraint rule branch master for lib.
However if I do the same on A, I see * for lib.
Is it expected ?

question

Most helpful comment

Yes. dep uses the dependencies constraints when attempting to solve.

If you tried dep status -h, will see the following:

Usage: dep status [package...]

With no arguments, print the status of each dependency of the project.

  PROJECT     Import path
  CONSTRAINT  Version constraint, from the manifest
  VERSION     Version chosen, from the lock
  REVISION    VCS revision of the chosen version
  LATEST      Latest VCS revision available
  PKGS USED   Number of packages from this project that are actually used

...

What dep status prints is what's in the manifest (Gopkg.toml) and lock (Gopkg.lock). So even though dep reads and tries to satisfy the constraints of the dependencies, unless you add it to your manifest it won't appear in dep status.

All 2 comments

Yes. dep uses the dependencies constraints when attempting to solve.

If you tried dep status -h, will see the following:

Usage: dep status [package...]

With no arguments, print the status of each dependency of the project.

  PROJECT     Import path
  CONSTRAINT  Version constraint, from the manifest
  VERSION     Version chosen, from the lock
  REVISION    VCS revision of the chosen version
  LATEST      Latest VCS revision available
  PKGS USED   Number of packages from this project that are actually used

...

What dep status prints is what's in the manifest (Gopkg.toml) and lock (Gopkg.lock). So even though dep reads and tries to satisfy the constraints of the dependencies, unless you add it to your manifest it won't appear in dep status.

OK, that answers my question.
Thank you ! 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sdboyer picture sdboyer  路  119Comments

sdboyer picture sdboyer  路  40Comments

cpapidas picture cpapidas  路  50Comments

sdboyer picture sdboyer  路  26Comments

mastoj picture mastoj  路  29Comments