On tip, invoking "go test -n -cover ./..." on a collection of packages that include at least one package with code but no tests can result in a spurious errors. Example:

$ cd `go env GOROOT`
$ cd src/internal/coverage
$ go test -n -cover ./...
...
internal/coverage/uleb128: open $WORK/b112/covmeta.b07a5f2dff1231cae3a6bdd70c8cc7c19da16abf8ac59747d8e9859c03594d37: no such file or directory
$ echo $?
1
$

This obviously shouldn't be happening for a "-n" test run (works fine without -cover).

Comment From: gabyhelp

Similar Issues

  • https://github.com/golang/go/issues/65653
  • https://github.com/golang/go/issues/23454
  • https://github.com/golang/go/issues/43242
  • https://github.com/golang/go/issues/27333
  • https://github.com/golang/go/issues/63356

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

Comment From: gopherbot

Change https://go.dev/cl/592201 mentions this issue: cmd/go: fix "go test -n -cover" glitch with no-test packages