用于docker了,go也慢慢看一些。。
推荐书籍《go语言实践》就是<Go in Action>的中文版,有文字版PDF的。
package main import ( "fmt" ) //main is the entry of the program func main() { var array1 [5]string array2 := [5]int{10, 20, 30, 40, 50} array3 := [...]int{10, 20, 30, 40, 50} array4 := [5]int{1: 10, 2: 20} array2[2] = 35 array5 := [5]*int{0: new(int), 1: new(int)} *array5[0] = 10 *array5[1] = 20 array6 := [5]string{"Red", "Blue", "Green", "Yellow", "Pink"} array1 = array6 array7 := [4][2]int{{10, 11}, {20, 21}, {30, 31}, {40, 41}} fmt.Println(array1, array2, array3, array4, array5, array6, array7) }