Open
Description
Hey, so I'm trying to get goxls
to work on neovim, here's what I did:
Procedure
- Install
goxls
usinggop install github.com/goplus/goxls@latest
- Start the LSP manually when entering
*.gop
files:
-- Custom LSPs
vim.api.nvim_create_autocmd("BufEnter", {
pattern = "*.gop",
callback = function()
vim.lsp.start({
name = "goxls",
cmd = {
os.getenv( "HOME" ) .. "/go/bin/goxls",
},
root_dir = vim.fn.getcwd(),
})
end,
})
- When opening a
main.gop
files, the following error is thrown:
[START][2024-08-31 13:42:11] LSP logging initiated
[ERROR][2024-08-31 13:42:11] .../vim/lsp/rpc.lua:770 "rpc" "/home/myzel394/go/bin/goxls" "stderr" "panic: runtime error: invalid memory address or nil pointer dereference\n[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xdcdcba]\n\ngoroutine 125 [running]:\ngolang.org/x/tools/gopls/internal/lsp/cache.localPackageKey({{0xc0007d79d0, 0x4}, {0xc0007d79d0, 0x4}, {0xc0007d79d4, 0x4}, {0xc0005e4e60, 0x1, 0x1}, {0x1b1c260, ...}, ...})\n\t/home/myzel394/go/pkg/mod/github.com/goplus/tools/gopls@v0.0.0-20240212113720-3c9c8e3d8619/internal/lsp/cache/check.go:1493 +0xcfa\ngolang.org/x/tools/gopls/internal/lsp/cache.(*packageHandleBuilder).buildPackageHandle(0xc000ad31d0, {0x13fb9a8, 0xc0000c8640}, 0xc0000c85f0)\n\t/home/myzel394/go/pkg/mod/github.com/goplus/tools/gopls@v0.0.0-20240212113720-3c9c8e3d8619/internal/lsp/cache/check.go:1143 +0x2e5\ngolang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).getPackageHandles.func2.1()\n\t/home/myzel394/go/pkg/mod/github.com/goplus/tools/gopls@v0.0.0-20240212113720-3c9c8e3d8619/internal/lsp/cache/check.go:942 +0xc8\ngolang.org/x/sync/errgroup.(*Group).Go.func1()\n\t/home/myzel394/go/pkg/mod/golang.org/x/sync@v0.6.0/errgroup/errgroup.go:78 +0x50\ncreated by golang.org/x/sync/errgroup.(*Group).Go in goroutine 123\n\t/home/myzel394/go/pkg/mod/golang.org/x/sync@v0.6.0/errgroup/errgroup.go:75 +0x96\n"
Info
$ nvim --version
NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1713773202
Run "nvim -V1 -v" for more info
$ gop version
gop v1.2.6 linux/amd64
$ go version
go version go1.23.0 linux/amd64