Documentation ¶
Index ¶
- func Export(p *Profiles, format Format, writer io.Writer) error
- func ExportCodecovJson(p *Profiles, writer io.Writer) error
- func ExportLCOV(p *Profiles, writer io.Writer) error
- type Format
- type LineCounts
- func (lc *LineCounts) CopyFrom(other *LineCounts)
- func (lc *LineCounts) ForEach(fn func(lineIdx, hitCount int))
- func (lc *LineCounts) MergeWith(other *LineCounts)
- func (lc *LineCounts) Reset()
- func (lc *LineCounts) Set(lineIdx, hitCount int)
- func (lc *LineCounts) String() string
- func (lc *LineCounts) StringWithSeparator(sep string) string
- type Profiles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExportCodecovJson ¶
ExportCodecovJson exports profile data to the Codecov custom coverage JSON format (https://docs.codecov.com/docs/codecov-custom-coverage-format).
Sample output (with added comments):
{ "coverage": { "filename": { "1": 0, # line 1 missed "2": 1, # line 2 hit once "7": 5 # line 7 hit 5 times } } }
func ExportLCOV ¶
ExportLCOV exports profile data to the LCOV format (see https://ltp.sourceforge.net/coverage/lcov/geninfo.1.php).
Types ¶
type Format ¶
type Format int
func FormatFromFilename ¶
FormatFromFilename determines the format from the extension of the filename. Supported extensions are: .gocov, .lcov, .json
type LineCounts ¶
type LineCounts struct {
// contains filtered or unexported fields
}
LineCounts stores the hit counts for a file.
func (*LineCounts) CopyFrom ¶
func (lc *LineCounts) CopyFrom(other *LineCounts)
CopyFrom copies the given counts.
func (*LineCounts) ForEach ¶
func (lc *LineCounts) ForEach(fn func(lineIdx, hitCount int))
ForEach runs the given function for each line that has a hit count (in increasing lineIdx order).
func (*LineCounts) MergeWith ¶
func (lc *LineCounts) MergeWith(other *LineCounts)
MergeWith merges in the given line counts.
For any given line, the resulting hit count is the sum between the two hit counts.
func (*LineCounts) Set ¶
func (lc *LineCounts) Set(lineIdx, hitCount int)
Set the hit count for a line. If the line already has a hit count, the larger value is used.
func (*LineCounts) String ¶
func (lc *LineCounts) String() string
func (*LineCounts) StringWithSeparator ¶
func (lc *LineCounts) StringWithSeparator(sep string) string
StringWithSeparator generates a string representation showing groups of lines with the same hit count, separated by the given separator.
type Profiles ¶
type Profiles struct {
// contains filtered or unexported fields
}
Profiles stores LineCounts for a collection of files.
func ImportGoCover ¶
ImportGoCover imports go cover profile data.
func ImportLCOV ¶
ImportLCOV imports profile data from LCOV format (see https://ltp.sourceforge.net/coverage/lcov/geninfo.1.php).
func (*Profiles) LineCounts ¶
func (p *Profiles) LineCounts(filename string) *LineCounts
LineCounts returns the LineCounts for the given file, adding the file to the collection if necessary.
func (*Profiles) MergeWith ¶
MergeWith merges in the given profiles.
For any given line, the resulting hit count is the sum between the hit counts in the two profiles.
func (*Profiles) RenameFiles ¶
RenameFiles changes the names of the files in the profile.