2
0

cleanup and module support (#77)

* cleanup and module support
This commit is contained in:
Lukas Rist
2020-10-21 16:19:57 +02:00
committed by GitHub
parent 94d9e492cc
commit 47ffae2331
8 changed files with 45 additions and 30 deletions
+3 -3
View File
@@ -5,8 +5,8 @@ import (
"syscall"
)
// os_Chown is a var so we can mock it out during tests.
var os_Chown = os.Chown
// osChown is a var so we can mock it out during tests.
var osChown = os.Chown
func chown(name string, info os.FileInfo) error {
f, err := os.OpenFile(name, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, info.Mode())
@@ -15,5 +15,5 @@ func chown(name string, info os.FileInfo) error {
}
f.Close()
stat := info.Sys().(*syscall.Stat_t)
return os_Chown(name, int(stat.Uid), int(stat.Gid))
return osChown(name, int(stat.Uid), int(stat.Gid))
}