aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/arithmetic.go
diff options
context:
space:
mode:
authorAlan Donovan <adonovan@google.com>2025-12-04 15:29:49 -0500
committerGopher Robot <gobot@golang.org>2025-12-05 13:41:05 -0800
commitf3d572d96a25d1a0956ef828c0ff510ebf214d22 (patch)
tree17613c7a4f52e15d1050b49a02e9cf4a479ded91 /test/codegen/arithmetic.go
parent76345533f70e149511b1f50dbee598d0980cf867 (diff)
downloadgo-f3d572d96a25d1a0956ef828c0ff510ebf214d22.tar.xz
cmd/go: fix race applying fixes in fix and vet -fix modes
Previously, the cmd/fix tool, which is analogous to a compiler in a "go fix" or "go vet -fix" build, applied its fixes directly to source files during the build. However, this led to races since the edits may in some cases occur concurrently with other build steps that are still reading those source file. This change separates the computation of the fixes, which happens during the build, and applying the fixes, which happens in a phase after the build. The unitchecker now accepts a FixArchive file name (see CL 726940). If it is non-empty, the unitchecker will write the fixed files into an archive instead of updating them directly. The vet build sets this option, then reads the produced zip files in the second phase. The files are saved in the cache; some care is required to sequence the various cache operations so that a cache hit has all-or-nothing semantics. The tweak to vet_basic.txt is a sign that there was a latent bug, inadvertently fixed by this change: because the old approach relied on side effects of cmd/fix to mutate files, rather than the current pure-functional approach of computing fixes which are then applied as a second pass, a cache hit would cause some edits not to be applied. Now they are applied. Fixes golang/go#71859 Change-Id: Ib8e70644ec246dcdb20a90794c11ea6fd420247d Reviewed-on: https://go-review.googlesource.com/c/go/+/727000 Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Michael Matloob <matloob@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@google.com>
Diffstat (limited to 'test/codegen/arithmetic.go')
0 files changed, 0 insertions, 0 deletions