Documentation ¶
Overview ¶
Package parser parses the cover profiles into statements.
Index ¶
Constants ¶
const ( Original State = "Original" Changed State = "Changed" Keep Mode = "Keep" Ignore Mode = "Ignore" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FuncExtent ¶
type FuncExtent struct {
// contains filtered or unexported fields
}
FuncExtent describes a function's extent in the source by file and position.
type FuncVisitor ¶
type FuncVisitor struct {
// contains filtered or unexported fields
}
FuncVisitor implements the visitor that builds the function position list for a file.
type Function ¶
type Function struct { // Name is the name of the function. If the function has a receiver, the // name will be of the form T.N, where T is the type and N is the name. Name string // File is the full path to the file in which the function is defined. File string // Start is the start offset of the function's signature. Start int // End is the end offset of the function. End int // StartLine is the start line number of the function. StartLine int // EndLine is the end line number of the function. EndLine int // statements registered with this function. Statements []*Statement }
func (*Function) Accumulate ¶
Accumulate will accumulate the coverage information from the provided Function into this Function.
type Mode ¶
type Mode string
Mode represents statement's mode. "Keep" means it will be used in coverage calculation "Ignore" means it won't be used in coverage calculation
type Package ¶
type Package struct { // Name is the canonical path of the package. Name string // Functions is a list of functions registered with this package. Functions []*Function // IgnoreProfiles is a list of ignore profiles that within this package. IgnoreProfiles []*annotation.IgnoreProfile }
func (*Package) Accumulate ¶
Accumulate will accumulate the coverage information from the provided Package into this Package.
type Packages ¶
type Packages []*Package
Packages represents a set of Package structures. The "AddPackage" method may be used to merge package coverage results into the set.
func ReadPackages ¶
ReadPackages takes a list of filenames and parses their contents as a Packages object.
The special filename "-" may be used to indicate standard input. Duplicate filenames are ignored.
func (*Packages) AddPackage ¶
AddPackage adds a package's coverage information to the
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser wrapper for parsing
type State ¶
type State string
State represents statement's state. "Original" means it hasn't changed compared with compare branch (master or main) "Changed" means it has been changed compared with compare branch (master or main)
type Statement ¶
type Statement struct { // Start is the start offset of the statement. Start int // End is the end offset of the statement. End int // StartLine is the start line number of the statement. StartLine int // EndLine is the end line number of the statement. EndLine int // Reached is the number of times the statement was reached. Reached int64 // State indicates whether current statement is changed or not. State State // Mode indicates whether current statement counts for coverage. Mode Mode }
func (*Statement) Accumulate ¶
Accumulate will accumulate the coverage information from the provided Statement into this Statement.
type StmtExtent ¶
type StmtExtent extent
StmtExtent describes a statements's extent in the source by file and position.
type StmtVisitor ¶
type StmtVisitor struct {
// contains filtered or unexported fields
}
func (*StmtVisitor) VisitStmt ¶
func (v *StmtVisitor) VisitStmt(s ast.Stmt)