Skip to content

Commit 13108b0

Browse files
authored
Merge pull request #3248 from bhcleek/revive
lint: use revive instead of golint
2 parents 4fc8892 + 68fffca commit 13108b0

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

autoload/go/config.vim

+3-3
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ endfunction
271271
function! go#config#MetalinterAutosaveEnabled() abort
272272
let l:default = []
273273
if get(g:, 'go_metalinter_command', s:default_metalinter) == 'golangci-lint'
274-
let l:default = ['govet', 'golint']
274+
let l:default = ['govet', 'revive']
275275
endif
276276

277277
return get(g:, 'go_metalinter_autosave_enabled', l:default)
@@ -280,14 +280,14 @@ endfunction
280280
function! go#config#MetalinterEnabled() abort
281281
let l:default = []
282282
if get(g:, 'go_metalinter_command', s:default_metalinter) == 'golangci-lint'
283-
let l:default = ['vet', 'golint', 'errcheck']
283+
let l:default = ['vet', 'revive', 'errcheck']
284284
endif
285285

286286
return get(g:, 'go_metalinter_enabled', l:default)
287287
endfunction
288288

289289
function! go#config#GolintBin() abort
290-
return get(g:, "go_golint_bin", "golint")
290+
return get(g:, "go_golint_bin", "revive")
291291
endfunction
292292

293293
function! go#config#ErrcheckBin() abort

autoload/go/lint_test.vim

+13-7
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ func! s:gometa(metalinter) abort
2323
\ ]
2424
if a:metalinter == 'golangci-lint'
2525
let expected = [
26-
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'w', 'module': '', 'text': '[runner] The linter ''golint'' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive.'},
27-
\ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function `MissingFooDoc` should have comment or be unexported (golint)'}
26+
\ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'exported: exported function MissingFooDoc should have comment or be unexported (revive)'}
2827
\ ]
2928
endif
3029

@@ -33,7 +32,7 @@ func! s:gometa(metalinter) abort
3332

3433
let g:go_metalinter_enabled = ['ST1000']
3534
if a:metalinter == 'golangci-lint'
36-
let g:go_metalinter_enabled = ['golint']
35+
let g:go_metalinter_enabled = ['revive']
3736
endif
3837

3938
call go#lint#Gometa(0, 0, $GOPATH . '/src/foo')
@@ -135,8 +134,7 @@ func! s:gometaautosave(metalinter, withList) abort
135134
" \ ]
136135
elseif a:metalinter == 'golangci-lint'
137136
let l:expected = [
138-
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'w', 'module': '', 'text': '[runner] The linter ''golint'' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive.'},
139-
\ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function `MissingDoc` should have comment or be unexported (golint)'}
137+
\ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'exported: exported function MissingDoc should have comment or be unexported (revive)'}
140138
\ ]
141139
endif
142140

@@ -153,7 +151,7 @@ func! s:gometaautosave(metalinter, withList) abort
153151

154152
let g:go_metalinter_autosave_enabled = ['ST1000']
155153
if a:metalinter == 'golangci-lint'
156-
let g:go_metalinter_autosave_enabled = ['golint']
154+
let g:go_metalinter_autosave_enabled = ['revive']
157155
endif
158156

159157
call go#lint#Gometa(0, 1)
@@ -276,7 +274,7 @@ func! s:gometa_multiple(metalinter) abort
276274
" clear the quickfix list
277275
call setqflist([], 'r')
278276

279-
let g:go_metalinter_enabled = ['golint']
277+
let g:go_metalinter_enabled = ['revive']
280278

281279
call go#lint#Gometa(0, 0)
282280

@@ -461,6 +459,10 @@ func! Test_Lint_GOPATH() abort
461459
let actual = getqflist()
462460
endwhile
463461

462+
" sort the results for deterministic ordering
463+
call sort(actual)
464+
call sort(expected)
465+
464466
call gotest#assert_quickfix(actual, expected)
465467

466468
"call assert_report(execute('ls'))
@@ -494,6 +496,10 @@ func! Test_Lint_NullModule() abort
494496
let actual = getqflist()
495497
endwhile
496498

499+
" sort the results for deterministic ordering
500+
call sort(actual)
501+
call sort(expected)
502+
497503
call gotest#assert_quickfix(actual, expected)
498504
call call(RestoreGO111MODULE, [])
499505
endfunc

doc/vim-go.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1632,7 +1632,7 @@ an empty list; `staticcheck`'s `-checks` flag will not be used.
16321632

16331633
When `g:go_metalinter_command is set to `golangci-lint'`, the default value is
16341634
>
1635-
let g:go_metalinter_autosave_enabled = ['vet', 'golint']
1635+
let g:go_metalinter_autosave_enabled = ['vet', 'revive']
16361636
<
16371637
*'g:go_metalinter_enabled'*
16381638

@@ -1649,7 +1649,7 @@ an empty list; `staticcheck`'s `-checks` flag will not be used.
16491649
When `g:go_metalinter_command` is set to `golangci-lint'`, the default value
16501650
is
16511651
>
1652-
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
1652+
let g:go_metalinter_enabled = ['vet', 'revive', 'errcheck']
16531653
<
16541654
*'g:go_metalinter_command'*
16551655

plugin/go.vim

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ let s:packages = {
4747
\ 'godef': ['github.com/rogpeppe/godef@latest'],
4848
\ 'goimports': ['golang.org/x/tools/cmd/goimports@master'],
4949
\ 'golint': ['golang.org/x/lint/golint@master'],
50+
\ 'revive': ['github.com/mgechev/revive@latest'],
5051
\ 'gopls': ['golang.org/x/tools/gopls@latest', {}, {'after': function('go#lsp#Restart', [])}],
5152
\ 'golangci-lint': ['github.com/golangci/golangci-lint/cmd/golangci-lint@latest'],
5253
\ 'staticcheck': ['honnef.co/go/tools/cmd/staticcheck@latest'],

0 commit comments

Comments
 (0)