ray-x / go.nvim

G'day Nvimer, Joyful Gopher: Discover the Feature-Rich Go Plugin for Neovim
MIT License
1.93k stars 119 forks source link

GoLint(golangci-lint) uses hardcoded flags #352

Open KasonBraley opened 1 year ago

KasonBraley commented 1 year ago

The GoLint command used to run golangci-lint uses hardcoded flags: https://github.com/ray-x/go.nvim/blob/a8095eb334495caec3099b717cc7f5b1fbc3e628/lua/go/commands.lua#L228

I would like to have the --exclude-use-default flag set to true (the default for golangci-lint). That way the only lint errors that show up in the qf list are ones related to my .golangci.yml file.

I guess this would be a feature request to allow changing the flags passed to the GoLint command, perhaps through a new configuration field.

pedrocunha commented 5 months ago

@KasonBraley did you find a workaround this?

KasonBraley commented 5 months ago

@KasonBraley did you find a workaround this?

@pedrocunha no I never did. I ended up not using the GoLint command due to this, and just run golangci-lint from the cli as normal. The only other thing I tried and use on and off is the golangci-lint lsp integration. I mostly have it turned off those because I don't always want to see the lint errors in my editor, got cluttered sometimes.

luv2code commented 4 weeks ago

To workaround, I added a new command to my config that runs the linter with the options I want:

vim.cmd(
    [[command! GoLintEx        :setl makeprg=golangci-lint\ run\ --print-issued-lines=false\ --exclude-use-default=true\ --out-format=line-number | :GoMake]]
)

https://github.com/luv2code/nvim/commit/aad1cd0b7c191542d1ae531d2c897a3c8cf84e8d