呼唤远方
更完整一点(在 中还有一个论点make)示例:slice := make([]int, 2, 5)fmt.Printf("length: %d - capacity %d - content: %d", len(slice), cap(slice), slice)出去:length: 2 - capacity 5 - content: [0 0]或者使用动态类型slice:slice := make([]interface{}, 2, 5)fmt.Printf("length: %d - capacity %d - content: %d", len(slice), cap(slice), slice)出去:length: 2 - capacity 5 - content: [<nil> <nil>]