Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/winlinvip/gocover
A example for go coverage
https://github.com/winlinvip/gocover
Last synced: about 1 month ago
JSON representation
A example for go coverage
- Host: GitHub
- URL: https://github.com/winlinvip/gocover
- Owner: winlinvip
- License: mit
- Created: 2017-06-21T09:44:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-11T10:35:15.000Z (about 5 years ago)
- Last Synced: 2024-06-20T17:54:29.619Z (6 months ago)
- Language: HTML
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gocover
A example for go coverage
## Test
Get package:
```
go get github.com/winlinvip/gocover
```Run the utest `go test ./... -v`:
```
go test ./... -v
# === RUN TestMin
# --- PASS: TestMin (0.00s)
# PASS
# ok _/Users/winlin/git/gocover/core 0.007s
```## Cover
First, generate cover files:
```
mkdir -p cover &&
go test github.com/winlinvip/gocover/core -cover -coverprofile cover/core.cover &&
go test github.com/winlinvip/gocover/protocol -cover -coverprofile cover/protocol.cover
```Then, combile the data:
```
echo 'mode: set' > system.cover &&
tail -q -n +2 cover/*.cover >> system.cover
```Finally, generate the report:
```
go tool cover -html=system.cover -o system.html
```Please read the [report](https://winlinvip.github.io/gocover/system.html#file0) here.
## Simple Usage
To get the coverage of a specified package, please run:
```
go test github.com/winlinvip/gocover/protocol -cover -coverprofile out.cover &&
go tool cover -html=out.cover