Remove go1.9 specific code for windows (#5033)

Following fix https://go-review.googlesource.com/#/c/41834/ has
been merged upstream and released with go1.9.
This commit is contained in:
Harshavardhana
2017-10-13 03:01:15 -07:00
committed by Nitish Tiwari
parent ad53c5d859
commit 3d0dced23c
21 changed files with 52 additions and 610 deletions

View File

@@ -113,7 +113,7 @@ func newPosix(path string) (StorageAPI, error) {
},
},
}
fi, err := osStat((diskPath))
fi, err := os.Stat((diskPath))
if err == nil {
if !fi.IsDir() {
return nil, syscall.ENOTDIR
@@ -249,7 +249,7 @@ func (s *posix) getVolDir(volume string) (string, error) {
// checkDiskFound - validates if disk is available,
// returns errDiskNotFound if not found.
func (s *posix) checkDiskFound() (err error) {
_, err = osStat((s.diskPath))
_, err = os.Stat((s.diskPath))
if err != nil {
if os.IsNotExist(err) {
return errDiskNotFound
@@ -340,7 +340,7 @@ func listVols(dirPath string) ([]VolInfo, error) {
continue
}
var fi os.FileInfo
fi, err = osStat((pathJoin(dirPath, entry)))
fi, err = os.Stat((pathJoin(dirPath, entry)))
if err != nil {
// If the file does not exist, skip the entry.
if os.IsNotExist(err) {
@@ -350,7 +350,7 @@ func listVols(dirPath string) ([]VolInfo, error) {
}
volsInfo = append(volsInfo, VolInfo{
Name: fi.Name(),
// As osStat() doesn't carry other than ModTime(), use
// As os.Stat() doesn't carry other than ModTime(), use
// ModTime() as CreatedTime.
Created: fi.ModTime(),
})
@@ -381,14 +381,14 @@ func (s *posix) StatVol(volume string) (volInfo VolInfo, err error) {
}
// Stat a volume entry.
var st os.FileInfo
st, err = osStat((volumeDir))
st, err = os.Stat((volumeDir))
if err != nil {
if os.IsNotExist(err) {
return VolInfo{}, errVolumeNotFound
}
return VolInfo{}, err
}
// As osStat() doesn't carry other than ModTime(), use ModTime()
// As os.Stat() doesn't carry other than ModTime(), use ModTime()
// as CreatedTime.
createdTime := st.ModTime()
return VolInfo{
@@ -453,7 +453,7 @@ func (s *posix) ListDir(volume, dirPath string) (entries []string, err error) {
return nil, err
}
// Stat a volume entry.
_, err = osStat((volumeDir))
_, err = os.Stat((volumeDir))
if err != nil {
if os.IsNotExist(err) {
return nil, errVolumeNotFound
@@ -489,7 +489,7 @@ func (s *posix) ReadAll(volume, path string) (buf []byte, err error) {
return nil, err
}
// Stat a volume entry.
_, err = osStat((volumeDir))
_, err = os.Stat((volumeDir))
if err != nil {
if os.IsNotExist(err) {
return nil, errVolumeNotFound
@@ -560,7 +560,7 @@ func (s *posix) ReadFile(volume, path string, offset int64, buffer []byte, verif
return 0, err
}
// Stat a volume entry.
_, err = osStat((volumeDir))
_, err = os.Stat((volumeDir))
if err != nil {
if os.IsNotExist(err) {
return 0, errVolumeNotFound
@@ -652,7 +652,7 @@ func (s *posix) createFile(volume, path string) (f *os.File, err error) {
return nil, err
}
// Stat a volume entry.
_, err = osStat((volumeDir))
_, err = os.Stat((volumeDir))
if err != nil {
if os.IsNotExist(err) {
return nil, errVolumeNotFound
@@ -667,7 +667,7 @@ func (s *posix) createFile(volume, path string) (f *os.File, err error) {
// Verify if the file already exists and is not of regular type.
var st os.FileInfo
if st, err = osStat((filePath)); err == nil {
if st, err = os.Stat((filePath)); err == nil {
if !st.Mode().IsRegular() {
return nil, errIsNotRegular
}
@@ -794,7 +794,7 @@ func (s *posix) StatFile(volume, path string) (file FileInfo, err error) {
return FileInfo{}, err
}
// Stat a volume entry.
_, err = osStat((volumeDir))
_, err = os.Stat((volumeDir))
if err != nil {
if os.IsNotExist(err) {
return FileInfo{}, errVolumeNotFound
@@ -806,7 +806,7 @@ func (s *posix) StatFile(volume, path string) (file FileInfo, err error) {
if err = checkPathLength((filePath)); err != nil {
return FileInfo{}, err
}
st, err := osStat((filePath))
st, err := os.Stat((filePath))
if err != nil {
// File is really not found.
if os.IsNotExist(err) {
@@ -887,7 +887,7 @@ func (s *posix) DeleteFile(volume, path string) (err error) {
return err
}
// Stat a volume entry.
_, err = osStat((volumeDir))
_, err = os.Stat((volumeDir))
if err != nil {
if os.IsNotExist(err) {
return errVolumeNotFound
@@ -931,14 +931,14 @@ func (s *posix) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) (err e
return err
}
// Stat a volume entry.
_, err = osStat((srcVolumeDir))
_, err = os.Stat((srcVolumeDir))
if err != nil {
if os.IsNotExist(err) {
return errVolumeNotFound
}
return err
}
_, err = osStat((dstVolumeDir))
_, err = os.Stat((dstVolumeDir))
if err != nil {
if os.IsNotExist(err) {
return errVolumeNotFound
@@ -961,7 +961,7 @@ func (s *posix) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) (err e
}
if srcIsDir {
// If source is a directory we expect the destination to be non-existent always.
_, err = osStat((dstFilePath))
_, err = os.Stat((dstFilePath))
if err == nil {
return errFileAccessDenied
}