diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go index cbddda88b6..9c4c7ebedc 100644 --- a/src/path/filepath/path_test.go +++ b/src/path/filepath/path_test.go @@ -1374,13 +1374,27 @@ func TestWalkSymlink(t *testing.T) { } func TestIssue29372(t *testing.T) { - f, err := ioutil.TempFile("", "issue29372") + tmpDir, err := ioutil.TempDir("", "TestIssue29372") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(tmpDir) + + if runtime.GOOS == "windows" { + // This test is broken on windows, if temporary directory + // is a symlink. See issue 29746. + // TODO(brainman): Remove this hack once issue #29746 is fixed. + tmpDir, err = filepath.EvalSymlinks(tmpDir) + if err != nil { + t.Fatal(err) + } + } + + path := filepath.Join(tmpDir, "file.txt") + err = ioutil.WriteFile(path, nil, 0644) if err != nil { t.Fatal(err) } - f.Close() - path := f.Name() - defer os.Remove(path) pathSeparator := string(filepath.Separator) tests := []string{