1, IDE (goland)
One may need 'jetbrains-agent-latest.zip':
链接: https://pan.baidu.com/s/1Ze1TUhByRNX7BkAU8mNpIw 提取码: dx2k
2, defer
<Defer, Panic, and Recover> is an excellent doc: https://www.cnblogs.com/kaid/p/9698477.html
3, Execise: Slices
package main
import (
//"fmt"
"golang.org/x/tour/pic"
)
func Pic(dx, dy int) [][]uint8 {
var p [][]uint8 = make([][]uint8, dx)
for i := 0; i < dx; i++ {
p[i] = make([]uint8, dy)
for j :=0; j < dy; j++ {
p[i][j] = uint8(i*j)
}
}
return p
}
func main() {
//fmt.Println(Pic(16, 16))
pic.Show(Pic)
}
<