xhd2015 / xgo

All-in-one go testing library
MIT License
368 stars 19 forks source link

trace not emitted when used with -cover #285

Closed xhd2015 closed 1 week ago

xhd2015 commented 1 week ago

This maybe caused by absence of blank import after rewritten by -cover.

xhd2015 commented 1 week ago

The situation is quite a corner case but yet common: the target package does not import github.com/xhd2015/xgo/runtime/trace, so trigger auto load. But since -cover is used, these files, firstly replaced by xgo, then replaced by go tool cover.

I may attribute this a bug to the go test -cover but there is a workaround: just instrument the .go and _test.go each at least for once.