-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
runAnalyzersConfig: export analyzers #2710
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
Conversation
In order to use golangci-lint in non-trivial use cases, such as Bazel's rules_go's 'nogo' static analysis framework, we would need to make the analysis.Analyzer defined for various different golinters be reuseable outside of golangci-lint. Export the GetAnalyzers function of runAnalyzersConfig interface as well as adjusting the 2 implementations of that interface: goanalysis.Linter and goanalysis.MetaLinter This should help enable other packages to be able to consumer golangci-lint analyzers for different use cases.
Hey, thank you for opening your first Pull Request ! |
@ldez is there anything I could do to help unblocking this? |
I discussed with @Helcaraxan updated the PR description with a bit more technical details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Admittedly I have not contributed to golangci-lint
in recent times, however @sluongng attracted my attention to this PR as he needs to get it merged to support the work on #1473.
Based on the conversation in that issue, the minor size of this change and the amount of developer value that would be unlocked by it I feel that it's better here to merge and "ask for forgiveness, rather than permission".
Just chiming in as a user to say I'm very keen to see this Bazel |
@ldez @Helcaraxan @alexandear Could you please revisit this? There is a lot of interest from the community of Golang & Bazel users and we'd direly like to leverage Golangci-lint in a native way as this paves the way for. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Let's just close this stale PR. Since this PR was opened, I have taken alternative routes to export analyzers from My understanding of Instead, in |
Overview
In order to use golangci-lint in non-trivial use cases, such as Bazel's rules_go's 'nogo' static analysis framework, we would need to make the analysis.Analyzer defined for various different golinters be reuseable outside of golangci-lint.
Export the GetAnalyzers function of runAnalyzersConfig interface as well as adjusting the 2 implementations of that interface: goanalysis.Linter and goanalysis.MetaLinter
This should help enable other packages to be able to consumer golangci-lint analyzers for different use cases.
Technical details
Once this is merged, we can build a solution for issue #1473 by generating a new Go package for each linter in golangci-lint. With each package contains only one file like this:
Bazel rules_go's
nogo
static analysis then would be able to consume this package as the documentation stated here https://github.com/bazelbuild/rules_go/blob/master/go/nogo.rst#id8