Open
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.- go version go1.23.2 darwin/amd64
- Run
gopls -v version
to get version of Gopls from the VS Code integrated terminal.- Build info
golang.org/x/tools/gopls v0.17.1
golang.org/x/tools/[email protected] h1:Mt/DSfnnSe3dyf6MH/dZZ0iww+viHNhAFc4rEYDiOAw=
github.com/BurntSushi/[email protected] h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs=
github.com/google/[email protected] h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
golang.org/x/exp/[email protected] h1:1P7xPZEwZMoBoz0Yze5Nx2/4pxj6nw9ZqHWXqP0iRgQ=
golang.org/x/[email protected] h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/[email protected] h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
golang.org/x/[email protected] h1:TCDqnvbBsFapViksHcHySl/sW4+rTGNIAoJJesHRuMM=
golang.org/x/[email protected] h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
golang.org/x/[email protected] h1:kgwdasJRsdDWYgWcEgMF424DiXwwXHSb3V8xVTi//i8=
golang.org/x/[email protected] h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I=
honnef.co/go/[email protected] h1:4bH5o3b5ZULQ4UrBmP+63W9r7qIkqJClEA9ko5YKx+I=
mvdan.cc/[email protected] h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU=
mvdan.cc/xurls/[email protected] h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=
go: go1.23.2
- Build info
- Run
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.- Version: 1.96.2
Commit: fabdb6a30b49f79a7aba0f2ad9df9b399473380f
Date: 2024-12-19T10:22:47.216Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Darwin x64 24.2.0
- Version: 1.96.2
- Check your installed extensions to get the version of the VS Code Go extension
- 0.45.0
- Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Tools
command.-
Tools Configuration
## Environment GOBIN: undefined toolsGopath: gopath: /Users/emreisikligil/go GOROOT: /usr/local/Cellar/go/1.23.2/libexec PATH: /Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/sbin:/Applications/apache-jmeter-5.0/bin:/usr/local/opt/[email protected]/bin:/Users/emreisikligil/go/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/usr/texbin:/usr/local/go/bin ## Tools go: /usr/local/bin/go: go version go1.23.2 darwin/amd64 gopls: /Users/emreisikligil/go/bin/gopls (version: v0.17.1 built with go: go1.23.2) gotests: not installed gomodifytags: /Users/emreisikligil/go/bin/gomodifytags (version: v1.17.0 built with go: go1.23.2) impl: /Users/emreisikligil/go/bin/impl (version: v1.4.0 built with go: go1.23.2) goplay: not installed dlv: /Users/emreisikligil/go/bin/dlv (version: v1.23.1 built with go: go1.23.2) golangci-lint: /Users/emreisikligil/go/bin/golangci-lint (version: v1.61.0 built with go: go1.23.2) ## Go env Workspace Folder (test): /Users/emreisikligil/Desktop/test GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/Users/emreisikligil/Library/Caches/go-build' GOENV='/Users/emreisikligil/Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='darwin' GOINSECURE='' GOMODCACHE='/Users/emreisikligil/go/pkg/mod' GONOPROXY='github.com/SharperShape' GONOSUMDB='github.com/SharperShape' GOOS='darwin' GOPATH='/Users/emreisikligil/go' GOPRIVATE='github.com/SharperShape' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/local/Cellar/go/1.23.2/libexec' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='local' GOTOOLDIR='/usr/local/Cellar/go/1.23.2/libexec/pkg/tool/darwin_amd64' GOVCS='' GOVERSION='go1.23.2' GODEBUG='' GOTELEMETRY='local' GOTELEMETRYDIR='/Users/emreisikligil/Library/Application Support/go/telemetry' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='cc' CXX='c++' CGO_ENABLED='1' GOMOD='/Users/emreisikligil/Desktop/test/go.mod' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/kj/09g_3wgs5tn10g33fnqxm02r0000gn/T/go-build2279188997=/tmp/go-build -gno-record-gcc-switches -fno-common'
-
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.gopath": "",
"go.testFlags": ["-v"],
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"],
"go.delveConfig": {
"dlvLoadConfig": {
"followPointers": true,
"maxVariableRecurse": 1,
"maxStringLen": 1024,
"maxArrayValues": 64,
"maxStructFields": -1
},
"apiVersion": 2,
"showGlobalVariables": false,
"debugAdapter": "dlv-dap"
},
"go.lintOnSave": "file"
"go.toolsManagement.autoUpdate": true,
"go.coverageDecorator": {
"type": "gutter",
"uncoveredGutterStyle": "blockyellow"
},
"go.testTimeout": "5m",
"go.inlayHints.constantValues": true,
"go.coverOnTestPackage": false,
Describe the bug
When I run or debug an embedded test on level 2 or more using run test | debug test
button on top of t.Run
statement, the extension passes a wrong path to the go tool and it returns with testing: warning: no tests to run
.
Let's say I have 3 layer of tests as below. When I try to run Inner test
, it executes the following command which ends up failing to find the correct test.
func Test(t *testing.T) {
t.Run("Middle test", func(t *testing.T) {
t.Run("Inner test", func(t *testing.T) {
t.Log("Inner test")
})
})
}
Running tool: /usr/local/bin/go test -timeout 5m -run ^Test$/^Inner_test$ github.com/emreisikligil/test -v
=== RUN Test
--- PASS: Test (0.00s)
testing: warning: no tests to run
PASS
ok github.com/emreisikligil/test 0.466s [no tests to run]
The expected behavior is to run the corresponding test.
Steps to reproduce the behavior:
- Create a folder named test.
- Put the following files into the folder
main_test.go:
package main
import "testing"
func Test(t *testing.T) {
t.Run("Middle test", func(t *testing.T) {
t.Run("Inner test", func(t *testing.T) {
t.Log("Inner test")
t.Log("Inner test")
})
})
}
go.mod:
module github.com/test/test
go 1.23
- Open main_test in VSCode
- Click on
run test
ordebug test
on top oft.Run("Inner test", func(t *testing.T) {
Screenshots or recordings
Metadata
Metadata
Assignees
Labels
No labels