Documentation ¶
Overview ¶
This code is adapted from the Go standard library's cover tool: https://github.com/golang/go/blob/master/src/cmd/cover/func.go
Index ¶
- func WriteHTMLEscapedCode(dst *bufio.Writer, line string) error
- func WriteHTMLEscapedLine(dst *bufio.Writer, lineNumber int, count *int, line string) error
- type GoDir
- type GoFile
- type GoListItem
- type GoProject
- type Pkg
- type TemplateData
- type TemplateLinkData
- type TemplateListItemData
- type TemplateViewData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteHTMLEscapedCode ¶ added in v0.2.2
WriteHTMLEscapedCode writes the given line to the provided bufio.Writer, escaping HTML special characters.
Types ¶
type GoDir ¶
type GoDir struct { *GoListItem SubDirs []*GoDir Files []*GoFile }
type GoFile ¶
type GoFile struct { *GoListItem ABSPath string Profile []cover.ProfileBlock }
type GoListItem ¶ added in v0.2.3
type GoListItem struct { RelPkgPath string ID string Title string StmtCount int StmtCoveredCount int }
func NewGoListItem ¶ added in v0.2.3
func NewGoListItem(relPkgPath string) *GoListItem
func (*GoListItem) Percent ¶ added in v0.2.3
func (item *GoListItem) Percent() float64
Percent calculates the percentage of statement coverage for a GoListItem.
type GoProject ¶
type GoProject struct { Dirs map[string]*GoDir RootPath string Cutlines *config.Cutlines Ignores []string }
func NewGoProject ¶
func (*GoProject) Parse ¶
Parse parses the input profiles filename and updates the GoProject's coverage report.
func (*GoProject) Report ¶
Report generates an HTML report of the GoProject and writes it to the provided io.Writer. The report includes a directory tree of the project's files and directories, along with coverage information.
type Pkg ¶
Pkg describes a single package, compatible with the JSON output from 'go list'; see 'go help list'.
type TemplateData ¶
type TemplateData struct { Views []*TemplateViewData InitialID string Cutlines *config.Cutlines }
TemplateData is a struct that holds data for generating HTML templates.
func (*TemplateData) AddDir ¶ added in v0.2.3
func (td *TemplateData) AddDir(dir *GoDir, links []*TemplateLinkData) error
AddDir adds a directory to the template data.
func (*TemplateData) AddFile ¶ added in v0.2.3
func (td *TemplateData) AddFile(file *GoFile, links []*TemplateLinkData) error
AddFile adds a Go file to the template data with the given links and returns an error if any. The method also generates the HTML-escaped lines of code for the file and adds them to the view data.
type TemplateLinkData ¶ added in v0.2.3
TemplateLinkData represents the data needed for a link in a template.
type TemplateListItemData ¶ added in v0.2.3
type TemplateListItemData struct { ClassName string ID string Title string Progress string Percent string NumStmtCovered int NumStmt int }
TemplateListItemData represents the data structure for a single item in the HTML template list.
func NewTemplateListItemData ¶ added in v0.2.3
func NewTemplateListItemData(item *GoListItem, cutlines *config.Cutlines) *TemplateListItemData
NewTemplateListItemData returns a new instance of TemplateListItemData based on the given GoListItem and Cutlines.
type TemplateViewData ¶ added in v0.2.3
type TemplateViewData struct { ID string Percent string NumStmtCovered int NumStmt int Links []*TemplateLinkData Items []*TemplateListItemData Lines string IsDir bool }
TemplateViewData represents the data needed to render a template view.