49db8210f6
Allows the user to override $GO111MODULE environment variable through ale options. This gives control over the default behavior of Go module resolution. Golang documentation: https://github.com/golang/go/wiki/Modules#how-to-use-modules Add `ale#Go#EnvString()` function to make it easy to add similar Go environment variables in the future. Use the new `EnvString` function in all available Go tools callbacks & update tests Also add test of linter command callback for `gofmt`
21 lines
673 B
VimL
21 lines
673 B
VimL
" Author: neersighted <bjorn@neersighted.com>
|
|
" Description: golint for Go files
|
|
|
|
call ale#Set('go_golint_executable', 'golint')
|
|
call ale#Set('go_golint_options', '')
|
|
|
|
function! ale_linters#go#golint#GetCommand(buffer) abort
|
|
let l:options = ale#Var(a:buffer, 'go_golint_options')
|
|
|
|
return ale#go#EnvString(a:buffer) . '%e'
|
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
|
\ . ' %t'
|
|
endfunction
|
|
|
|
call ale#linter#Define('go', {
|
|
\ 'name': 'golint',
|
|
\ 'output_stream': 'both',
|
|
\ 'executable': {b -> ale#Var(b, 'go_golint_executable')},
|
|
\ 'command': function('ale_linters#go#golint#GetCommand'),
|
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
|
\})
|