All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: w0rp <devw0rp@gmail.com>
2 " Author: Jerko Steiner <https://github.com/jeremija>
3 " Description: https://github.com/saibing/gopls
5 call ale#Set('go_gopls_executable', 'gopls')
6 call ale#Set('go_gopls_options', '--mode stdio')
7 call ale#Set('go_gopls_init_options', {})
8 call ale#Set('go_gopls_use_global', get(g:, 'ale_use_global_executables', 0))
10 function! ale_linters#go#gopls#GetCommand(buffer) abort
11 return ale#go#EnvString(a:buffer)
13 \ . ale#Pad(ale#Var(a:buffer, 'go_gopls_options'))
16 function! ale_linters#go#gopls#FindProjectRoot(buffer) abort
17 let l:go_modules_off = ale#Var(a:buffer, 'go_go111module') is# 'off'
18 let l:project_root = l:go_modules_off ?
19 \ '' : ale#path#FindNearestFile(a:buffer, 'go.mod')
22 if empty(l:project_root)
23 let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git')
27 return !empty(l:project_root) ? fnamemodify(l:project_root, l:mods) : ''
30 call ale#linter#Define('go', {
33 \ 'executable': {b -> ale#path#FindExecutable(b, 'go_gopls', [
34 \ ale#go#GetGoPathExecutable('bin/gopls'),
36 \ 'command': function('ale_linters#go#gopls#GetCommand'),
37 \ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'),
38 \ 'initialization_options': {b -> ale#Var(b, 'go_gopls_init_options')},