-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Custom Linter vs --fix #1728
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
@MeenaAlfons If you figured this out, I would love to hear how! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Any progress in this area? I've run into this now where golangci-lint running a compiled .so cannot apply a fix, but crafting a custom main.go using package main
import (
"fmt"
"golang.org/x/tools/go/analysis/singlechecker"
"mylinter"
)
func main() {
p, err := mylinter.New(nil)
if err != nil {
fmt.Printf("Unable to initialize linter: %v\n", err)
return
}
a, err := p.BuildAnalyzers()
if err != nil {
fmt.Printf("Unable to build analyzers: %v\n", err)
return
}
singlechecker.Main(a[0])
}
This works but a Plugin with a // New returns a new instance of the linter.
func New(any) ([]*analysis.Analyzer, error) {
p, err := mylinter.New(nil)
if err != nil {
return nil, err
}
return p.BuildAnalyzers()
} When I run:
I see:
|
This issue will be fixed when #1779 will be fixed. I've started working on it again, and I hope to be able to finalize it. |
Thank you for creating the issue!
Please include the following information:
Version v1.33.0 of golangci-lint
Config file
Go environment
Verbose output of running
We created a custom linter that works great. Right now we are trying to add suggested fixes to this linter. There is no example of such a thing in the New Linter tutorial on the website. However, we found SuggestedFix in the documentation of golang.org/x/tools/go/analysis. We used it but we still can't see any fixes happening.
Is this the right way to support fixes in a custom linter ☝️ ? Or is there a different way we should use?
The text was updated successfully, but these errors were encountered: