mark2web/vendor/github.com/otiai10/copy/preserve_owner.go
Sebastian Frank a781485c0a
Some checks failed
continuous-integration/drone/push Build is failing
no git submodules
2022-02-28 10:28:34 +01:00

23 lines
368 B
Go

//+build !windows
package copy
import (
"os"
"syscall"
)
func preserveOwner(src, dest string, info fileInfo) (err error) {
if info == nil {
if info, err = os.Stat(src); err != nil {
return err
}
}
if stat, ok := info.Sys().(*syscall.Stat_t); ok {
if err := os.Chown(dest, int(stat.Uid), int(stat.Gid)); err != nil {
return err
}
}
return nil
}