Skip to content

Commit ccaa491

Browse files
author
Bryan C. Mills
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
1 parent ab2a080 commit ccaa491

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cmd/go/internal/work/action.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,11 @@ func (b *Builder) Init() {
242242
}
243243
if !cfg.BuildWork {
244244
workdir := b.WorkDir
245-
base.AtExit(func() { os.RemoveAll(workdir) })
245+
base.AtExit(func() {
246+
if err := os.RemoveAll(workdir); err != nil {
247+
fmt.Fprintf(os.Stderr, "go: failed to remove work dir: %s\n", err)
248+
}
249+
})
246250
}
247251
}
248252

0 commit comments

Comments
 (0)