open a go file, go to a random non package func, like copy() and wait for info, then many errors starting coming like for all request made to gopls by vim-go
just providing function information and a working plugin for go coding, like it was working before!
continuous error displayed following this pattern:
Error detected while processing function 46_handler[2]..go#tool#Info[11]..go#lsp#Info[4]..go#lsp#DidChange[24]..11[47]..14
:
line 11:
E900: Invalid channel id
Error detected while processing function 46_handler[2]..go#tool#Info[11]..go#lsp#Info[17]..11[47]..14:
line 11:
E900: Invalid channel id
Press ENTER or type command to continue
Error detected while processing function 46_handler[5]..go#guru#SameIds[15]..go#lsp#SameIDs[1]..go#lsp#DidChange[24]..11[4
7]..14:
line 11:
E900: Invalid channel id
neovim 0.3.8
go 1.13.7 amd64/openbsd
AND
neovim 0.4.3
go 1.13.7 amd64/openbsd
v1.22
vimrc you used to reproduce (use a minimal vimrc with other pluginscall plug#begin('$HOME/.config/nvim/plugged')
Plug 'fatih/vim-go', { 'tag': 'v1.22' }
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
call plug#end()
map
map
map
map
"
" VIM-GO
"
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_types = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_generate_tags = 1
let g:go_highlight_format_strings = 1
let g:go_updatetime = 400
let g:go_auto_type_info = 1
let g:go_auto_sameids = 1
let g:go_info_mode = 'gopls'
let g:go_def_mode = 'gopls'
let g:go_referrers_mode = 'gopls'
let g:go_def_mode = 'gopls'
let g:go_rename_command = 'gopls'
no other plugins, i started from scratch.
:version):neovim 0.3.8
NVIM v0.3.8
Build type: Release
Lua 5.1
neovim 0.4.3
NVIM v0.4.3
Build type: RelWithDebInfo
LuaJIT 2.0.5
go version):go 1.13.7
go env Output:
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="openbsd"
GONOPROXY=""
GONOSUMDB=""
GOOS="openbsd"
GOPATH="/home/user/dev/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/user/tools/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/user/tools/go/pkg/tool/openbsd_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
gopls version Output:
$ gopls version
golang.org/x/tools/gopls v0.3.1
golang.org/x/tools/[email protected] h1:yNTWrf4gc4Or0UecjOas5pzOa3BL0WDDyKDV4Wz5VaM=
Can you provide the relevant gopls logs by running vim-go with let g:go_debug=['lsp'] in your vimrc?
@stamblerre do you know of anything in gopls that would cause it to crash if trying to get hover content or references for builtins?
@bhcleek panic in gopls it seems...
sent: Content-Length: 5890^M^@^M^@{"method": "textDocument/didChange","jsonrpc": "2.0", "params": {"contentChanges": [{"text":"package main\n\nimport (\n\t\"bytes\"\n\t\"crypto/rand\"\n\t\"crypto/tls\"\n\t\"fmt\"\n\t\"io\"\n\t\"net\"\n\t\"os\"\n\n\t\"in
sent: Content-Length: 198^M^@^M^@{"method": "textDocument/definition", "jsonrpc": "2.0", "id": 50, "params": {"textDocument": {"uri": "file:///home/user/dev/kobe/d/main.go"}, "position": {"character": 2, "line": 142}}}
sent: Content-Length: 5890^M^@^M^@{"method": "textDocument/didChange", "jsonrpc": "2.0", "params": {"contentChanges": [{"text": "package main\n\nimport (\n\t\"bytes\"\n\t\"crypto/rand\"\n\t\"crypto/tls\"\n\t\"fmt\"\n\t\"io\"\n\t\"net\"\n\t\"os\"\n\n\t\"in
sent: Content-Length: 239^M^@^M^@{"method": "textDocument/references", "jsonrpc": "2.0", "id": 51, "params": {"context": {"includeDeclaration": true}, "textDocument": {"uri": "file:///home/user/dev/kobe/d/main.go"}, "position": {"character":
received: Content-Length: 175^M^@^M^@{"jsonrpc":"2.0","result":[{"uri":"file:///home/user/tools/go/src/builtin/builtin.go","range":{"start":{"line":140,"character":0},"end":{"line":140,"character":4}}}],"id":50}
sent: Content-Length: 194^M^@^M^@{"method": "textDocument/hover", "jsonrpc": "2.0", "id": 52, "params": {"textDocument": {"uri": "file:///home/user/tools/go/src/builtin/builtin.go"}, "position": {"character": 0, "line": 140}}}
received: Content-Length: 122^M^@^M^@{"jsonrpc":"2.0","error":{"code":-32603,"message":"method \"textDocument/references\" did
stderr: panic: runtime error: invalid memory address or nil pointer dereference
stderr: [signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x7c7758]
stderr:
stderr: goroutine 3567 [running]:
stderr: golang.org/x/tools/internal/lsp/source.findFileInPackage(0x0, 0x0, 0x0, 0x0, 0xb, 0xc0013ef288, 0xad6320, 0x0, 0x0, 0x1
stderr: /home/user/dev/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/source/util.go:69
stderr: golang.org/x/tools/internal/lsp/source.findMapperInPackage(0xe64560, 0xc0001b5680, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc002
stderr: /home/user/dev/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/source/util.go:66
stderr: golang.org/x/tools/internal/lsp/source.posToMappedRange(0xe64560, 0xc0001b5680, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0,
stderr: /home/user/dev/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/source/util.go:20
stderr: golang.org/x/tools/internal/lsp/source.nameToMappedRange(...)
stderr: /home/user/dev/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/source/util.go:19
stderr: golang.org/x/tools/internal/lsp/source.objToMappedRange(0xe64560, 0xc0001b5680, 0x0, 0x0, 0xe64ec0, 0xc0000d2dc0, 0x0,
stderr: /home/user/dev/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/source/util.go:19
stderr: golang.org/x/tools/internal/lsp/source.References(0xe51000, 0xc0038f1c80, 0xe610a0, 0xc003acaae0, 0xe4f080, 0xc003acaa2
stderr: /home/user/dev/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/source/references
stderr: golang.org/x/tools/internal/lsp.(Server).references(0xc0001bfc00, 0xe51000, 0xc00393ac60, 0xc003802370, 0xc003802370,
stderr: /home/user/dev/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/references.go:31
stderr: golang.org/x/tools/internal/lsp.(Server).References(0xc0001bfc00, 0xe51000, 0xc00393ac60, 0xc003802370, 0xc003802370,
stderr: /home/user/dev/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/server_gen.go:148
stderr: golang.org/x/tools/internal/lsp/protocol.serverHandler.Deliver(0xe6ee20, 0xc0001bfc00, 0xe51000, 0xc00393ac60, 0xc003b7
stderr: /home/user/dev/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/protocol/tsserver
stderr: golang.org/x/tools/internal/jsonrpc2.(Conn).Run.func1(0xc0038a7da0, 0xc003b76240, 0xc000235020, 0xe51000, 0xc00393ac60
stderr: /home/user/dev/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/jsonrpc2.go:
stderr: created by golang.org/x/tools/internal/jsonrpc2.(Conn).Run
stderr: /home/user/dev/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/jsonrpc2.go:
sent: Content-Length: 5890^M^@^M^@{"method": "textDocument/didChange", "jsonrpc": "2.0", "params": {"contentChanges": [{"text":
This sounds like a duplicate of https://github.com/fatih/vim-go/issues/2701.
@stamblerre : should move to master instead of v1.22 ?
This is fixed in gopls at master, but I would recommend sticking with gopls/v0.3.1 until gopls/v0.4.0 is released. This can be worked around by not calling find references on builtin types.
@stamblerre oki doki, thanks a lot for your support and for your work on those projects just tried master indeed works and no more crashes, i'll wait for v0.4.0.
may I ask how to "disable" to find reference on builtin types?
Your best bet to avoid trying to resolve builtins is to use the defaults for g:go_auto_sameids and g:go_auto_info and don't run the associated commands manually on builtins.
@bhcleek : oki doki! I'll disable that and wait for a proper fix to be able to work in the meantime! cheers!
NB: thank you also, for your help/support/work!
Can you provide the relevant gopls logs by running vim-go with
let g:go_debug=['lsp']in your vimrc?
i install plugin using this init file then open my go project, vim-go show this error, i dont know why
@xuantungmta Fixing vim-go to v1.22 worked for me:
Plug 'fatih/vim-go', { 'tag': 'v1.22', 'do': ':GoUpdateBinaries' }
Closing, because this looks unrelated to vim-go and requires a fix in gopls. It's already fixed on gopls master.
@stamblerre was the fix for this included in one of the releases after v0.3.1 or do users truly need to wait for v0.4.0?