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

dep init doesn't recognize govendor's version #1454

Closed
jostyee opened this issue Dec 14, 2017 · 4 comments
Closed

dep init doesn't recognize govendor's version #1454

jostyee opened this issue Dec 14, 2017 · 4 comments

Comments

@jostyee
Copy link

jostyee commented Dec 14, 2017

dep doesn't respect the dependency version set via govendor.

We have a project which used govendor before, and specified lib version by:

govendor fetch -v github.com/apache/thrift/lib/go/thrift@=0.10.0
Get version "github.com/apache/thrift/lib/go/thrift"@=0.10.0
	Found exact version "0.10.0"

What version of dep are you using (dep version)?

v0.3.2-140-g3a59b685

What dep command did you run?

dep init -v
Getting direct dependencies...
Checked 4 directories for packages.
Found 7 direct dependencies.
Root project is "go.company.com/group/project"
 2 transitively valid internal packages
 11 external packages imported from 7 projects
(0)   ✓ select (root)
(1)	? attempt github.com/yurishkuro/opentracing-tutorial with 1 pkgs; 1 versions to try
(1)	    try github.com/yurishkuro/opentracing-tutorial@master
(1)	✓ select github.com/yurishkuro/opentracing-tutorial@master w/1 pkgs
(2)	? attempt github.com/opentracing-contrib/go-stdlib with 1 pkgs; 3 versions to try
(2)	    try github.com/opentracing-contrib/go-stdlib@master
(2)	✓ select github.com/opentracing-contrib/go-stdlib@master w/1 pkgs
(3)	? attempt go.company.com/group/logging with 2 pkgs; 1 versions to try
(3)	    try go.company.com/group/logging@master
(3)	✓ select go.company.com/group/logging@master w/2 pkgs
(4)	? attempt github.com/go-playground/ansi with 1 pkgs; 2 versions to try
(4)	    try github.com/go-playground/[email protected]
(4)	✓ select github.com/go-playground/[email protected] w/1 pkgs
(5)	? attempt github.com/opentracing/opentracing-go with 3 pkgs; 28 versions to try
(5)	    try github.com/opentracing/[email protected]
(5)	✓ select github.com/opentracing/[email protected] w/3 pkgs
(6)	? attempt github.com/go-playground/log with 1 pkgs; 17 versions to try
(6)	    try github.com/go-playground/[email protected]
(6)	✓ select github.com/go-playground/[email protected] w/1 pkgs
(7)	? attempt go.company.com/group/tracing with 2 pkgs; 1 versions to try
(7)	    try go.company.com/group/tracing@master
(7)	✓ select go.company.com/group/tracing@master w/2 pkgs
(8)	? attempt github.com/gin-gonic/gin with 1 pkgs; 23 versions to try
(8)	    try github.com/gin-gonic/[email protected]
(8)	✓ select github.com/gin-gonic/[email protected] w/3 pkgs
(9)	? attempt github.com/gin-contrib/sse with 1 pkgs; 1 versions to try
(9)	    try github.com/gin-contrib/sse@master
(9)	✓ select github.com/gin-contrib/sse@master w/1 pkgs
(10)  ? attempt gopkg.in/yaml.v2 with 1 pkgs; 1 versions to try
(10)      try gopkg.in/yaml.v2@v2
(10)  ✓ select gopkg.in/yaml.v2@v2 w/1 pkgs
(11)  ? attempt github.com/ugorji/go with 1 pkgs; 2 versions to try
(11)      try github.com/ugorji/go@master
(11)  ✓ select github.com/ugorji/go@master w/1 pkgs
(12)  ? attempt gopkg.in/go-playground/validator.v8 with 1 pkgs; 28 versions to try
(12)      try gopkg.in/go-playground/[email protected]
(12)  ✓ select gopkg.in/go-playground/[email protected] w/1 pkgs
(13)  ? attempt github.com/golang/protobuf with 1 pkgs; 2 versions to try
(13)      try github.com/golang/protobuf@master
(13)  ✓ select github.com/golang/protobuf@master w/1 pkgs
(14)  ? attempt golang.org/x/net with 1 pkgs; 5 versions to try
(14)      try golang.org/x/net@master
(14)  ✓ select golang.org/x/net@master w/1 pkgs
(15)  ? attempt github.com/mattn/go-isatty with 1 pkgs; 5 versions to try
(15)      try github.com/mattn/[email protected]
(15)  ✓ select github.com/mattn/[email protected] w/1 pkgs
(16)  ? attempt golang.org/x/sys with 1 pkgs; 1 versions to try
(16)      try golang.org/x/sys@master
(16)  ✓ select golang.org/x/sys@master w/1 pkgs
(17)  ? attempt github.com/uber/jaeger-client-go with 2 pkgs; 69 versions to try
(17)      try github.com/uber/[email protected]
(17)  ✓ select github.com/uber/[email protected] w/13 pkgs
(18)  ? attempt github.com/uber/jaeger-lib with 1 pkgs; 10 versions to try
(18)      try github.com/uber/[email protected]
(18)  ✓ select github.com/uber/[email protected] w/1 pkgs
(19)  ? attempt github.com/codahale/hdrhistogram with 1 pkgs; 1 versions to try
(19)      try github.com/codahale/hdrhistogram@master
(19)  ✓ select github.com/codahale/hdrhistogram@master w/1 pkgs
(20)  ? attempt github.com/apache/thrift with 1 pkgs; 31 versions to try
(20)      try github.com/apache/[email protected]
(20)  ✓ select github.com/apache/[email protected] w/1 pkgs
  ✓ found solution with 38 packages from 20 projects

Solver wall times by segment:
     b-list-versions: 25.419619979s
         b-list-pkgs:  4.559608016s
     b-source-exists:  4.127277253s
              b-gmal:  3.726878472s
  b-deduce-proj-root:  1.008983888s
         select-atom:    4.740041ms
             satisfy:    4.406719ms
            new-atom:     800.182µs
         select-root:     469.278µs
               other:      99.685µs

  TOTAL: 38.852883513s

  Locking in v1.2.1 (c48167d) for transitive dep github.com/uber/jaeger-lib
  Locking in master (0e0d6e8) for transitive dep github.com/ugorji/go
  Using ^1.0.2 as constraint for direct dep github.com/opentracing/opentracing-go
  Locking in v1.0.2 (1949ddb) for direct dep github.com/opentracing/opentracing-go
  Using ^1.2.0 as constraint for direct dep github.com/gin-gonic/gin
  Locking in v1.2 (d459835) for direct dep github.com/gin-gonic/gin
  Locking in master (3a0bb77) for transitive dep github.com/codahale/hdrhistogram
  Using master as constraint for direct dep github.com/opentracing-contrib/go-stdlib
  Locking in master (b1a47cf) for direct dep github.com/opentracing-contrib/go-stdlib
  Using ^4.3.0 as constraint for direct dep github.com/go-playground/log
  Locking in v4.3.0 (effffa9) for direct dep github.com/go-playground/log
  Locking in v8.18.2 (5f1438d) for transitive dep gopkg.in/go-playground/validator.v8
  Locking in master (0131e68) for transitive dep golang.org/x/sys
  Locking in v2.11.0 (ff3efa2) for transitive dep github.com/uber/jaeger-client-go
  Locking in 0.11.0 (327ebb6) for transitive dep github.com/apache/thrift
  Using master as constraint for direct dep github.com/yurishkuro/opentracing-tutorial
  Locking in master (5c0940e) for direct dep github.com/yurishkuro/opentracing-tutorial
  Locking in v2.0.0 (62a4186) for transitive dep github.com/go-playground/ansi
  Using master as constraint for direct dep go.company.com/group/tracing
  Locking in master (22bce31) for direct dep go.company.com/group/tracing
  Locking in master (22d885f) for transitive dep github.com/gin-contrib/sse
  Locking in v2 (287cf08) for transitive dep gopkg.in/yaml.v2
  Locking in master (1e59b77) for transitive dep github.com/golang/protobuf
  Locking in master (d866cfc) for transitive dep golang.org/x/net
  Locking in v0.0.3 (0360b2a) for transitive dep github.com/mattn/go-isatty
  Using master as constraint for direct dep go.company.com/group/logging
  Locking in master (f09f7e2) for direct dep go.company.com/group/logging
Old vendor backed up to /Users/yee/dev/go/src/go.company.com/group/project/_vendor-20171214141945
(1/20) Wrote github.com/go-playground/[email protected]
(2/20) Wrote github.com/opentracing-contrib/go-stdlib@master
(3/20) Wrote gopkg.in/yaml.v2@v2
(4/20) Wrote github.com/opentracing/[email protected]
(5/20) Wrote go.company.com/group/logging@master
(6/20) Wrote github.com/yurishkuro/opentracing-tutorial@master
(7/20) Wrote go.company.com/group/tracing@master
(8/20) Wrote github.com/mattn/[email protected]
(9/20) Wrote github.com/uber/[email protected]
(10/20) Wrote gopkg.in/go-playground/[email protected]
(11/20) Wrote github.com/gin-contrib/sse@master
(12/20) Wrote github.com/go-playground/[email protected]
(13/20) Wrote github.com/codahale/hdrhistogram@master
(14/20) Wrote github.com/uber/[email protected]
(15/20) Wrote github.com/ugorji/go@master
(16/20) Wrote github.com/gin-gonic/[email protected]
(17/20) Wrote github.com/golang/protobuf@master
(18/20) Wrote golang.org/x/sys@master
(19/20) Wrote golang.org/x/net@master
(20/20) Wrote github.com/apache/[email protected]

What did you expect to see?

Read version from vendor.json which specifies version as:

"version": "=0.10.0",
"versionExact": "0.10.0"

What did you see instead?

The config had been ignored, dep fetches the latest version 0.11.0

@carolynvs
Copy link
Collaborator

I noticed from your output that the govendor importer was not run at all. If dep had detected your govendor configuration, you would see something like this in the output:

Detected govendor configuration file...
Converting from vendor.json...
  Using ^0.8.1 as initial constraint for imported dep github.com/sdboyer/deptest
  Trying v0.8.1 (3f4c3be) as initial lock for imported dep github.com/sdboyer/deptest

dep looks for govendor config at the root of the project in vendor/vendor.json. Is yours in a different location?

@jostyee
Copy link
Author

jostyee commented Dec 17, 2017

govendor generated a vendor.json in the vendor directory, which I've never moved away, I have no idea why dep didn't find it.

@carolynvs
Copy link
Collaborator

carolynvs commented Dec 17, 2017

Is the repository public? Or could you create a sample repository that I can use to reproduce?

Another thought is did you run dep init from the root of your repository, and is your vendor directory at the root as well? Here's what dep expects:

@jostyee
Copy link
Author

jostyee commented Dec 18, 2017

Can't reproduce this issue after go get -u github.com/golang/dep , it correctly locks the version this time.

[[projects]]
  name = "github.com/apache/thrift"
  packages = ["lib/go/thrift"]
  revision = "b2a4d4ae21c789b689dd162deb819665567f481c"
  version = "0.10.0"

I'll close the issue for now, thanks for helping.

@jostyee jostyee closed this as completed Dec 18, 2017
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