]> Cypherpunks repositories - gostls13.git/commit
cmd/gofmt: fix a data race in TestPermissions
authorBryan C. Mills <bcmills@google.com>
Thu, 18 May 2023 12:20:54 +0000 (08:20 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 18 May 2023 12:52:14 +0000 (12:52 +0000)
commit7b0835d42de1deccd889451eda12390a56722ab7
treed729d168b29e240597b5e1709219214faa0bc7c6
parent75add1ce0e4424f2a72cd40835bafeafd80641d1
cmd/gofmt: fix a data race in TestPermissions

The asynchronous call to processFile is synchronized by the call to
GetExitCode. We can't safely access errBuf until then, because
processFile may still be writing to it.

This is diagnosed by 'go test -race cmd/gofmt', but only the
darwin-amd64-race builder caught it because the other "-race" builders
apparently all run as root (see #10719).

Updates #60225.

Change-Id: Ie66bb4e47429ece81043d6425f26953b7bb26002
Reviewed-on: https://go-review.googlesource.com/c/go/+/496155
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/gofmt/gofmt_unix_test.go