Closed weirdgiraffe closed 7 years ago
I've deduced the problem to a single line in vimrc - syntax enable
. Without this line :GoCoverage
works
Now that the Go 1.9 has landed in the Arch packages I tested this with Go 1.9, and as far as I can see it works fine for me, either with my own vimrc or yours. These are the test files I used:
~/go/src/a/a.go
:
package a
func tested() string {
return "X"
}
func untested() string {
return "X"
}
~/go/src/a/a_test.go
:
package a
import "testing"
func TestTested(t *testing.T) {
_ = tested()
}
I'm not sure why a Go 1.9 upgrade would break this, either. Maybe try using syntax on
instead of syntax enable
?
I've deduced the problem to a single line in vimrc - syntax enable. Without this line :GoCoverage works
I have Go 1.9 and syntax enable
in my vimrc and it totally works. Can you please update to Vim 8.0 ? Vim 7.4.x is not up to date with latest bug fixes and we develop against the latest vim version.
@fatih , it is an interesting case. With vim 8 and following config coverage works well:
set nocompatible
set backspace=indent,eol,start
set encoding=utf-8
nnoremap Q <Nop>
nnoremap gQ <Nop>
if empty(glob($HOME.'/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall | source $MYVIMRC
endif
call plug#begin($HOME.'/.vim/plugged')
Plug 'fatih/vim-go', {'for': 'go', 'do': ':GoInstallBinaries'}
call plug#end()
syntax enable
but if I enable syntax before vim-go
plugin I'm getting the same error.
Error detected while processing function 2[2]..<SNR>39_coverage_callback[2]..go#coverage#overlay:
line 57:
E28: No such highlight group name: goCoverageNormalText
Looks like this issue is not about go1.9 but about the order of vim instructions in vimrc
. I'm about to close this issue, should I create a new one about syntax enable
?
I have the same issue and it not happen all the time, on the same environment. That's weird.
Oh, I found the root cause.
Because I lazy loaded vim-go in vimrc After modify the vim-plug setting from
Plug 'fatih/vim-go', {'on': ['GoInstallBinaries', 'GoUpdateBinaries', 'GoPath'], 'for': 'go'}
to
Plug 'fatih/vim-go'
It works fine now. Sorry for the interruption.
Oh, the problem with that is that Plug will load the plugin on an autocmd event (e.g. FileType
), but vim-go also uses the same event, but by the time vim-go is loaded it has missed the events.
This is something vim-plug can improve on perhaps by manually firing the events again; don't know ... but in general, you don't want to use for: ...
with filetype-specific plugins (such as vim-go).
I am affected by this on the latest Ubuntu, when putting vim-go in ~/.vim/pack/plugins/start/vim-go (no explicit load command)
Behavior
I've intalled go1.9.linux-amd64. Then I've tried to use
:GoCoverage
as usualy but from now on I constantly get the following error:I expect
:GoCoverage
to work as beforeSteps to reproduce:
~/issuevimrc
cd /usr/local/go/src/archive/tar
vim -u ~/issuevimrc common.go
, issue:PlugInstall
command, then quit vim.vim -u ~/issuevimrc common.go
, issue:GoInstallBinaries
, then quit vim.vim -u ~/issuevimrc common.go
, issue:GoCoverage
command in vim.Configuration
vimrc
vim version
vim-go version
go version