golang make创建slice,map,channel

1.slice

make([]Type,len) //cap=len

make([]Type,len,cap)

2.map

make(map[Type]type)

make(map[Type]Type,size)

3.channel

无缓冲channel:make(chan Type)

有缓冲channel:make(chan Type,size)

你可能感兴趣的:(golang make创建slice,map,channel)