Here is go code:
type someThing struct {
sync.Mutex
cv *sync.Cond
num int
}
func NewSomething() *someThing {
// how do you do this ?
return &someThing{cv:sync.NewCond(sync.Mutex)}
}
This code fails to compile:
sync.Mutex (type) is not an expression
So basically the question is how to refer to the struct itself (because it has an embedded member sync.Mutex) while initializing it ? (c++ has this, for example).