ray-x / go.nvim

G'day Nvimer, Joyful Gopher: Discover the Feature-Rich Go Plugin for Neovim
MIT License
1.91k stars 119 forks source link

When running GoTestFile -F I get an error #430

Closed TheLazyLemur closed 3 months ago

TheLazyLemur commented 4 months ago

When I try to run a test on a specific file using -F flag I get the following error

go: cannot find main module, but found .git/config in /Users/<redacted>/dev/core
╎       to create a module there, run:                                              
╎       go mod init                                                                 
╎                                                                                   
[Process exited 1]                                                                  

I guess the crux of the issue is that my go.mod file and .git folder are not in the same directory. This happens with all tests using -F flag. However for most tests if a manually cd to where my go.mod file is it works. However it still breaks for GoTestFile.

ray-x commented 4 months ago

I think this may most likely related to your workspace setting. The plugin relies on lsp workspace to setup top level folder. Please refer to the lspconfig and setup the workspace correctly.