diff --git a/lib/index.js b/lib/index.js index 7639cac..40c06cf 100644 --- a/lib/index.js +++ b/lib/index.js @@ -210,9 +210,11 @@ function parseGovendorLock(root, targetFile) { var deps = {}; var lockJson = JSON.parse(lock); lockJson.package && lockJson.package.forEach(function (pkg) { + var version = pkg.versionExact || ('#' + pkg.revision); + var dep = { name: pkg.path, - version: '#' + pkg.revision, + version: version, } deps[dep.name] = dep; diff --git a/test/fixtures/gopath/src/path/to/pkg/vendor/vendor.json b/test/fixtures/gopath/src/path/to/pkg/vendor/vendor.json index 99c5e0f..75a15db 100644 --- a/test/fixtures/gopath/src/path/to/pkg/vendor/vendor.json +++ b/test/fixtures/gopath/src/path/to/pkg/vendor/vendor.json @@ -6,7 +6,8 @@ { "checksumSHA1": "dummy", "path": "gitpub.com/food/salad", - "revision": "8b100cedd15d96a9ba0f4e48fd852d21b93b0f33" + "revision": "8b100cedd15d96a9ba0f4e48fd852d21b93b0f33", + "versionExact": "v1.3.7" }, { "checksumSHA1": "dummy", @@ -21,7 +22,8 @@ { "checksumSHA1": "dummy", "path": "gitpub.com/meal/dinner", - "revision": "2ebf14b5ac2969032b6c7f6f3e9ff1b2a8db0075" + "revision": "2ebf14b5ac2969032b6c7f6f3e9ff1b2a8db0075", + "versionExact": "v0.0.7" } ] } diff --git a/test/inspect.test.js b/test/inspect.test.js index 99d14d7..1482cdf 100644 --- a/test/inspect.test.js +++ b/test/inspect.test.js @@ -262,7 +262,7 @@ test('happy inspect govendor', function (t) { t.match(deps['gitpub.com/food/salad'], { name: 'gitpub.com/food/salad', - version: '#8b100cedd15d96a9ba0f4e48fd852d21b93b0f33', + version: 'v1.3.7', dependencies: { 'gitpub.com/nature/vegetables/tomato': { version: '#b6ffb7d62206806b573348160795ea16a00940a6', @@ -271,31 +271,28 @@ test('happy inspect govendor', function (t) { version: '#b6ffb7d62206806b573348160795ea16a00940a6', }, }, - from: [ - 'path/to/pkg@0.0.0', - 'gitpub.com/food/salad@#8b100cedd15d96a9ba0f4e48fd852d21b93b0f33', - ], + from: ['path/to/pkg@0.0.0', 'gitpub.com/food/salad@v1.3.7'], }, 'salad depends on tomato and cucamba'); t.match(deps['gitpub.com/meal/dinner'], { - version: '#2ebf14b5ac2969032b6c7f6f3e9ff1b2a8db0075', + version: 'v0.0.7', dependencies: { 'gitpub.com/food/salad': { - version: '#8b100cedd15d96a9ba0f4e48fd852d21b93b0f33', + version: 'v1.3.7', dependencies: { 'gitpub.com/nature/vegetables/tomato': { version: '#b6ffb7d62206806b573348160795ea16a00940a6', from: [ 'path/to/pkg@0.0.0', - 'gitpub.com/meal/dinner@#2ebf14b5ac2969032b6c7f6f3e9ff1b2a8db0075', // jscs:ignore maximumLineLength - 'gitpub.com/food/salad@#8b100cedd15d96a9ba0f4e48fd852d21b93b0f33', // jscs:ignore maximumLineLength + 'gitpub.com/meal/dinner@v0.0.7', + 'gitpub.com/food/salad@v1.3.7', 'gitpub.com/nature/vegetables/tomato@#b6ffb7d62206806b573348160795ea16a00940a6', // jscs:ignore maximumLineLength ], }, }, }, }, - }, 'salad is also a trasitive dependency') + }, 'salad is also a trasitive dependency'); t.end(); });