summaryrefslogtreecommitdiff
path: root/ale_linters/go/staticcheck.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2021-05-27 22:03:39 +0100
committerw0rp <devw0rp@gmail.com>2021-05-27 22:03:46 +0100
commit1b08791228f5aca4545a3fba6699b29a003028fe (patch)
tree42cb78fe66f93100217ecb1230c269c26d58db1b /ale_linters/go/staticcheck.vim
parenta02a4f2811f810877f3c3859cca963f9578ff94a (diff)
downloadale-1b08791228f5aca4545a3fba6699b29a003028fe.zip
Make staticcheck configurable with GOPATH detection
Diffstat (limited to 'ale_linters/go/staticcheck.vim')
-rw-r--r--ale_linters/go/staticcheck.vim10
1 files changed, 7 insertions, 3 deletions
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',