File.Chmod is supported on Windows since CL 250077, there is no need
to skip the call anymore.
Updates #18026
Change-Id: Ie03cf016e651b93241f73067614fc4cb341504ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/480416
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
return info.Size()
}
-const chmodSupported = runtime.GOOS != "windows"
-
// backupFile writes data to a new file named filename<number> with permissions perm,
// with <number randomly chosen such that the file name is unique. backupFile returns
// the chosen file name.
return "", err
}
bakname := f.Name()
- if chmodSupported {
- err = f.Chmod(perm)
- if err != nil {
- f.Close()
- os.Remove(bakname)
- return bakname, err
- }
+ err = f.Chmod(perm)
+ if err != nil {
+ f.Close()
+ os.Remove(bakname)
+ return bakname, err
}
// write data to backup file