...

Text file src/cmd/go/testdata/script/testing_issue40908.txt

Documentation: cmd/go/testdata/script

     1[short] skip
     2[!race] skip
     3
     4go test -race testrace
     5
     6-- go.mod --
     7module testrace
     8
     9go 1.16
    10-- race_test.go --
    11package testrace
    12
    13import "testing"
    14
    15func TestRace(t *testing.T) {
    16	helperDone := make(chan struct{})
    17	go func() {
    18		t.Logf("Something happened before cleanup.")
    19		close(helperDone)
    20	}()
    21
    22	t.Cleanup(func() {
    23		<-helperDone
    24	})
    25}

View as plain text