I am trying to set up my Neovim (nightly - latest) with Go (the programming language).

However, it doesn't seem to be working, most likely because I'm missing something. I'm not sure what though.

Right now, when I open a Go file, at the bottom of Vim, I get a message saying:

Autostart for gopls failed: matching root directory not detected.

With the Go file still open, if I run :LspInfo I get:

screenshot of LspInfo


  1. vimrc
  2. zprofile
  3. completion.lua (has cmp and lspconfig)

What am I missing? Why am I not getting auto-complete, go to definition, find references ...etc (the usual LSP stuff).

1 Answer 1


It turns out, the buffer doesn't get attached unless I have a .git folder in the project root directory, or a go.mod file.

I didn't have those, I just had a main.go.

  • appreciate you following up on this! Had the same issue tonight. Cheers!
    – jrnxf
    Feb 4, 2022 at 6:42
  • You’re welcome :)
    – J86
    Feb 4, 2022 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.