Skip to content

Commit 3574af8

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

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

autoload/go/config.vim

Lines changed: 4 additions & 0 deletions
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

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2489,14 +2489,53 @@ Highlight the current line and breakpoints in the debugger.
24892489
let g:go_highlight_debug = 1
24902490
<
24912491

2492-
*'go:go_debug_breakpoint_sign_text'*
2492+
*'g:go_debug_breakpoint_sign_text'*
24932493

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

24962496
>
24972497
let g:go_debug_breakpoint_sign_text = '>'
24982498
<
24992499

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

plugin/go.vim

Lines changed: 5 additions & 0 deletions
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+
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)