Closed mrjones2014 closed 1 year ago
Hi @mrjones2014,
No idea why this would be the case, nor if it's an issue with neotest or this adapter. Looking at
These files should be detected regardless, I work in a mixed language monorepo and go tests run fine for me 🤷🏿♂️ not sure what your exact layout is though.
In any event people tend to investigate and contribute fixes for any issues they encounter themselves, just mentioning since issues opened here are unlikely to advance without the author raising a PR
In any event people tend to investigate and contribute fixes for any issues they encounter themselves, just mentioning since issues opened here are unlikely to advance without the author raising a PR
Sure, I'm willing to. I might be able to get to it next week or so.
For reference, I'm working in this repo: https://github.com/mrjones2014/op.nvim
And this is the error I get:
Interestingly, :lua print(require('neotest-go').root(vim.fn.expand('%')))
does return the correct directory, but I still get the error I screenshotted above 🤔
Pretty sure this was user error. Moving my go.mod
and go.sum
to the root, but keeping my Go sources under go/
works.
Hmm, I had a similiar problem, it seems that the does not contain main module
error message occurs when you are within a symlinked directory.
When I went to the actual directory that message suddenly vanished.
Interestingly,
:lua print(require('neotest-go').root(vim.fn.expand('%')))
does return the correct directory, but I still get the error I screenshotted above 🤔
I am having the same problem. I never had this issue with fatih/vim-go
plugin.
My setup is as below:
GOPATH=~/projects/core
Go code is under ~/projects/core/src/ttx
Vim root(pwd) is ~/projects/core
lua print(require('neotest-go').root(vim.fn.expand('%')))
correctly identifies the root as ~/projects/core/src/ttx
When I change cwd in vim doing cd src/ttx
the test runs correctly, but it does not If stay in actual project root which is ~/projects/core
It is not an option for me to move go.mod
or go.sum
out to ~/projects/core
@breneser - did you ever find a solution? I'm in the same boat working in a mono-repo.
Not sure if this is an issue with
neotest-go
orneotest
-- let me know if I should move it.I have a project with multiple languages in use, and my Go code lives under a
go/
subdirectory. When running tests with a Go file open, it should try to find the closestgo.mod
file to the current file, and run thego test
command with that directory as its working directory.Currently it just runs tests in current working directory, which does not work for this use case.