I'm using goroutines in the function because I want when the function will start then the quires of database also run on that time. But there is a question I'm asking that Can we implement a goroutine in the other goroutine because in the function I already set a go routine but in that go routine there are to queries more and I want that they also run when the parent goroutine starts. Example
func main(){
wg := &sync.WaitGroup{}
wg.Add(1)
go func(){
defer wg.Done()
Id,err := QueryWhichWillReturnId()
if err == nil{
wg.Add(1)
go func(){
defer wg.Done()
data:= GetAnyDataById(Id)
fmt.Println(data)
}()
}
}()
wg.Wait()
}
Is this above example is possible while implementing goroutines?
any suggestions will appreciated.