github.com/traefik/yaegi@v0.15.1/_test/method20.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "sync" 6 ) 7 8 type Hello struct { 9 mu sync.Mutex 10 } 11 12 func (h *Hello) Hi() string { 13 h.mu.Lock() 14 h.mu.Unlock() 15 return "hi" 16 } 17 18 func main() { 19 a := &Hello{} 20 21 fmt.Println(a.Hi()) 22 } 23 24 // Output: 25 // hi