Documentation ¶
Overview ¶
Package gocov is a code coverage analysis tool for Go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Default = &Context{}
Default coverage context.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { sync.Mutex // ObjectList is a sorted list of coverage objects // (packages, functions, etc.) Objects ObjectList // Tracer is used for tracing coverage. If nil, no tracing will occur. Tracer Writer // TraceFlags alters how coverage is traced. TraceFlags TraceFlag }
Coverage context.
func (*Context) RegisterPackage ¶
RegisterPackage registers a package for coverage.
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 // statements registered with this function. Statements []*Statement // number of times the function has been entered. Entered int64 // number of times the function has been left. Left int64 // contains filtered or unexported fields }
func (*Function) Accumulate ¶
Accumulate will accumulate the coverage information from the provided Function into this Function.
func (*Function) Enter ¶
func (f *Function) Enter()
Enter informs gocov that the function has been entered.
func (*Function) Leave ¶
func (f *Function) Leave()
Leave informs gocov that the function has been left.
func (*Function) RegisterStatement ¶
RegisterStatement registers a statement for coverage.
type Object ¶
type Object interface {
Uid() int
}
Object is an interface implemented by all coverage objects.
type ObjectList ¶
type ObjectList []Object
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 // contains filtered or unexported fields }
func RegisterPackage ¶
RegisterPackage registers a package for coverage using the default context.
func (*Package) Accumulate ¶
Accumulate will accumulate the coverage information from the provided Package into this Package.
func (*Package) RegisterFunction ¶
RegisterFunction registers a function for coverage.
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 // Reached is the number of times the statement was reached. Reached int64 // contains filtered or unexported fields }
func (*Statement) Accumulate ¶
Accumulate will accumulate the coverage information from the provided Statement into this Statement.
Notes ¶
Bugs ¶
(unlikely) overflow not handled