mirror of https://github.com/dense-analysis/ale
goimports fixer doesn't work for vendored libraries
In Go you can "vendor" packages by putting them in the `vendor/` directory for a project. Adding the `-srcdir` argument makes `goimports` pick up these packages, in addition to what you have in GOPATH. Without this, `goimports` is not very useful, since most projects vendor their packages.
This commit is contained in:
parent
7d932a239c
commit
92f20b0e51
|
@ -14,7 +14,7 @@ function! ale#fixers#goimports#Fix(buffer) abort
|
|||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -l -w'
|
||||
\ . ' -l -w -srcdir %s'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
|
|
|
@ -25,7 +25,7 @@ Execute(The goimports callback should the command when the executable test passe
|
|||
AssertEqual
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape(g:ale_go_goimports_executable) . ' -l -w %t'
|
||||
\ 'command': ale#Escape(g:ale_go_goimports_executable) . ' -l -w -srcdir %s %t'
|
||||
\ },
|
||||
\ ale#fixers#goimports#Fix(bufnr(''))
|
||||
|
||||
|
@ -36,6 +36,6 @@ Execute(The goimports callback should include extra options):
|
|||
AssertEqual
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape(g:ale_go_goimports_executable) . ' -l -w --xxx %t'
|
||||
\ 'command': ale#Escape(g:ale_go_goimports_executable) . ' -l -w -srcdir %s --xxx %t'
|
||||
\ },
|
||||
\ ale#fixers#goimports#Fix(bufnr(''))
|
||||
|
|
Loading…
Reference in New Issue