mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-20 00:28:35 +08:00
Support $GO111MODULE with Go tooling
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`
This commit is contained in:
@@ -25,3 +25,20 @@ function! ale#go#FindProjectRoot(buffer) abort
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#Set('go_go111module', '')
|
||||
|
||||
" Return a string setting Go-specific environment variables
|
||||
function! ale#go#EnvString(buffer) abort
|
||||
let l:env = ''
|
||||
|
||||
" GO111MODULE - turn go modules behavior on/off
|
||||
let l:go111module = ale#Var(a:buffer, 'go_go111module')
|
||||
|
||||
if !empty(l:go111module)
|
||||
let l:env = ale#Env('GO111MODULE', l:go111module) . l:env
|
||||
endif
|
||||
|
||||
return l:env
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user