Closed slingamn closed 1 hour ago
There must be more to it than that. I can use godef
to jump to definition in a simple package when the go.mod
has go 1.23
without a problem.
Have you tried updating godef
(e.g. :GoUpdateBinaries godef
)?
Can you execute :let g:go_debug=['shell-command']
in your vim session and then try jumping to the definition using :GoDef
or gd
? After that, I'd like to know the output of :messages
. If you're feeling up to it or if the output of :messages
doesn't seem to reveal anything, then you could execute whatever godef
command is revealed by :messages
and execute it on the command line to see what godef
reports directly.
Thanks for your time! I tried updating godef
but it didn't seem to help. (go version -m
says it's godef v1.1.2
now.)
I tried issuing :let g:go_debug=['shell-commands']
but I don't see anything informative in :messages
, it looks like:
vim-go: initializing gopls
vim-go: initialized gopls
vim-go: Finished loading packages.
vim-go: [definition] SUCCESS
vim-go: [definition] SUCCESS
I may be entering the debug command incorrectly because when I downgrade go.mod
to 1.22, jump-to-definition works again, but I still don't see anything useful in :messages
:
"irc/server.go" 1162L, 41949B
vim-go: initializing gopls
vim-go: initialized gopls
vim-go: Finished loading packages.
vim-go: [definition] SUCCESS
"irc/modes/modes.go" 474L, 11633B
"irc/server.go" 1162L, 41949B
vim-go: [definition] SUCCESS
"irc/caps/defs.go" 191L, 6387B
It would help if I could spell correctly. That should be shell-commands
instead of shell-command
. I corrected my previous message, too, FWIW. Sorry about that.
Hmm, with go.mod set to go 1.22
, when I issue the debug command :let g:go_debug=['shell-commands']
and then use :GoDef
I see something, but it doesn't seem pertinent:
vim-go: initializing gopls
vim-go: initialized gopls
vim-go: Finished loading packages.
vim-go: [definition] SUCCESS
"irc/connection_limits/tor.go" 49L, 1093B
vim-go: [definition] SUCCESS
"irc/connection_limits/throttler.go" 51L, 1413B
vim-go: shell command: '/usr/local/go/bin/go' 'env' 'GOMOD'
vim-go: [definition] SUCCESS
"irc/connection_limits/tor.go" 49L, 1093B
"irc/server.go" 1162L, 41949B
vim-go: [definition] SUCCESS
"irc/whowas.go" 93L, 2073B
vim-go: shell command: '/usr/local/go/bin/go' 'env' 'GOMOD'
With go.mod set to go 1.23
I see the same output as before.
I'm so sorry. I misread your issue and thought it was specifically related to godef
, but it's not. It looks like you're using gopls
for jumping to definitions. In that case, make sure you do :GoUpdateBinaries gopls
and try again. If there's no improvement, then we need to use :let g:go_debug=['lsp']
, try again, and I'll need to see the contents of the __GOLSP_LOG__
window.
Thanks very much! I updated to golang.org/x/tools/gopls v0.16.2
and that fixed it.
What did you do? (required: The issue will be closed when not provided)
go.mod
specifiesgo 1.23
as the required Go version:GoDef
orgd
What did you expect to happen?
vim-go jumps to definition, as it does with
go 1.22
ingo.mod
What happened instead?
The status bar prints
vim-go: [definition] SUCCESS
but there is no jump to definition; cursor remains over the current tokenConfiguration (MUST fill this out):
vim-go version:
v1.28
vimrc
you used to reproduce:vimrc
```vim set encoding=utf-8 syntax on filetype plugin indent on ```Vim version (first three lines from
:version
):vim on Ubuntu 22.04, package version
2:8.2.3995-1ubuntu2.18
:Go version (
go version
):go version go1.23.1 linux/amd64
Go environment
go env
Output:gopls version
gopls version
Output: