summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-08-05 13:43:12 -0700
committerRui Ueyama <ruiu@google.com>2014-08-05 13:43:12 -0700
commitb7efa22d7e5ce661c2341e57cdfbe3401f6a21af (patch)
tree9e789c847a599dbdbd3e562032a0894d0fdd01da /src
parent5050f23de3ddd79d40a309ad52a9a0ac9a3d18d5 (diff)
downloadgo-b7efa22d7e5ce661c2341e57cdfbe3401f6a21af.tar.gz
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://codereview.appspot.com/122120043
Diffstat (limited to 'src')
-rw-r--r--src/pkg/mime/multipart/writer_test.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pkg/mime/multipart/writer_test.go b/src/pkg/mime/multipart/writer_test.go
index 2412985b9..ba00c97ec 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
}