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
Add custom go lint checker #3021
Comments
I think there is a feature in golangci-lint that you can add custom plugins to it for your own needs. also by creating a plugin every repository can add it on top of golangci-lint to run. |
Yep, that would be my preference. Unfortunately it's a binary plugin interface, so distribution is a problem. |
Yes it's binary plugin but it's possible to download binary in Makefile when running lint command. I take a look at this to see if I can help. |
There are several examples of logs messages first letter capitalized. Are you sure this feature is needed? |
Do you have an idea about import alias namimg pattern? |
The alias naming guidelines are here. It might be hard to programmatically get it right because the rule is a bit subjective, but I expect it to reasonably easy to ensure that a set of specific well-known imports are always consistent. |
I think this rule is easy to implement and also effective:
contour/cmd/contour/certgen.go Line 26 in bb14b25
|
The rule is newer than the code, so it's not (yet) followed consistently. A linter would be really useful to help us make the transition (especially if it emits a fixit suggestion) :) In your examples, I think it would be fine to end up with |
Can I start working on implementation for import alias? |
Yes, please do! |
On Oct 23, 2020, at 7:43 PM, Glyphack <notifications@github.com> wrote:
I was scanning the repo and found this is this a lint error we should catch?
import envoy_api_v2_auth "github.com/envoyproxy/go-control-plane/envoy/api/v2/auth"
error is raised because envoy does not match envoyproxy we can extend word match to a regex like *envoy*.
I yeh this is why I suggested hard coding well known patterns. The rule isn’t described with enough precision to apply generally. We could end up with a config file entry that has the patterns, or just fixing things to confirm is ok by me.
|
Unclear to me what the rule means for this import, maybe
Hmm, what is this telling me? Maybe an artifact of the testing mechanism?
👍 Overall, it looks like the linter is doing a pretty reasonable job :) |
Yes that's meant to be correct, maybe error message needs more clarification.
I suspect this is only happening on my machine could not find anything about it. |
I implemented fixit option for linter(Glyphack/go-import-alias#2). and used it on contour main branch to see how it works(#3108). As I can see It's doing a reasonable job, Do you have any comments on it? |
If we make a decision on how to integrate linter with project I can make progress on (#3108).
|
@Glyphack WDYT about making a new repository for linters under |
@jpeach It's a good idea keeping list of all linters we use somewhere, Are you thinking about a single repo with all linters in it and a multicheker or separate ones? I'm OK with both.
I make an issue in golangci-lint about our linters, If they accept it to be part of golangci-lint it would be great, If not we can use binary plugins. |
yeh I was thinking of a single repo |
I created this issue in golangci-lint repo 11 days ago and did not get any response from them. shall we create the linters repository and proceed with binary plugins? |
I was trying to test linter using a generated plugin from github.com/contour/lint and got an error about cannot opening the plugin. searched and found this issue on golangci-lint:
|
If we release this as a standalone binary, we can run in it in a separate Contour CI job, WDTY? |
closing for now, I think we're happing with our existing linting |
Please describe the problem you have
We have a few informal rules around style and interfaces
We can add a Go lint tool to check these conventions, removing the burden from maintainers and contributors.
The text was updated successfully, but these errors were encountered: