From: Rui Ueyama Date: Tue, 5 Aug 2014 20:43:12 +0000 (-0700) Subject: mime/multipart: fix Writer data race test X-Git-Tag: go1.4beta1~945 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=22e08d1a3b6fba51df3bcad9a5f0d70fefd0412d;p=gostls13.git 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 --- diff --git a/src/pkg/mime/multipart/writer_test.go b/src/pkg/mime/multipart/writer_test.go index 2412985b9b..ba00c97ece 100644 --- a/src/pkg/mime/multipart/writer_test.go +++ b/src/pkg/mime/multipart/writer_test.go @@ -118,8 +118,11 @@ func TestWriterBoundaryGoroutines(t *testing.T) { // https://codereview.appspot.com/95760043/ and reverted in // https://codereview.appspot.com/117600043/ w := NewWriter(ioutil.Discard) + done := make(chan int) go func() { w.CreateFormField("foo") + done <- 1 }() w.Boundary() + <-done }