Request for Code Review

agolangf · · 421 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>So seeing as how this is my first attempt at writing an app in GO I decided to keep the problem domain simple. </p> <p>This is a very cliche service which exposes a TODO API.</p> <p>It was written using a layered object oriented design approach.</p> <p>Given that the language lends itself well to procedural programming, I was hoping to receive some feedback from the community regarding this design decision and whether they feel that it&#39;s easier to read. </p> <p><a href="https://github.com/schweppesale/todo" rel="nofollow">https://github.com/schweppesale/todo</a></p> <hr/>**评论:**<br/><br/>shovelpost: <pre><blockquote> <p>layered object oriented design approach</p> </blockquote> <p>This structure and naming looks almost exactly like my first Go application (I have Java background).</p> <p>While this structure works, it&#39;s really not ideal for Go.</p> <p>Please read Ben Jonhson&#39;s article about <a href="https://medium.com/@benbjohnson/standard-package-layout-7cdbc8391fc1" rel="nofollow">standard package layout</a>.</p></pre>Schweppesale: <pre><p>Thanks. I&#39;ll check this out later tonight.</p></pre>nstratos: <pre><p>I&#39;ve also passed from this phase when writing my first Go code. </p> <p>Please read <a href="https://www.reddit.com/r/golang/comments/56wk4v/structuring_go_api/d8n4axl/" rel="nofollow">my answer on a similar question</a> as I have assembled quite a few resources that you might find useful.</p></pre>Schweppesale: <pre><p>You&#39;re the man. Thank you.</p></pre>md2perpe: <pre><p>Instead of </p> <pre><code> switch { case request.Method == &#34;GET&#34;: </code></pre> <p>use</p> <pre><code> switch request.Method { case &#34;GET&#34;: </code></pre></pre>lilgnomeo: <pre><p>Almost unbearable to read, sorry.</p></pre>allhatenocattle: <pre><p>Why not give feedback that is helpful? </p> <p>If you can&#39;t, what is the point of your message?</p></pre>

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

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