coverage

package
v2.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Profile

type Profile struct {
	// contains filtered or unexported fields
}

Profile holds which source lines are covered by tests.

func ParseProfile

func ParseProfile(path, modulePath string) (*Profile, error)

ParseProfile parses a Go coverage profile (generated by go test -coverprofile) using modulePath to strip the module prefix from each entry, leaving relative paths that can be matched against absolute file paths.

Example: with modulePath="github.com/acme/app", the profile entry "github.com/acme/app/pkg/foo.go:5.1,10.3 2 1" becomes key "pkg/foo.go".

func (*Profile) IsCovered

func (p *Profile) IsCovered(absFile string, line int) bool

IsCovered reports whether the given absolute file path and line number are reached by any test. The match uses the relative path suffix of absFile against the module-relative keys stored in the profile.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL