
Go学习笔记
奇妙海盐
这个作者很懒,什么都没留下…
展开
-
【Go学习笔记】return 语句是原子操作吗?
函数返回值一开始就定义为变量 z。在 defer 语句执行之前,为 z 赋值 100;执行 defer 后,z 的值更新为 200,并作为函数返回值进行返回,因此返回值可以体现 defer 操作产生的变化。在 defer 语句执行之前,将 z 的值赋给一个临时变量,并将这个临时变量作为函数返回值,因此 defer 语句对 z 的操作不影响函数返回值。...原创 2022-08-15 17:19:41 · 468 阅读 · 0 评论 -
【Go学习笔记】时间和字符串转换(time)
Parse解析一个格式化的时间字符串并返回它代表的时间。自定义layout参数时必须采用这一规定时间,该时间具有各项取值皆不相等的特征,Parse方法通过解析各项取值来确定时间格式。原创 2022-08-15 10:17:29 · 4507 阅读 · 0 评论 -
【Go学习笔记】堆(container/heap)
源码package heapimport "sort"// The Interface type describes the requirements// for a type using the routines in this package.// Any type that implements it may be used as a// min-heap with the following invariants (established after// Init has been原创 2022-04-04 22:21:10 · 465 阅读 · 2 评论