-
Notifications
You must be signed in to change notification settings - Fork 72
Add golangci-lint plugin #83
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
Project inspired by alecthomas version [1] which unfortunately doesn’t works very well with the latest version of golangci-lint nor SublimeText and hasn’t been updated during the last 9+ months. He also announced a few days ago that he’s going to deprecate “gometalinter” [2] another popular linter in the Go (golang) community, so I jumped right away to offer an alternative. Note: I want to transfer this linter to the SublimeLinter organization. [1] https://github.com/alecthomas/SublimeLinter-contrib-golang-cilint [2] alecthomas/gometalinter#590
I spoke with @alecthomas about the possibility to merge both projects since his version is older than mine, and people are probably already using it. My version contains better error and warning parsing, and works better with the latest version of golangci-lint. He agree to review and maybe accept a pull-request with my version of the code, so I’m changing this pull-request to link to his repository rather than mine.
Ok 👍🏻 We don’t list his version, so we could add yours. You could also try to get @alecthomas to give you access to his and collaborate on it. That way there aren’t two competing projects on GitHub trying to do the same thing. That way people will be able to more easily find and contribute to the right package. Or propose to move his repo into the SublimeLinter org, and then we can also give you access make the changes it needs. |
Thank you, I’ll talk to him. |
Hi. I'm the author of the original package, but I no longer maintain it. I'd like to propose that @cixtor's package become the "blessed" one and I'll decommission mine. |
Alec Thomas agreed to transfer the maintenance of the SublimeLinter plugin for golangci-lint to me on Mar 5, 2019 [1]. The other version of the code will be decommissioned and this one will become the canonical repository for the linter. [1] #83 (comment)
Excellent, works for me. @cixtor please create a 1.0.0 release in your repository. |
@braver Done! Let me know if this works [1]. I also included a “sublime-package” for convenience, but I’m not sure if Package Control prefers that over plain Zip archives. People who don’t use Package Control may prefer to simply drag and drop this file into their “Installed Packages” folders (although, they probably need Package Control anyway to install SublimeLinter, so maybe this file is redundant). [1] https://github.com/cixtor/SublimeLinter-golangcilint/releases/tag/1.0.0 |
Yeah you don’t need to make that file. If people want to do a manual install they can just unzip a download into the Packages dir. Installed Packages is best left to package control. In fact, package control will create the zips for you from source by exporting the tag, you don’t have to attach the zips to the release. |
Honestly, I don't want it in the org if it's doesn't follow the official API, well at least a bit. 😁 I think at least executing the command and parsing should be separated. For parsing implementing We don't We usually hate tempdir generation, but 🤷♂️ isn't the linter generally too slow for running in background? |
I can address these concerns, but I need more time to read SublimeLinter’s code since the official documentation is very scarce on details. I agree that the “json -> string -> regex” part is weird, I was trying to make sense of how SublimeLinter works and this was the only obvious way to proceed at the moment.
I hate it too, but right now it’s the only way to make golangci-lint work. If the changes in the file are not saved, for example, the tool will not be able to process the file that the user is modifying, instead it will just process the actual content of the file (which may not contain warnings or errors). This is in my TODO list of things to improve, but again, it seems to be the only way to make it work for now.
By default, golangci-lint runs 31 different linters (if they are installed), but this SublimeLinter plugin executes the tool with a
Note: I ran the test three (3) times to get an average. All the linters are executed concurrently allowing the plugin to provide a report in less than a second, or less if the repository is smaller. The only two exceptions are “gosec” and “varcheck” which take 1-2 seconds to bootstrap their corresponding cache, but subsequent calls take significantly less time. I’ll take your suggestion and base my improvements on SublimeLinter-stylelint. |
Well on my laptop ESLint also takes forever to run. Luckily users can tweak how each linter runs now 😄 @cixtor I already transferred the repo, totally cool if you want to iterate on it more. Personally, I'm not going to test a Go linter, so if you can confirm for me that it works at all I'm ok with publishing it. Then, you can open a PR on the plugin repo to continue the refactor and get feedback there. |
Hello @braver thank you for transferring the project to the SublimeLinter organization, hopefully this will give people more confidence when installing the plugin 🙂 I will keep maintaining it for the foreseeable future as I write Go in a daily basis, and make use of both SublimeText and SublimeLinter all the time. Here is a GIF proving that the plugin works: |
@cixtor Could you perhaps update the repo url before I merge this? |
@braver done! I also moved the changes into |
Thanks. I see the alphabetical order is messed up already, I’ll clean that up later. |
@cixtor Could you also transfer your super-computer to the org 😁 ? 😒 |
Project inspired by alecthomas version [1] which unfortunately doesn’t works very well with the latest version of golangci-lint nor SublimeText and hasn’t been updated during the last 9+ months. He also announced a few days ago that he’s going to deprecate “gometalinter” [2] another popular linter in the Go (golang) community, so I jumped right away to offer an alternative.
Note: I want to transfer this linter to the SublimeLinter organization.
[1] https://github.com/alecthomas/SublimeLinter-contrib-golang-cilint
[2] alecthomas/gometalinter#590