From c95f1347b189ababd9495b8c0e054c286df3d439 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Wed, 6 Nov 2024 14:46:00 -0600 Subject: [PATCH] Enable golangci-lint --- .config/nvim/lua/plugins/conform.lua | 1 + .config/nvim/lua/plugins/lint.lua | 17 ++++++++++++++--- .config/nvim/lua/plugins/lspconfig.lua | 7 ++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.config/nvim/lua/plugins/conform.lua b/.config/nvim/lua/plugins/conform.lua index f5c250f..5c509f0 100644 --- a/.config/nvim/lua/plugins/conform.lua +++ b/.config/nvim/lua/plugins/conform.lua @@ -17,6 +17,7 @@ return { formatters_by_ft = { lua = { "stylua" }, ruby = { "rufo" }, + go = { "gofmt" }, }, }, } diff --git a/.config/nvim/lua/plugins/lint.lua b/.config/nvim/lua/plugins/lint.lua index e0ad35d..8969b29 100644 --- a/.config/nvim/lua/plugins/lint.lua +++ b/.config/nvim/lua/plugins/lint.lua @@ -1,13 +1,24 @@ return { "mfussenegger/nvim-lint", + opts = { + linters_by_ft = { + -- ruby = { "rubocop", "standardrb" }, + ruby = { "standardrb" }, + go = { "golangcilint" }, + }, + }, config = function() - require("lint").linters_by_ft = { - ruby = { "rubocop", "standardrb" }, + local lint = require("lint") + + lint.linters_by_ft = { + -- ruby = { "rubocop", "standardrb" }, + ruby = { "standardrb" }, + go = { "golangcilint" }, } vim.api.nvim_create_autocmd({ "BufWritePost" }, { callback = function() - require("lint").try_lint() + lint.try_lint() end, }) end, diff --git a/.config/nvim/lua/plugins/lspconfig.lua b/.config/nvim/lua/plugins/lspconfig.lua index c5c7df7..eef86c3 100644 --- a/.config/nvim/lua/plugins/lspconfig.lua +++ b/.config/nvim/lua/plugins/lspconfig.lua @@ -1,14 +1,14 @@ return { { "williamboman/mason.nvim", - config = function() + config = function() require("mason").setup() end, -}, + }, { "williamboman/mason-lspconfig.nvim", dependencies = { "williamboman/mason.nvim" }, - config = function() + config = function() require("mason-lspconfig").setup({ ensure_installed = { "lua_ls", @@ -49,6 +49,7 @@ return { }, }) lspconfig.pyright.setup({}) + lspconfig.gopls.setup({}) end, }, }