Re: [go-nuts] unit test for function which has goroutine

2020-09-10 Thread Yvonne Zhang
7;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. > >

Re: [go-nuts] unit test for function which has goroutine

2020-09-10 Thread Yvonne Zhang
struct{} > func (m mockB) functionB(...) > > On 10.09.20 09:15, Yvonne Zhang wrote: > > Hi, > > I have a function streaming a zipreader to browser. It is like this. > > func functionA()(body io.ReadCloser, err error){ > > > >// some logic to get

[go-nuts] unit test for function which has goroutine

2020-09-10 Thread Yvonne Zhang
Hi, I have a function streaming a zipreader to browser. It is like this. func functionA()(body io.ReadCloser, err error){ // some logic to get a zipreader body, pipeWriter := io.Pipe() zipWriter := zip.NewWriter(pipeWriter) go func(){ // err := functionB(zipReader, zipWrite