1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
package main import "fmt" type T struct { i int } func (t T) Foo () { fmt.Println (t.i) } func (t *T) Bar () { fmt.Println (t.i) } func main () { fmt.Println ("Shall we?") var t T t.Foo () var pt = new (T) pt.Bar () }