-
Notifications
You must be signed in to change notification settings - Fork 763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Go Companion: "Run Tests with Coverage" leads to error #3654
Comments
@hyangah @findleyr Can you confirm that @t-hofmann I pushed a branch with the change. If you're willing I'd appreciate if you tested the fix. I'm attaching a VSIX of the extension with the fix or if you'd prefer you can build it yourself from the branch. GitHub won't let me attach a |
@firelizzard18 yes, -mod=readonly will make this work, but will hit the network to download go.mod files. Is that desirable for people using vendoring? Furthermore, the mod directories will be in the module cache, not in the vendor directory. Can you help me understand what you are trying to achieve with that |
@findleyr Ultimately the point is to resolve paths present in the profile generated by
When Hana brought this to my attention in #3597 I asked myself, "How can I resolve these to real paths?" In some circumstances (I'm honestly not sure when/why), this can include entries for dependencies, so my solution was to build a (module path => filesystem path) for all dependencies, and the obvious choice for that seemed to be
That's definitely not ideal. If a module is vendored, that vendored code will be used instead of what's in the module cache, correct? If that's true, resolving these paths to the module cache would be incorrect. Though I don't actually know what paths the coverage profile would report for vendored code; I suppose it might report the true path. As I was implementing this I questioned whether it makes sense for VSCode's/Go Companion's test coverage feature to report coverage for external modules. The UX is not great, because it means VSCode's "Test Coverage" pane has to resort to showing the full path instead of the path relative to the current workspace. I could exclude external modules, but someone is sure to report that as a bug eventually. Go Companion does have a way to set |
@firelizzard18 The VSIX-version fixed it. And even more: also the file-coverage decorators - they were missing before - now show at various places:
So: Thanks a lot! |
Version Information
go version
to get version of Go from the VS Code integrated terminal.gopls -v version
to get version of Gopls from the VS Code integrated terminal.code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Go: Locate Configured Go Tools
command.Share the Go related settings you have added/edited
cat ~/.config/Code/User/settings.json | grep go
:Describe the bug
When running tests with coverage, e. g.:
Then the following error pops up:
Steps to reproduce the behavior:
Prerequisite is a test-file with a test.
The error message suggests two workarounds, that is to add the option
-mod=mod
or-mod=readonly
, the resulting command would be:/PATH/go list -m -json all -mod=readonly
The text was updated successfully, but these errors were encountered: