Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

go: no such tool "covdata" in Go 1.25

After upgrading to Go 1.25 (specifically 1.25.1) when I run go test -cover I get this message:

go: no such tool "covdata"

The command exits with status 1.

It seems this does not happen with 1.24 — the version I upgraded from. How do I fix this?

like image 416
blackgreen Avatar asked Oct 30 '25 05:10

blackgreen


1 Answers

It's probably a bug with the Go toolchain, somehow related to auto-switching the Go version.

Run go env. If you have GOTOOLCHAIN=auto, replace it with a specific version. This fix was suggested by trym-moeller in issue #75031:

It can be noted that manually running go env -w GOTOOLCHAIN=go1.25.0+auto fixed a similar problem for me.

What this does can be found here: https://go.dev/doc/toolchain

The default GOTOOLCHAIN setting is auto, which enables the toolchain switching described earlier. The alternate form <name>+auto sets the default toolchain to use before deciding whether to switch further. For example GOTOOLCHAIN=go1.21.3+auto directs the go command to begin its decision with a default of using Go 1.21.3 but still use a newer toolchain if directed by go and toolchain lines [in the go.mod file].

NOTE:

Setting a specific toolchain at the env level affects how the go command runs, i.e. it prefers the specific toolchain version in all your repositories. If you must compile some projects with an older version of Go, then be careful.

You can force a specific version on a per-repository basis by setting the env each time you run the command:

GOTOOLCHAIN=go1.25.0+auto go test -cover ./...
like image 96
blackgreen Avatar answered Oct 31 '25 18:10

blackgreen