]> Cypherpunks repositories - gostls13.git/commitdiff
mime/multipart: fix Writer data race test
authorRui Ueyama <ruiu@google.com>
Tue, 5 Aug 2014 20:43:12 +0000 (13:43 -0700)
committerRui Ueyama <ruiu@google.com>
Tue, 5 Aug 2014 20:43:12 +0000 (13:43 -0700)
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

src/pkg/mime/multipart/writer_test.go

index 2412985b9bb371c8834fd856ade0cd4731581582..ba00c97eceea4b6f302a08ce1bd6fb70c8a777cf 100644 (file)
@@ -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
 }