版本学习

主要是对我有影响的变更

1.21

  • 新增min和max函数,类似Python的min和max函数

  • 新增slices包,提供了python的list.in、二分法搜索等功能

  • 新增maps包,提供了python的dict.keys、dict.values等功能(实际上这两个函数是等到1.23版本才支持)

  • 新增的toolchain指令, goland的2023.1版本go.mod不识别这个指令

1.20新内容

https://golang.google.cn/doc/go1.20

Go 1.17 added conversions from slice to an array pointer. Go 1.20 extends this to allow conversions from a slice to an array: given a slice x, [4]byte(x) can now be written instead of *(*[4]byte)(x).

列表便捷转换成数组,有空写代码验证下