]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/lockedfile: add a sync.Mutex to lockedfile.Mutex
authorBryan C. Mills <bcmills@google.com>
Wed, 3 Apr 2019 13:33:13 +0000 (09:33 -0400)
committerBryan C. Mills <bcmills@google.com>
Wed, 3 Apr 2019 17:17:40 +0000 (17:17 +0000)
commit8c896aa46655cfbdfd9971fb16a830046fcdf81c
tree24250257d6752934f2772611609237e4544057ab
parentb0bcd7aeb0060361fc8ff04cc4b6764aa146b086
cmd/go/internal/lockedfile: add a sync.Mutex to lockedfile.Mutex

The compiler (and race detector) don't interpret locking a file as a
synchronization operation, so we add an explicit (and redundant)
sync.Mutex to make that property clear.

The additional synchronization makes it safe to parallelize the tests
in cmd/go/internal/modfetch/coderepo_test.go, which cuts the wall time
of that test by around 50%.

Updates #30550

Change-Id: Ief3479020ebf9e0fee524a4aae5568697727c683
Reviewed-on: https://go-review.googlesource.com/c/go/+/170597
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/internal/lockedfile/mutex.go
src/cmd/go/internal/modfetch/coderepo_test.go