<p>I have used go tool cover to get 100% coverage. Apparently <code>go tool cover -http <file></code> is not working anymore with go 1.8 as it did with go 1.7.x. </p>
<p>How can we see the code coverage ?</p>
<hr/>**评论:**<br/><br/>gohacker: <pre><blockquote>
<p>-http <file></p>
</blockquote>
<p>Did that ever work? It has always been <code>-html</code>.</p></pre>chmikes: <pre><p>It could be a typo. Sorry. I had an alias. So I'm using the exact same command that worked with go 1.7.x.
However, in the mean time there have been system updates and firefox updates. I'll retry tomorrow after the reboot.</p></pre>gohacker: <pre><p>Well, it definitely works for me. Here's how go tool cover chooses between browsers: <a href="https://github.com/golang/go/blob/678f35b676de075375066ade2935296dfb8050ec/src/cmd/internal/browser/browser.go#L17-L38" rel="nofollow">https://github.com/golang/go/blob/678f35b676de075375066ade2935296dfb8050ec/src/cmd/internal/browser/browser.go#L17-L38</a></p></pre>chmikes: <pre><p>I'm ashamed. I didn't notice that I was connected on a remote host. Of course it could not work in this condition. After switching to the local host it now works. </p></pre>gotack: <pre><p><code>go tool cover -html <file></code> seems to do the trick for me on <code>go version go1.8 linux/amd64</code></p></pre>SSoreil: <pre><p>Not sure if this will help you but I had issues with it on either Go 1.6 or Go 1.7 as well. The process would use 100% CPU and I think memory started to leak like crazy as well.</p></pre>nstratos: <pre><p>This command used to be my bread and butter before vim-go made it easier:</p>
<pre><code>go test -covermode=count -coverprofile=count.out && go tool cover -html=count.out
</code></pre>
<p>But I still use it sometimes because <a href="https://blog.golang.org/cover#TOC_6." rel="nofollow">heat maps</a> are cool! Oh wait.</p></pre>TcM1911: <pre><p>You may need to set the environment variable $BROWSER in your shell. </p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传