diff options
author | Jelte Fennema <github-tech@jeltef.nl> | 2018-01-07 13:11:01 +0100 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2018-01-07 12:11:01 +0000 |
commit | b6d1c419255d335a1e87a5eb32fd910081fa16ac (patch) | |
tree | d052512bc99cd95432cdc08dec5fac4e7e29842a /ale_linters/go | |
parent | c9d66b861b4593e1797cedd302a2203bd7110a99 (diff) | |
download | ale-b6d1c419255d335a1e87a5eb32fd910081fa16ac.zip |
Go: Add gotype support (#1099)
Diffstat (limited to 'ale_linters/go')
-rw-r--r-- | ale_linters/go/gotype.vim | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ale_linters/go/gotype.vim b/ale_linters/go/gotype.vim new file mode 100644 index 00000000..731f4c92 --- /dev/null +++ b/ale_linters/go/gotype.vim @@ -0,0 +1,23 @@ +" Author: Jelte Fennema <github-public@jeltef.nl> +" Description: gotype for Go files + +call ale#linter#Define('go', { +\ 'name': 'gotype', +\ 'output_stream': 'stderr', +\ 'executable': 'gotype', +\ 'command_callback': 'ale_linters#go#gotype#GetCommand', +\ 'callback': 'ale#handlers#unix#HandleAsError', +\}) + +"\ 'command': +function! ale_linters#go#gotype#GetCommand(buffer) abort + let l:cur_file = expand('#' . a:buffer . ':p') + if l:cur_file =~# '_test\.go$' + return + endif + + let l:module_files = globpath(expand('#' . a:buffer . ':p:h'), '*.go', 0, 1) + let l:other_module_files = filter(l:module_files, 'v:val isnot# ' . ale#util#EscapeVim(l:cur_file) . ' && v:val !~# "_test\.go$"') + return 'gotype %t ' . join(map(l:other_module_files, 'ale#Escape(v:val)')) + +endfunction |