-
Notifications
You must be signed in to change notification settings - Fork 570
Proposal: Add gopherjsvet tool #1219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I like this idea, I think it would help avoiding a lot of possible pitfalls (aka know bugs :) ). I would also propose to integrate it into the gopherjs tool itself as a |
Ah yes, good (and obvoius) suggestion. This makes me wonder, though... should the tool still live in a separate repo, or should it live here, where it can track with GopherJS releases more easily? |
I think because it would also be a standalone tool, it makes most sense to keep it in a separate repository, but I could be convinced otherwise. |
I attempted to work on this today, but it's not quite as easy as one might hope. The go/analysis/multichecker library is expected to be called directly from
A third possibility, which I tried a bit, with little luck, would be to mangle |
Might be worth asking in the gopher slack #tools channel, but I feel like option #1 is the only one really viable. It is really unfortunate that multichecker doesn't optionally accept something like flagset. |
So we have the same problem with option #1... I'll work on a custom implementation, to see how ugly it gets. |
Uh oh!
There was an error while loading. Please reload this page.
Background
I just built a trivial linter during a recently 2-hour livestream on my YouTube channel. During my next livestream, I intend to start building a real/useful linter. And I had the idea of creating one for gopherjs.
So I'm opening this issue to get feedback and to solicit rule ideas to include.
Proposal
Create a new repo,
github.com/gopherjs/gopherjsvet
, which will contain a linter that can be embedded intogolangci-lint
, as well as compatible withgo vet
, and usable as a standalone binary.Linter rules
My proposed linter rules (pending feasability, of course) so far are listed here. I'm soliciting suggestions for others. They should be issues that apply only to GopherJS code, as any other issues should go in a general-purpose linter. Most of these come from JavaScript Tips and Gotchas
js.Object
directly*js.Object
must always be a pointer*js.Object
must always be a pointer.js
tags are present, a*js.Object
field is embedded as the first struct field.*js.Object
do not also initialize other fields.*js.Object
.github.com/gopherjs/gopherjs/js
andsyscall/js
net/http
packageencoding/json
package when only unmarshaling.Other Considerations
My immediate interest in this is mostly educational. So whether this proposal is accepted or not, I do intend to go forward (I just may do so in a private project, rather than one hosted under the
gopherjs
project).Beyond that immediate goal, if this proves to be both feasable and of general interest, once the linter reaches a certain level of usefulness/maturity (criteria TBD), I would like to:
The text was updated successfully, but these errors were encountered: