What is the efficient way to execute commands in parallel in golang ?
I have the following
code ,where i execute a bunch of commands using go routine. I do get the output of the commands executed. But I also get the following statements in the end.
=====
throw: all goroutines are asleep - deadlock!
goroutine 1 [semacquire]:
sync.runtime_Semacquire(0x18600110, 0x18600110)
/build/buildd/golang-1/src/pkg/runtime/zsema_386.c:146 +0x29
sync.(*WaitGroup).Wait(0x1861c6a0, 0x3)
/usr/lib/go/src/pkg/sync/waitgroup.go:78 +0xe6
main.main()
/home/rahul/programs/Remodel/exec.go:27 +0x114
goroutine 2 [syscall]:
created by runtime.main
/build/buildd/golang-1/src/pkg/runtime/proc.c:221
======
I dont quite understand , whats happening. Why is it a deadlock at first place ? I am using a very wrong technique to parallize execution of commands ? If yes, whats the efficient way of doing so ?
./Rahul