Description
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.- 1.19.1
-
Run
gopls -v version
to get version of Gopls from the VS Code integrated terminal.- golang.org/x/tools/gopls v0.9.4
-
Run
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.- 1.71.0, arm64
-
Check your installed extensions to get the version of the VS Code Go extension
- v0.35.2
-
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/arm64gotests: /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"]
or gopls
prefixes.
"go.toolsManagement.autoUpdate": true
"go.testEnvFile": "${workspaceFolder}/local.env"
Describe the bug
Consider the file tree below
src
└ tests
| ├ helper_package
| | └ helper.go
| └ a_test.go
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:
- Download the minimal_reproducible_project.zip
- Unzip it
- Open debug-tests-path in VS Code
- Use the Test Explorer to run the tests
- See the file not found error prompt
- Also see the Test Output terminal, which prints incorrect paths as well.
=== RUN Test_A
/Users/mathiastg/debug-tests-path/src/tests/helper.go:8: asd
--- FAIL: Test_A (0.00s)
FAIL
FAIL gleerup.io/debug-tests/src/tests 0.103s
> Test run finished at 08/09/2022, 11:19:59 <
Screenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status