Code coverage but only for new lines

238 views
Skip to first unread message

Arkadiusz Drabczyk

unread,
Sep 11, 2024, 6:17:04 AM9/11/24
to golan...@googlegroups.com
Is there a tool that can show code coverage but only for new lines,
for example added or changed since origin in case of Git repository?

Something similar to SonarQube but that works in command line.

--
Arkadiusz Drabczyk <arka...@drabczyk.org>

Fulton Shaw

unread,
Sep 13, 2024, 6:16:28 AM9/13/24
to golang-nuts

Arkadiusz Drabczyk

unread,
Sep 16, 2024, 9:10:44 AM9/16/24
to Fulton Shaw, golang-nuts
On Fri, Sep 13, 2024 at 03:16:28AM -0700, Fulton Shaw wrote:
> Take a look at https://github.com/xhd2015/xgo#incremental-coverage
>
> Example incremental code coverage:  https://github.com/xhd2015/xgo/blob/master/
> doc/img/coverage.jpg

Thanks but I don't know how to run it, I get:

git diff --diff-filter=R --summary --ignore-submodules "$compareRef" $ref -- || true
panic: Diff err: runtime error: invalid memory address or nil pointer dereference

goroutine 11 [running]:
some-git.com/some-corp/some-service/some-lv1/code-lens/support/testing-local/handler.InitStatic()
some-git.com/some-corp/some-service/some-lv1/code-lens/support/testing-local/handler/init.go:88 +0x225
created by some-git.com/some-corp/some-service/some-lv1/code-lens/support/testing-local/cmd/codelens-tool-coverage/run.setupFiles
some-git.com/some-corp/some-service/some-lv1/code-lens/support/testing-local/cmd/codelens-tool-coverage/run/main.go:247 +0x248
exit status 2

I tried to run it with changes commited on another branch and with
non-staged changes on master.

ref is always empty:

ref=

even when the environment variable is set:

ref=HEAD xgo tool coverage serve cover.out

--
Arkadiusz Drabczyk <arka...@drabczyk.org>

肖华冬

unread,
Sep 17, 2024, 10:41:54 PM9/17/24
to Arkadiusz Drabczyk, golang-nuts
Hi can you file an issue on the github issue thread list? We can follow up there

Arkadiusz Drabczyk <arka...@drabczyk.org> 于2024年9月16日周一 21:10写道:
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/66e82e2f.050a0220.121ee3.2bdaSMTPIN_ADDED_BROKEN%40gmr-mx.google.com.

Nikolay Dubina

unread,
Oct 14, 2024, 1:38:36 PM10/14/24
to golang-nuts
xgo is very interesting tool. thanks for sharing
Reply all
Reply to author
Forward
0 new messages