Skip to content

Inline "run test" button running the wrong sub test #3926

@pWoLiAn

Description

@pWoLiAn

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.25.4 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • golang.org/x/tools/gopls v0.20.0
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.106.2
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.50.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
# Tools Configuration


## Environment

GOBIN: undefined
toolsGopath: 
gopath: /root/go
GOROOT: /usr/local/go
PATH: /root/.vscode-server/cli/servers/Stable-1e3c50d64110be466c0b4a45222e81d2c9352888/server/bin/remote-cli:/root/.rover/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/root/.local/share/coursier/bin:/root/go/bin:/root/.fzf/bin:/root/.cache/coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.14%252B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.14_7.tar.gz/jdk-17.0.14+7/bin

## Tools

	go:	/usr/local/go/bin/go: go version go1.25.4 linux/amd64

	gopls:	/root/go/bin/gopls	(version: v0.20.0 built with go: go1.25.4)
	gotests:	/root/go/bin/gotests	(version: v1.6.0 built with go: go1.25.4)
	impl:	/root/go/bin/impl	(version: v1.4.0 built with go: go1.25.4)
	goplay:	/root/go/bin/goplay	(version: v1.0.0 built with go: go1.25.4)
	dlv:	/root/go/bin/dlv	(version: v1.25.2 built with go: go1.25.4)
	staticcheck:	/root/go/bin/staticcheck	(version: v0.6.1 built with go: go1.25.4)

## Go env

Workspace Folder (??): /root/vega/??

	AR='ar'
	CC='gcc'
	CGO_CFLAGS='-O2 -g'
	CGO_CPPFLAGS=''
	CGO_CXXFLAGS='-O2 -g'
	CGO_ENABLED='1'
	CGO_FFLAGS='-O2 -g'
	CGO_LDFLAGS='-O2 -g'
	CXX='g++'
	GCCGO='gccgo'
	GO111MODULE='on'
	GOAMD64='v1'
	GOARCH='amd64'
	GOAUTH='netrc'
	GOBIN=''
	GOCACHE='/root/.cache/go-build'
	GOCACHEPROG=''
	GODEBUG=''
	GOENV='/root/.config/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFIPS140='off'
	GOFLAGS=''
	GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2413303794=/tmp/go-build -gno-record-gcc-switches'
	GOHOSTARCH='amd64'
	GOHOSTOS='linux'
	GOINSECURE=''
	GOMOD='/root/vega/??/go.mod'
	GOMODCACHE='/root/go/pkg/mod'
	GONOPROXY='github.??.com/*'
	GONOSUMDB='github.??.com/*'
	GOOS='linux'
	GOPATH='/root/go'
	GOPRIVATE='github.??.com/*'
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/usr/local/go'
	GOSUMDB='sum.golang.org'
	GOTELEMETRY='local'
	GOTELEMETRYDIR='/root/.config/go/telemetry'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
	GOVCS=''
	GOVERSION='go1.25.4'
	GOWORK=''
	PKG_CONFIG='pkg-config'

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.editorContextMenuCommands": {
        "addTags": false,
        "generateTestForFunction": false,
        "addImport": false,
        "playground": false,
        "debugTestAtCursor": false
 },
"go.terminal.activateEnvironment": false,
"go.testFlags": [
        "-gcflags=all=-N",
        "-gcflags=all=-l"
],
"gopls": {
        "ui.semanticTokens": true
},

Describe the bug

A clear and concise description of what the bug: Clicking on "run test" is running the wrong sub test
A clear and concise description of what you expected to happen: It should run the intended sub test

Steps to reproduce the behavior:

  1. Open a go test file
  2. Click on "run test" inline button in one of the sub tests in a test function
  3. A different sub test gets executed, as shown in the "Go Tests" output panel

Screenshots or recordings

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions