6

Golang 进阶文章一览

 3 years ago
source link: https://www.cyningsun.com/10-15-2020/advanced-golang-article.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

最近在组内 Code Review 发现很多同学学习时间虽然不短,但Golang的一些基本Pattern仍然有所疏漏。

譬如,RPC接口内随意go协程,不考虑调用量大之后,协程暴涨可能导致程序OOM。再譬如,协程不知道有哪些同步、退出机制。

如果时间不是问题,那么就是知识体系存在漏洞。那么一个体系化、结构化的指南,对他们应该会帮助,因此整理之前主体阅读过的经典文章,形成了本篇文章。

1、Golang Design Cornerstone

Do not communicate by sharing memory; instead, share memory by communicating.

《Share Memory By Communicating》
《Concurrency is not parallelism》

2、Concurrency Pattern

《Go Concurrency Patterns: Context》
《Go Concurrency Patterns: Pipelines and cancellation》
《Go Concurrency Patterns: Timing out, moving on》
《Advanced Go Concurrency Patterns》
《Context isn’t for cancellation》
《Never start a goroutine without knowing how it will stop》
《Rethinking Classical Concurrency Patterns》
《Timeouts and Deadlines》

3、Error Handling

《Errors are values》
《Don’t just check errors, handle them gracefully》

4、Naming

《Package names》
《Avoid package names like base, util, or common》

5、Package Management

《Using Go Modules》

6、Logging

《Let’s talk about logging》

7、Code Style

《SOLID Go Design》
《Do not fear first class functions》
《The Zen of Go》
《Clear is better than clever》
《Go, without package scoped variables》
《Should methods be declared on T or *T》
《Simplicity and collaboration》

8、Debug&Profile&Diagnostics

《Profiling Go Programs》
《Diagnostics》
《Stack Traces In Go》

9、TDD

《Prefer table driven tests》

10、Golang Struct

《If a map isn’t a reference variable, what is it?》
《Slices from the ground up》

11、精华网站

Gopher Academy BlogThe official Go BlogGolang TalksGo WikiDave Cheney

本文作者:cyningsun
本文地址https://www.cyningsun.com/10-15-2020/advanced-golang-article.html
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-ND 3.0 CN 许可协议。转载请注明出处!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK