Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Go: coverage profile is never matched, so every site is reported uncovered and the run exits 0

オープン
#2 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

@vducong がすでに取り組んでいます。

2026年10月26日 から。

  • #7 @vducong による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go, python
領域
tooling

調査の方向性

Start in target/coverage/go/coverage.out handling and the coverage.covered_lines / _suffix_rank / _lookup functions the issue names. Reproduce with the given Go module repro, then add a candidate that strips the module path from go.mod off profile keys (or adds a root-relative path candidate). Done: Go profiles match on a covered module, mutants are killed, and the exit code reflects killed mutants.

索引モデルが issue の本文から書いたものです。

説明

On a Go module, mutator reports every site as uncovered and exits 0, even when the tests cover the line. With --no-coverage the same sites run.

Repro (mutator a5a0cb8, crapper 6fd92c4, go 1.25.8, macOS)

go.mod: module example.com/demo

calc/calc.go:

package calc

func Max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

calc/calc_test.go:

package calc

import "testing"

func TestMax(t *testing.T) {
	if Max(2, 1) != 2 || Max(1, 2) != 2 {
		t.Fatal("wrong max")
	}
}
$ ../mutator/mutator calc/calc.go
Max      example.com/demo/calc       0         0          1      1    n/a
$ echo $?
0
$ ../mutator/mutator --no-coverage calc/calc.go
Max      example.com/demo/calc       0         1          0      1   0.0%

crapper reads the same profile correctly (Max example.com/demo/calc 2 100.0% 2.0).

Cause, as far as I can tell

target/coverage/go/coverage.out names the file by import path, example.com/demo/calc/calc.go. coverage.covered_lines looks it up by absolute path, /…/mutrepro/calc/calc.go. _suffix_rank only matches when one path is a suffix of the other, and these two share only the tail calc/calc.go, so _lookup returns None and every line counts as uncovered.

Why it matters

Exit 0 means every executed mutant was killed. Used as a gate on a Go project, mutator passes without running a mutant.

Possible fix

Strip the module path from go.mod off Go profile keys before matching, or add the root-relative path to the lookup candidates.

主要言語
Python
スター
55
フォーク
7
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

unclebob/mutator のほかの issue

unclebob/mutator の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。