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 {