<p>This is my first time writing an API client in Go and I'd appreciate any feedback you guys have. It's still fairly small but has the basics of connecting, authenticating, and a few endpoint calls in place.</p>
<p>I think I'm doing things in an idiomatic way but want to make sure.</p>
<p>Also, if anyone is interested in contributing to this let me know!</p>
<p>Docs: <a href="http://godoc.org/github.com/jpoehls/go-conduit">http://godoc.org/github.com/jpoehls/go-conduit</a><br/>
Code: <a href="http://github.com/jpoehls/go-conduit">http://github.com/jpoehls/go-conduit</a> (README has usage examples)</p>
<p><strong>Update</strong>: I should mention that my tests are basically non-existent at this point. I plan to flush them out but they are just a sanity check for now.</p>
<hr/>**评论:**<br/><br/>Ainar-G: <pre><p>Disclaimer: I've never worked with Conduit API, so I can't judge the correctness of your code. As for the style, it seems all right apart from a couple of nits:</p>
<ul>
<li><p>s/Uri/URI/ in your <a href="http://godoc.org/github.com/jpoehls/go-conduit#PHIDResult">PHIDResult</a></p></li>
<li><p><code>error</code> variables are usually called <code>err</code>, not <code>e</code>.</p></li>
<li><p><code>IsConduitError</code> looks useless; <code>ConduitError</code> is exported, so users can write a type assertion for themselves.</p></li>
</ul></pre>silent__thought: <pre><p>Thanks! I fixed the things you mentioned but left <code>IsConduitError</code> around for now. Will probably remove soon though since I agree it is is pretty useless.</p></pre>space-llama: <pre><p>It's not the worst. <code>call()</code> in <code>dialer.go</code> could probably be moved into utilities? There are a few places where you could compress some lines by making the call and checking the error in the <code>if</code> statement. Like, change <a href="https://github.com/jpoehls/go-conduit/blob/master/phid.go#L30" rel="nofollow">this</a> to be like <a href="https://github.com/jpoehls/go-conduit/blob/master/phid.go#L66" rel="nofollow">this</a>. There also seems to be an opportunity to use the reflect package to generalize all of the api endpoints + results but I'm sure there are plenty of good reasons not to.</p></pre>silent__thought: <pre><p>Thanks! Good catch on my <code>if</code> statements. I'm still getting use to the shorthand version and forget to use it most of the time.</p>
<p>I've cleaned those up and moved <code>call()</code> as well.</p></pre>PsyWolf: <pre><p>If you're familiar with python, you should check out the arcyon tool in <a href="https://github.com/bloomberg/phabricator-tools" rel="nofollow">https://github.com/bloomberg/phabricator-tools</a> . You can use as an example conduit client to check your implementation against.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传