Skip to content

testing: is the package thread-safe? #20940

Description

@matthewmueller

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.8.3 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOHOSTARCH="amd64"
GOHOSTOS="darwin"

What did you do?

Running t.Fatal(err) inside multiple goroutines with the -race flag

What did you expect to see?

The testing package to be thread-safe and not report data races when running the -race flag.

I'm not 100% sure this isn't related to my code, but based on the error I think it's because I'm calling t.Fatal(err) from multiple goroutines. So I'd just like some clarity there.

What did you see instead?

Write at 0x00c42014e524 by goroutine 10:
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:658 +0x119

Previous write at 0x00c42014e524 by goroutine 62:
  testing.(*common).FailNow()
      /usr/local/go/src/testing/testing.go:485 +0x4a
  testing.(*common).Fatal()
      /usr/local/go/src/testing/testing.go:524 +0x7c
  command-line-arguments_test.TestPageSetControlNavigations.func1()
      /Users/matt/go/src/github.com/api/api_test.go:241 +0x2d3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions