package main // 参考文档: // https://github.com/Unknwon/the-way-to-go_ZH_CN/blob/master/eBook/06.8.md import "fmt" func main() { f() } func f() { for i := 0; i < 4; i++ { g := func(i int) { fmt.Printf("%d ", i) } g(i) fmt.Printf(" -g is of type %T and has value %v\n", g, g) } }