0

打印 Go Test 的代码覆盖

 2 years ago
source link: https://blog.lucien.ink/archives/520/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

打印 Go Test 的代码覆盖

  1. 首页
请注意,本文编写于 228 天前,最后修改于 224 天前,其中某些信息可能已经过时。

打印 Go Test 的代码覆盖

本文地址:blog.lucien.ink/archives/520

将这段代码复制进 ~/.zshrc 或者是 ~/.bashrc 等文件中(取决于你的命令行),然后在任何一个 Go Package 中执行 cover 即可。

cover() { 
    t="/tmp/go-cover.$$.tmp"
    go test -coverprofile=$t $@ && go tool cover -html=$t && unlink $t
}
  1. How to measure test coverage in Go
最后修改:2021 年 07 月 29 日 05 : 36 PM
谢谢老板!
  1. 马内
    August 3rd, 2021 at 10:18 pm

    感谢博主的分享,支持了。
    技术文章,学习了。

发表评论 取消回复

评论 *

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK