[go: up one dir, main page]

Skip to content

Don't launch a goroutine when creating temporary directories

tempdir package is launching a goroutine every time a temporary directory is created. The purpose of the goroutine is to clean up the temporary directory on context cancellation. This doesn't seem very necessary and has downsides.

  1. In our tests, we look for goroutines that are still running after tests. This deletion goroutine is not synchronized with this and can thus cause flakes.
  2. If context is canceled, the directory is deleted. If there is still code operating on the directory, that code can fail with unexpected errors rather than returning a context canceled error.
  3. The clean up is simpler handled by deferring a deletion of the directory when it is created.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information