Go1.18 快讯:废弃了这个 API

从 11 月 01 日起,Go1.18 就冻结了,也就是 1.18 的功能已经确定。所有语言标记值都保证格式良好。

Go1.18 快讯:新增的 Cut 函数太方便了

strings 包中,Index 相关函数有好几个:Go 官方统计了 Go 源码中使用相关函数的代码:311 Index calls outside examples and testdata.

Go1.18 快讯:这个新特性太实用了

在 bar.go 中增加如下示例代码:接着,在 example 模块中处理:在 main.go 中增加如下内容:这时候,如果我们运行 go mod tidy,肯定会报错,因为我们的 mypkg 包根本没有提交到 github 上,肯定找不到。

Go1.18 快讯:新的 IP 包

早在 2017 年 1 月,Brad Fitzpatrick 就提了 issue,认为 net.IP 的设计存在问题:见原文链接,那时他还在 Go Team。因为 Go 中 slice 类型是不可比较的,也就是说 net.IP 不支持 ==,也不能作为 map 的 key。