shurcooL / Go-Package-Store

An app that displays updates for the Go packages in your GOPATH.
MIT License
900 stars 29 forks source link

Support govendor file format. #49

Closed captncraig closed 8 years ago

captncraig commented 8 years ago

I am using https://github.com/kardianos/govendor for my vendoring needs. It would be nice if Go-Package-Store could load my vendor file and check for updates. It should be almost identical to godeps mode, but with a slightly different json schema.

dmitshur commented 8 years ago

I think I can support that.

I'll have to familiarize myself with the https://github.com/kardianos/vendor-spec file format.

Is there a parser for that file format that I should use? Or is it so trivial that I should just implement it in unexported code? /cc @kardianos

captncraig commented 8 years ago

I'm thinking it should just be a matter of unmarshalling to a slightly different json object from what you are using for godeps. It is just json.

kardianos commented 8 years ago

There is a helper package here: https://godoc.org/github.com/kardianos/govendor/vendorfile

Mainly useful if you are writing as well as reading as it will preserve unknown fields when writing (as the spec requires).

dmitshur commented 8 years ago

@captncraig, can you point me to a sample project that has a govendor file, so I can test out this feature?

kardianos commented 8 years ago

bitbucket.org/kardianos/rdb

dmitshur commented 8 years ago

Thanks @kardianos.

I tried the following:

$ Go-Package-Store -govendor=.../src/bitbucket.org/kardianos/rdb/vendor/vendor.json

I see its vendor.json has:

{
    "path": "golang.org/x/net/context",
    "revision": "aa73292ff82e",
    "revisionTime": "2014-11-10T09:49:06+09:00"
}

But that commit doesn't exist in the current golang.org/x/net/context history:

https://github.com/golang/net/commit/aa73292ff82e

It does exist in the previous mercurial repo:

https://code.google.com/p/go/source/browse/?repo=net&r=aa73292ff82e

Go Package Store cannot compare version across different repositories in the general case, so you'll see this:

image

However, it works well on the other two packages:

image

It looks like there have been a lot of updates to that repo since the last time you've updated it. :)

kardianos commented 8 years ago

Whoops! Oh, I think I had a bug in the tool when I added that. Will fix.

On Sun, Dec 6, 2015, 21:53 Dmitri Shuralyov notifications@github.com wrote:

Thanks @kardianos https://github.com/kardianos.

I tried the following:

$ Go-Package-Store -govendor=.../src/bitbucket.org/kardianos/rdb/vendor/vendor.json

I see its vendor.json has:

{ "path": "golang.org/x/net/context", "revision": "aa73292ff82e", "revisionTime": "2014-11-10T09:49:06+09:00" }

But that commit doesn't exist in the current golang.org/x/net/context history:

golang/net@aa73292 https://github.com/golang/net/commit/aa73292ff82e

It does exist in the previous mercurial repo:

https://code.google.com/p/go/source/browse/?repo=net&r=aa73292ff82e

Go Package Store cannot compare version across different repositories in the general case, so you'll see this:

[image: image] https://cloud.githubusercontent.com/assets/1924134/11619993/12cbedac-9c63-11e5-8967-e780d40a935d.png

However, it works well on the other two packages:

[image: image] https://cloud.githubusercontent.com/assets/1924134/11620040/97cb04ca-9c63-11e5-8d49-b1d36ae2e01e.png

It looks like there have been a lot of updates to that repo since the last time you've updated it. :)

— Reply to this email directly or view it on GitHub https://github.com/shurcooL/Go-Package-Store/issues/49#issuecomment-162417895 .

kardianos commented 8 years ago

I fixed the rdb repo. Should be able to test properly this time.

dmitshur commented 8 years ago

It works as expected. Your golang.org/x/net/context dependency is now up to date, and hence doesn't show up.

The other repo has a few new commits, and they show up.

image

I'll be merging the PR soon. @captncraig, please try it out and let me know if it resolves your needs.

dmitshur commented 8 years ago

It's live now.

Do go get -u github.com/shurcooL/Go-Package-Store (or just go install github.com/shurcooL/Go-Package-Store if you've already updated the source, possibly via GPS itself) as usual to update to latest version, and let me know @captncraig!