Godeps.json with extra hash on comment string confuses dep init parsing semver #827
Description
What version of Go (go version
) and dep
(git describe --tags
) are you using?
Go version
go1.7.4 darwin/amd64
Dep Version
v0.1.0-215-g911cd22
Description
Our existing Godeps.json
has comments that aren't valid semver. For example:
{
"ImportPath": "github.com/Shopify/sarama",
"Comment": "v1.11.0-44-g3efb95d",
"Rev": "3efb95dad8fbcd194d3c06f7b9c40eabeb719b36"
},
The comment has an extra -44-g3efb95d
, which does not match a tag in Sarama. Dep seems to use the extra hash as the tag, which can lead to the version being not found.
Some lines from the output during dep init
Using v1.11.0-44-g3efb95d as initial hint for imported dep github.com/Shopify/sarama
No versions of github.com/Shopify/sarama met constraints:
v1.11.0-44-g3efb95d: unable to update repository:
v1.12.0: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.11.0: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.10.1: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.10.0: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.9.0: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.8.0: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.7.0: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.6.1: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.6.0: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.5.0: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.4.3: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.4.2: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.4.1: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.4.0: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.3.0: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.2.0: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.1.0: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
v1.0.0: Could not introduce github.com/Shopify/[email protected], as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
master: Could not introduce github.com/Shopify/sarama@master, as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
gh-pages: Could not introduce github.com/Shopify/sarama@gh-pages, as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
http_sse_example: Could not introduce github.com/Shopify/sarama@http_sse_example, as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
producer-partition-buffer: Could not introduce github.com/Shopify/sarama@producer-partition-buffer, as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
server: Could not introduce github.com/Shopify/sarama@server, as it is not allowed by constraint v1.11.0-44-g3efb95d from project stash.in.ionicsecurity.com/ip/gyre.
Deleting the hash manually from the comment does allow dep to find the correct version.
Here's a few more examples from our Godeps.json, some values from the comment
don't reference semver (and still have the extra hash):
{
"ImportPath": "github.com/gocql/gocql",
"Comment": "pre-node-events-365-g58b3c71",
"Rev": "58b3c7120a7ef9a077e4d089dd1badcb9ec756a8"
},
{
"ImportPath": "github.com/kr/pretty",
"Comment": "go.weekly.2011-12-22-29-gadd1dbc",
"Rev": "add1dbc86daf0f983cd4a48ceb39deb95c729b67"
},
{
"ImportPath": "github.com/lib/pq",
"Comment": "go1.0-cutoff-127-gd8eeeb8",
"Rev": "d8eeeb8bae8896dd8e1b7e514ab0d396c4f12a1b"
},
{
"ImportPath": "gopkg.in/mgo.v2/bson",
"Comment": "r2016.08.01-5-g3f83fa5",
"Rev": "3f83fa5005286a7fe593b055f0d7771a7dce4655"
},
It looks like Godeps uses git describe --tags
for the comment field?
https://github.com/tools/godep/blob/3c0ccb9a2415fbda40b982b622735906bcd1760f/godepfile.go#L142
https://github.com/tools/godep/blob/3c0ccb9a2415fbda40b982b622735906bcd1760f/vcs.go#L43
Running git describe --tags
on sarama, I see: v1.11.0-44-g3efb95d