Well structured and documented small/medium projects to learn from

agolangf · 2018-03-03 18:30:11 · 501 次点击    
这是一个分享于 2018-03-03 18:30:11 的资源,其中的信息可能已经有所发展或是发生改变。

Hi Everyone. I've been trying out Go for small projects for a month now, but when looking at my code I'm under the impression that I'm not using efficient patterns and making the most out of what Go gives (forgetting to use pointers, scarcely using anonymous functions).

I'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'd love to see it too!


评论:

leaf_bebop:

Standard libraries.

shovelpost:

but when looking at my code I'm under the impression that I'm not using efficient patterns and making the most out of what Go gives (forgetting to use pointers, scarcely using anonymous functions).

  • Read Effective Go many times.

  • Read CodeReviewComments.

  • Use tools like golint, go vet and gometalinter.

  • Post specific examples of things you are not sure about so we can help.

  • Don't worry and just keep coding.

hell_0n_wheel:

Don't worry and just keep coding.

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 $$$$$$$$$.

zacgarby:

Most of the standard libraries aren't that low level.

qu33ksilver:

forgetting to use pointers

A lot of people that using pointers makes your program "cool" and you feel like a real "software engineer".

In practice, pointers do not give the best performance always. Run gcflags="-m -m" and see for yourself. Sometimes, it is better to put things on stack. The stack is fast and cache-friendly. As always YMMV.

pom_bear:

Not sure if this is exactly what you're asking for but check out gophercises.com

s-kostyaev:

https://github.com/cweill/gotests for example.

peterbourgon:

I think https://github.com/oklog/oklog is quite well-done and easy to read, but I’m definitely biased.


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

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