First go project - feedback appreciated

xuanbao · · 408 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I wanted to give go a try so I made Sponge - a news and link aggregator. Any feedback or suggestions are appreciated!</p> <p><a href="https://github.com/bobo333/sponge" rel="nofollow">https://github.com/bobo333/sponge</a></p> <hr/>**评论:**<br/><br/>drannoc-dono: <pre><p>Hey man. That&#39;s a good job for a first go project. I do have some feedbacks for you :o)</p> <p>I suggest you using a more-fit-for-Go structure for your files, as described by Ben Johnson (<a href="https://medium.com/@benbjohnson/structuring-applications-in-go-3b04be4ff091" rel="nofollow">https://medium.com/@benbjohnson/structuring-applications-in-go-3b04be4ff091</a>). It&#39;s a classic behavior that a lot of beginners have (made it myself) to build its piece of software in Golang &#34;application oriented&#34; by putting the main package at the root of the sources, sort of a web fashion. Go development is &#34;library oriented&#34;, it&#39;s a different approach that I find more logical, makes you think of your code in a more open and reusable way.</p> <p>Pretty much linked to the &#34;application oriented&#34; way of thinking, you don&#39;t need to go ape with subpackages. Can become a hell of public/private struct with public/privates method and render your code harder to read. Golang point of view tends to be &#34;go the simplest way&#34;</p> <p>If I was trawler and your main function an iceberg, I would sink. I suggest you to cut it up in functions, some part of your main could be factorized, and use more early return conditions, for clarity.</p> <p>You test error return, that&#39;s good! But most of the times it simply gets printed. The user most likely won&#39;t know anything went wrong, except if software output gets read or redirected to a file. I guess that was enough for you to put it that way for now and change that in future updates, but I had to point this out.</p> <p>I hope that helped. Good day to you :o)</p></pre>bobo333: <pre><p>Thanks for taking the time to critique! Useful suggestions, and the article is helpful as well, cheers</p></pre>

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

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