Closed captncraig closed 8 years ago
I've discussed this feature request with @captncraig, it sounds very reasonable to me.
I've already mentioned that this would be a future enhancement in commit d86275543c7ca18d75b1014a9d474568eae23134.
I envision an interface like:
type RepoUpdater interface {
// Update Go packages that match import path pattern to latest version.
//
// The only allowed format for import path string is "{{.RepoRoot}}/...", where RepoRoot
// is the import path of repository root (not necessarily a valid Go package).
// For example, "golang.org/x/net/..." or "github.com/shurcooL/Go-Package-Store/...".
Update(importPathPattern string) error
}
(Or something like that; exact parameters may change towards what makes most sense.)
With concrete implementations for GOPATH workspace (the current code), and another for updating govendor dependencies.
The code that needs to change to support the interface above is quite messy; so I'll refactor that stuff myself. But if someone wants to implement that interface for govendor afterwards (and maybe for godep), that should be much more viable.
Ok, I've done that refactor and created the aforementioned repo.Updater
interface, which should allow creating a new repo.Updater
implementation much more doable.
awesome, I'll play with it tonight
On Tue, Dec 8, 2015 at 8:40 PM, Dmitri Shuralyov notifications@github.com wrote:
Ok, I've done that refactor and created the aforementioned repo.Updater https://godoc.org/github.com/shurcooL/Go-Package-Store/repo#Updater interface, which should allow creating a new repo.Updater implementation much more doable.
— Reply to this email directly or view it on GitHub https://github.com/shurcooL/Go-Package-Store/issues/51#issuecomment-163095417 .
The repo.Updater
interface is simplified significantly in #53, which is a major refactor that gets rid of all legacy gist packages.
I'd suggest working on this issue on top of #53 or waiting after it's merged. It'll make resolving this task much easier.
Awesome. I look forward to it. On Dec 29, 2015 6:43 PM, "Dmitri Shuralyov" notifications@github.com wrote:
The repo.Updater interface is simplified significantly in #53 https://github.com/shurcooL/Go-Package-Store/pull/53, which is a major refactor that gets rid of all legacy gist packages.
I'd suggest working on this issue on top of #53 https://github.com/shurcooL/Go-Package-Store/pull/53 or waiting after it's merged. It'll make resolving this task much easier.
— Reply to this email directly or view it on GitHub https://github.com/shurcooL/Go-Package-Store/issues/51#issuecomment-167915500 .
Ok, I've merged #53. Take a look at the new repo.Updater
interface and 2 sample implementations (one is a normal updater for your GOPATH, the other is a mock updater that just prints text to stdout):
https://gotools.org/github.com/shurcooL/Go-Package-Store/repo
The updater no longer has to manage state of repositories that have been updated. It now only has one simple responsibility, to update the specified repository to the latest version, and return an error if anything went wrong (or nil otherwise).
Let me know how it goes.
I've done this today, going to push an update soon. Only govendor
support for now. It will update packages by executing:
govendor update import/path/pattern/...
Go-Package-Store
needs to be run from the repo root. So, you'll likely call it with:
Go-Package-Store -govendor=vendor/vendor.json
It seemed to work well. If you have a chance to try it @captncraig, let me know how it goes.
If someone wants the same functionality for godep
, it's really easy to add. I won't do it now since I don't use godep
at this time.
Currently if I run
go-package-store -govendor vendor/vendor.json
I get a list of package updates. The update button is greyed out and has no effect. It would be awesome if it could update the packages. There are varying degrees of how this could be done:govendor update github.com/pkg/name/...
(or the godep equivalent).An alternative to running
govendor
update on each individual update would be a single button to rungovendor update +ven
on the repo level to pull in all changes in the entire gopath at once. Any of these approaches would be useful. My current workaround is to look at the g-p-s page and dogo get -u
govendor update +ven
by hand.I am running on
github.com/captncraig/labelmaker
, which is still very much work in progress.cc @kardianos