Any tool that combines gocode + gocoverage in a web interface that can be run locally?

xuanbao · · 715 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Generally when I write Go, I have a godoc server running so I can easily check the docs for the packages that I use (both mine and third parties). In addition I write many tests so I keep creating html coverages to see what parts I haven&#39;t covered yet.</p> <p>While this is a very useful workflow, it&#39;s not very streamlined. For example, I have to refresh go coverage html report manually after each <code>go test</code> and even then the refresh make the view to jump to the first file in the file-list. Also I have to keep two windows open, one for docs and one for coverage.</p> <p>So I was wondering if there&#39;s a tool that I can run in the root folder of my package and then it</p> <ul> <li>automatically discovers and run the tests for all of the sub-packages</li> <li>creates and shows coverage reports</li> <li>shows the docs for the package, sub-packages and all imported ones with the links to the source code</li> </ul> <p>So it would be kind of a local &#34;CI&#34;y tool. I looked around quite a bit and couldn&#39;t find anything that does the above. Is there such a tool available? </p> <p>As a side note, have you found the need for such a tool? If not, what&#39;s your typical workflow? I&#39;m curious to learn how to improve mine.</p> <p>Thanks.</p> <p><em>Edit 1</em> - In the title it should be &#34;godoc&#34;, not &#34;gocode&#34;.</p> <hr/>**评论:**<br/><br/>dasacc22: <pre><p><a href="https://github.com/smartystreets/goconvey" rel="nofollow">https://github.com/smartystreets/goconvey</a></p> <p>Runs tests on package and sub pkgs, does coverage. Not sure about the last bullet on your list.</p> <p>You can ignore the whole new way to write tests with goconvey, it works fine with standard Go tests.</p></pre>khaki0: <pre><p>Ha. This looks pretty neat. I had seen goconvey but I was under the impression that I had to change my tests to use their BDD-style of test so I never gave it a try. </p></pre>mdwhatcott: <pre><p>Not true, there are two parts to goconvey, the BDD library (which is built on top of the &#34;testing&#34; package), and the runner, which actually just runs &#34;go test&#34; on all your packages when a change is detected.</p></pre>natefinch: <pre><p>Have you guys thought about breaking out the two pieces? They don&#39;t really seem to need to be together.</p></pre>mwholt: <pre><p>Yes, actually. <a href="https://docs.google.com/document/d/1R72jRHDdbadhn1TC9SXvZSccrWAphYpkjpVYklhLzdk" rel="nofollow">https://docs.google.com/document/d/1R72jRHDdbadhn1TC9SXvZSccrWAphYpkjpVYklhLzdk</a></p> <p>Never got around to it, though - didn&#39;t have enough time.</p></pre>Growlizing: <pre><p>Goconvey is awesome. It runs all your tests, so if you want to avoid &#39;lock-in&#39; to the their test syntax, you can write your tests with any go test compatible runner.</p></pre>bketelsen: <pre><p>+1 goconvey is awesome. BIG GREEN DASHBOARD</p></pre>johnnydoebk: <pre><blockquote> <p>it works fine with standard Go tests</p> </blockquote> <p>It works incorrectly with some tests. Imagine you have the following function in your code:</p> <pre><code>func SomeFunction(...) { if condition { panic(&#34;...&#34;) } } </code></pre> <p>In tests you want to make sure it panics in case of certain condition:</p> <pre><code>func TestSomeFunction_PanicInCaseOfSmth(t *testing.T) { // Make sure the function panic&#39;ed. defer func() { if err := recover(); err == nil { t.Error(&#34;SomeFunction was expected to panic, but it didn&#39;t.&#34;) } } SomeFunction(...) } </code></pre> <p>This is an absolutely valid test in go that should pass if <code>SomeFunction</code> panics. But, goconvey doesn&#39;t think so.</p></pre>dasacc22: <pre><p>I agree, this is a valid test. I haven&#39;t run into this in use of goconvey. File a bug report?</p></pre>johnnydoebk: <pre><p>They disabled GH issues and I don&#39;t feel like I want to send them e-mail.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

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