Skip to content

Commit 6cfe0c7

Browse files
committed
Override SublimeLinter.finalize_cmd method to reset command
SublimeLinter automatically appends the filename to the end of the command, but unfortunately, golangci-lint doesn’t supports linting individual files, or at least not very well. When the linter is executed using a single file, packages are not scanned, which translates into useless warnings about missing functions and global variables.
1 parent e2d1813 commit 6cfe0c7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

linter.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ def run(self, cmd, code):
2222
else:
2323
return self._in_place_lint(cmd)
2424

25+
def finalize_cmd(self, cmd, context, at_value='', auto_append=False):
26+
"""prevents SublimeLinter to append filename at the end of cmd"""
27+
return cmd
28+
2529
def _live_lint(self, cmd, code):
2630
dir = os.path.dirname(self.filename)
2731
files = [file for file in os.listdir(dir) if file.endswith(".go")]

0 commit comments

Comments
 (0)