mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-05-19 21:46:32 +00:00
Merge 198986b3fb into cd45295f9c
This commit is contained in:
commit
d279bf735f
2 changed files with 31 additions and 9 deletions
|
|
@ -551,4 +551,8 @@ https://github.com/gorbit99/codewindow.nvim
|
|||
- Allow `vim.treesitter.context.setupOpts.max_lines` to also be given as a
|
||||
string in order to allow percentage values like `"20%"`
|
||||
|
||||
[RoastedCheese](https://github.com/roastedcheese):
|
||||
|
||||
- Fix `golangci-lint` to lint at the package level.
|
||||
|
||||
<!-- vim: set textwidth=80: -->
|
||||
|
|
|
|||
|
|
@ -67,7 +67,21 @@
|
|||
"--output.junit-xml.path="
|
||||
"--output.teamcity.path="
|
||||
"--output.sarif.path="
|
||||
(mkLuaInline ''
|
||||
-- Run on current file only if go.mod is missing
|
||||
function()
|
||||
local fnmod = ":p";
|
||||
local cmd = {"${getExe pkgs.go}", "env", "GOMOD"};
|
||||
local ok, gomod = pcall(vim.fn.system, cmd);
|
||||
gomod = gomod:gsub("%s+", "")
|
||||
if ok and gomod ~= "" and gomod ~= "/dev/null" then
|
||||
fnmod = ":h";
|
||||
end
|
||||
return vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), fnmod)
|
||||
end
|
||||
'')
|
||||
];
|
||||
append_fname = false;
|
||||
parser = mkLuaInline ''
|
||||
function(output, bufnr)
|
||||
local SOURCE = "golangci-lint";
|
||||
|
|
@ -111,15 +125,19 @@
|
|||
local normalized = issue.Severity:lower()
|
||||
sev = severity_map[normalized] or vim.diagnostic.severity.ERROR
|
||||
end
|
||||
table.insert(diagnostics, {
|
||||
bufnr = bufnr,
|
||||
lnum = issue.Pos.Line - 1,
|
||||
col = issue.Pos.Column - 1,
|
||||
message = issue.Text,
|
||||
code = issue.FromLinter,
|
||||
severity = sev,
|
||||
source = SOURCE,
|
||||
})
|
||||
|
||||
local buffer = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(bufnr), ":p")
|
||||
if vim.fs.normalize(buffer) == vim.fs.normalize(issue.Pos.Filename) then
|
||||
table.insert(diagnostics, {
|
||||
bufnr = bufnr,
|
||||
lnum = issue.Pos.Line - 1,
|
||||
col = issue.Pos.Column - 1,
|
||||
message = issue.Text,
|
||||
code = issue.FromLinter,
|
||||
severity = sev,
|
||||
source = SOURCE,
|
||||
})
|
||||
end
|
||||
end
|
||||
return diagnostics
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue