Discover Packages
github.com/jonbaldie/go-mutesting/v2
internal
baseline
package
Version:
v2.7.6
Opens a new window with list of versions in this module.
Published: Jun 24, 2026
License: MIT
Opens a new window with license information.
Imports: 8
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package baseline tracks known-surviving mutants so CI fails only on new
regressions, not on pre-existing escapes that the team has accepted.
Usage:
First run: --update-baseline (writes current escaped set, exits 0)
CI: baseline file committed; new runs fail only on NEW escapes
MutantID returns a stable identifier for a mutant.
It hashes the relative file path, mutator name, and the actual changed
lines from the diff — deliberately excluding line numbers so the ID
survives refactors that only shift surrounding code.
Write serialises the escaped mutants to the baseline file.
moduleRoot is used to make file paths relative and portable.
type Entry struct {
ID string `json:"id"`
File string `json:"file"`
Mutator string `json:"mutator"`
Line int64 `json:"line"`
}
Entry describes one known-surviving mutant.
type File struct {
Version int `json:"version"`
Mutants []Entry `json:"mutants"`
}
File is the on-disk baseline format.
Load reads the baseline file.
Returns (nil, nil) when the file does not exist — callers treat this as
"no baseline active" and skip the check entirely.
IDSet returns the set of known mutant IDs for fast O(1) lookup.
NewEscapes returns mutants from escaped that are not recorded in this baseline.
When f is nil (no baseline loaded), all mutants are considered new.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.