Skip to content

Commit

Permalink
Merge pull request #3126 from bhcleek/lint/default/staticcheck
Browse files Browse the repository at this point in the history
lint: make staticcheck the default metalinter
  • Loading branch information
bhcleek committed Jan 3, 2021
2 parents 9d676ce + 53c7ccc commit 706c73b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -44,6 +44,8 @@ IMPROVEMENTS:
[[GH-3097]](https://github.com/fatih/vim-go/pull/3097)
* Add syntax highlighting for go.sum files.
[[GH-3102]](https://github.com/fatih/vim-go/pull/3102)
* Change the default from metalinter to staticcheck.
[[GH-3126]](https://github.com/fatih/vim-go/pull/3126)

BUG FIXES:
* Remove implications that terminal mode is only applied for Neovim.
Expand Down
7 changes: 4 additions & 3 deletions autoload/go/config.vim
Expand Up @@ -259,13 +259,14 @@ function! go#config#SetTemplateAutocreate(value) abort
let g:go_template_autocreate = a:value
endfunction

let s:default_metalinter = 'staticcheck'
function! go#config#MetalinterCommand() abort
return get(g:, 'go_metalinter_command', 'golangci-lint')
return get(g:, 'go_metalinter_command', s:default_metalinter)
endfunction

function! go#config#MetalinterAutosaveEnabled() abort
let l:default = []
if get(g:, 'go_metalinter_command', 'golangci-lint') == 'golangci-lint'
if get(g:, 'go_metalinter_command', s:default_metalinter) == 'golangci-lint'
let l:default = ['govet', 'golint']
endif

Expand All @@ -274,7 +275,7 @@ endfunction

function! go#config#MetalinterEnabled() abort
let l:default = []
if get(g:, 'go_metalinter_command', 'golangci-lint') == 'golangci-lint'
if get(g:, 'go_metalinter_command', s:default_metalinter) == 'golangci-lint'
let l:default = ['vet', 'golint', 'errcheck']
endif

Expand Down
5 changes: 3 additions & 2 deletions doc/vim-go.txt
Expand Up @@ -1639,14 +1639,15 @@ an empty list; `staticcheck`'s `-checks` flag will not be used.
let g:go_metalinter_autosave_enabled = ['all']
<

When `g:go_metalinter_command is set to `golangci-lint'`, the default value is
When `g:go_metalinter_command` is set to `golangci-lint'`, the default value
is
>
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
<
*'g:go_metalinter_command'*

Overrides the command to be executed when |:GoMetaLinter| is called. By
default it's `golangci-lint`. Valid options are `golangci-lint, `gopls`, and
default it's `staticcheck`. Valid options are `golangci-lint`, `gopls`, and
`staticcheck`..

When the value is `gopls`, users may want to consider setting
Expand Down

0 comments on commit 706c73b

Please sign in to comment.