mirror of
https://github.com/golang/go
synced 2024-11-19 05:04:43 -07:00
mime/multipart: fix Writer data race test
If the process exits before the spawned goroutine completes, it'll miss the data race. LGTM=bradfitz R=bradfitz CC=dvyukov, golang-codereviews https://golang.org/cl/122120043
This commit is contained in:
parent
1d371a0ed2
commit
22e08d1a3b
@ -118,8 +118,11 @@ func TestWriterBoundaryGoroutines(t *testing.T) {
|
|||||||
// https://codereview.appspot.com/95760043/ and reverted in
|
// https://codereview.appspot.com/95760043/ and reverted in
|
||||||
// https://codereview.appspot.com/117600043/
|
// https://codereview.appspot.com/117600043/
|
||||||
w := NewWriter(ioutil.Discard)
|
w := NewWriter(ioutil.Discard)
|
||||||
|
done := make(chan int)
|
||||||
go func() {
|
go func() {
|
||||||
w.CreateFormField("foo")
|
w.CreateFormField("foo")
|
||||||
|
done <- 1
|
||||||
}()
|
}()
|
||||||
w.Boundary()
|
w.Boundary()
|
||||||
|
<-done
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user