dushaoshuai / dushaoshuai.github.io

https://www.shuai.host
0 stars 0 forks source link

Go: 使用 append() 函数得到一个切片 #14

Open dushaoshuai opened 2 years ago

dushaoshuai commented 2 years ago

例如,json.Marshal() 函数中:

buf := append([]byte(nil), e.Bytes()...)

再比如,append() 的注释中:

// As a special case, it is legal to append a string to a byte slice, like this:
// slice = append([]byte("hello "), "world"...)