
读完Golang源码
小企鹅么么
just学习
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
读完Golang源码之Runtime-Slice
基于源码Golang1.14.2切片和数组的不同数组:计算机会为数组分配一块连续的内存来保存数组中的元素,我们可以利用数组中元素的索引快速访问元素对应的存储地址切片:切片其实就是动态数组,它的长度并不固定,可以追加元素并会在切片容量不足时进行扩容。slice相关源码结构type slice struct { array unsafe.Pointer len int cap...原创 2020-04-14 20:26:52 · 936 阅读 · 0 评论 -
读完Golang源码之Context
介绍Go 1.7 标准库引入 context,中文译作 “上下文”,准确说它是 goroutine 的上下文,包含 goroutine 的运行状态、环境、现场等信息。context 主要用来在 goroutine 之间传递上下文信息,包括:取消信号、超时时间、截止时间、k-v 等。context 用来解决 goroutine 之间退出通知、元数据传递的功能。实现包整体介绍名称...原创 2020-03-30 00:12:33 · 198 阅读 · 0 评论 -
读完Golang源码之Container
堆type Interface interface { sort.Interface Push(x interface{}) Pop() interface{} // remove and return element Len() - 1.}其中sort.Interface如下图,具体介绍会在Sort里面介绍type Interface interface { Len() i...原创 2020-03-31 18:55:36 · 220 阅读 · 0 评论