首页 > 学院 > 开发设计 > 正文

Go | golang 1.8 is released

2019-11-08 02:37:21
字体:
来源:转载
供稿:网友

Go | golang 1.8 is released


今天打开golang.org,惊喜发现golang 1.8发布了,果断切换到1.8的开发环境。以下内容摘录自官网


语言方面改变

When explicitly converting a value from one struct type to another, as of Go 1.8 the tags are ignored. Thus two structs that differ only in their tags may be converted from one to the other:

func example() { type T1 struct { X int `json:"foo"` } type T2 struct { X int `json:"bar"` } var v1 T1 var v2 T2 v1 = T1(v2) // now legal}

The language specification now only requires that implementations support up to 16-bit exponents in floating-point constants. This does not affect either the “gc” or gccgo compilers, both of which still support 32-bit exponents.

如果两个结构体只有tag信息是不一样的,可以直接强制转换。


GC STW时间比1.7有所优化

Garbage collection pauses should be significantly shorter than they were in Go 1.7, usually under 100 microseconds and often as low as 10 microseconds. See the document on eliminating stop-the-world stack re-scanning for details. More work remains for Go 1.9.

10us级别的STW,爽!


更多信息请参考https://golang.org/doc/go1.8


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表