Simplify goroutine structure of generated code

We use one less goroutine (merging with the main goroutine) instead of
synchronizing the main goroutine with the children.