Wrote this very basic code to understand channels.
If there is a wait in a goroutine, why is the main goroutine waiting on it? I read that the main goroutine needs to have a wait time as the control is passed back to it immediately after invoking goroutine.
Why are goroutines not designed like main thread and child threads in java where they can run in parallel?
func main() {
channel := make(chan int)
go func() {
time.Sleep(3*time.Second)
}()
for {
fmt.Println("../");
<-channel
}
}