I wish to know what is the proper way of waiting for a go routine to finish before exiting the program. Reading some other answers it seems that a bool chan will do the tric
Why the <- done
works at all?
what happens if I uncomment the last line?
Bonus, if you're extremely limited on memory, you can use done := make(chan struct{})
and done <- struct{}{}
, struct{}
is guaranteed to use 0 memory.