Giter VIP home page Giter VIP logo

goc's Introduction

goc

Go Report Card Build Release codecov GoDoc

English | 简体中文

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

Enjoy, Have Fun! Demo

Installation

# Mac/AMD64
curl -s https://api.github.com/repos/qiniu/goc/releases/latest | grep "browser_download_url.*-darwin-amd64.tar.gz" | cut -d : -f 2,3 | tr -d \" | xargs -n 1 curl -L | tar -zx && chmod +x goc && mv goc /usr/local/bin

# Linux/AMD64
curl -s https://api.github.com/repos/qiniu/goc/releases/latest | grep "browser_download_url.*-linux-amd64.tar.gz" | cut -d : -f 2,3 | tr -d \" | xargs -n 1 curl -L | tar -zx && chmod +x goc && mv goc /usr/local/bin

# Linux/386
curl -s https://api.github.com/repos/qiniu/goc/releases/latest | grep "browser_download_url.*-linux-386.tar.gz" | cut -d : -f 2,3 | tr -d \" | xargs -n 1 curl -L | tar -zx && chmod +x goc && mv goc /usr/local/bin

Goc supports both GOPATH project and Go Modules project with Go 1.11+. However, for developing goc, you need to install Go 1.13+.

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
    ...   
    
    PS:
    enricofoltran/simple-go-server/main.go:30.13,48.33 13 1
    
    File: enricofoltran/simple-go-server/main.go
    Position of first point of this code block: 30.13
    Position of second point of this code block: 48.33
    Number of statements of this code block: 13
    Number of executions of this code block: 1
    

Show Code Coverage Change at Runtime in Vscode

We provide a vscode extension - Goc Coverage which can show highlighted covered source code at runtime.

Extension

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 specify 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.

  4. The coverage data is stored on each covered service side, so if one service needs to restart during test, this service's coverage data will be lost. For this case, you can use following steps to handle:

    1. Before the service restarts, collect coverage with goc profile -o a.cov
    2. After service restarted and test finished, collect coverage again with goc profile -o b.cov
    3. Merge two coverage profiles together: goc merge a.cov b.cov -o merge.cov
  5. By default, goc will use the artifact's file name as its service name. You can overwrite it by setting environment variable GOC_SERVICE_NAME. (See #293 for details)

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

goc's People

Contributors

alonelucky avatar blaxon avatar carlji avatar dependabot[bot] avatar e06084 avatar gavwu avatar golangaccount avatar ifantsai avatar longbai avatar lyyyuna avatar meicanlirui avatar memoryliu avatar naisisor avatar qiniu-bot avatar socket515 avatar stardustman avatar sword-jin avatar tongjingran avatar vieira-zj avatar williamfzc avatar xen0n avatar xwen-winnie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

goc's Issues

goc comamnd should not print any logs when running normally

for example, goc build . would print the following information when it works normally, which is noisy:

2020/05/29 19:58:02 cover.go:114: go list cmd is: [go list -json . ./...]
2020/05/29 19:58:02 tmpfolder.go:65: Temp project generated in: /var/folders/_6/t59gxn4d0zz12vqlm3j3gwhr0000gn/T/goc-7af393cb71aa
2020/05/29 19:58:03 tmpfolder.go:78: New working/building directory in: /var/folders/_6/t59gxn4d0zz12vqlm3j3gwhr0000gn/T/goc-7af393cb71aa
2020/05/29 19:58:03 tmpfolder.go:47: New GOPATH:
2020/05/29 19:58:03 cover.go:114: go list cmd is: [go list -json . ./...]
2020/05/29 19:58:03 cover.go:89: handle package: github.com/qiniu/goc
2020/05/29 19:58:03 build.go:61: Go building in temp...
2020/05/29 19:58:06 build.go:76: Go build exit successful.
2020/05/29 19:58:06 binarymove.go:55: Generating binary: /Users/jicarl/qiniu/goc-1/goc

