learn go function callback
package main // 参考文档: // https://github.com/Unknwon/the-way-to-go_ZH_CN/blob/master/eBook/06.7.md import ( "fmt" ) func main () { callback(1, Add) } func Add(a, b int) { fmt.Printf("The sum of %d and %d is: %d\n", a, b, a+b); } func callback(y int, f func(int, int)) { f(y, 2) // this becomes Add(1, 2) }