GoExpertProgramming
GoExpertProgramming copied to clipboard
《Go专家编程》Go语言快速入门,轻松进阶!
```go func ReadChanReturnValue() { ch := make(chan int, 10) ch
容器类型: - heap(src/container/heap) - list(src/container/list) - ring(src/container/ring) - set(非标准库)(https://github.com/kubernetes/kubernetes/tree/master/staging/src/k8s.io/apimachinery/pkg/util/sets) 参考素材: - `heap` kubefed 实现的[delivererHeap](https://github.com/kubernetes-sigs/kubefed/blob/de2e0a9f0aa41971a79e6bd72cc184b4aa592231/pkg/controller/util/delaying_deliverer.go#L41) - `heap` kubernetes 实现的 [TimeValue](https://github.com/kubernetes/kubernetes/blob/b07d99dd35e9b74389dbdde59f3496755bb04d14/pkg/controller/nodelifecycle/scheduler/rate_limited_queue.go#L43)
Gopher
浏览了你的开源书,还有开源社区的贡献,发现你不仅参与kubernetes & CNCF 比较多,而且对Go语言也有极大的研究热情,可以留个邮箱交流下吗?
感谢开源出这么好的文章,这一定是我在 Github 发现的最有价值的仓库之一。 在协程调度一文 **3.1 队列轮转** 中,有提到如下观点: > 上图中可见每个P维护着一个包含G的队列,不考虑G进入系统调用或IO操作的情况下,P周期性的将G调度到M中执行,执行一小段时间,将上下文保存下来,然后将G放到队列尾部,然后从队列中重新取出一个G进行调度。 文中的观点是 P 存在有类似时间片的调度机制,不管 G 是否执行完毕,会把它重新放入队列,再取出新的 G 执行。 但我在[另外一篇文章](https://rakyll.org/scheduler/)中又读到 > Once a runnable G is found, it is executed until it is...
``` [root@ecs-d8b6 ~]# go tool trace Usage of 'go tool trace': Given a trace file produced by 'go test': go test -trace=trace.out pkg Open a web browser displaying trace: go...
源码: ``` func RangeString() { s := "Hello World" for i, v := range s { fmt.Printf("index: %d, value: %c\n", i, v) } } ``` Example: ``` func ExampleRangeString() {...
Go的switch语句分为两种类型: - 表达式 - 类型 参考资料: [Switch statements](https://golang.org/ref/spec#Switch_statements).
https://github.com/RainbowMango/GoExpertProgramming/blob/master/chapter09/9.1.2-timer_principle.md#%E5%81%9C%E6%AD%A2timer > Timer还未触发,系统协程已经删除该Timer,Stop()返回false; > Timer已经触发,系统协程还未删除该Timer,Stop()返回true; https://golang.google.cn/pkg/time/#Timer.Stop > It returns true if the call stops the timer, false if the timer has already expired or been stopped. 可能是这样的? - Timer还未触发,且系统协程还未删除该Timer,Stop()返回true -...
- [10 Essential Go Interview Questions](https://www.toptal.com/go/interview-questions)