i think keeping the behavior of goc consistent with pure go command will make user more easier to use goc. not only goc build needs to be modified, but others as well.

goc build err but i can't understand , I need your help

"github.com/sparrc/go-ping"
I use goPing library in my projects . when i run the command "goc build ." error occurs but i can't understand.

mistake
./http_cover_apis_auto_generated.go:2135:89: undefined: cache_343664633233633838353763.GoCacheCover_0_34636232323162626631
./http_cover_apis_auto_generated.go:2137:88: undefined: cache_343664633233633838353763.GoCacheCover_1_34636232323162626631
./http_cover_apis_auto_generated.go:3978:17: undefined: cache_343664633233633838353763.GoCacheCover_0_34636232323162626631
./http_cover_apis_auto_generated.go:3980:17: undefined: cache_343664633233633838353763.GoCacheCover_1_34636232323162626631
FATA Fail to build: fail to execute: [/bin/bash -c go build -o /home/test .], err: exit status 2

cover.Store.GetAll() return a map will potentially cause panic(a map without protection)

// memoryStore holds the registered services only into memory
type memoryStore struct {
	mu          sync.RWMutex
	servicesMap map[string][]string
}

// Get returns all the registered service information
func (l *memoryStore) GetAll() map[string][]string {
	l.mu.RLock()
	defer l.mu.RUnlock()
	return l.servicesMap
}

Proposal:

  1. Clone a map and return
  2. Support access the map under protection

goc profile耗时很长

当有很多服务注册在goc server上面,服务被销毁后,获取覆盖率文件耗时很长,如果不手动清理,注册的服务会越来越多,耗时也越来越长。 有参数可以设置跟客服端的请求超时不

goc clear can't clear coverage data

收集了一堆覆盖率数据,想清除之前的重新收集,执行goc clear似乎无效
[user_00@user]$ goc clear
Register service aaa: http://127.0.0.1:57832 coverage counter clear call successfully
Register service bbb: http://127.0.0.1:51907 coverage counter clear call successfully

再次执行goc profile,仍然有覆盖率数据
杀掉goc server进程,重新打开,仍然有覆盖率数据

不知道是不是我理解错了,还是要用其他的方式清除数据?

add particular port for registered service

Some services run virtualized environment such as docker container. The registered service can expose fixed port, making them a relatively easy method of integration across virtualized container and service center

求设计文档

想问下,有相关 goc 的原理/架构设计相关的介绍吗?在线求

go get报错

xxxxMacBook-Pro:~ xxxx$ go get -u github.com/qiniu/goc

github.com/hashicorp/go-retryablehttp

xxx/src/github.com/hashicorp/go-retryablehttp/roundtripper.go:48:16: undefined: errors.Unwrap

github.com/qiniu/goc/pkg/build

xxxx/src/github.com/qiniu/goc/pkg/build/tmpfolder.go:86:5: undefined: errors.Is

unable to build project [https://github.com/enricofoltran/simple-go-server]

Steps:

  1. workspace and environment
➜  simple-go-server git:(master) echo $GOPATH
/Users/jicarl/k8s
➜  simple-go-server git:(master) pwd
/Users/jicarl/qbox/simple-go-server
➜  simple-go-server git:(master) git remote -v
origin	[email protected]:enricofoltran/simple-go-server.git (fetch)
origin	[email protected]:enricofoltran/simple-go-server.git (push)
➜  simple-go-server git:(master)
  1. try to use goc command to build this project, but got errors:
➜  simple-go-server git:(master) goc build .
2020/05/24 15:15:29 cover.go:114: go list cmd is: [go list -json . ./...]
2020/05/24 15:15:29 tmpfolder.go:65: Temp project generated in: /var/folders/_6/t59gxn4d0zz12vqlm3j3gwhr0000gn/T/goc-055cb24d8755
2020/05/24 15:15:29 tmpfolder.go:78: New working/building directory in: /var/folders/_6/t59gxn4d0zz12vqlm3j3gwhr0000gn/T/goc-055cb24d8755/Users/jicarl/qbox/simple-go-server
2020/05/24 15:15:29 tmpfolder.go:47: New GOPATH: /var/folders/_6/t59gxn4d0zz12vqlm3j3gwhr0000gn/T/goc-055cb24d8755:/Users/jicarl/k8s
2020/05/24 15:15:29 cover.go:114: go list cmd is: [go list -json . ./...]
2020/05/24 15:15:29 build.go:61: Go building in temp...
2020/05/24 15:15:29 build.go:74: Fail to execute: go build .. The error is: chdir /var/folders/_6/t59gxn4d0zz12vqlm3j3gwhr0000gn/T/goc-055cb24d8755/Users/jicarl/qbox/simple-go-server: no such file or directory, the stdout/stderr is:

Test all goc subcommands with goc itself

  1. current goc profile only support long-run program, needs to work out a solution or workaround to get profile of all running goc subcommands' coverage (build/install/cover/diff ...).

goc install fail to list package dependencies with golang ld warning info

go list ./... some packages with ld warning info:

ld: warning: ld: warning: object file (/var/folders/8c/hk9slbfs25lbn_3z8rl7jqkr0000gn/T/go-link-210771923/000000.o) was built for newer OSX version (10.15) than being linked (10.13)object file (/var/folders/8c/hk9slbfs25lbn_3z8rl7jqkr0000gn/T/go-link-210771923/go.o) was built for newer OSX version (10.15) than being linked (10.13)

ld: warning: object file (/var/folders/8c/hk9slbfs25lbn_3z8rl7jqkr0000gn/T/go-link-210771923/000001.o) was built for newer OSX version (10.15) than being linked (10.13)
{
"Dir": "/Users/lei.liu/qbox/src/qiniu.com/pili-cluster/src/qiniu.com/pili.v1/app/pili-aliasyncauth",
"ImportPath": "qiniu.com/pili.v1/app/pili-aliasyncauth",
"Name": "main",
..........
}

goc server 支持通过服务发现获取和运行是注册

现在是在 goc build 的时候指定 ip:port,能否支持在服务启动的时候通过服务发现,来获取 goc server 的 ip:port ? 场景是 goc server 的 ip 无法固定,同时服务的编译和启动是分开的,有一次编译,多次运行的场景。

cannot build if go.mod has relative path 'replace' directive

项目比较大,各种依赖很复杂,有十几个文件,之前都是用makefile编译的
执行goc build .报错
go: $path/[email protected]: parsing $path/go.mod: open $path/go.mod: no such file or directory
FATA Fail to build: fail to execute: [/bin/bash -c go build -o $path/$program .], err: exit status 1
试了下用go build .可以成功编译

goc profile confused because of different versions of same code

When we use same goc_server for several different version of same code, we found that the goc profile cannot show which version it get. This makes me confused.
How service bind:

$ > cat _svrs_address.txt
MyProject/moduleA&http://ip1:port1
MyProject/moduleA&http://ip2:port2

How goc profile show:

...
MyProject/moduleA/main.go:32.13,37.16 4 2
MyProject/moduleA/main.go:37.16,39.3 1 0
...

We build several goc_sever for each version to solve it temporary.
Goc should have power to make it possible for code version control.

wrong output binary name

The binary name should be generate from import path, not the directory path for gomodule project.

服务监听固定端口--agentport参数貌似没有生效?

各位贡献者,你们好!
这是一个超棒的工具!
我在使用的过程中,发现我设定固定监听端口没有生效,我是这样的一个过程:
1、首先启动server
image
2、执行命令goc build --agentport :8080 --debug .
image
3、goc run .
image
发现端口还是随机生成的54776,并不是刚才注册的8080端口。

是不是我漏掉了某些步骤?
然后我有用goc init重置配置,具体步骤如下:
1、执行goc init
image
2、执行goc register -a "http://127.0.0.1:8080" -n simple-go-server --debug
image
3、然后再执行 goc build --agentport :8080 --debug . && goc run .
image
发现端口还是随机生成的!
最后用8080端口请求数据,发现报错,且返回为空:
image
请大家指导~~~🌹

微信群聊二维码过期

大家好,README当中的微信群聊二维码似乎已经过期了,各位已经入群的朋友有时间的话可否更新一下?感谢。

有几个问题解答一下

最近有在尝试使用,几个问题望解答
1、使用goc build --center="http://127.0.0.1:7777" 编译后,如果goc的server没有启动,那么我编译后的服务,是否也无法启动?(我当前有这个问题)是否就是这样设计的?
2、register到center上是否只在服务启动的时候才注册?
3、当我的服务重启之后,注册在goc server上的信息不会remove,然后我goc profile或者goc clear 都会报错。当然,goc profile可以-f来强行获取,但是clear不行。
4、是否可以来一个remove的命令,让我对server上已经失去联系的服务自动进行清除。(如果不清理,以为着看你上面的信息会很多很多)
5、clear现在只有针对center的,是否可以提供针对service的clear?
6、覆盖率的数据是存在我自己的服务侧的,所以重启服务,或者服务突然down掉后,覆盖率数据就没有了,会重新开始收集?

If one of the covered services exit, goc profile cannot get the coverage

If the tested service exit before goc profile get the coverage file, goc profile will write the error message instead:

goc profile output:
{"error":"Get http://127.0.0.1:38102/v1/cover/profile: dial tcp 127.0.0.1:38102: connect: connection refused"}

expected:

  1. should output coverage always

期望支持 PersistenceFile 可配置

const PersistenceFile = "_svrs_address.txt"

背景:如果 go server 部署在 K8s 集群中当服务宕机重启后无法做到持久化
目标:在 K8s 集群中希望将文件通过 hostPath 或者 OSS 这种方式挂载实现持久化存储亦或是使用 ConfigMap
需求:
希望在 goc server 启动服务的时候增加 PersistenceFile 参数,如:goc server --port=:8080 --register-path=<persistence-file-path/register.txt>

suggest to do some retries when connect to github API failed

error log:

[2020-06-04T17:49:02.521244021+0800] INFO: goc diff and display in github comment
time="2020-06-04T17:49:02+08:00" level=error msg="Get PR changed file failed. repoOwner is: qbox, repoName is: kodo, prNum is: 2781"
time="2020-06-04T17:49:02+08:00" level=fatal msg="Get pull request changed file failed." error="Get https://api.github.com/repos/qbox/kodo/pulls/2781/files?page=1: dial tcp 13.250.168.23:443: connect: connection refused"

Encounter a problem when follows the instruction of gif in Readme

Nice tool!
I'm trying to use the goc tool by following the instructions of the gif in readme. But the output is unexpected.

First of all, I have installed goc tool through go get command and git clone the simple-go-server.
Then, goc run .looks great.
But the output of goc profile is not exactly the same as gif, and goc profile --center="http://127.0.0.1:52943" > coverage.out && go tool cover -func="coverage.out" throws a 'can't find package 'error.

The log is showed below:

➜  simple-go-server git:(master) ✗ goc run .
[goc] goc server started: http://127.0.0.1:52943 
http: 2020/07/08 14:14:29 Simple go server
http: 2020/07/08 14:14:29 Version: 
http: 2020/07/08 14:14:29 GitTag: 
http: 2020/07/08 14:14:29 GitCommit: 
http: 2020/07/08 14:14:29 GitTreeState: 
http: 2020/07/08 14:14:29 Server is starting...
http: 2020/07/08 14:14:29 Server is ready to handle requests at :5000

➜  simple-go-server git:(master) ✗ goc profile --center="http://127.0.0.1:52943"               
mode: count 
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:30.13,48.33 13 1
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:48.33,50.3 1 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:52.2,65.12 5 1
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:65.12,74.46 7 1
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:74.46,76.4 1 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:77.3,77.14 1 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:80.2,82.79 3 1
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:82.79,84.3 1 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:86.2,87.34 2 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:90.27,91.71 1 1
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:91.71,92.24 1 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:92.24,95.4 2 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:96.3,99.35 4 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:103.29,104.71 1 1
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:104.71,105.38 1 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:105.38,108.4 2 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:109.3,109.47 1 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:113.66,114.46 1 1
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:114.46,115.72 1 1
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:115.72,116.17 1 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:116.17,118.12 2 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:118.12,120.6 1 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:121.5,121.81 1 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:123.4,123.24 1 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:128.75,129.46 1 1
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:129.46,130.72 1 1
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:130.72,132.23 2 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:132.23,134.5 1 0
_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4/main.go:135.4,137.41 3 0

➜  simple-go-server git:(master) ✗ goc profile --center="http://127.0.0.1:52943" > coverage.out && go tool cover -func="coverage.out"
cover: cannot find package "_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4" in any of:
	/usr/local/go/src/_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4 (from $GOROOT)
	/Users/huangkuan/go/src/_/private/var/folders/wb/hmpbbl7j1jz74t843mxs7wqh0000gn/T/goc-build-ef63a484ffd4 (from $GOPATH)

Did I miss any steps in the gif?
Any suggestions will be appreciated :)

