vscode-go
vscode-go copied to clipboard
testify test suite test cases cannot be debuged for single test
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.- go1.17.2 darwin/amd64
-
Run
gopls -v version
to get version of Gopls from the VS Code integrated terminal.- golang.org/x/tools/gopls v0.8.3
-
Run
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.- 1.66.2
-
Check your installed extensions to get the version of the VS Code Go extension
- v0.32.0
-
Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Tools
command.- Checking configured tools.... GOBIN: undefined toolsGopath: gopath: /Users/tom/go GOROOT: /usr/local/Cellar/go/1.17.2/libexec PATH: /Users/tom/.rvm/gems/ruby-2.7.0/bin:/Users/tom/.rvm/gems/ruby-2.7.0@global/bin:/Users/tom/.rvm/rubies/ruby-2.7.0/bin:/usr/local/opt/[email protected]/bin:/Users/tom/torch/install/bin:/Users/tom/.nvm/versions/node/v14.8.0/bin:/Users/tom/.gem/bin:/Users/tom/go/bin:/usr/local/sbin:/Users/tom/.sdkman/candidates/gradle/current/bin:/Users/tom/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/Apple/usr/bin:/Users/Tom/Library/Android/sdk/tools:/Users/Tom/Library/Android/sdk/platform-tools:/Users/tom/.rvm/bin
go: /usr/local/bin/go: go version go1.17.2 darwin/amd64
go-outline: /Users/tom/go/bin/go-outline (version: v0.0.0-20210608161538-9736a4bde949 built with go: go1.17.2) gotests: /Users/tom/go/bin/gotests (version: v1.6.0 built with go: go1.17.2) gomodifytags: /Users/tom/go/bin/gomodifytags (version: v1.16.0 built with go: go1.17.2) impl: /Users/tom/go/bin/impl (version: v1.1.0 built with go: go1.17.2) goplay: /Users/tom/go/bin/goplay (version: v1.0.0 built with go: go1.17.2) dlv: /Users/tom/go/bin/dlv (version: v1.8.2 built with go: go1.17.2) golangci-lint: /Users/tom/go/bin/golangci-lint (version: (devel) built with go: go1.17.7) gopls: /Users/tom/go/bin/gopls (version: v0.8.3 built with go: go1.17.2)
go env Workspace Folder (playground): /Users/tom/workspace/playground GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/tom/Library/Caches/go-build" GOENV="/Users/tom/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="-mod=vendor" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/tom/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/tom/go" GOPRIVATE="" GOPROXY="https://goproxy.cn,direct" GOROOT="/usr/local/Cellar/go/1.17.2/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.17.2/libexec/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.17.2" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/tom/workspace/playground/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/xx/rkz1tt1j1nb5wt4j8zr7kcp00000gn/T/go-build3718678352=/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.
Describe the bug
testify test suite test cases cannot be debuged for single test.
Steps to reproduce the behavior:
- main_test.go
package main
import (
"log"
"testing"
"github.com/stretchr/testify/suite"
)
type PlaygroundSuite struct {
suite.Suite
}
func TestPlaygroundSuite(t *testing.T) {
mallSuit := new(PlaygroundSuite)
suite.Run(t, mallSuit)
}
// can debug
func (self *PlaygroundSuite) TestFoo() {
v := "bar"
log.Println(v)
}
- other_test.go
package main
import (
"log"
_ "github.com/stretchr/testify/suite"
)
// cannot debug
func (self *PlaygroundSuite) TestFar() {
v := "bar"
log.Println(v)
}
click debug test
, but debug console output:
Starting: [/Users/tom/go/bin/dlv]() dap --check-go-version=false --listen=127.0.0.1:60712 --log-dest=3 from [/Users/tom/workspace/playground/tests]()
DAP server listening at: 127.0.0.1:60712
Type 'dlv help' for list of commands.
testing: warning: no tests to run
PASS
Process 38235 has exited with status 0
Detaching
dlv dap (38199) exited with code: 0
seems cannnot debug test case in file other_test.go
.
This appears to be the same issue as golang/vscode-go#2414. Since that one has an open PR, will close this issue in favor of that one.