From 9997dae7a3499a3f180e7e34df0bb22fa487ad85 Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Fri, 17 Sep 2010 12:35:34 +1000 Subject: [PATCH] os: make RemoveAll() work on windows R=golang-dev, rsc1 CC=golang-dev https://golang.org/cl/2212041 --- src/pkg/os/path.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pkg/os/path.go b/src/pkg/os/path.go index bea971375eb..74c83ab17aa 100644 --- a/src/pkg/os/path.go +++ b/src/pkg/os/path.go @@ -84,7 +84,6 @@ func RemoveAll(path string) Error { if err != nil { return err } - defer fd.Close() // Remove contents & return first error. err = nil @@ -105,6 +104,9 @@ func RemoveAll(path string) Error { } } + // Close directory, because windows won't remove opened directory. + fd.Close() + // Remove directory. err1 := Remove(path) if err == nil {