https://github.com/po3rin/gocovercounter
gocovercounter lets you to generate coverage-annotated source.
https://github.com/po3rin/gocovercounter
counter coverage go
Last synced: 5 months ago
JSON representation
gocovercounter lets you to generate coverage-annotated source.
- Host: GitHub
- URL: https://github.com/po3rin/gocovercounter
- Owner: po3rin
- Created: 2019-05-18T15:43:29.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-20T03:57:01.000Z (about 7 years ago)
- Last Synced: 2024-06-20T05:13:10.146Z (almost 2 years ago)
- Topics: counter, coverage, go
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gocovercounter
gocovercounter lets you to generate coverage-annotated source.
code is Roughly mirror of golang/go/src/cmd/cover/cover.go.
## Quick Start
use package as CLI.
```bash
$ go get -u github.com/po3rin/gocovercounter/cmd/coco
$ coco ./testdata/testfile.go
```
coco outputs following. this code is coverage-annotated source.
```go
//line ./testdata/testfile.go:1
package testfile
import (
"bufio"
"fmt"
"os"
)
func Testfile() {GoCover.Count[0] = 1;
fmt.Println("text: ")
stdin := bufio.NewScanner(os.Stdin)
stdin.Scan()
text := stdin.Text()
if text != "hello" {GoCover.Count[2] = 1;
return
}
GoCover.Count[1] = 1;fmt.Println("hello")
}
var GoCover = struct {
Count [3]uint32
Pos [3 * 3]uint32
NumStmt [3]uint16
} {
Pos: [3 * 3]uint32{
9, 15, 0x150011, // [0]
18, 18, 0x160002, // [1]
15, 17, 0x30015, // [2]
},
NumStmt: [3]uint16{
5, // 0
1, // 1
1, // 2
},
}
```
If you use ```-o``` flag, coco creates output file.
```
$ coco -o out.txt ./testdata/testfile.go
```