1
0
mirror of https://github.com/golang/go synced 2024-11-23 20:40:07 -07:00

os: simplify check whether to run subtest of TestRemoveAll

This commit is contained in:
Leon Klingele 2019-01-30 18:14:50 +01:00
parent 56c9f8e8cf
commit e5c5db51bc
No known key found for this signature in database
GPG Key ID: 0C8AF48831EEC211

View File

@ -80,16 +80,8 @@ func TestRemoveAll(t *testing.T) {
t.Fatalf("Lstat %q succeeded after RemoveAll (third)", path)
}
// Determine if we should run the following test.
testit := true
if runtime.GOOS == "windows" {
// Chmod is not supported under windows.
testit = false
} else {
// Test fails as root.
testit = Getuid() != 0
}
if testit {
// Chmod is not supported under Windows and test fails as root.
if runtime.GOOS != "windows" && Getuid() != 0 {
// Make directory with file and subdirectory and trigger error.
if err = MkdirAll(dpath, 0777); err != nil {
t.Fatalf("MkdirAll %q: %s", dpath, err)