github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/method20.gno (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