cmd/cover: NumStmt duplicated across split blocks, inflating statement coverage [1.26 backport]
Author: gopherbotCreated Sep 28, 2026Updated Sep 28, 2026
LabelsCherryPickCandidate
@mwchatten requested issue #80974 to be considered for backport to the next 1.26 minor release.
@gopherbot please backport to Go 1.27
This is a regression from Go 1.26. Coverage statement counts are silently wrong under Go 1.27. Source and tests are unchanged, but coverage moves a lot in either direction depending on whether the duplicated blocks are covered. We saw 70.7% → 39.2% on an unchanged service, and the comment above reports 69% → 51%. This breaks CI coverage gates across many repositories on a toolchain upgrade alone. The only workaround is to stay on Go 1.26, which isn't possible for code that uses 1.27 features. The fix (CL 819000) is small, limited to cmd/cover, and applies cleanly to go1.27.1.
Source: golang/go