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)
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
本文链接:https://www.haomeiwen.com/subject/pmsoeltx.html
网友评论