mdempsky / unconvert

Remove unnecessary type conversions from Go source
BSD 3-Clause "New" or "Revised" License
377 stars 26 forks source link

Make ... syntax work for packages #4

Closed cespare closed 8 years ago

cespare commented 8 years ago

Thanks for the great tool! It would be nice if you could do e.g. unconvert ./... to check a tree of packages at once.

mdempsky commented 8 years ago

Is ... expansion something commonly supported by other similar tools? I know x/tools/cmd/eg doesn't.

I've been using

unconvert `go list ./...`
dominikh commented 8 years ago

errcheck supports it (by using github.com/kisielk/gotool, which is extracted from the Go tool), golint supports it (haven't checked how), guru now supports it (by using its own implementation in buildutil which allows negations, but doesn't understand "std" or "all")

mdempsky commented 8 years ago

Okay, sounds like unconvert should support it too then.

dmitshur commented 8 years ago

gostatus supports it (by using github.com/kisielk/gotool), goimporters supports it (by using github.com/kisielk/gotool and resolveRelative), and goimportgraph supports it (by using github.com/kisielk/gotool and resolveRelative). They're all tools I made.

I think it's great for Go tools to support import path patterns, I consider them an excellent feature of Go. If a tool says it accepts [packages] but doesn't allow import path patterns, it's unfortunate.

Also, github.com/kisielk/gotool makes it very easy to do so, so there's no reason not to.

mdempsky commented 8 years ago

I was originally hesitant to add non-stdlib dependencies, but I see now that github.com/kisielk/gotool is pretty trivial and self-contained. If someone wants to upload a PR to make use of it, I'll review it. (Same offer goes for mdempsky/maligned#4.)

dmitshur commented 8 years ago

Yep, it's basically original stdlib code but made exported, so it can be reused by 3rd party tools.

I'll make that PR tonight if no one beats me to it.

dmitshur commented 8 years ago

Made #9.