golangci-lint-langserver

command module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

golangci-lint-langserver

golangci-lint-langserver is golangci-lint language server.

asciicast

Installation

Install golangci-lint.

go install github.com/emilpriver/golangci-lint-langserver@latest

Options

  -debug
        output debug log
  -nolintername
        don't show a linter name in message

Configuration

You need to set golangci-lint command to initializationOptions with --out-format json.

Configuration for coc.nvim

coc-settings.json

{
  "languageserver": {
    "golangci-lint-languageserver": {
      "command": "golangci-lint-langserver",
      "filetypes": ["go"],
      "initializationOptions": {
        "command": ["golangci-lint", "run", "--output.json.path", "stdout", "--show-stats=false", "--issues-exit-code=1"]
    }
  }
}
Configuration for vim-lsp
augroup vim_lsp_golangci_lint_langserver
  au!
  autocmd User lsp_setup call lsp#register_server({
      \ 'name': 'golangci-lint-langserver',
      \ 'cmd': {server_info->['golangci-lint-langserver']},
      \ 'initialization_options': {'command': ['golangci-lint', 'run', '--output.json.path', 'stdout', '--show-stats=false', '--issues-exit-code=1']},
      \ 'whitelist': ['go'],
      \ })
augroup END

vim-lsp-settings provide installer for golangci-lint-langserver.

Configuration for nvim-lspconfig

Requires Neovim v0.6.1 or nightly.

local lspconfig = require 'lspconfig'
local configs = require 'lspconfig/configs'

if not configs.golangcilsp then
 	configs.golangcilsp = {
		default_config = {
			cmd = {'golangci-lint-langserver'},
			root_dir = lspconfig.util.root_pattern('.git', 'go.mod'),
			init_options = {
					command = { "golangci-lint", "run", "--output.json.path", "stdout", "--show-stats=false", "--issues-exit-code=1" };
		};
	}
end
lspconfig.golangci_lint_ls.setup {
	filetypes = {'go','gomod'}
}
Configuration for lsp-mode (Emacs)

Support for golangci-lint-langserver is built-in to lsp-mode since late 2023. When the golangci-lint-langserver executable is found, it is automatically started for Go buffers as an add-on server along with the gopls language server.

Configuration for helix

You can use .golangci.yaml in the project root directory to enable other linters

[[language]]
name = "go"
auto-format = true
language-servers = [ "gopls", "golangci-lint-lsp" ]

[language-server.golangci-lint-lsp]
command = "golangci-lint-langserver"

[language-server.golangci-lint-lsp.config]
command = ["golangci-lint", "run", "--output.json.path", "stdout", "--show-stats=false", "--issues-exit-code=1"]

golangci-lint Version Compatibility

  • For golangci-lint v2+: Use --output.json.path stdout --show-stats=false parameters
  • For golangci-lint v1: Use --out-format json parameter

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址