1. 8
    1. 5

      There’s an additional issue that I only realized recently. You have to add t.Parallel() twice if you use the (common) idiom of table-driven tests and sub-tests. E.g.

      func TestReverseRight(t *testing.T) {
      	for msg, tc := range testCases {
      		tc := tc
      		t.Run(msg, func(t *testing.T) {
                              // Actual test code…
    2. 4

      You can also add t.Parallel() to your tests to make them run in parallel.

      Oh, so Go tests are not parallel by default? That’s surprising, parallel is a much better default for the ecosystem!

      1. 3

        Yeah this was something that surprised me coming to Go (and that I blogged about too) because I was surprised there wasn’t even a way to ask go test to force it to be parallel, you had to set it up yourself 😬

      2. [Comment removed by author]

    3. [Comment removed by author]