From ba8dfd977c2618f05773721c84751db87c20cbf9 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Sun, 14 Nov 2021 14:16:02 -0500 Subject: [PATCH] fix(builtins): add vim.NIL check to golangci-lint --- .../builtins/diagnostics/golangci_lint.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lua/null-ls/builtins/diagnostics/golangci_lint.lua b/lua/null-ls/builtins/diagnostics/golangci_lint.lua index b2ad368a1..9f0e6ea3f 100644 --- a/lua/null-ls/builtins/diagnostics/golangci_lint.lua +++ b/lua/null-ls/builtins/diagnostics/golangci_lint.lua @@ -25,13 +25,16 @@ return h.make_builtin({ end, on_output = function(params) local diags = {} - for _, d in ipairs(params.output.Issues) do - if d.Pos.Filename == params.bufname then - table.insert(diags, { - row = d.Pos.Line, - col = d.Pos.Column, - message = d.Text, - }) + local issues = params.output["Issues"] + if type(issues) == "table" then + for _, d in ipairs(issues) do + if d.Pos.Filename == params.bufname then + table.insert(diags, { + row = d.Pos.Line, + col = d.Pos.Column, + message = d.Text, + }) + end end end return diags