Go to file
2020-07-16 12:26:15 +08:00
.github/workflows add codecov.yaml 2020-07-11 08:43:27 +08:00
cmd add flags for cmd profile 2020-07-16 12:26:15 +08:00
docs/images README.md: Add demo gif of goc run 2020-06-19 13:17:15 +08:00
pkg add flags for cmd profile 2020-07-16 12:26:15 +08:00
tests add goc run e2e test 2020-07-12 20:02:11 +08:00
.gitignore Add agentport flag check 2020-07-09 16:03:09 +08:00
ci-build.sh goc version: dynamic inject the version value when publishing 2020-07-03 19:36:49 +08:00
codecov.yaml add codecov.yaml 2020-07-11 08:43:27 +08:00
go.mod add flags for cmd profile 2020-07-16 12:26:15 +08:00
go.sum goc build goc 2020-07-11 08:31:05 +08:00
goc.go update copyright with qiniu.com url 2020-05-26 00:21:54 +08:00
LICENSE update copyright with qiniu.com url 2020-05-26 00:21:54 +08:00
Makefile add makefile 2020-07-10 10:20:43 +08:00
OWNERS init the directory structure and create OWNERS file (#2) 2020-05-09 15:34:47 +08:00
README.md doc: add Tips into readme 2020-07-05 00:16:11 +08:00

goc

Go Report Card Build Release codecov GoDoc

goc is a comprehensive coverage testing system for The Go Programming Language, especially for some complex scenarioslike system testing code coverage collection and accurate testing.

Enjoy, Have Fun! Demo

Installation

To install goc tool, you need to install Go first (version 1.11+ is required), then:

go get -u github.com/qiniu/goc

Examples

You can use goc tool in many scenarios.

Code Coverage Collection for your Golang System Tests

Goc can collect code coverages at runtime for your long-run golang applications. To do that, normally just need three steps:

  1. use goc server to start a service registry center:
    ➜  simple-go-server git:(master) ✗ goc server
    
  2. use goc build to build the target service, and run the generated binary. Here let's take the simple-go-server project as example:
    ➜  simple-go-server git:(master) ✗ goc build .
    ... // omit logs
    ➜  simple-go-server git:(master) ✗ ./simple-go-server  
    
  3. use goc profile to get the code coverage profile of the started simple server above:
    ➜  simple-go-server git:(master) ✗ goc profile
    mode: atomic
    enricofoltran/simple-go-server/main.go:30.13,48.33 13 1
    enricofoltran/simple-go-server/main.go:48.33,50.3 1 0
    enricofoltran/simple-go-server/main.go:52.2,65.12 5 1
    enricofoltran/simple-go-server/main.go:65.12,74.46 7 1
    enricofoltran/simple-go-server/main.go:74.46,76.4 1 0
    ...   
    

Tips

  1. To understand the execution details of goc tool, you can use the --debug flag. Also we appreciate if you can provide such logs when submitting a bug to us.

  2. By default, the covered service will listen a random port in order to communicate with the goc server. this may not be suitable in docker or kubernetes environment since the port must be exposed explicitly in order to be accessible by others in such environment. For this kind of scenario, you can use --agentport flag to specific a fixed port when calling goc build or goc install.

  3. To use a remote goc server, you can use --center flag to compile the target service with goc build or goc install command.

RoadMap

  • Support code coverage collection for system testing.
  • Support code coverage counters clear for the services under test at runtime.
  • Support develop mode towards accurate testing.
  • Support code coverage diff based on Pull Request.
  • Optimize the performance costed by code coverage counters.

Contributing

We welcome all kinds of contribution, including bug reports, feature requests, documentation improvements, UI refinements, etc.

Thanks to all contributors!!

License

Goc is released under the Apache 2.0 license. See LICENSE.txt