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.21.1 linux/amd64
- Run
gopls -v version
to get version of Gopls from the VS Code integrated terminal.-
Build info ---------- golang.org/x/tools/gopls v0.13.2 golang.org/x/tools/gopls@v0.13.2 h1:Pyvx6MKvatbX3zzZmdGiFRfQZl0ohPlt2sFxO/5j6Ro= 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@v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= golang.org/x/exp/typeparams@v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y= golang.org/x/mod@v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/sync@v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sys@v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= golang.org/x/text@v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= golang.org/x/tools@v0.11.2-0.20230810185051-cc6b5804b8cf h1:Oush7UwPamr2/iNeNFBuNFj89YyHn0YY69EKDdvANnk= golang.org/x/vuln@v0.0.0-20230110180137-6ad3e3d07815 h1:A9kONVi4+AnuOr1dopsibH6hLi1Huy54cbeJxnq4vmU= honnef.co/go/tools@v0.4.2 h1:6qXr+R5w+ktL5UkwEbPp+fEvfyoMPche6GkOpGHZcLc= mvdan.cc/gofumpt@v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM= mvdan.cc/xurls/v2@v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc= go: go1.21.1
-
- Run
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.
f1b07bd25dfad64b0167beb15359ae573aecd2cc
x64
``` -
- Check your installed extensions to get the version of the VS Code Go extension
- v0.39.1
- Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Tools
command.-
Checking configured tools.... GOBIN: undefined toolsGopath: gopath: /home/roberto.neto/go GOROOT: /usr/local/go PATH: /home/roberto.neto/.local/bin:/home/roberto.neto/.nvm/versions/node/v14.21.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin:/usr/local/go/bin:/home/roberto.neto/go/bin:/usr/local/go/bin/ go: /usr/local/go/bin/go: go version go1.21.1 linux/amd64 gotests: not installed gomodifytags: not installed impl: not installed goplay: not installed dlv: /home/roberto.neto/go/bin/dlv (version: v1.21.0 built with go: go1.21.1) staticcheck: /home/roberto.neto/go/bin/staticcheck (version: v0.4.6 built with go: go1.21.1) gopls: /home/roberto.neto/go/bin/gopls (version: v0.13.2 built with go: go1.21.1) go env Workspace Folder (legacy-gateway): /home/roberto.neto/sources/legacy-gateway GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/home/roberto.neto/.cache/go-build' GOENV='/home/roberto.neto/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMODCACHE='/home/roberto.neto/go/pkg/mod' GONOPROXY='' GONOSUMDB='git.senior.com.br' GOOS='linux' GOPATH='/home/roberto.neto/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,https://******:*******@**********/artifactory/api/go/go,direct' GOROOT='/usr/local/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64' GOVCS='' GOVERSION='go1.21.1' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='gcc' CXX='g++' CGO_ENABLED='0' GOMOD='/home/roberto.neto/sources/legacy-gateway/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 -m64 -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1985667666=/tmp/go-build -gno-record-gcc-switches'
-
Share the Go related settings you have added/edited
"go.testFlags": [
"-v"
],
"go.testTags": "testing,skip_postgres",
"go.buildTags": "testing",
"go.formatTool": "gofmt",
"gopls": {
},
"go.testEnvVars": {
"TF_ACC": "1",
},
Describe the bug
When I write nested tests like this one:
func TestTokenSwitcherServiceImpl(t *testing.T) { // level 1
t.Run("SwitchTokenToJwt", func(t *testing.T) { // level 2
t.Run("AlreadyAJwt", func(t *testing.T) { // level 3
// .... code ...
})
})
}
I'm not able to run the "level 3" (AlreadyAJwt
) test using the extension shortcut inside the code editor.
The output prints an info saying warning: no tests to run
:
Running tool: /usr/local/go/bin/go test -timeout 30s -tags testing,skip_postgres -run ^\QTestTokenSwitcherServiceImpl\E$/^\QAlreadyAJwt\E$ mygithost.com/project-name/mypackage -v
=== RUN TestTokenSwitcherServiceImpl
--- PASS: TestTokenSwitcherServiceImpl (0.00s)
testing: warning: no tests to run
PASS
ok mygithost.com/project-name/mypackage (cached) [no tests to run]
Note that the go test
generated by the extension seams to be the problem, the arg -run
is not considering the "parent-child" test SwitchTokenToJwt
: -run ^\QTestTokenSwitcherServiceImpl\E$/^\QAlreadyAJwt\E$
Steps to reproduce the behavior:
- Create a test file
- Declare a test unit function
- Create a nested test A
- Create another nested test B inside A
- Try to run the test B using the editor shortcut
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done