Skip to content

Commit 4c6513e

Browse files
committed
feat: add config to exclude certain binaries from updating
Signed-off-by: Elias Van Ootegem <[email protected]>
1 parent b5fc468 commit 4c6513e

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

autoload/go/config.vim

+4
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,10 @@ function! go#config#FillStructMode() abort
578578
return get(g:, 'go_fillstruct_mode', 'fillstruct')
579579
endfunction
580580

581+
function! go#config#GoExcludeBinaries() abort
582+
return get(g:, 'go_exclude_binaries', [])
583+
endfunction
584+
581585
function! go#config#DebugMappings() abort
582586
let l:default = {
583587
\ '(go-debug-continue)': {'key': '<F5>'},

doc/vim-go.txt

+42-1
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ CTRL-t
512512
syntax to the binary name. e.g. `:GoInstallBinaries [email protected]`.
513513

514514
Set |'g:go_get_update'| to disable updating dependencies.
515+
Set |'g:go_exclude_binaries'| to disable installing specific binaries.
515516

516517
*:GoUpdateBinaries*
517518
:GoUpdateBinaries [binaries]
@@ -525,6 +526,7 @@ CTRL-t
525526
syntax to the binary name. e.g. `:GoUpdateBinaries [email protected]`.
526527

527528
Set |'g:go_get_update'| to disable updating dependencies.
529+
Set |'g:go_exclude_binaries'| to disable updating specific binaries.
528530

529531
*:GoImplements*
530532
:GoImplements
@@ -2489,14 +2491,53 @@ Highlight the current line and breakpoints in the debugger.
24892491
let g:go_highlight_debug = 1
24902492
<
24912493

2492-
*'go:go_debug_breakpoint_sign_text'*
2494+
*'g:go_debug_breakpoint_sign_text'*
24932495

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

24962498
>
24972499
let g:go_debug_breakpoint_sign_text = '>'
24982500
<
24992501

2502+
*'g:go_exclude_binaries'*
2503+
2504+
Set a list of binaries to exclude from installing/updating when running either
2505+
|:GoInstallBinaries| or |:GoUpdateBinaries|. Possible values are all keys used
2506+
in the `s:packages` dictionary:
2507+
2508+
>
2509+
let g:go_exclude_binaries = [
2510+
\ 'asmfmt',
2511+
\ 'dlv',
2512+
\ 'errcheck',
2513+
\ 'fillstruct',
2514+
\ 'godef',
2515+
\ 'goimports',
2516+
\ 'revive',
2517+
\ 'gopls',
2518+
\ 'golangci-lint',
2519+
\ 'staticcheck',
2520+
\ 'gomodifytags',
2521+
\ 'gorename',
2522+
\ 'gotags',
2523+
\ 'impl',
2524+
\ 'motion',
2525+
\ 'iferr',
2526+
\]
2527+
<
2528+
2529+
Default:
2530+
2531+
>
2532+
let g:go_exclude_binaries = []
2533+
<
2534+
2535+
To exclude, for example, `errcheck`, `dlv`, and `golangci-lint`:
2536+
2537+
>
2538+
let g:go_exclude_binaries = ['errcheck', 'dlv', 'golangci-lint']
2539+
<
2540+
25002541
==============================================================================
25012542
FAQ TROUBLESHOOTING *go-troubleshooting*
25022543

plugin/go.vim

+5
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ function! s:GoInstallBinaries(updateBinaries, ...)
132132
let l:packages = s:packages
133133
endif
134134

135+
" Filter packages from exclude list
136+
for l:bin in go#config#GoExcludeBinaries()
137+
call remove(l:bin, l:packages)
138+
endfor
139+
135140
let l:platform = ''
136141
if go#util#IsWin()
137142
let l:platform = 'windows'

0 commit comments

Comments
 (0)