matm / gocov-html Goto Github PK
View Code? Open in Web Editor NEWMake pretty HTML output from gocov, a coverage testing tool for Go
License: MIT License
Make pretty HTML output from gocov, a coverage testing tool for Go
License: MIT License
my-package has no testfiles
gocov test github.com/my-package | gocov-html
panic: runtime error: index out of range
goroutine 1 [running]:
github.com/matm/gocov-html/cov.printReport(0x44d218, 0xc82002c010, 0xc82003be00)
github.com/matm/gocov-html/cov/report.go:163 +0xa0c
github.com/matm/gocov-html/cov.HTMLReportCoverage(0x44d2e8, 0xc82002c008, 0x0, 0x0, 0x0, 0x0)
github.com/matm/gocov-html/cov/report.go:276 +0x49f
main.main()
gopkg.in/matm/v1/gocov-html/gocov-html.go:50 +0xfb
The same with the XML reporter works:
gocov test github.com/my-package | gocov-xml
Latest version tag seems to be broken:
$ go install github.com/matm/gocov-html@latest
go: github.com/matm/gocov-html@latest: module github.com/matm/gocov-html@latest found (v1.1.1), but does not contain package github.com/matm/gocov-html
I'm using go 1.18.1 on ubuntu18
Hi @matm, is it possible that your latest commits introduced a regression issue.
When I want to install your package
go install github.com/matm/gocov-html/cmd/gocov-html@latest
I am getting following error:
../gopath/pkg/mod/github.com/matm/[email protected]/pkg/themes/theme.go:9:2: cannot use defaultTheme{} (value of type defaultTheme) as types.Beautifier value in array or slice literal: defaultTheme does not implement types.Beautifier (missing method Data)
../gopath/pkg/mod/github.com/matm/[email protected]/pkg/themes/theme.go:10:2: cannot use kitTheme{} (value of type kitTheme) as types.Beautifier value in array or slice literal: kitTheme does not implement types.Beautifier (missing method Data)
../gopath/pkg/mod/github.com/matm/[email protected]/pkg/themes/theme.go:14:33: cannot use defaultTheme{} (value of type defaultTheme) as types.Beautifier value in variable declaration: defaultTheme does not implement types.Beautifier (missing method Data)
Shall I use earlier version?
Best regards
Eckard.
Would allow to only add functions/methods whose code coverage is lower or greater than threshold values.
For example, the strings
package in the standard library have only 12 functions/methods with a code coverage < 100%.
Using a CLI flag -cmax 97
would add those 12 functions only into the generated HTML output.
Setting a threshold value can be useful to quickly find what is left for testing and generate the HTML output faster.
$ gocov test strings | gocov-html -cmax 97
-cmax
flag (default: 100) stating "only show functions whose coverage is less than cmax"-cmin
flag (default: 0) stating "only show functions whose coverage is more than cmin"If you have an empty function in your code base (e.g. for a callback) then it's being reported at "0/0 0%", but a more sensible output would be "0/0 100%".
volt
theme based on the volt boostrap themeMaybe a bootstrap template with some simple charts to improve the current UI.
-d
flat that prints the CSS content of the default theme to stdout-s
) into HTML documentREADME.md
go install
Makefile
to build-v
flag for program versiongo version 1.12.5 amd 64
my project is GOMOD enabled
export GO11MODULE=on
go get -v gopkg.in/matm/v1/gocov-html
gives me invalid module path "gopkg.in/matm/v1/gocov-html"
-r
flag to reverse order (boolean, defaults to false)See #11.
Running go install github.com/matm/gocov-html@latest
fails with the following error:
go install github.com/matm/gocov-html@latest: module github.com/matm/gocov-html@latest found (v1.1.1), but does not contain package github.com/matm/gocov-html
Installing with go install github.com/matm/gocov-html@71874e2e203b87a703f46020febb9650f0f8320d
works fine
Makefile
with targets for building for Linux/FreeBSD/Windows/Darwin/OpenBSD amd64The linked screenshot on the README is not working.
pkg/types
packageHi @matm
Tag v1.2 is broken - it should be v1.2.0
GO supports only semver tags or commit hashes for public modules.
https://go.dev/blog/publishing-go-modules
When I'm trying to install the latest version go fetches only v1.1.1
go install github.com/matm/gocov-html/cmd/gocov-html@latest
go: downloading github.com/matm/gocov-html v1.1.1
go: downloading github.com/axw/gocov v1.1.0
When I try to install v1.2
go throws an error
go install github.com/matm/gocov-html/cmd/[email protected]
go: github.com/matm/gocov-html/cmd/[email protected]: no matching versions for query "v1.2"
Output is very nice, but my code uses "<<" operator.
Instead of seeing:
flags & (1<<uint(i))
I only see:
flags & (1<
I think you didn't change the whole "<" to "<" (lol, github change html code :) => "& lt ;")
Regards
Use x.y.z in the table.
io/ioutil
for ReadAll()
instead of io.ReadAll()
go.mod
accordinglySee #26.
Dockerfile
showing the build instructionsGenerating the code for methods Beautifier.Template()
and Beautifier.Data()
will ease theme management. This way Beautifer.Assets()
can be used to simply define the required assets to build a theme.
Beautifier.Template()
and Beautifier.Data()
for the golang
(default) themepkg/themes/generator.go
that will generate a default_gen.go
file implementing those two methods with proper content taken from Assets()
go generate
before buildingremote: Cannot obtain refs from GitHub: cannot talk to GitHub: Get https://github.com/matm/gocov-html.git/info/refs?service=git-upload-pack: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
fatal: unable to access 'https://gopkg.in/matm/v1/gocov-html/': The requested URL returned error: 502
package gopkg.in/matm/v1/gocov-html: exit status 1
Makefile
Hi,
like this tool! Ad title: The source code in the report has sometimes malformed indentation (off by one level in both ways: 1 too much or 1 too les). It's only cosmetic, the tool is usable anyway. Thanks for publishing it.
The default HTML doc and its style can be vastly improved. Let's add support for themes and use the default CSS in the default theme.
-lt
flag to list available themes-t
flag to render a specific themeREADME.md
ChangeLog
Apologies for a newbie question (i'm fairly new to Go)
Let's say i have code living in
~/dev/project/go_implementation/api
. This is not inside my GOPATH
which is set to be ~/dev/go
.
I can run go test
and it passes fine.
However, when i run the gocov test
tool, i get an error saying that
coverage: 40.9% of statements ok _/Users/toli/dev/project/go_implementation/api 0.009s error: can't find "main.go": cannot find package "_/Users/toli/dev/project/go_implementation/api" in any of: /usr/local/Cellar/go/1.4.2/libexec/src/_/Users/toli/dev/project/go_implementation/api (from $GOROOT) /Users/toli/dev/go/src/_/Users/toli/dev/project/go_implementation/api (from $GOPATH)
If i symlink the directory to be inside GOPATH and cd into it, things work:
~/dev/go/src/github.com/toli/project/go_implementation/api
So, the potential newbie question: can gocov
only run from inside the GOPATH?
That works fine for me on my laptop, but I can't get it to work with CircleCI so i'm hoping there's an easier workaround.
➜ go git:(master) ✗ go get -u gopkg.in/matm/v1/gocov-html/cmd/gocov-html
# github.com/matm/gocov-html/pkg/cov
XXX/.gvm/pkgsets/go1.11/global/src/github.com/matm/gocov-html/pkg/cov/report.go:161:17: undefined: io.ReadAll
clean
target in build.mk
kit
theme based on the AdminKit bootstrap themeA declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.