Correct directory permission of testDir

When fs.MkdirAll() was called with a permission of "777" (without the 0 prefix),
it generated the testDir with a permission of `dr----x--x`, causing the following error
during a test run:

    === RUN TestRead0
    --- FAIL: TestRead0 (0.00 seconds)
    	fs_test.go:53: OsFs create failed: open /tmp/fun/test.txt: permission denied

Changing the decimal `777` to octal `0777` fixes the problem.
This commit is contained in:
Anthony Fok 2014-12-08 21:10:04 -07:00 committed by spf13
parent f20e72f15f
commit 3effba0913
1 changed files with 1 additions and 1 deletions

View File

@ -44,7 +44,7 @@ var Fss = []Fs{&MemMapFs{}, &OsFs{}}
func TestRead0(t *testing.T) { func TestRead0(t *testing.T) {
for _, fs := range Fss { for _, fs := range Fss {
path := testDir + "/" + testName path := testDir + "/" + testName
if err := fs.MkdirAll(testDir, 777); err != nil { if err := fs.MkdirAll(testDir, 0777); err != nil {
t.Fatal(fs.Name(), "unable to create dir", err) t.Fatal(fs.Name(), "unable to create dir", err)
} }