cover

Imports

Imports #

"bufio"
"errors"
"fmt"
"io"
"math"
"os"
"sort"
"strconv"
"strings"

Type Aliases

blocksByStart type #

type blocksByStart []ProfileBlock

boundariesByPos type #

type boundariesByPos []Boundary

byFileName type #

type byFileName []*Profile

Structs

Boundary struct #

Boundary represents the position in a source file of the beginning or end of a block as reported by the coverage profile. In HTML mode, it will correspond to the opening or closing of a tag and will be used to colorize the source

type Boundary struct {
Offset int
Start bool
Count int
Norm float64
Index int
}

Profile struct #

Profile represents the profiling data for a specific file.

type Profile struct {
FileName string
Mode string
Blocks []ProfileBlock
}

ProfileBlock struct #

ProfileBlock represents a single block of profiling data.

type ProfileBlock struct {
StartLine int
StartCol int
EndLine int
EndCol int
NumStmt int
Count int
}

Functions

Boundaries method #

Boundaries returns a Profile as a set of Boundary objects within the provided src.

func (p *Profile) Boundaries(src []byte) (boundaries []Boundary)

Len method #

func (b blocksByStart) Len() int

Len method #

func (p byFileName) Len() int

Len method #

func (b boundariesByPos) Len() int

Less method #

func (p byFileName) Less(i int, j int) bool

Less method #

func (b boundariesByPos) Less(i int, j int) bool

Less method #

func (b blocksByStart) Less(i int, j int) bool

ParseProfiles function #

ParseProfiles parses profile data in the specified file and returns a Profile for each source file described therein.

func ParseProfiles(fileName string) ([]*Profile, error)

ParseProfilesFromReader function #

ParseProfilesFromReader parses profile data from the Reader and returns a Profile for each source file described therein.

func ParseProfilesFromReader(rd io.Reader) ([]*Profile, error)

Swap method #

func (b blocksByStart) Swap(i int, j int)

Swap method #

func (b boundariesByPos) Swap(i int, j int)

Swap method #

func (p byFileName) Swap(i int, j int)

parseLine function #

parseLine parses a line from a coverage file. It is equivalent to the regex ^(.+):([0-9]+)\.([0-9]+),([0-9]+)\.([0-9]+) ([0-9]+) ([0-9]+)$ However, it is much faster: https://golang.org/cl/179377

func parseLine(l string) (fileName string, block ProfileBlock, err error)

seekBack function #

seekBack searches backwards from end to find sep in l, then returns the value between sep and end as an integer. If seekBack fails, the returned error will reference what.

func seekBack(l string, sep byte, end int, what string) (value int, nextSep int, err error)

Generated with Arrow