josa42 / coc-go

Go language server extension using gopls for coc.nvim.
MIT License
566 stars 30 forks source link

Language server broken on go1.23 #222

Open hexcowboy opened 1 month ago

hexcowboy commented 1 month ago

This morning my go language server stopped working, though all other CoC plugins remain working.

When I do actions like jump to definition or show cursor, it just says "[coc.nvim] hover not found" or similar.

Currently installed: coc-go@1.3.33,

:CocInfo

## versions

vim version: NVIM v0.9.5
node version: v18.19.1
coc.nvim version: 0.0.82-9c25f2f7 2024-08-31 14:53:59 +0800
coc.nvim directory: /Users/jack/.local/share/nvim/site/pack/packer/start/coc.nvim
term: Apple_Terminal
platform: darwin

## Log of coc.nvim

2024-09-11T12:45:02.780 INFO (pid:48996) [plugin] - coc.nvim initialized with node: v18.19.1 after 364
2024-09-11T12:45:02.804 INFO (pid:48996) [services] - LanguageClient gopls state change: stopped => starting
2024-09-11T12:45:02.889 INFO (pid:48996) [services] - LanguageClient gopls state change: starting => running
2024-09-11T12:45:02.891 INFO (pid:48996) [services] - service go started
2024-09-11T12:45:06.259 INFO (pid:48996) [attach] - receive notification: jumpDefinition []
2024-09-11T12:45:37.088 INFO (pid:48996) [attach] - receive notification: doHover []

:checkhealth

coc: health#coc#check

- OK nvim version satisfied
- OK Environment check passed
- WARNING pyx command not work, some extensions may fail to work, checkout ":help |pythonx|"
- WARNING Install pynvim by command: `pip install pynvim --upgrade`
- OK Javascript bundle build/index.js found
- OK Service started
hexcowboy commented 1 month ago

Also I'm using go1.23.0 darwin/arm64 and golang.org/x/tools/gopls v0.16.2 which may be the issue.

Edit: I changed go 1.23 and toolchain go1.23.0 to go 1.22 and toolchain go1.22.0 and coc-go began working again, though I'm not sure what the underlying issue is

hexcowboy commented 1 month ago

For anyone else needing help here, you can use gopls directly in coc by changing your ~/.config/nvim/coc-settings.json like so:

{
  ...other config here
  "languageserver": {
    "go": {
      "command": "gopls",
      "filetypes": ["go"]
    }
  }
}
pendar747 commented 4 days ago

I'm also having an issue with coc-go not working in projects that use go 1.23