diff options
author | Jakob Unterwurzacher | 2022-01-22 16:07:59 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2022-01-22 16:07:59 +0100 |
commit | 47358938ec111f27465beba20a8e0c16c3b98bda (patch) | |
tree | 2a51b7de6027e4865ffde5b1b4285af43da98432 | |
parent | 696f11499bc47ef4d9709ca75fd5ecff56076da2 (diff) |
tests: fix build failure on Go 1.15 and older
These don't have os.ReadDir yet.
Error was:
Error: vet: tests/defaults/overlayfs_test.go:104:15: ReadDir not declared by package os
-rw-r--r-- | tests/defaults/overlayfs_test.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/defaults/overlayfs_test.go b/tests/defaults/overlayfs_test.go index 2bc4387..7b41de4 100644 --- a/tests/defaults/overlayfs_test.go +++ b/tests/defaults/overlayfs_test.go @@ -50,7 +50,12 @@ func TestRenameWhiteout(t *testing.T) { t.Error(err) } // readdir should not choke on leftover or missing .name files - _, err = os.ReadDir(test_helpers.DefaultPlainDir) + dir, err := os.Open(test_helpers.DefaultPlainDir) + if err != nil { + t.Fatal(err) + } + defer dir.Close() + _, err = dir.Readdir(0) if err != nil { t.Error(err) } @@ -101,7 +106,12 @@ func TestRenameExchange(t *testing.T) { t.Error(err) } // readdir should not choke on leftover or missing .name files - _, err = os.ReadDir(test_helpers.DefaultPlainDir) + dir, err := os.Open(test_helpers.DefaultPlainDir) + if err != nil { + t.Fatal(err) + } + defer dir.Close() + _, err = dir.Readdir(0) if err != nil { t.Error(err) } |