go tool cover with go 1.8 doesn't open web page anymore

blov · · 472 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I have used go tool cover to get 100% coverage. Apparently <code>go tool cover -http &lt;file&gt;</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 &lt;file&gt;</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&#39;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&#39;ll retry tomorrow after the reboot.</p></pre>gohacker: <pre><p>Well, it definitely works for me. Here&#39;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&#39;m ashamed. I didn&#39;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 &lt;file&gt;</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 &amp;&amp; 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

472 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传