golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.86k stars 745 forks source link

Subtest of subtest not recognized #3191

Closed sollniss closed 7 months ago

sollniss commented 7 months ago

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.22.0 windows/amd64 ``` * Run `gopls -v version` to get version of Gopls from _the VS Code integrated terminal_. ``` Build info ---------- golang.org/x/tools/gopls v0.14.2 golang.org/x/tools/gopls@v0.14.2 h1:sIw6vjZiuQ9S7s0auUUkHlWgsCkKZFWDHmrge8LYsnc= github.com/BurntSushi/toml@v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= github.com/google/go-cmp@v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= golang.org/x/exp/typeparams@v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y= golang.org/x/mod@v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/sync@v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= golang.org/x/sys@v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/telemetry@v0.0.0-20231114163143-69313e640400 h1:brbkEFfGwNGAEkykUOcryE/JiHUMMJouzE0fWWmz/QU= golang.org/x/text@v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/tools@v0.14.1-0.20231114185516-c9d3e7de13fd h1:Oku7E+OCrXHyst1dG1z10etCTxewCHXNFLRlyMPbh3w= golang.org/x/vuln@v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU= honnef.co/go/tools@v0.4.5 h1:YGD4H+SuIOOqsyoLOpZDWcieM28W47/zRO7f+9V3nvo= mvdan.cc/gofumpt@v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM= mvdan.cc/xurls/v2@v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc= go: go1.22.0 ``` * Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. ``` 1.86.2 903b1e9d8990623e3d7da1df3d33db3e42d80eda x64 ``` * Check your installed extensions to get the version of the VS Code Go extension ``` v0.41.1 ``` * Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > `Go: Locate Configured Go Tools` command. ``` # Tools Configuration ## Environment GOBIN: undefined toolsGopath: gopath: C:\Users\sollniss\go GOROOT: C:\Program Files\Go PATH: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Go\bin;C:\Program Files\Git\cmd;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files (x86)\GnuWin32\bin;C:\Program Files\Rancher Desktop\resources\resources\win32\bin\;C:\Program Files\Rancher Desktop\resources\resources\linux\bin\;C:\Program Files\Cloudflare\Cloudflare WARP\;C:\Users\sollniss\AppData\Local\Microsoft\WindowsApps;C:\Users\sollniss\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\sollniss\go\bin; ## Tools go: C:\Program Files\Go\bin\go.exe: go version go1.21.5 windows/amd64 gopls: C:\Users\sollniss\go\bin\gopls.exe (version: v0.14.2 built with go: go1.22.0) gotests: C:\Users\sollniss\go\bin\gotests.exe (version: v1.6.0 built with go: go1.22.0) gomodifytags: C:\Users\sollniss\go\bin\gomodifytags.exe (version: v1.16.0 built with go: go1.22.0) impl: C:\Users\sollniss\go\bin\impl.exe (version: v1.1.0 built with go: go1.22.0) goplay: C:\Users\sollniss\go\bin\goplay.exe (version: v1.0.0 built with go: go1.22.0) dlv: C:\Users\sollniss\go\bin\dlv.exe (version: v1.22.1 built with go: go1.22.0) golangci-lint: C:\Users\sollniss\go\bin\golangci-lint.exe (version: v1.56.2 built with go: go1.22.0) ## Go env Workspace Folder (testrepo): c:\Users\sollniss\Desktop\privat\testrepo set GO111MODULE= set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\sollniss\AppData\Local\go-build set GOENV=C:\Users\sollniss\AppData\Roaming\go\env set GOEXE=.exe set GOEXPERIMENT= set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GOMODCACHE=C:\Users\sollniss\go\pkg\mod set GONOPROXY= set GONOSUMDB= set GOOS=windows set GOPATH=C:\Users\sollniss\go set GOPRIVATE= set GOPROXY=https://proxy.golang.org,direct set GOROOT=C:\Program Files\Go set GOSUMDB=sum.golang.org set GOTMPDIR= set GOTOOLCHAIN=auto set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64 set GOVCS= set GOVERSION=go1.22.0 set GCCGO=gccgo set GOAMD64=v1 set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=0 set GOMOD=c:\Users\sollniss\Desktop\test\go.mod set GOWORK= set CGO_CFLAGS=-O2 -g set CGO_CPPFLAGS= set CGO_CXXFLAGS=-O2 -g set CGO_FFLAGS=-O2 -g set CGO_LDFLAGS=-O2 -g set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\SOLLN~1\AppData\Local\Temp\go-build3942034388=/tmp/go-build -gno-record-gcc-switches ```

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.

None.

Describe the bug

Subtests of subtests are not recognized when clicking run test.

Steps to reproduce the behavior:

  1. With the following code
    func TestSomething(t *testing.T) {
    i := 1
    t.Run("subtest", func(t *testing.T) {
        j := 2
        t.Run("subsubtest", func(t *testing.T) {
            if i != j {
                t.Errorf("%d != %d", i, j)
            }
        })
    })
    }
  2. Click on 'run test' displayed above 'subsubtest'
  3. The executed command is Running tool: C:\Program Files\Go\bin\go.exe test -timeout 30s -run ^TestSomething$/^subsubtest$ test.com/testrepo
  4. [no tests to run] is displayed

I would expect the command to be go test -timeout 30s -run ^TestSomething$/^subtest$/^subsubtest$ test.com/testrepo

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem.

suzmue commented 7 months ago

Unfortunately, the extension does not currently handle nested subtests in codelenses.

Closing as duplicate of #3022, where we will continue to track any progress on this.