github.com/traefik/yaegi@v0.15.1/_test/method17.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "time" 6 ) 7 8 type MyTime struct { 9 time.Time 10 index int 11 } 12 13 func (m MyTime) Foo() { 14 minute := m.Minute() 15 fmt.Println("minute:", minute) 16 } 17 18 func (m *MyTime) Bar() { 19 second := m.Second() 20 fmt.Println("second:", second) 21 } 22 23 func main() { 24 t := MyTime{} 25 t.Time = time.Date(2009, time.November, 10, 23, 4, 5, 0, time.UTC) 26 t.Foo() 27 t.Bar() 28 (&t).Bar() 29 } 30 31 // Output: 32 // minute: 4 33 // second: 5 34 // second: 5