Skip to content

Commit a1be8cf

Browse files
authored
Merge pull request #9 from eread/eread/add-support-for-golangci_lint-version-2
Add support for golangci-lint version 2
2 parents 6c633a2 + e73e398 commit a1be8cf

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.8

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,26 @@ This linter plugin for [SublimeLinter](https://github.com/SublimeLinter) provide
66

77
## Installation
88

9-
- Install SublimeLinter 3 from [here](https://packagecontrol.io/packages/SublimeLinter)
9+
- Install SublimeLinter from [here](https://packagecontrol.io/packages/SublimeLinter)
1010
- Install SublimeLinter-golangcilint from [here](https://packagecontrol.io/packages/SublimeLinter-golangcilint)
11-
- Install the `golangci-lint` helper from [here](https://github.com/golangci/golangci-lint#install)
11+
- Install the `golangci-lint` helper from [here](https://golangci-lint.run/welcome/install/#local-installation)
1212

1313
![screenshot](screenshot.png)
1414

1515
## Configuration
1616

17-
In order for `golangci-lint` to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. Before going any further, please read and follow the steps in [Finding a linter executable](http://sublimelinter.readthedocs.org/en/latest/troubleshooting.html#finding-a-linter-executable) through “Validating your PATH” in the documentation. Once you have installed `golangci-lint`, you can proceed to install the plugin if it is not yet installed.
17+
For `golangci-lint` to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. Before going any further, please read and follow the steps in [Finding a linter executable](https://sublimelinter.readthedocs.io/en/stable/troubleshooting.html#finding-a-linter-executable) through “Validating your PATH” in the documentation. Once you have installed `golangci-lint`, you can proceed to install the plugin if it is not yet installed.
1818

19-
Due to the way that golangci-lint works, the linter will only run when saving a file, even if `lint_mode` is set to “background”.
19+
By default, the plugin expects `golangci-lint` version 2. To configure the plugin for `golangci-lint` version 1, set
20+
the `v1` setting to `true`:
21+
22+
```json
23+
"golangcilint": {
24+
"v1": true
25+
}
26+
```
27+
28+
Due to the way that `golangci-lint` works, the linter will only run when saving a file, even if `lint_mode` is set to “background”.
2029

2130
## Plugin installation
2231

linter.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33

44
class GolangCILint(Linter):
5-
cmd = 'golangci-lint run ${args} --out-format tab ${file_path}'
5+
def cmd(self):
6+
if self.settings.get("v1", False):
7+
return 'golangci-lint run ${args} --out-format tab ${file_path}'
8+
return 'golangci-lint run ${args} --output.tab.path stdout ${file_path}'
69
tempfile_suffix = '-'
710
# Column reporting is optional and not provided by all linters.
811
# Issues reported by the 'typecheck' linter are treated as errors,
@@ -13,5 +16,4 @@ class GolangCILint(Linter):
1316
default_type = WARNING
1417
defaults = {
1518
'selector': 'source.go',
16-
'args': '--fast'
1719
}

0 commit comments

Comments
 (0)