-
Notifications
You must be signed in to change notification settings - Fork 8
Add support for golangci-lint version 2 #9
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 support for golangci-lint version 2 #9
Conversation
244ba55 to
2e0ac76
Compare
| class GolangCILint(Linter): | ||
| cmd = 'golangci-lint run ${args} --out-format tab ${file_path}' | ||
| def cmd(self): | ||
| if self.settings.get("v1", False): |
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.
@kaste This is still too magical. Do we need to run golangci-lint version somehow and regex the version out of what's returned?
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.
Right now, that would be just a manual setting. We would need to add that to the README and then the release notes.
Of course it would be possible to automate this, let me sketch that out. Let's see if I get that just out of my head:
import shutil
from SublimeLinter.lint import util
# first resolve the executable
if binary:= shutil.which("golangci"):
stdout: str = util.check_output([binary, "<whatever arg it takes to return the version>"])
# parse stdout with a regex or simpler if stdout.startswith("1.")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.
@kaste Thanks! It occurred to me only later that we were creating a new setting. I actually like the idea of making it just a setting. Very light weight and robust.
I've pushed up some more changes. What do you think now?
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.
LGTM 😄
2e0ac76 to
e73e398
Compare
|
Released as 3.0.0 🚀 |
Thanks @kaste! 🤝 |
|
Given that this I suggest to automatically detect version based on |
|
v1 is actually a linter setting, so you can set it in a project file or per syntax or directly on a view. We should have added it to the defaults dict to make that clear. And also to ensure we have a default set at any time. |
|
I won't be polluting my projects with sublime text project files. This version detection should be automatic imho, and the config option should serve as a (non-recommended) override. |
@silverwind That would be an excellent enhancement. You could raise a pull request for that? My pull request was a first simple step. |
With the release of
golangci-lintversion 2, some changes are needed to this package.