gitee.com/quant1x/gox@v1.21.2/runtime/stdlib_test.go (about) 1 package runtime 2 3 import ( 4 "fmt" 5 "reflect" 6 "testing" 7 ) 8 9 func test1(cb func()) { 10 v := reflect.ValueOf(cb) 11 fmt.Println(v) 12 //p := unsafe.Pointer(&cb) 13 //pc := uintptr(p) 14 pc := v.Pointer() 15 funcName := FuncName(pc) 16 fmt.Println(funcName) 17 } 18 19 func foo() { 20 fmt.Println(1) 21 } 22 23 func TestFunction(t *testing.T) { 24 fmt.Println(Caller()) 25 test1(foo) 26 fmt.Println(FuncInfo(foo)) 27 }