Code review requested: imap message broker

agolangf · · 390 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hello! I&#39;ve been learning Go for the past few weeks now, and finally released my very first project. It&#39;d be awesome to get a code review! </p> <p>Here is my project <a href="https://github.com/mikaa123/imapmq" rel="nofollow">https://github.com/mikaa123/imapmq</a></p> <p>Thanks!</p> <hr/>**评论:**<br/><br/>Ainar-G: <pre><blockquote> <p>Pwd</p> </blockquote> <p>&#34;Pwd&#34; usually means &#34;Print Working Directory&#34;. I&#39;d go with &#34;Pass&#34; or &#34;Password&#34;, but that&#39;s nitpicking.</p> <blockquote> <p>Logout()</p> </blockquote> <p>Usually such methods called close, but I don&#39;t know the specifics of IMAPMQ, so I might be wrong.</p> <p><a href="https://github.com/mikaa123/imapmq/blob/master/worker.go#L77" rel="nofollow">https://github.com/mikaa123/imapmq/blob/master/worker.go#L77</a></p> <p>Error ignored. Why?</p> <p><a href="https://github.com/mikaa123/imapmq/blob/master/imapmq.go#L28" rel="nofollow">https://github.com/mikaa123/imapmq/blob/master/imapmq.go#L28</a></p> <p>If all <code>done</code> ever does is being closed, why not make it <code>chan struct{}</code>?</p></pre>misokol123: <pre><p>Thanks for your input!</p> <blockquote> <p>&#34;Pwd&#34; usually means &#34;Print Working Directory&#34;. I&#39;d go with &#34;Pass&#34; or &#34;Password&#34;, but that&#39;s nitpicking.</p> </blockquote> <p>You&#39;re totally right, didn&#39;t think about that.</p> <blockquote> <p>Usually such methods called close, but I don&#39;t know the specifics of IMAPMQ, so I might be wrong.</p> </blockquote> <p>Makes sense, in this case it logs out of the IMAP session, but I guess that&#39;s an implementation detail. Close would probably be more explicit.</p> <blockquote> <p>Error ignored. Why?</p> </blockquote> <p>In this case it&#39;s ignored because no error can happen at that place. If it does, then it&#39;s a bug in my code and I&#39;d rather have it break loudly. I guess I could catch the error and Panic if it happens, but since I control the input, I&#39;m confident that it will never be called.</p></pre>FIuffyRabbit: <pre><p>Or passwd. Some security audits will complain at the usage of <em>password</em>. </p></pre>misokol123: <pre><p>Good to know. I ended-up using that.</p></pre>

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

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