Skip to content

Commit

Permalink
cmd/go: log failures to remove workdir
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bryan C. Mills committed Apr 11, 2019
1 parent ab2a080 commit ccaa491
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cmd/go/internal/work/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
}
}

Expand Down

0 comments on commit ccaa491

Please sign in to comment.