Skip to content

Commit

Permalink
teach GoErrCheck how to not jump to first error
Browse files Browse the repository at this point in the history
  • Loading branch information
bhcleek committed Nov 16, 2018
1 parent 68ac559 commit 22ae35b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions autoload/go/lint.vim
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ endfunction

" ErrCheck calls 'errcheck' for the given packages. Any warnings are populated in
" the location list
function! go#lint#Errcheck(...) abort
function! go#lint#Errcheck(bang, ...) abort
if a:0 == 0
let l:import_path = go#package#ImportPath()
if import_path == -1
Expand Down Expand Up @@ -177,7 +177,7 @@ function! go#lint#Errcheck(...) abort
if !empty(errors)
call go#list#Populate(l:listtype, errors, 'Errcheck')
call go#list#Window(l:listtype, len(errors))
if !empty(errors)
if !a:bang
call go#list#JumpToFirst(l:listtype)
endif
endif
Expand Down
4 changes: 3 additions & 1 deletion doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -466,14 +466,16 @@ CTRL-t
If [!] is not given the first error is jumped to.

*:GoErrCheck*
:GoErrCheck [options]
:GoErrCheck! [options]

Check for unchecked errors in you current package. Errors are populated in
the quickfix window.

You may optionally pass any valid errcheck flags/options. See
`errcheck -h` for a full list.

If [!] is not given the first error is jumped to.

*:GoFiles*
:GoFiles [source_files]

Expand Down
2 changes: 1 addition & 1 deletion ftplugin/go/commands.vim
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ command! -nargs=* -bang GoMetaLinter call go#lint#Gometa(<bang>0, 0, <f-args>)
command! -nargs=0 GoMetaLinterAutoSaveToggle call go#lint#ToggleMetaLinterAutoSave()
command! -nargs=* -bang GoLint call go#lint#Golint(<bang>0, <f-args>)
command! -nargs=* -bang GoVet call go#lint#Vet(<bang>0, <f-args>)
command! -nargs=* -complete=customlist,go#package#Complete GoErrCheck call go#lint#Errcheck(<f-args>)
command! -nargs=* -bang -complete=customlist,go#package#Complete GoErrCheck call go#lint#Errcheck(<bang>0, <f-args>)

" -- alternate
command! -bang GoAlternate call go#alternate#Switch(<bang>0, '')
Expand Down

0 comments on commit 22ae35b

Please sign in to comment.