Files
moxa/_test/method20.go

26 lines
224 B
Go

package main
import (
"fmt"
"sync"
)
type Hello struct {
mu sync.Mutex
}
func (h *Hello) Hi() string {
h.mu.Lock()
h.mu.Unlock()
return "hi"
}
func main() {
a := &Hello{}
fmt.Println(a.Hi())
}
// Output:
// hi