1
0
mirror of https://github.com/golang/go synced 2024-11-19 14:24:47 -07:00

cmd/go: close unintentionally left open file

cmd/go/internal/work.Builder.updateBuildID left a file opened.
But opened files cannot be deleted on Windows, so cmd/go just
leaves these files in %TMP% directory.

Close the file so deletion can succeed.

Fixes #22650

Change-Id: Ia3ea62f6ec7208d73972eae2e17fb4a766407914
Reviewed-on: https://go-review.googlesource.com/76810
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Alex Brainman 2017-11-10 10:26:05 +11:00
parent bdf30565e2
commit 821e3f7d85

View File

@ -448,6 +448,7 @@ func (b *Builder) updateBuildID(a *Action, target string, rewrite bool) error {
r, err := os.Open(target)
if err == nil {
c.Put(a.actionID, r)
r.Close()
}
}