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

     1  [short] skip
     2  [!race] skip
     3  
     4  go test -race testrace
     5  
     6  -- go.mod --
     7  module testrace
     8  
     9  go 1.16
    10  -- race_test.go --
    11  package testrace
    12  
    13  import "testing"
    14  
    15  func 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  }
    26  

View as plain text