cmd/go: remove temporary build directories when terminated by signal #39382
Comments
Will contexts be enough? They do provide cancellation, but there won't be a way for the main goroutine to wait for the cleanup process (deleting temporary directories) to finish. |
Cleaning up build directories happens in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Originally reported in golang/vscode-go#152.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Interrupt
go test
or any other build command using^C
or withkill -SIGINT
.It's easy to reproduce this by setting
GOTMPDIR
to a local directory and then running a test that sleeps for a few seconds.What did you expect to see?
No temporary
go-build
directories are left behind.What did you see instead?
Directories with names like
go-build312263156
are left behind.go test
should trap the signal, delete the work directory, and exit gracefully. It should not trim the build cache or do anything else that might take a long time (which it normally does when exiting).Fixing this would be non-trivial: we'll need to plumb contexts through to network, build, and test operations to handle the cancellation. We probably want to do that anyway though for tracing.
cc @hakim @bcmills @matloob
The text was updated successfully, but these errors were encountered: