1
0
mirror of https://github.com/golang/go synced 2024-11-17 14:14:56 -07:00

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: Jay Conrod <jayconrod@google.com>
This commit is contained in:
Bryan C. Mills 2019-04-11 16:35:56 -04:00
parent ab2a080338
commit ccaa491386

View File

@ -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)
}
})
}
}