diff --git a/lua/go/lsp_diag.lua b/lua/go/lsp_diag.lua index 67fdd64bc..fe48d0ae1 100644 --- a/lua/go/lsp_diag.lua +++ b/lua/go/lsp_diag.lua @@ -33,14 +33,11 @@ end return { setup = function() - vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with( - function(err, result, ctx, config) - vim.lsp.diagnostic.on_publish_diagnostics(err, result, ctx, config) - if _GO_NVIM_CFG.diagnostic.hdlr then - hdlr(result) - end - end, - {} - ) + vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(function(err, result, ctx, config) + vim.lsp.diagnostic.on_publish_diagnostics(err, result, ctx, config) + if type(_GO_NVIM_CFG.diagnostic) == 'table' and _GO_NVIM_CFG.diagnostic.hdlr then + hdlr(result) + end + end, {}) end, }