-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Penghui Liao <[email protected]>
- Loading branch information
Showing
6 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
" Author: Penghui Liao <[email protected]> | ||
" Description: Adds support for revive | ||
|
||
call ale#Set('go_revive_executable', 'revive') | ||
call ale#Set('go_revive_options', '') | ||
|
||
function! ale_linters#go#revive#GetCommand(buffer) abort | ||
let l:options = ale#Var(a:buffer, 'go_revive_options') | ||
|
||
return ale#go#EnvString(a:buffer) . '%e' | ||
\ . (!empty(l:options) ? ' ' . l:options : '') | ||
\ . ' %t' | ||
endfunction | ||
|
||
call ale#linter#Define('go', { | ||
\ 'name': 'revive', | ||
\ 'output_stream': 'both', | ||
\ 'executable': {b -> ale#Var(b, 'go_revive_executable')}, | ||
\ 'command': function('ale_linters#go#revive#GetCommand'), | ||
\ 'callback': 'ale#handlers#unix#HandleAsWarning', | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Before: | ||
Save g:ale_go_go111module | ||
|
||
call ale#assert#SetUpLinterTest('go', 'revive') | ||
|
||
After: | ||
Restore | ||
|
||
unlet! b:ale_go_go111module | ||
|
||
call ale#assert#TearDownLinterTest() | ||
|
||
Execute(The default revive command should be correct): | ||
AssertLinter 'revive', ale#Escape('revive') . ' %t' | ||
|
||
Execute(The revive executable should be configurable): | ||
let b:ale_go_revive_executable = 'foobar' | ||
|
||
AssertLinter 'foobar', ale#Escape('foobar') . ' %t' | ||
|
||
Execute(The revive options should be configurable): | ||
let b:ale_go_revive_options = '--foo' | ||
|
||
AssertLinter 'revive', ale#Escape('revive') . ' --foo %t' | ||
|
||
Execute(The revive command should support Go environment variables): | ||
let b:ale_go_go111module = 'on' | ||
|
||
AssertLinter 'revive', | ||
\ ale#Env('GO111MODULE', 'on') . ale#Escape('revive') . ' %t' |