Skip to content

When using go1.24 or later, the Go: Test command no longer displays compile errors #3744

Open
@shibayu36

Description

@shibayu36

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


## Environment

GOBIN: undefined
toolsGopath: 
gopath: /Users/shibayu36/go
GOROOT: /opt/homebrew/Cellar/go/1.24.1/libexec
PATH: /opt/homebrew/Cellar/go/1.24.1/libexec/bin:/Users/shibayu36/.codeium/windsurf/bin:/Users/shibayu36/.poetry/bin:/opt/homebrew/Cellar/zplug/2.4.2/bin:/opt/homebrew/opt/zplug/bin:/opt/homebrew/opt/gettext/bin:/opt/homebrew/opt/libpq/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/imagemagick@6/bin:/usr/local/opt/texinfo/bin:/opt/homebrew/opt/openssl@3/bin:/usr/local/heroku/bin:/Users/shibayu36/go/bin:/Users/shibayu36/.asdf/shims:/opt/homebrew/opt/asdf/libexec/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/shibayu36/.local/bin:/Users/shibayu36/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/usr/bin:/usr/sbin:/opt/local/sbin:/bin:/sbin:/Users/shibayu36/.tfenv/bin:/usr/local/opt/scala/bin:/Users/shibayu36/.poetry/bin:/Users/shibayu36/dotnet:/Users/shibayu36/.orbstack/bin:/opt/homebrew/opt/fzf/bin:/Users/shibayu36/.cache/lm-studio/bin
PATH (vscode launched with): /Users/shibayu36/.codeium/windsurf/bin:/Users/shibayu36/.poetry/bin:/opt/homebrew/Cellar/zplug/2.4.2/bin:/opt/homebrew/opt/zplug/bin:/opt/homebrew/opt/gettext/bin:/opt/homebrew/opt/libpq/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/imagemagick@6/bin:/usr/local/opt/texinfo/bin:/opt/homebrew/opt/openssl@3/bin:/usr/local/heroku/bin:/Users/shibayu36/go/bin:/Users/shibayu36/.asdf/shims:/opt/homebrew/opt/asdf/libexec/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/shibayu36/.local/bin:/Users/shibayu36/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/usr/bin:/usr/sbin:/opt/local/sbin:/bin:/sbin:/Users/shibayu36/.tfenv/bin:/usr/local/opt/scala/bin:/Users/shibayu36/.poetry/bin:/Users/shibayu36/dotnet:/Users/shibayu36/.orbstack/bin:/opt/homebrew/opt/fzf/bin:/Users/shibayu36/.cache/lm-studio/bin

## Tools

	go:	/opt/homebrew/bin/go: go version go1.24.1 darwin/arm64

	gopls:	/Users/shibayu36/go/bin/gopls	(version: v0.18.1 built with go: go1.24.0)
	gotests:	not installed
	gomodifytags:	not installed
	impl:	not installed
	goplay:	not installed
	dlv:	/Users/shibayu36/go/bin/dlv	(version: v1.24.0 built with go: go1.24.0)
	golangci-lint:	/Users/shibayu36/go/bin/golangci-lint	(version: v1.64.6 built with go: go1.24.0)

## Go env

Workspace Folder (vscode-go): /Users/shibayu36/development/src/github.com/golang/vscode-go

	AR='ar'
	CC='cc'
	CGO_CFLAGS='-O2 -g'
	CGO_CPPFLAGS=''
	CGO_CXXFLAGS='-O2 -g'
	CGO_ENABLED='1'
	CGO_FFLAGS='-O2 -g'
	CGO_LDFLAGS='-O2 -g'
	CXX='c++'
	GCCGO='gccgo'
	GO111MODULE=''
	GOARCH='arm64'
	GOARM64='v8.0'
	GOAUTH='netrc'
	GOBIN=''
	GOCACHE='/Users/shibayu36/Library/Caches/go-build'
	GOCACHEPROG=''
	GODEBUG=''
	GOENV='/Users/shibayu36/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFIPS140='off'
	GOFLAGS=''
	GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/7r/7nyxrx15693bsgd6gwv749g00000gn/T/go-build2791924945=/tmp/go-build -gno-record-gcc-switches -fno-common'
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMOD='/Users/shibayu36/development/src/github.com/golang/vscode-go/go.mod'
	GOMODCACHE='/Users/shibayu36/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='darwin'
	GOPATH='/Users/shibayu36/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/opt/homebrew/Cellar/go/1.24.1/libexec'
	GOSUMDB='sum.golang.org'
	GOTELEMETRY='local'
	GOTELEMETRYDIR='/Users/shibayu36/Library/Application Support/go/telemetry'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/opt/homebrew/Cellar/go/1.24.1/libexec/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.24.1'
	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.alternateTools": {
    "go": "/opt/homebrew/bin/go",
    "go-langserver": "gopls"
  },
  "go.languageServerExperimentalFeatures": {
    "autoComplete": true,
    "format": true
  },
  "go.lintFlags": [
    "--fast"
  ],
  "go.lintTool": "golangci-lint",
  "go.testFlags": [
    "-v",
    "-count=1",
    "-timeout=120s"
  ],
  "go.toolsManagement.autoUpdate": true,
  "[go]": {
    "editor.codeActionsOnSave": {
      "source.organizeImports": "explicit"
    },
    "editor.formatOnSave": true,
    "editor.snippetSuggestions": "none"
  },

Describe the bug

After upgrading to Go 1.24, running the Go: Test command (e.g. Go: Test File) no longer displays compile errors in the Output.

It is probably because in go1.24, go test -json now returns the build output in JSON as well.

https://tip.golang.org/doc/go1.24

Furthermore, go test -json now reports build output and failures in JSON, interleaved with test result JSON. These are distinguished by new Action types, but if they cause problems in a test integration system, you can revert to the text build output with GODEBUG setting gotestjsonbuildtext=1.

Steps to reproduce the behavior:

  1. Edit a file to cause a compilation error.
  2. Run the Go: Test File command.
  3. Check the output.

Screenshots or recordings

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

Cause a compile error
Image

When running Go: Test File using go1.24
Image

When running Go: Test File using go1.23

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Go CompanionIssues relating to the Go Companion extension

    Type

    No type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions