This is a tool for outputting Golang coverage in HTML format.
| go cover | gover-html | |
|---|---|---|
| file list | dropdown list | show directory tree to sidebar |
| coverage by package | no | show in sidebar |
| coverage by function | exec go tool cover with -func option |
show at the top of the report |
| line number | no | yes |
$ go install github.com/masakurapa/gover-html@latest$ go test -coverprofile=coverage.out ./...
$ gover-html
$ open coverage.htmlcoverage profile for input. default is coverage.out.
file for output. default is coverage.html.
output only the specified file or directory.
you can specify multiple items separated by commas.
if "exclude" is also specified, "exclude" option takes precedence.
Must specify a relative path from the package root directory!!
In the case of the following directory tree
github.com/masakurapa/gover-html
└── internal
├── cover
│ ├── cover.go
│ └── func.go
├── html
│ ├── html.go
│ ├── template.go
│ └── tree
│ └── tree.go
└── profile
└── profile.go
You can filter the output by specifying values as follows.
# Output only `internal/cover`!!
$ gover-html -include 'internal/cover'
# Output only `internal/cover` and `internal/html/tree`!!
$ gover-html -include './internal/cover,internal/html/tree/'
# This is no good :-C
$ gover-html -include '/internal/cover'
$ gover-html -include 'cover'
$ gover-html -include 'html/tree'output expect the specified file or directory.
You can specify multiple items separated by commas.
if "include" is also specified, this option takes precedence.
Must specify a relative path from the package root directory!!
In the case of the following directory tree
github.com/masakurapa/gover-html
└── internal
├── cover
│ ├── cover.go
│ └── func.go
├── html
│ ├── html.go
│ ├── template.go
│ └── tree
│ └── tree.go
└── profile
└── profile.go
You can filter the output by specifying values as follows.
# Output excluding `internal/cover`!!
$ gover-html -exclude 'internal/cover'
# Output excluding `internal/cover` and `internal/html/tree`!!
$ gover-html -exclude './internal/cover,internal/html/tree/'
# This is no good :-C
$ gover-html -exclude '/internal/cover'
$ gover-html -exclude 'cover'
$ gover-html -exclude 'html/tree'If you specify include and exclude at the same time, the output looks like this.
$ gover-html -include 'internal/html' -exclude 'internal/html/tree/'
github.com/masakurapa/gover-html
└── internal
└── html
├── html.go
└── template.goHTML color theme to output (dark or light)
if the value is invalid, it will be dark.
gover-html looks for config files in the following paths from the current working directory.
.gover.yml
See .gover.yml for a example configuration file.