`goc build` failed in build nonStandardLegacy project

When build nonStandardLegacy project with goc, it will return an error like
http_cover_apis_auto_generated.go:20:2: cannot find package "gocbuildcd3524726b16" in any of: /usr/local/go/src/gocbuildcd3524726b16 (from $GOROOT) /Users/xxx/go/src/gocbuildcd3524726b16 (from $GOPATH)

If using go build instead, the binary will build successful.

nonStandardLegacy project: project only use basic go packages without setting gopath.

Sonar-scan can't parset coverage.out:ERROR: Error parsing coverage info for file /xxx/coverage.out: Invalid go coverage, expect 'mode:' on the first line.

sonar-scan can't parse the coverage.out generated by 'goc profile'

ERROR:
INFO: Load project repositories (done) | time=18ms
INFO: Load coverage report from '/xxx/coverage.out'
ERROR: Error parsing coverage info for file /xxx/coverage.out: Invalid go coverage, expect 'mode:' on the first line.
INFO: Sensor SonarGo [go] (done) | time=523ms

template with one blank in instrument.go
mux.HandleFunc("/v1/cover/profile", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "mode: {{.Mode }} \n")

proposal: goc version management

Like go

➜  goplus git:(0701) go version
go version go1.14.4 darwin/amd64

Goc should also have version management when publishing.

profile --coverfile 选项支持支持 "not contains" 语义

$ goc profile --address=http://127.0.0.1:9999 --coverfile="service*",'?!thrift_gen*' -o=coverage.out

FATA Goc server http://127.0.0.1:7777 return an error: {"error":"failed to filter profile based on the patterns: [service* ?!thrift_gen*], error: filterProfile failed with pattern ?!thrift_gen* for profile git.byted.org/ee/lark/facade/sticker/database/abase_sticker_set.go, err: error parsing regexp: missing argument to repetition operator: ?"}

可以看到,使用 ?!thrift_gen* 正则来排除 thrift_gen 下的文件时,就有报错了

Provide performance test report

It's time to do some performance test now, and provide the report in README or doc.

  1. go build/install vs goc build/install on some large project.
  2. goc profile with several covered binary
  3. original binary vs covered binary in runtime in count/set/atomic mode
  4. goc profile 1 HZ, in count/set/atomic mode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.