Skip to content
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 "nilaway" as a linter #4045

Closed
Dentrax opened this issue Aug 28, 2023 · 12 comments
Closed

Add "nilaway" as a linter #4045

Dentrax opened this issue Aug 28, 2023 · 12 comments
Labels

Comments

@Dentrax
Copy link

Dentrax commented Aug 28, 2023

Your feature request related to a problem? Please describe.

NilAway is a static analysis tool that seeks to help developers avoid nil panics in production by catching them at compile time rather than runtime.

Describe the solution you'd like.

https://github.com/uber-go/nilaway

Describe alternatives you've considered.

-

Additional context.

IIUC, nilaway is more like a "tool" rather than a linter.

/cc @yuxincs @zzqatuber

@Dentrax Dentrax added the enhancement New feature or improvement label Aug 28, 2023
@Dentrax Dentrax changed the title Add "nilaway" tool Add "nilaway" as a linter Aug 28, 2023
@ldez
Copy link
Member

ldez commented Aug 28, 2023

Analyzers that just display potential problems are not considered as linters inside golangci-lint because of the large number of false positives.
Those kinds of analyzers are not allowed.

Similar to #3969

@ldez ldez added the feedback required Requires additional feedback label Aug 28, 2023
@Dentrax
Copy link
Author

Dentrax commented Aug 28, 2023

Ah, good to know. Maybe devs of that tool can optimize the code base to provide a linter interface.

Just curious to ask, why don't you provide a some kind of feature gate to allow "tools" and "false positives"? I totally understand your "golangci-lint's criteria". But maybe you can define "linter graduation policy": alpha > beta > stable, etc. So enabling experimental gates could allow non-stable and false-positive tools/linters.

I know, this would be a part of totally different proposal to discuss more about.

@ldez
Copy link
Member

ldez commented Aug 28, 2023

Maybe devs of that tool can optimize the code base to provide a linter interface.

This is not the problem: the problem is false positives, not the linter interface.

Just curious to ask, why don't you provide a some kind of feature gate to allow "tools" and "false positives"? I totally understand your "golangci-lint's criteria". But maybe you can define "linter graduation policy": alpha > beta > stable, etc. So enabling experimental gates could allow non-stable and false-positive tools/linters.

The goal of golangci-lint is to be accurate and relevant, i.e. no false positives, this is why we have default exclusions.
False positives are no relation with a linter "state" (alpha > beta > stable or experimental).
So, for now, there is no possibility of "false-positive linter" or "potential issues detector".

@karelbilek
Copy link

I don't fully understand this policy, when golangci-lint has style linters which are all very "potential issue detectors" and have lot of "false positives", but, it's up to you I guess

@YishaiBerg

This comment was marked as off-topic.

@dolmen
Copy link
Contributor

dolmen commented Nov 22, 2023

@karelbilek nilaway is still quite young and has really too many false positives. Just have a look at its issues queue.

@mfreeman451
Copy link

Why can't it just be added outside of the default set -- something people would enable if they wanted?

@moogacs
Copy link

moogacs commented Feb 27, 2024

I've created a custom plugin to be used locally and in GHA

@karelbilek
Copy link

(I have horrible experience with using plugins, because you need to keep tracking all the versions, and it produces inscrutable error messages when things go wrong. But, if it helps anyone... good)

@moogacs
Copy link

moogacs commented Feb 27, 2024

yeah i can tell :D , but i've considered that in that plugin and the script with it should be able to detect the dependancies version and force it before building it

@yuxincs
Copy link

yuxincs commented Feb 27, 2024

(I have horrible experience with using plugins, because you need to keep tracking all the versions, and it produces inscrutable error messages when things go wrong. But, if it helps anyone... good)

I agree. I have proposed an alternative way for integrating private linters from learnings of caddy the web server written in Go: #2505 (comment) which makes it easier to build a single custom binary (with the private linter code). Not sure if golangci-lint folks will like it 😃

If we have to build a plugin, we're happy to add some logic (e.g., the New function) to make it easier to build NilAway as a plugin.

@mfreeman451
Copy link

mfreeman451 commented Feb 27, 2024

Somewhat related - golang/go#63290

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants