Go checker: more contortions around "go_go_build_args" and "go_go_test_args".
This commit is contained in:
parent
8b97caa2d9
commit
c60e440d00
@ -264,6 +264,17 @@ function! syntastic#util#shexpand(string, ...) " {{{2
|
|||||||
return syntastic#util#shescape(a:0 ? expand(a:string, a:1) : expand(a:string, 1))
|
return syntastic#util#shescape(a:0 ? expand(a:string, a:1) : expand(a:string, 1))
|
||||||
endfunction " }}}2
|
endfunction " }}}2
|
||||||
|
|
||||||
|
" Escape arguments
|
||||||
|
function! syntastic#util#argsescape(opt) " {{{2
|
||||||
|
if type(a:opt) == type('') && a:opt != ''
|
||||||
|
return [a:opt]
|
||||||
|
elseif type(a:opt) == type([])
|
||||||
|
return map(copy(a:opt), 'syntastic#util#shescape(v:val)')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return []
|
||||||
|
endfunction " }}}2
|
||||||
|
|
||||||
" decode XML entities
|
" decode XML entities
|
||||||
function! syntastic#util#decodeXMLEntities(string) " {{{2
|
function! syntastic#util#decodeXMLEntities(string) " {{{2
|
||||||
let str = a:string
|
let str = a:string
|
||||||
|
@ -162,23 +162,13 @@ endfunction " }}}2
|
|||||||
|
|
||||||
function! g:SyntasticChecker._getOpt(opts, basename, name, default) " {{{2
|
function! g:SyntasticChecker._getOpt(opts, basename, name, default) " {{{2
|
||||||
let ret = []
|
let ret = []
|
||||||
call extend( ret, self._shescape(get(a:opts, a:name . '_before', '')) )
|
call extend( ret, syntastic#util#argsescape(get(a:opts, a:name . '_before', '')) )
|
||||||
call extend( ret, self._shescape(syntastic#util#var( a:basename . a:name, get(a:opts, a:name, a:default) )) )
|
call extend( ret, syntastic#util#argsescape(syntastic#util#var( a:basename . a:name, get(a:opts, a:name, a:default) )) )
|
||||||
call extend( ret, self._shescape(get(a:opts, a:name . '_after', '')) )
|
call extend( ret, syntastic#util#argsescape(get(a:opts, a:name . '_after', '')) )
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
endfunction " }}}2
|
endfunction " }}}2
|
||||||
|
|
||||||
function! g:SyntasticChecker._shescape(opt) " {{{2
|
|
||||||
if type(a:opt) == type('') && a:opt != ''
|
|
||||||
return [a:opt]
|
|
||||||
elseif type(a:opt) == type([])
|
|
||||||
return map(copy(a:opt), 'syntastic#util#shescape(v:val)')
|
|
||||||
endif
|
|
||||||
|
|
||||||
return []
|
|
||||||
endfunction " }}}2
|
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
|
|
||||||
" Private functions {{{1
|
" Private functions {{{1
|
||||||
|
@ -51,12 +51,16 @@ function! SyntaxCheckers_go_go_GetLocList() dict
|
|||||||
" compiled by `go build`, therefore `go test` must be called for those.
|
" compiled by `go build`, therefore `go test` must be called for those.
|
||||||
if match(expand('%', 1), '\m_test\.go$') == -1
|
if match(expand('%', 1), '\m_test\.go$') == -1
|
||||||
let opts = syntastic#util#var('go_go_build_args')
|
let opts = syntastic#util#var('go_go_build_args')
|
||||||
let opts = opts != '' ? syntastic#util#shescape(opts) : ''
|
if type(opts) != type('') || opts != ''
|
||||||
|
let opts = join(syntastic#util#argsescape(opts))
|
||||||
|
endif
|
||||||
let makeprg = self.getExec() . ' build ' . opts . ' ' . syntastic#c#NullOutput()
|
let makeprg = self.getExec() . ' build ' . opts . ' ' . syntastic#c#NullOutput()
|
||||||
let cleanup = 0
|
let cleanup = 0
|
||||||
else
|
else
|
||||||
let opts = syntastic#util#var('go_go_test_args')
|
let opts = syntastic#util#var('go_go_test_args')
|
||||||
let opts = opts != '' ? syntastic#util#shescape(opts) : ''
|
if type(opts) != type('') || opts != ''
|
||||||
|
let opts = join(syntastic#util#argsescape(opts))
|
||||||
|
endif
|
||||||
let makeprg = self.getExec() . ' test -c ' . opts . ' ' . syntastic#c#NullOutput()
|
let makeprg = self.getExec() . ' test -c ' . opts . ' ' . syntastic#c#NullOutput()
|
||||||
let cleanup = 1
|
let cleanup = 1
|
||||||
endif
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user