• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 39908198252
93%

Build:
DEFAULT BRANCH: main
Ran 23 Oct 2026 06:03AM UTC
Jobs 11
Files 1785
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

23 Oct 2026 05:52AM UTC coverage: 92.962% (+0.01%) from 92.952%
39908198252

push

github

web-flow
go: fix test coverage on Go v1.25+ by registering via `testdeps` (#23666)

Closes #20689, and fixes the breakage tracked in #17951.

## The bug

With a Go v1.25 or newer toolchain, `pants test --use-coverage` fails on
every Go package:

```
testing: cannot use -test.coverprofile because test binary was not built with coverage enabled
IndexError: tuple index out of range
```

Pants instruments sources with Go's legacy coverage mechanism (`go tool
cover -mode=<m> -var=<v>`), which stores counters in exported
package-level variables, and hands them to `testing` by generating a
`registerCover()` that calls `testing.RegisterCover`.

Go v1.20's "coverage redesign" made `testing.CoverMode()` read state
registered via `testing.MainStart` rather than anything `RegisterCover`
writes. Up to v1.24 Pants worked around that by building everything with
`GOEXPERIMENT=nocoverageredesign` (`sdk.py`), which restores the old
implementation — so coverage genuinely worked there. Go v1.25 removed
the experiment *and* gutted `RegisterCover` to an empty body, so
`CoverMode()` is always `""` and `testing` aborts with exit 2.

## The fix

On Go v1.25+, the generated setup code registers coverage the way
`cmd/go`'s own generated test main does — by pointing the exported
`testing/internal/testdeps` hooks (`CoverMode`, `CoverSnapshotFunc`,
`CoverProcessTestDirFunc`, `CoverMarkProfileEmittedFunc`) at a profile
writer which emits textfmt from the counters Pants already collects.

Registering there, rather than writing the profile after `m.Run()`:

|  | write after `m.Run()` | `testdeps` |
| -- | -- | -- |
| `testing.CoverMode()` | still `""` → fatal guard still fires |
non-empty → guard passes |
| `-test.coverprofile=cover.out` | must be removed; needs an env var or
custom flag | unchanged |
| `TestMain` doing `os.Exit(m.Run())` | **profile silently lost** |
written |
| `generate_testmain/main.go` | must restructure `main()` | **zero
change** |
| `testing.Coverage()` | broken | work... (continued)

132 of 137 new or added lines in 9 files covered. (96.35%)

1 existing line in 1 file now uncovered.

96573 of 103884 relevant lines covered (92.96%)

3.65 hits per line

Uncovered Changes

Lines Coverage ∆ File
3
85.71
-3.52% src/python/pants/backend/go/util_rules/build_pkg_third_party.py
1
82.86
3.69% src/python/pants/backend/go/conftest.py
1
94.24
-0.3% src/python/pants/backend/go/util_rules/build_pkg_target.py

Coverage Regressions

Lines Coverage ∆ File
1
36.69
0.0% src/python/pants_release/generate_github_workflows.py
Jobs
ID Job ID Ran Files Coverage
1 test_python_linux_x86_64_8/10 - 39908198252.1 23 Oct 2026 06:13AM UTC 1215
52.6
GitHub Action Run
2 test_python_linux_x86_64_2/10 - 39908198252.2 23 Oct 2026 06:06AM UTC 1216
58.64
GitHub Action Run
3 test_python_linux_x86_64_4/10 - 39908198252.3 23 Oct 2026 06:11AM UTC 1246
59.01
GitHub Action Run
4 test_python_linux_x86_64_6/10 - 39908198252.4 23 Oct 2026 06:06AM UTC 1213
50.08
GitHub Action Run
5 test_python_linux_x86_64_5/10 - 39908198252.5 23 Oct 2026 06:04AM UTC 1232
60.29
GitHub Action Run
6 test_python_linux_arm64 - 39908198252.6 23 Oct 2026 06:02AM UTC 1197
52.57
GitHub Action Run
7 test_python_linux_x86_64_3/10 - 39908198252.7 23 Oct 2026 06:07AM UTC 1215
52.25
GitHub Action Run
8 test_python_linux_x86_64_7/10 - 39908198252.8 23 Oct 2026 06:11AM UTC 1220
50.81
GitHub Action Run
9 test_python_linux_x86_64_9/10 - 39908198252.9 23 Oct 2026 06:06AM UTC 1226
53.93
GitHub Action Run
10 test_python_linux_x86_64_0/10 - 39908198252.10 23 Oct 2026 06:07AM UTC 1237
57.35
GitHub Action Run
11 test_python_linux_x86_64_1/10 - 39908198252.11 23 Oct 2026 06:06AM UTC 1216
48.82
GitHub Action Run
Source Files on build 39908198252
  • Tree
  • List 1785
  • Changed 17
  • Source Changed 11
  • Coverage Changed 17
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #39908198252
  • 1f14efb8 on github
  • Prev Build on main (#39683737229)
  • Next Build on main (#40004409316)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc