2016-01-10 13:08:16 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"runtime"
|
|
|
|
)
|
|
|
|
|
|
|
|
func afunction(s string) {
|
|
|
|
fmt.Println(s)
|
|
|
|
}
|
|
|
|
|
|
|
|
type someStruct struct {
|
|
|
|
s string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *someStruct) structfunc(s2 string) {
|
|
|
|
fmt.Println(o.s, s2)
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
fn1 := afunction
|
|
|
|
var o someStruct
|
|
|
|
fn2 := o.structfunc
|
|
|
|
fn3 := func(s string) {
|
|
|
|
fmt.Println("inline", s)
|
|
|
|
}
|
|
|
|
runtime.Breakpoint()
|
2016-02-06 06:00:48 +00:00
|
|
|
fn1("test")
|
|
|
|
afunction("test")
|
2016-01-10 13:08:16 +00:00
|
|
|
fmt.Println(fn1, fn2, fn3, o)
|
|
|
|
}
|