testing: TempDir RemoveAll cleanup failures with "The process cannot access the file because it is being used by another process." #51442
FWIW, this fix would be easy to backport to Go 1.18, but somewhat less trivial to backport to Go 1.17 (it would also need CL 371296, which is a bit more invasive).
There is also a workaround that you can apply for your own specific tests independent of the Go version: you can
I believe I'm running into this same issue in Golang 1.18.1 and 1.18.2 (only two versions I've tested) with some casbin tests that are loading a model configuration file. It's only reproducible in Windows. Team members on non-Windows machines are not running into the issue.
go env output:
…indows cleanup retries Fixes #52986 Updates #51442 Updates #50051 Change-Id: I1bfbc08c907077467fd50febbec6299a9b73af41 Reviewed-on: https://go-review.googlesource.com/c/go/+/388916 Trust: Bryan Mills <firstname.lastname@example.org> Run-TryBot: Bryan Mills <email@example.com> TryBot-Result: Gopher Robot <firstname.lastname@example.org> Reviewed-by: Ian Lance Taylor <email@example.com> (cherry picked from commit eeb9f09) Reviewed-on: https://go-review.googlesource.com/c/go/+/407877 Reviewed-by: Nooras Saba <firstname.lastname@example.org> Auto-Submit: Bryan Mills <email@example.com>