mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
89d39e5e77
full diff: https://github.com/gotestyourself/gotest.tools/compare/v3.0.3...v3.1.0 noteworthy changes: - ci: add go1.16 - ci: add go1.17, remove go1.13 - golden: only create dir if update flag is set - icmd: replace all usages of os/exec with golang.org/x/sys/execabs - assert: ErrorIs - fs: add DirFromPath - Stop creating directory outside of testdata - fs: Fix comparing symlink permissions Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
38 lines
628 B
Go
38 lines
628 B
Go
//go:build !windows
|
|
// +build !windows
|
|
|
|
package fs
|
|
|
|
import (
|
|
"os"
|
|
"runtime"
|
|
"syscall"
|
|
)
|
|
|
|
const defaultRootDirMode = os.ModeDir | 0700
|
|
|
|
var defaultSymlinkMode = os.ModeSymlink | 0777
|
|
|
|
func init() {
|
|
switch runtime.GOOS {
|
|
case "darwin":
|
|
defaultSymlinkMode = os.ModeSymlink | 0755
|
|
}
|
|
}
|
|
|
|
func newResourceFromInfo(info os.FileInfo) resource {
|
|
statT := info.Sys().(*syscall.Stat_t)
|
|
return resource{
|
|
mode: info.Mode(),
|
|
uid: statT.Uid,
|
|
gid: statT.Gid,
|
|
}
|
|
}
|
|
|
|
func (p *filePath) SetMode(mode os.FileMode) {
|
|
p.file.mode = mode
|
|
}
|
|
|
|
func (p *directoryPath) SetMode(mode os.FileMode) {
|
|
p.directory.mode = mode | os.ModeDir
|
|
}
|