Well structured and documented small/medium projects to learn from

agolangf · · 387 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi Everyone. I&#39;ve been trying out Go for small projects for a month now, but when looking at my code I&#39;m under the impression that I&#39;m not using efficient patterns and making the most out of what Go gives (forgetting to use pointers, scarcely using anonymous functions). </p> <p>I&#39;m looking for an inspiration based on well-known Go projects which are not as huge and complex as e.g. moby and perhaps not as low-level as the ones in standard lib. If they are well documented that would be a plus. Resources like blogs where someone way smarter than me goes from 0 to something more than main package script would be awesome too. If you have a project like that I&#39;d love to see it too!</p> <hr/>**评论:**<br/><br/>leaf_bebop: <pre><p>Standard libraries.</p></pre>shovelpost: <pre><blockquote> <p>but when looking at my code I&#39;m under the impression that I&#39;m not using efficient patterns and making the most out of what Go gives (forgetting to use pointers, scarcely using anonymous functions).</p> </blockquote> <ul> <li><p>Read <a href="https://golang.org/doc/effective_go.html" rel="nofollow">Effective Go</a> many times.</p></li> <li><p>Read <a href="https://github.com/golang/go/wiki/CodeReviewComments" rel="nofollow">CodeReviewComments</a>.</p></li> <li><p>Use tools like <code>golint</code>, <code>go vet</code> and <a href="https://github.com/alecthomas/gometalinter" rel="nofollow">gometalinter</a>.</p></li> <li><p>Post specific examples of things you are not sure about so we can help.</p></li> <li><p>Don&#39;t worry and just keep coding. </p></li> </ul></pre>hell_0n_wheel: <pre><blockquote> <p>Don&#39;t worry and just keep coding.</p> </blockquote> <p>This. Premature optimization is never a good thing. If your code works correctly and runs without unreasonable delay, who cares what it looks like under the hood? Tons and tons of ugly code out there making $$$$$$$$$.</p></pre>zacgarby: <pre><p>Most of the standard libraries aren&#39;t that low level.</p></pre>qu33ksilver: <pre><blockquote> <p>forgetting to use pointers</p> </blockquote> <p>A lot of people that using pointers makes your program &#34;cool&#34; and you feel like a real &#34;software engineer&#34;.</p> <p>In practice, pointers do not give the best performance always. Run <code>gcflags=&#34;-m -m&#34;</code> and see for yourself. Sometimes, it is better to put things on stack. The stack is fast and cache-friendly. As always YMMV.</p></pre>pom_bear: <pre><p>Not sure if this is exactly what you&#39;re asking for but check out gophercises.com </p></pre>s-kostyaev: <pre><p><a href="https://github.com/cweill/gotests" rel="nofollow">https://github.com/cweill/gotests</a> for example.</p></pre>peterbourgon: <pre><p>I think <a href="https://github.com/oklog/oklog" rel="nofollow">https://github.com/oklog/oklog</a> is quite well-done and easy to read, but I’m definitely biased.</p></pre>

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

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