summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/go/gopls.vim16
-rw-r--r--ale_linters/go/staticcheck.vim10
2 files changed, 8 insertions, 18 deletions
diff --git a/ale_linters/go/gopls.vim b/ale_linters/go/gopls.vim
index 23082e9b..80909830 100644
--- a/ale_linters/go/gopls.vim
+++ b/ale_linters/go/gopls.vim
@@ -7,20 +7,6 @@ call ale#Set('go_gopls_options', '--mode stdio')
call ale#Set('go_gopls_init_options', {})
call ale#Set('go_gopls_use_global', get(g:, 'ale_use_global_executables', 0))
-function! s:GetGoPathExecutable(suffix) abort
- let l:prefix = $GOPATH
-
- if !empty($GOPATH)
- let l:prefix = $GOPATH
- elseif has('win32')
- let l:prefix = $USERPROFILE . '/go'
- else
- let l:prefix = $HOME . '/go'
- endif
-
- return ale#path#Simplify(l:prefix . '/' . a:suffix)
-endfunction
-
function! ale_linters#go#gopls#GetCommand(buffer) abort
return ale#go#EnvString(a:buffer)
\ . '%e'
@@ -45,7 +31,7 @@ call ale#linter#Define('go', {
\ 'name': 'gopls',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#path#FindExecutable(b, 'go_gopls', [
-\ s:GetGoPathExecutable('bin/gopls'),
+\ ale#go#GetGoPathExecutable('bin/gopls'),
\ ])},
\ 'command': function('ale_linters#go#gopls#GetCommand'),
\ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'),
diff --git a/ale_linters/go/staticcheck.vim b/ale_linters/go/staticcheck.vim
index 84e70d58..5dc88f1a 100644
--- a/ale_linters/go/staticcheck.vim
+++ b/ale_linters/go/staticcheck.vim
@@ -1,8 +1,10 @@
" Author: Ben Reedy <https://github.com/breed808>
" Description: staticcheck for Go files
+call ale#Set('go_staticcheck_executable', 'staticcheck')
call ale#Set('go_staticcheck_options', '')
call ale#Set('go_staticcheck_lint_package', 0)
+call ale#Set('go_staticcheck_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#go#staticcheck#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'go_staticcheck_options')
@@ -10,18 +12,20 @@ function! ale_linters#go#staticcheck#GetCommand(buffer) abort
let l:env = ale#go#EnvString(a:buffer)
if l:lint_package
- return l:env . 'staticcheck'
+ return l:env . '%e'
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
endif
- return l:env . 'staticcheck'
+ return l:env . '%e'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %s:t'
endfunction
call ale#linter#Define('go', {
\ 'name': 'staticcheck',
-\ 'executable': 'staticcheck',
+\ 'executable': {b -> ale#path#FindExecutable(b, 'go_staticcheck', [
+\ ale#go#GetGoPathExecutable('bin/staticcheck'),
+\ ])},
\ 'cwd': '%s:h',
\ 'command': function('ale_linters#go#staticcheck#GetCommand'),
\ 'callback': 'ale#handlers#go#Handler',