Test Explorer: test logging in another package results in wrong file path in Test Output #2444
Labels
Go Companion
Issues relating to the Go Companion extension
go-test
issues related to go test support (test output, test explorer, ...)
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
Run
go version
to get version of Go from the VS Code integrated terminal.Run
gopls -v version
to get version of Gopls from the VS Code integrated terminal.Run
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Check your installed extensions to get the version of the VS Code Go extension
Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Tools
command.go: /Users/mathiastg/go/bin/go: go version go1.19.1 darwin/arm64
gotests: /Users/mathiastg/go/bin/gotests (version: v1.6.0 built with go: go1.19.1)
gomodifytags: /Users/mathiastg/go/bin/gomodifytags (version: v1.16.0 built with go: go1.19.1)
impl: /Users/mathiastg/go/bin/impl (version: v1.1.0 built with go: go1.19.1)
goplay: /Users/mathiastg/go/bin/goplay (version: v1.0.0 built with go: go1.19.1)
dlv: /Users/mathiastg/go/bin/dlv (version: v1.9.1 built with go: go1.19.1)
staticcheck: /Users/mathiastg/go/bin/staticcheck (version: v0.3.3 built with go: go1.19.1)
gopls: /Users/mathiastg/go/bin/gopls (version: v0.9.4 built with go: go1.19.1)
Share the Go related settings you have added/edited
Run
Preferences: Open Settings (JSON)
command to open your settings.json file.Share all the settings with the
go.
or["go"]
orgopls
prefixes."go.toolsManagement.autoUpdate": true
"go.testEnvFile": "${workspaceFolder}/local.env"
Describe the bug
Consider the file tree below
I have a test in
a_test.go
, that uses a helper function in helper_package.helper.go. This helper function logs some errors on t.Error.I run the test in a_test.go using the Test Explorer.
VS Code tries to automatically GOTO the line in helper.go where I log something, but the file path is wrong.
VS Code redirects me to
src/tests/helper.go
, which doesn't exist, so it shows a prompt like the attached picture.helper.go is placed in
src/tests/helper_packages/helper.go
.I expected VS Code to redirect me to
src/tests/helper_package/helper.go
Steps to reproduce the behavior:
Screenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.
The text was updated successfully, but these errors were encountered: