Closed joefitzgerald closed 7 years ago
Hi,
I could certainly add this. But before I do, I'd like to better understand how you plan to use it, so that we can come up with the most optimal solution.
Be aware that this tool is extremely simple, so I think there's a chance it might be easier for you to simply do what it does, rather than go through the binstale
binary.
Namely, it runs the following command:
go list -e -f '{{if (and (not .Error) (not .Goroot) (eq .Name "main"))}}{{.ImportPath}} {{.Stale}}{{end}}' all
That lists all packages, skipping ones with errors, those that are in GOROOT, or those that are not commands (package name is not "main"). Then, for those packages, it prints import path and whether it's stale, separated by a tab.
The rest of the code simply looks for binaries in your GOPATH/bin folders and prints out their status.
It sounds likely that you could just call go list
in a similar manner from the go-plus plugin. go list
accepts a flag -json
which causes the package data to be printed in JSON format
instead of using the template format. Or you could arrange the template format to output JSON.
Anyway, I am completely open to adding this, but only if it makes sense to do it. So please let me know how you envision go-plus using binstale
.
I'm interested in structured output that doesn't need to be parsed via regex, so that I can offer a command in go-plus that:
Generalized a little, it's less about the binary and more about the package. But providing that same insight for binaries and variance against current source is a very helpful extension to that concept.
To clarify, when you speak of "outdated" or "update", are you referring to stale local outputs (i.e., local environment), or outdated against remotes (i.e., needing to use network to check remote status)?
binstale
can help with "Shows outdated packages", but more specifically commands (package main
) that have a binary installed in $GOPATH/bin
and are stale (binary is older than the local source). It doesn't deal with remote updates to the package (gostatus
and Go-Package-Store
deal with that).
- Allows you to update packages:
- Individual packages
- All packages
That can be done by using go
command. To install an individual command, you can go install individual/package
. To install all packages, you can go install all
.
To update via network, you can use go get -u invididual/package
and go get -u all
, but might want to be careful with the latter since it might get dependencies of unrelated packages.
I can consider adding a -json
flag to binstale
, similar to go list
command, that produces output in a structured format like this:
{
"CommandName": "Go-Package-Store",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/Go-Package-Store",
"Stale": true
}
]
}
{
"CommandName": "binstale",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/binstale",
"Stale": true
}
]
}
{
"CommandName": "doc",
"Statuses": null
}
{
"CommandName": "dump_args",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/cmd/dump_args",
"Stale": true
}
]
}
{
"CommandName": "dump_glfw3_joysticks",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/cmd/dump_glfw3_joysticks",
"Stale": true
}
]
}
{
"CommandName": "dump_httpreq",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/cmd/dump_httpreq",
"Stale": true
}
]
}
{
"CommandName": "dupl",
"Statuses": [
{
"ImportPath": "github.com/mibk/dupl",
"Stale": true
}
]
}
{
"CommandName": "git-branches",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/git-branches",
"Stale": false
}
]
}
{
"CommandName": "git-codereview",
"Statuses": [
{
"ImportPath": "golang.org/x/review/git-codereview",
"Stale": true
}
]
}
{
"CommandName": "glow",
"Statuses": [
{
"ImportPath": "github.com/go-gl/glow",
"Stale": false
}
]
}
{
"CommandName": "go-find-references",
"Statuses": [
{
"ImportPath": "github.com/lukehoban/go-find-references",
"Stale": true
}
]
}
{
"CommandName": "go-outline",
"Statuses": [
{
"ImportPath": "github.com/lukehoban/go-outline",
"Stale": true
}
]
}
{
"CommandName": "gocode",
"Statuses": [
{
"ImportPath": "github.com/nsf/gocode",
"Stale": true
}
]
}
{
"CommandName": "godef",
"Statuses": [
{
"ImportPath": "github.com/rogpeppe/godef",
"Stale": true
}
]
}
{
"CommandName": "goexec",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/goexec",
"Stale": true
}
]
}
{
"CommandName": "goimporters",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/cmd/goimporters",
"Stale": true
}
]
}
{
"CommandName": "goimportgraph",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/cmd/goimportgraph",
"Stale": true
}
]
}
{
"CommandName": "goimports",
"Statuses": [
{
"ImportPath": "golang.org/x/tools/cmd/goimports",
"Stale": true
}
]
}
{
"CommandName": "golint",
"Statuses": [
{
"ImportPath": "github.com/golang/lint/golint",
"Stale": true
}
]
}
{
"CommandName": "gomobile",
"Statuses": [
{
"ImportPath": "golang.org/x/mobile/cmd/gomobile",
"Stale": true
}
]
}
{
"CommandName": "gomvpkg",
"Statuses": [
{
"ImportPath": "golang.org/x/tools/cmd/gomvpkg",
"Stale": true
}
]
}
{
"CommandName": "gopathshadow",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/cmd/gopathshadow",
"Stale": false
}
]
}
{
"CommandName": "gopherjs",
"Statuses": [
{
"ImportPath": "github.com/gopherjs/gopherjs",
"Stale": false
}
]
}
{
"CommandName": "gorename",
"Statuses": [
{
"ImportPath": "golang.org/x/tools/cmd/gorename",
"Stale": true
}
]
}
{
"CommandName": "gorepogen",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/cmd/gorepogen",
"Stale": true
}
]
}
{
"CommandName": "gostatus",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/gostatus",
"Stale": true
}
]
}
{
"CommandName": "gostringer",
"Statuses": [
{
"ImportPath": "github.com/sourcegraph/gostringer",
"Stale": true
}
]
}
{
"CommandName": "govendor",
"Statuses": [
{
"ImportPath": "github.com/kardianos/govendor",
"Stale": true
}
]
}
{
"CommandName": "govers",
"Statuses": [
{
"ImportPath": "github.com/rogpeppe/govers",
"Stale": true
}
]
}
{
"CommandName": "gtdo",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/gtdo",
"Stale": true
}
]
}
{
"CommandName": "impl",
"Statuses": [
{
"ImportPath": "github.com/josharian/impl",
"Stale": true
}
]
}
{
"CommandName": "implements",
"Statuses": [
{
"ImportPath": "honnef.co/go/implements",
"Stale": true
}
]
}
{
"CommandName": "interfacer",
"Statuses": [
{
"ImportPath": "github.com/mvdan/interfacer/cmd/interfacer",
"Stale": true
}
]
}
{
"CommandName": "jsonfmt",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/cmd/jsonfmt",
"Stale": true
}
]
}
{
"CommandName": "markdownfmt",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/markdownfmt",
"Stale": true
}
]
}
{
"CommandName": "misspell",
"Statuses": [
{
"ImportPath": "github.com/client9/misspell/cmd/misspell",
"Stale": true
}
]
}
{
"CommandName": "present",
"Statuses": [
{
"ImportPath": "golang.org/x/tools/cmd/present",
"Stale": true
}
]
}
{
"CommandName": "protoc-gen-gogo",
"Statuses": [
{
"ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo",
"Stale": true
}
]
}
{
"CommandName": "rune_stats",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/cmd/rune_stats",
"Stale": true
}
]
}
{
"CommandName": "stringer",
"Statuses": [
{
"ImportPath": "golang.org/x/tools/cmd/stringer",
"Stale": true
}
]
}
{
"CommandName": "unconvert",
"Statuses": [
{
"ImportPath": "github.com/mdempsky/unconvert",
"Stale": true
}
]
}
{
"CommandName": "unused",
"Statuses": [
{
"ImportPath": "honnef.co/go/unused/cmd/unused",
"Stale": false
}
]
}
{
"CommandName": "vfsgendev",
"Statuses": [
{
"ImportPath": "github.com/shurcooL/vfsgen/cmd/vfsgendev",
"Stale": true
}
]
}
What do you think?
It looks like this intersects with https://github.com/shurcooL/gostatus/issues/28.
Are you looking for an all-in-one solution that combines binstale with gostatus and basically tells you whether some package should be updated with go get -u import/path
?
Closing because this issue is stale and I don't see anything concrete that can be done productively here.
Feel free to re-open if that changes.
Are you looking for an all-in-one solution that combines binstale with gostatus and basically tells you whether some package should be updated with go get -u import/path?
Yes, that's ultimately what I am looking for - but that's not what this issue is for - the original issue stands. What is not concrete about a flag to print output as JSON?
What is not concrete about a flag to print output as JSON?
I proposed what the output would look like in https://github.com/shurcooL/binstale/issues/1#issuecomment-204818237 and asked what you think, but never got a reply.
Can you confirm that that's the JSON output that satisfies this issue? If so, I can add that.
I would love to integrate this tool with go-plus. Would you be open to adding a flag to specify output format, perhaps starting with JSON?