From 4e20d999ec4cc9c6ff8e3d01e79c26a8ba775b7b Mon Sep 17 00:00:00 2001 From: Leon Klingele Date: Sun, 3 Mar 2019 13:10:59 +0000 Subject: [PATCH] os: simplify check whether to run subtest of TestRemoveAll Change-Id: Ic5b46cfb393f5ba7b91b3fb73b158b0bc238a532 GitHub-Last-Rev: e5c5db51bcc4848d807b0ce45e85c022492b2013 GitHub-Pull-Request: golang/go#30019 Reviewed-on: https://go-review.googlesource.com/c/go/+/160443 Run-TryBot: Tobias Klauser TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/os/removeall_test.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/os/removeall_test.go b/src/os/removeall_test.go index 21371d8776..8690bb5d2a 100644 --- a/src/os/removeall_test.go +++ b/src/os/removeall_test.go @@ -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)