vim-go
vim-go copied to clipboard
godef crashes when looking up a tag
What did you do? (required: The issue will be closed when not provided)
When you press CTRL-]
on a variable or type godef crashes. From the looks of it this is a side effect of go 1.22.
Now before everyone starts yelling "use gopls and besides godef is deprecated", hear me out.
The unfortunate reality is that gopls
is not robust, is slow, and uses a lot of resources. After one or two days of hacking on code it stops working and I have to restart vim and lose my development environment as it is. Before it stops working it also slows down drastically, several seconds to autocomplete rendering it useless to quickly hit CTRL-p
in succession to autocomplete. Overall gopls
degrades very quickly and eventually dies.
I have used godef for years and right up until go 1.22 it never failed or brought down my development environment. It auto-completes sub-second and doesn't hog resources like chrome. My vim sessions are always inside tmux and they are long lived (months at a time) and it basically stayed out of the way and just worked.
Now, I know this isn't the right repo to bring this issue up but I figured that I am not the only one that would like for godef
to become active again and maybe as a part of vim-go. Or maybe someone can point me to some magic config option to make gopls less painful to use. I'll gladly help debugging the issue as well if there is interest.
To reproduce use godef
instead of gopls
by adding this to the config:
let g:go_def_mode='godef'
Reopen vim with a go source file and position the cursor on any type (e.g. time.Second) and hit CTRL-]
.
What did you expect to happen?
I expected to go to the definition of the tag.
What happened instead?
godef crashed.
Configuration (MUST fill this out):
vim-go version:
commit 8318a6814d22e99151760ac2fc890f55088a3192
vimrc
you used to reproduce:
vimrc
let g:go_def_mode='godef'
"let g:go_def_mode='gopls'
let g:go_fmt_command="gopls"
let g:go_gopls_gofumpt=1
let g:go_gopls_local=trim(system('go list -m'))
let g:go_imports_autosave=1
Vim version (first three lines from :version
):
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar 14 2024 09:05:11) Included patches: 1-579, 1969, 580-1848, 4975, 5016, 5023, 5072, 2068, 1849-1854, 1857, 1855-1857, 1331, 1858, 1858-1859, 1873, 1860-1969, 1992, 1970-1992, 2010, 1993-2068, 2106, 2069-2106, 2108, 2107-2109, 2109-3995, 4563, 4646, 4774, 4895, 4899, 4901, 4919, 213, 1840, 1846-1847, 2110-2112, 2121 Modified by [email protected]
Go version (go version
):
go version go1.22.2 linux/arm64
Go environment
go env
Output:
GO111MODULE='' GOARCH='arm64' GOBIN='' GOCACHE='/home/marco/.cache/go-build' GOENV='/home/marco/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='arm64' GOHOSTOS='linux' GOINSECURE='' GOMODCACHE='/home/marco/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='linux' GOPATH='/home/marco/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/snap/go/10589' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/snap/go/10589/pkg/tool/linux_arm64' GOVCS='' GOVERSION='go1.22.2' GCCGO='gccgo' AR='ar' CC='gcc' CXX='g++' CGO_ENABLED='1' GOMOD='/home/marco/Documents/src/heminetwork/go.mod' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2926004934=/tmp/go-build -gno-record-gcc-switches'
gopls version
gopls version
Output:
golang.org/x/tools/gopls v0.15.3
vim-go configuration:
vim-go configuration
g:go_fmt_command = 'gopls' g:go_loaded_install = 1 g:go_gopls_local = 'github.com/hemilabs/heminetwork' g:go_def_mode = 'godef' g:go_gopls_gofumpt = 1 g:go_jump_to_error = 1 g:go_imports_autosave = 1 g:go_loaded_gosnippets = 1
filetype detection configuration:
filetype detection
filetype detection:ON plugin:ON indent:ON
Crash:
vim-go: panic: runtime error: invalid memory address or nil pointer dereference [recovered]
vim-go: panic: runtime error: invalid memory address or nil pointer dereference
vim-go: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x224b34]
vim-go:
vim-go: goroutine 340 [running]:
vim-go: go/types.(*Checker).handleBailout(0x40000c0e00, 0x40007dbc38)
vim-go: /snap/go/10589/src/go/types/check.go:367 +0x9c
vim-go: panic({0x2ce2c0?, 0x533920?})
vim-go: /snap/go/10589/src/runtime/panic.go:770 +0x124
vim-go: go/types.(*StdSizes).Sizeof(0x0, {0x38ea50, 0x538480})
vim-go: /snap/go/10589/src/go/types/sizes.go:228 +0x314
vim-go: go/types.(*Config).sizeof(...)
vim-go: /snap/go/10589/src/go/types/sizes.go:333
vim-go: go/types.representableConst.func1({0x38ea50?, 0x538480?})
vim-go: /snap/go/10589/src/go/types/const.go:76 +0x9c
vim-go: go/types.representableConst({0x391810, 0x52c018}, 0x40000c0e00, 0x538480, 0x40007d9d18)
vim-go: /snap/go/10589/src/go/types/const.go:106 +0x2b0
vim-go: go/types.(*Checker).representation(0x40000c0e00, 0x40008b1000, 0x538480)
vim-go: /snap/go/10589/src/go/types/const.go:256 +0x68
vim-go: go/types.(*Checker).representable(0x40000c0e00, 0x40008b1000, 0x538480)
vim-go: /snap/go/10589/src/go/types/const.go:239 +0x28
vim-go: go/types.(*Checker).shift(0x40000c0e00, 0x40008b0f80, 0x40008b1000, {0x390968, 0x4000098720}, 0x14)
vim-go: /snap/go/10589/src/go/types/expr.go:650 +0x1d8
vim-go: go/types.(*Checker).binary(0x40000c0e00, 0x40008b0f80, {0x390968, 0x4000098720}, {0x390f08, 0x40000a45a0}, {0x390f08, 0x40000a45c0}, 0x14, 0x770)
vim-go: /snap/go/10589/src/go/types/expr.go:796 +0x100
vim-go: go/types.(*Checker).exprInternal(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968, 0x4000098720}, {0x0, 0x0})
vim-go: /snap/go/10589/src/go/types/expr.go:1416 +0x1d4
vim-go: go/types.(*Checker).rawExpr(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968?, 0x4000098720?}, {0x0?, 0x0?}, 0x0)
vim-go: /snap/go/10589/src/go/types/expr.go:979 +0x12c
vim-go: go/types.(*Checker).expr(0x40000c0e00, 0x0?, 0x40008b0f80, {0x390968?, 0x4000098720?})
vim-go: /snap/go/10589/src/go/types/expr.go:1513 +0x38
vim-go: go/types.(*Checker).binary(0x40000c0e00, 0x40008b0f80, {0x390968, 0x4000098750}, {0x390968, 0x4000098720}, {0x390f08, 0x40000a45e0}, 0xd, 0x774)
vim-go: /snap/go/10589/src/go/types/expr.go:783 +0x70
vim-go: go/types.(*Checker).exprInternal(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968, 0x4000098750}, {0x0, 0x0})
vim-go: /snap/go/10589/src/go/types/expr.go:1416 +0x1d4
vim-go: go/types.(*Checker).rawExpr(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968?, 0x4000098750?}, {0x0?, 0x0?}, 0x0)
vim-go: /snap/go/10589/src/go/types/expr.go:979 +0x12c
vim-go: go/types.(*Checker).expr(0x40000c0e00, 0x400009d6e0?, 0x40008b0f80, {0x390968?, 0x4000098750?})
vim-go: /snap/go/10589/src/go/types/expr.go:1513 +0x38
vim-go: go/types.(*Checker).constDecl(0x40000c0e00, 0x400009d7a0, {0x0, 0x0}, {0x390968, 0x4000098750}, 0x0)
vim-go: /snap/go/10589/src/go/types/decl.go:488 +0x23c
vim-go: go/types.(*Checker).objDecl(0x40000c0e00, {0x3941b8, 0x400009d7a0}, 0x0)
vim-go: /snap/go/10589/src/go/types/decl.go:191 +0x84c
vim-go: go/types.(*Checker).packageObjects(0x40000c0e00)
vim-go: /snap/go/10589/src/go/types/resolver.go:693 +0x468
vim-go: go/types.(*Checker).checkFiles(0x40000c0e00, {0x4000092038, 0x1, 0x1})
vim-go: /snap/go/10589/src/go/types/check.go:408 +0x164
vim-go: go/types.(*Checker).Files(...)
vim-go: /snap/go/10589/src/go/types/check.go:372
vim-go: golang.org/x/tools/go/packages.(*loader).loadPackage(0x400009e0c0, 0x40001f04e0)
vim-go: /home/marco/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:868 +0x5d0
vim-go: golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
vim-go: /home/marco/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:715 +0x178
vim-go: /snap/go/10589/src/go/types/sizes.go:228 +0x314
vim-go: go/types.(*Config).sizeof(...)
vim-go: /snap/go/10589/src/go/types/sizes.go:333
vim-go: go/types.representableConst.func1({0x38ea50?, 0x538480?})
vim-go: /snap/go/10589/src/go/types/const.go:76 +0x9c
vim-go: go/types.representableConst({0x391810, 0x52c018}, 0x40000c0e00, 0x538480, 0x40007d9d18)
vim-go: /snap/go/10589/src/go/types/const.go:106 +0x2b0
vim-go: go/types.(*Checker).representation(0x40000c0e00, 0x40008b1000, 0x538480)
vim-go: /snap/go/10589/src/go/types/const.go:256 +0x68
vim-go: go/types.(*Checker).representable(0x40000c0e00, 0x40008b1000, 0x538480)
vim-go: /snap/go/10589/src/go/types/const.go:239 +0x28
vim-go: go/types.(*Checker).shift(0x40000c0e00, 0x40008b0f80, 0x40008b1000, {0x390968, 0x4000098720}, 0x14)
vim-go: /snap/go/10589/src/go/types/expr.go:650 +0x1d8
vim-go: go/types.(*Checker).binary(0x40000c0e00, 0x40008b0f80, {0x390968, 0x4000098720}, {0x390f08, 0x40000a45a0}, {0x390f08, 0x40000a45c0}, 0x14, 0x770)
vim-go: /snap/go/10589/src/go/types/expr.go:796 +0x100
vim-go: go/types.(*Checker).exprInternal(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968, 0x4000098720}, {0x0, 0x0})
vim-go: /snap/go/10589/src/go/types/expr.go:1416 +0x1d4
vim-go: go/types.(*Checker).rawExpr(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968?, 0x4000098720?}, {0x0?, 0x0?}, 0x0)
vim-go: /snap/go/10589/src/go/types/expr.go:979 +0x12c
vim-go: go/types.(*Checker).expr(0x40000c0e00, 0x0?, 0x40008b0f80, {0x390968?, 0x4000098720?})
vim-go: /snap/go/10589/src/go/types/expr.go:1513 +0x38
vim-go: go/types.(*Checker).binary(0x40000c0e00, 0x40008b0f80, {0x390968, 0x4000098750}, {0x390968, 0x4000098720}, {0x390f08, 0x40000a45e0}, 0xd, 0x774)
vim-go: /snap/go/10589/src/go/types/expr.go:783 +0x70
vim-go: go/types.(*Checker).exprInternal(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968, 0x4000098750}, {0x0, 0x0})
vim-go: /snap/go/10589/src/go/types/expr.go:1416 +0x1d4
vim-go: go/types.(*Checker).rawExpr(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968?, 0x4000098750?}, {0x0?, 0x0?}, 0x0)
vim-go: /snap/go/10589/src/go/types/expr.go:979 +0x12c
vim-go: go/types.(*Checker).expr(0x40000c0e00, 0x400009d6e0?, 0x40008b0f80, {0x390968?, 0x4000098750?})
vim-go: /snap/go/10589/src/go/types/expr.go:1513 +0x38
vim-go: go/types.(*Checker).constDecl(0x40000c0e00, 0x400009d7a0, {0x0, 0x0}, {0x390968, 0x4000098750}, 0x0)
vim-go: /snap/go/10589/src/go/types/decl.go:488 +0x23c
vim-go: go/types.(*Checker).objDecl(0x40000c0e00, {0x3941b8, 0x400009d7a0}, 0x0)
vim-go: /snap/go/10589/src/go/types/decl.go:191 +0x84c
vim-go: go/types.(*Checker).packageObjects(0x40000c0e00)
vim-go: /snap/go/10589/src/go/types/resolver.go:693 +0x468
vim-go: go/types.(*Checker).checkFiles(0x40000c0e00, {0x4000092038, 0x1, 0x1})
vim-go: /snap/go/10589/src/go/types/check.go:408 +0x164
vim-go: go/types.(*Checker).Files(...)
vim-go: /snap/go/10589/src/go/types/check.go:372
vim-go: golang.org/x/tools/go/packages.(*loader).loadPackage(0x400009e0c0, 0x40001f04e0)
vim-go: /home/marco/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:868 +0x5d0
vim-go: golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
vim-go: /home/marco/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:715 +0x178
vim-go: sync.(*Once).doSlow(0x0?, 0x0?)
vim-go: /snap/go/10589/src/sync/once.go:74 +0x100
vim-go: sync.(*Once).Do(...)
vim-go: /snap/go/10589/src/sync/once.go:65
vim-go: golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
vim-go: /home/marco/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:703 +0x50
vim-go: golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
vim-go: /home/marco/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:710 +0x30
vim-go: created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 24
vim-go: /home/marco/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:709 +0x84
While plying around some more I found the fix and created a PR for it.
See https://github.com/rogpeppe/godef/pull/128
I am leaving the issue open in the hopes we can convince rogpeppe to commit this. If not I wouldn't mind if you point it to my repo and I'll keep it up to date.
Thank you @marcopeereboom. I'll leave this open while your PR to godef is evaluated.
Interestingly, gopls definition
exists now, and I wonder if vim-go should support it as an option. Unfortunately, I suspect it may not satisfy your performance desires, but it's worth checking.
Crash:
vim-go: panic: runtime error: invalid memory address or nil pointer dereference [recovered] vim-go: panic: runtime error: invalid memory address or nil pointer dereference vim-go: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x224b34] vim-go: vim-go: goroutine 340 [running]: vim-go: go/types.(*Checker).handleBailout(0x40000c0e00, 0x40007dbc38) vim-go: /snap/go/10589/src/go/types/check.go:367 +0x9c vim-go: panic({0x2ce2c0?, 0x533920?}) vim-go: /snap/go/10589/src/runtime/panic.go:770 +0x124 vim-go: go/types.(*StdSizes).Sizeof(0x0, {0x38ea50, 0x538480}) vim-go: /snap/go/10589/src/go/types/sizes.go:228 +0x314 vim-go: go/types.(*Config).sizeof(...) vim-go: /snap/go/10589/src/go/types/sizes.go:333 vim-go: go/types.representableConst.func1({0x38ea50?, 0x538480?}) vim-go: /snap/go/10589/src/go/types/const.go:76 +0x9c vim-go: go/types.representableConst({0x391810, 0x52c018}, 0x40000c0e00, 0x538480, 0x40007d9d18) vim-go: /snap/go/10589/src/go/types/const.go:106 +0x2b0 vim-go: go/types.(*Checker).representation(0x40000c0e00, 0x40008b1000, 0x538480) vim-go: /snap/go/10589/src/go/types/const.go:256 +0x68 vim-go: go/types.(*Checker).representable(0x40000c0e00, 0x40008b1000, 0x538480) vim-go: /snap/go/10589/src/go/types/const.go:239 +0x28 vim-go: go/types.(*Checker).shift(0x40000c0e00, 0x40008b0f80, 0x40008b1000, {0x390968, 0x4000098720}, 0x14) vim-go: /snap/go/10589/src/go/types/expr.go:650 +0x1d8 vim-go: go/types.(*Checker).binary(0x40000c0e00, 0x40008b0f80, {0x390968, 0x4000098720}, {0x390f08, 0x40000a45a0}, {0x390f08, 0x40000a45c0}, 0x14, 0x770) vim-go: /snap/go/10589/src/go/types/expr.go:796 +0x100 vim-go: go/types.(*Checker).exprInternal(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968, 0x4000098720}, {0x0, 0x0}) vim-go: /snap/go/10589/src/go/types/expr.go:1416 +0x1d4 vim-go: go/types.(*Checker).rawExpr(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968?, 0x4000098720?}, {0x0?, 0x0?}, 0x0) vim-go: /snap/go/10589/src/go/types/expr.go:979 +0x12c vim-go: go/types.(*Checker).expr(0x40000c0e00, 0x0?, 0x40008b0f80, {0x390968?, 0x4000098720?}) vim-go: /snap/go/10589/src/go/types/expr.go:1513 +0x38 vim-go: go/types.(*Checker).binary(0x40000c0e00, 0x40008b0f80, {0x390968, 0x4000098750}, {0x390968, 0x4000098720}, {0x390f08, 0x40000a45e0}, 0xd, 0x774) vim-go: /snap/go/10589/src/go/types/expr.go:783 +0x70 vim-go: go/types.(*Checker).exprInternal(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968, 0x4000098750}, {0x0, 0x0}) vim-go: /snap/go/10589/src/go/types/expr.go:1416 +0x1d4 vim-go: go/types.(*Checker).rawExpr(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968?, 0x4000098750?}, {0x0?, 0x0?}, 0x0) vim-go: /snap/go/10589/src/go/types/expr.go:979 +0x12c vim-go: go/types.(*Checker).expr(0x40000c0e00, 0x400009d6e0?, 0x40008b0f80, {0x390968?, 0x4000098750?}) vim-go: /snap/go/10589/src/go/types/expr.go:1513 +0x38 vim-go: go/types.(*Checker).constDecl(0x40000c0e00, 0x400009d7a0, {0x0, 0x0}, {0x390968, 0x4000098750}, 0x0) vim-go: /snap/go/10589/src/go/types/decl.go:488 +0x23c vim-go: go/types.(*Checker).objDecl(0x40000c0e00, {0x3941b8, 0x400009d7a0}, 0x0) vim-go: /snap/go/10589/src/go/types/decl.go:191 +0x84c vim-go: go/types.(*Checker).packageObjects(0x40000c0e00) vim-go: /snap/go/10589/src/go/types/resolver.go:693 +0x468 vim-go: go/types.(*Checker).checkFiles(0x40000c0e00, {0x4000092038, 0x1, 0x1}) vim-go: /snap/go/10589/src/go/types/check.go:408 +0x164 vim-go: go/types.(*Checker).Files(...) vim-go: /snap/go/10589/src/go/types/check.go:372 vim-go: golang.org/x/tools/go/packages.(*loader).loadPackage(0x400009e0c0, 0x40001f04e0) vim-go: /home/marco/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:868 +0x5d0 vim-go: golang.org/x/tools/go/packages.(*loader).loadRecursive.func1() vim-go: /home/marco/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:715 +0x178 vim-go: /snap/go/10589/src/go/types/sizes.go:228 +0x314 vim-go: go/types.(*Config).sizeof(...) vim-go: /snap/go/10589/src/go/types/sizes.go:333 vim-go: go/types.representableConst.func1({0x38ea50?, 0x538480?}) vim-go: /snap/go/10589/src/go/types/const.go:76 +0x9c vim-go: go/types.representableConst({0x391810, 0x52c018}, 0x40000c0e00, 0x538480, 0x40007d9d18) vim-go: /snap/go/10589/src/go/types/const.go:106 +0x2b0 vim-go: go/types.(*Checker).representation(0x40000c0e00, 0x40008b1000, 0x538480) vim-go: /snap/go/10589/src/go/types/const.go:256 +0x68 vim-go: go/types.(*Checker).representable(0x40000c0e00, 0x40008b1000, 0x538480) vim-go: /snap/go/10589/src/go/types/const.go:239 +0x28 vim-go: go/types.(*Checker).shift(0x40000c0e00, 0x40008b0f80, 0x40008b1000, {0x390968, 0x4000098720}, 0x14) vim-go: /snap/go/10589/src/go/types/expr.go:650 +0x1d8 vim-go: go/types.(*Checker).binary(0x40000c0e00, 0x40008b0f80, {0x390968, 0x4000098720}, {0x390f08, 0x40000a45a0}, {0x390f08, 0x40000a45c0}, 0x14, 0x770) vim-go: /snap/go/10589/src/go/types/expr.go:796 +0x100 vim-go: go/types.(*Checker).exprInternal(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968, 0x4000098720}, {0x0, 0x0}) vim-go: /snap/go/10589/src/go/types/expr.go:1416 +0x1d4 vim-go: go/types.(*Checker).rawExpr(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968?, 0x4000098720?}, {0x0?, 0x0?}, 0x0) vim-go: /snap/go/10589/src/go/types/expr.go:979 +0x12c vim-go: go/types.(*Checker).expr(0x40000c0e00, 0x0?, 0x40008b0f80, {0x390968?, 0x4000098720?}) vim-go: /snap/go/10589/src/go/types/expr.go:1513 +0x38 vim-go: go/types.(*Checker).binary(0x40000c0e00, 0x40008b0f80, {0x390968, 0x4000098750}, {0x390968, 0x4000098720}, {0x390f08, 0x40000a45e0}, 0xd, 0x774) vim-go: /snap/go/10589/src/go/types/expr.go:783 +0x70 vim-go: go/types.(*Checker).exprInternal(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968, 0x4000098750}, {0x0, 0x0}) vim-go: /snap/go/10589/src/go/types/expr.go:1416 +0x1d4 vim-go: go/types.(*Checker).rawExpr(0x40000c0e00, 0x0, 0x40008b0f80, {0x390968?, 0x4000098750?}, {0x0?, 0x0?}, 0x0) vim-go: /snap/go/10589/src/go/types/expr.go:979 +0x12c vim-go: go/types.(*Checker).expr(0x40000c0e00, 0x400009d6e0?, 0x40008b0f80, {0x390968?, 0x4000098750?}) vim-go: /snap/go/10589/src/go/types/expr.go:1513 +0x38 vim-go: go/types.(*Checker).constDecl(0x40000c0e00, 0x400009d7a0, {0x0, 0x0}, {0x390968, 0x4000098750}, 0x0) vim-go: /snap/go/10589/src/go/types/decl.go:488 +0x23c vim-go: go/types.(*Checker).objDecl(0x40000c0e00, {0x3941b8, 0x400009d7a0}, 0x0) vim-go: /snap/go/10589/src/go/types/decl.go:191 +0x84c vim-go: go/types.(*Checker).packageObjects(0x40000c0e00) vim-go: /snap/go/10589/src/go/types/resolver.go:693 +0x468 vim-go: go/types.(*Checker).checkFiles(0x40000c0e00, {0x4000092038, 0x1, 0x1}) vim-go: /snap/go/10589/src/go/types/check.go:408 +0x164 vim-go: go/types.(*Checker).Files(...) vim-go: /snap/go/10589/src/go/types/check.go:372 vim-go: golang.org/x/tools/go/packages.(*loader).loadPackage(0x400009e0c0, 0x40001f04e0) vim-go: /home/marco/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:868 +0x5d0 vim-go: golang.org/x/tools/go/packages.(*loader).loadRecursive.func1() vim-go: /home/marco/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:715 +0x178 vim-go: sync.(*Once).doSlow(0x0?, 0x0?) vim-go: /snap/go/10589/src/sync/once.go:74 +0x100 vim-go: sync.(*Once).Do(...) vim-go: /snap/go/10589/src/sync/once.go:65 vim-go: golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?) vim-go: /home/marco/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:703 +0x50 vim-go: golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?) vim-go: /home/marco/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:710 +0x30 vim-go: created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 24 vim-go: /home/marco/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:709 +0x84
hey guys, I have same problem as you that godef has crashed when looking up a tag; How can i fix it?
thanks!
hey guys, I have same problem as you that godef has crashed when looking up a tag; How can i fix it?
You have a couple of options:
- You can use
let g:go_def_mode='gopls'
so thatgd
,ctrl-]
, and:GoDef
will usegopls
instead ofgodef
. - You can build
godef
using the changes in https://github.com/rogpeppe/godef/pull/128 and installgodef
manually.
I'd recommend the first option.
Fix isn't being picked up. I am willing to maintain this if you guys want to flip the link. gopls does not work for me at all so I continue to use godef.
I'd be interested to find out why gopls
doesn't work for you. I'm strongly considering removing godef
support entirely.