Skip to content

Commit

Permalink
feat: add config to exclude certain binaries from updating
Browse files Browse the repository at this point in the history
Signed-off-by: Elias Van Ootegem <[email protected]>
  • Loading branch information
EVODelavega committed Jun 5, 2024
1 parent b5fc468 commit 3574af8
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
4 changes: 4 additions & 0 deletions autoload/go/config.vim
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,10 @@ function! go#config#FillStructMode() abort
return get(g:, 'go_fillstruct_mode', 'fillstruct')
endfunction

function! go#config#GoExcludeBinaries() abort
return get(g:, 'go_exclude_binaries', [])
endfunction

function! go#config#DebugMappings() abort
let l:default = {
\ '(go-debug-continue)': {'key': '<F5>'},
Expand Down
41 changes: 40 additions & 1 deletion doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2489,14 +2489,53 @@ Highlight the current line and breakpoints in the debugger.
let g:go_highlight_debug = 1
<

*'go:go_debug_breakpoint_sign_text'*
*'g:go_debug_breakpoint_sign_text'*

Set the sign text used for breakpoints in the debugger. By default it's '>'.

>
let g:go_debug_breakpoint_sign_text = '>'
<

*'g:go_exclude_binaries'*

Set a list of binaries to exclude from installing/updating when running either
|:GoInstallBinaries| or |:GoUpdateBinaries|. Possible values are all keys used
in the `s:packages` dictionary:

>
let g:go_exclude_binaries = [
\ 'asmfmt',
\ 'dlv',
\ 'errcheck',
\ 'fillstruct',
\ 'godef',
\ 'goimports',
\ 'revive',
\ 'gopls',
\ 'golangci-lint',
\ 'staticcheck',
\ 'gomodifytags',
\ 'gorename',
\ 'gotags',
\ 'impl',
\ 'motion',
\ 'iferr',
\]
<

Default:

>
let g:go_exclude_binaries = []
<

To exclude, for example, `errcheck`, `dlv`, and `golangci-lint`:

>
let g:go_exclude_binaries = ['errcheck', 'dlv', 'golangci-lint']
<

==============================================================================
FAQ TROUBLESHOOTING *go-troubleshooting*

Expand Down
5 changes: 5 additions & 0 deletions plugin/go.vim
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ function! s:GoInstallBinaries(updateBinaries, ...)
let l:packages = s:packages
endif

" Filter packages from exclude list
for l:bin in go#config#GoExcludeBinaries()
remove(l:bin, l:packages)
endfor

let l:platform = ''
if go#util#IsWin()
let l:platform = 'windows'
Expand Down

0 comments on commit 3574af8

Please sign in to comment.