mdempsky/unconvert

Rewrite in terms of lintutil

tamird opened this issue · 7 comments

https://godoc.org/honnef.co/go/lint/lintutil is a neat package by @dominikh that provides a framework for writing linters like unconvert.

The main benefit of rewriting unconvert in terms of lintutil is that it would allow users to implement "meta linters" that can run many lints while traversing the AST only once. Such a thing already exists in CockroachDB (https://github.com/cockroachdb/cockroach/blob/master/pkg/cmd/metacheck/main.go).

cc @dominikh

I would hold off on that at least for now, as the API of lintutil is not stable yet and going to change in the near future.

(And, to be pedantic: the AST will still be traversed lots of times. your meta linter avoids the cost of parsing, type checking and SSA building)

Fair enough, thanks for the correction. FWIW, the meta linter saves about
80% of the time-cost of each linter that is added to it (in my testing
against CockroachDB).

On Fri, Nov 18, 2016 at 4:48 PM, Dominik Honnef notifications@github.com
wrote:

I would hold off on that at least for now, as the API of lintutil is not
stable yet and going to change in the near future.

(And, to be pedantic: the AST will still be traversed lots of times. your
meta linter avoids the cost of parsing, type checking and SSA building)


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#18 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABdsPD74wcHWIrhpQi3eM7IthUB3PCA3ks5q_h0QgaJpZM4K29Ry
.

Frankly, at this point, I'd prefer keeping lintutil internal, as I will experiment with alternative/forked SSA packages and the like, so it won't really be fit for general projects for now.

I've more or less done this in cockroachdb/cockroach#19395.

Update: lintutil is now part of https://godoc.org/honnef.co/go/tools which has a stable release, so it seems like doing this is more palatable now. @mdempsky if you're interested, I'd be happy to submit a PR.

I'm still advising against it. lintutil is still a moving target - it doesn't have a stable release, merely tagged releases; there can and will be breaking changes between releases (also the whole forked SSA thing and the fact that soon, my tools will no longer use go/loader)

It sounds like there's nothing to do here at the moment. I'm going to close for now, but please do reopen once there's a usable framework to rebase unconvert on top of. Thanks!