go.nvim icon indicating copy to clipboard operation
go.nvim copied to clipboard

Gopls local property is not set when CWD doesn't contain go.mod

Open ffoebel opened this issue 1 year ago • 1 comments

There's no upward search here: https://github.com/ray-x/go.nvim/blob/master/lua/go/gopls.lua#L288

I'm pretty sure go.mod discovery works fine in other cases, maybe there's a function to reuse?

For big repositories it's quite common (at least for me) to open nvim in a subdirectory to limit e.g. file search.

ffoebel avatar Oct 10 '24 10:10 ffoebel

You can re-write the function and pass the result to gopls config

lsp_cfg = {settings={gopls={['local'] = 'your_local_module_path', gofumpt = true }}}

But what does your preferred method look like? As I always set root-dir to either go.mod, go.work etc

ray-x avatar Oct 11 '24 02:10 ray-x