Closed palsivertsen closed 6 years ago
According to
syntastic_<filetype>_<checker>_<option>
thefname
option is automatically set to the name of the current file.
No. What the manual says is that you can override the default fname
by setting the variable syntastic_<filetype>_<checker>_<option>
. Most of the time the variable itself is left unset by syntastic.
When running checkers with
syntastic_debug = 1
I see that thefname
option is set to the directory of the file, instead of the filename itself.
Yes, some checkers expect a directory name instead of a filename. gometalinter
is one of these checkers. Is there a problem you're actually trying to solve?
No. What the manual says is that you can override the default fname by setting the variable syntastic
_
Oh, sorry, my mistake
Is there a problem you're actually trying to solve?
I'm running gometalinter
using test
and testify
. Since these linters is slow, I was hoping to only run linters on the current file and the associated test file.
I'm running
gometalinter
usingtest
andtestify
. Since these linters is slow, I was hoping to only run linters on the current file and the associated test file.
Well you could set fname
to point to the current file, but IIRC gometalinter
won't accept that. In the mean time there are better options: the recently added checker golangci_lint
is supposed to be faster than gometalinter
; Vim plugin vim-go has better support for go
than syntastic and supports gometalinter
; and Vim plugin ale can run checks asynchronously.
Thanks! I'll check it out
gometalinter
accepts files as far as I can see. If anyone is interested I got fname
working with the following autocmd:
autocmd BufEnter * silent! let g:syntastic_go_gometalinter_fname = split(globpath(expand("%:h"), expand("%:t:r") . "*"))
It will set the g:syntastic_go_gometalinter_fname
variable to the current file and associated test file (if exists)
This sets g:syntastic_go_gometalinter_fname
for all files in the project. You probably want to use b:...
instead of g:...
, and restrict the autocmd
pattern to test files. You also probably want to set do it only once. But this is general Vim-fu, not directly related to syntastic.
According to
syntastic_<filetype>_<checker>_<option>
thefname
option is automatically set to the name of the current file. When running checkers withsyntastic_debug = 1
I see that thefname
option is set to the directory of the file, instead of the filename itself. See line 9: