Commit ccaa4913 authored by Bryan C. Mills's avatar Bryan C. Mills

cmd/go: log failures to remove workdir

Failures here don't otherwise affect the build, but they do cause a
slow file leak in the user's temp directory. The user deserves at
least a cursory warning that something may be amiss.

Updates #30789

Change-Id: Id0e72b1967e7f7c88cdc94d532554496653f264b
Reviewed-on: https://go-review.googlesource.com/c/go/+/171764
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarJay Conrod <jayconrod@google.com>
parent ab2a0803
......@@ -242,7 +242,11 @@ func (b *Builder) Init() {
}
if !cfg.BuildWork {
workdir := b.WorkDir
base.AtExit(func() { os.RemoveAll(workdir) })
base.AtExit(func() {
if err := os.RemoveAll(workdir); err != nil {
fmt.Fprintf(os.Stderr, "go: failed to remove work dir: %s\n", err)
}
})
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment