Right, I wanted to write something about the goroutine and forgot about
it. Sorry about that.
The problem here could be that in the code you posted there's nothing
waiting on any result from the goroutine, and if the test exits quickly
enough, it might not get scheduled.
In general, whenever a goroutine is created, you should have some idea
of when and how it gets to run and when it stops running, and how other
goroutines wait for it to do its job.
You could do this for example by controlling the lifetime of the
goroutine with a sync.WaitGroup. Pass in a WaitGroup and call Done() on
it when the goroutine returns (probably as a deferred call), then call
Wait() in some other goroutine (for example in your main function or in
the TestFoo function) so there's some sort of ordering enforced.
In general, you'll need some way of signalling "I'm done copying stuff
from zipReader to zipWriter" in the goroutine, and you'll need to
arrange for some other, longer lived, goroutine to wait for that signal.
>
https://groups.google.com/d/msgid/golang-nuts/33648e9a-4011-4d02-a07b-01b506cf5cd1n%40googlegroups.com
> <
https://groups.google.com/d/msgid/golang-nuts/33648e9a-4011-4d02-a07b-01b506cf5cd1n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Gregor Best
be...@pferdewetten.de