Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
35 changes: 26 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
Gocov HTML export
=================

This is a simple helper tool for generating HTML output from `axw/gocov`_.
This is a simple helper tool for generating HTML output from `axw/gocov`_

.. _axw/gocov: https://github.com/axw/gocov
.. _axw/gocov: https://github.com/axw/gocov

Here is a screenshot:
and it forked from `matm/gocov-html`_.

.. _matm/gocov-html: https://github.com/matm/gocov-html

.. image:: https://github.com/matm/gocov-html/blob/master/gocovh-html.png
:scale: 40 %
:alt: HTML coverage report screenshot
:align: center


Installation
Expand All @@ -19,20 +17,39 @@ Installation
Just type the following to install the program and its dependencies::

$ go get github.com/axw/gocov/gocov
$ go get -u gopkg.in/matm/v1/gocov-html
$ go get github.com/XingyanLee/gocov-html

Usage
-----


first step: Set environment variable `GO_COV_HTML_REORDER`::

$ export GO_COV_HTML_REORDER=1

`gocov-html` can read a JSON file or read from standard input::

$ gocov test net/http | gocov-html > http.html
$ gocov convert c.out | gocov-html > http.html

or::

$ gocov test net/http > http.json
$ gocov-html http.json > http.html

if you want to use former sorting algorithm,just set `GO_COV_HTML_REORDER` to null or do not set environment variable `GO_COV_HTML_REORDER`.


if you want to compare current and previous code coverage file, the former must be a json file and need be written after the filed '-diff' . In addition,you need set an environment variable `GO_COV_HTML_REORDER_TOPN` whose value is up to you. Its default value is 10. These two command will show `GO_COV_HTML_REORDER_TOPN` functions whose coverage is less than the former file::

$ export GO_COV_HTML_REORDER_TOPN=10
$ gocov convert c.out | gocov-html -diff formerfilename.json> http.html


if you want to see functions whose coverage is less than a certain value in current code coverage file, you just need to set a environment variable `GO_COV_HTML_REORDER_NEWFUNLIMIT` whose value is up to you. this command will highlight the functions whose coverage is less than `GO_COV_HTML_REORDER_NEWFUNLIMIT`::

$ export GO_COV_HTML_REORDER_NEWFUNLIMIT=90


The generated HTML content comes along with a default embedded CSS. Use the `-s`
flag to use a custom stylesheet::

Expand Down
4 changes: 2 additions & 2 deletions cov/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const (
text-align: center;
font-size: 20px;
font-weight: bold;
color: 375eab;
color: #375eab;
}
.funcname {
text-align: left;
Expand Down Expand Up @@ -149,7 +149,7 @@ const (
padding: 10px;
margin: 20px;
line-height: 18px;
font-size; 14px;
font-size: 14px;
}
a {
text-decoration: none;
Expand Down
Loading