switch darwin defaults using runtime.GOOS
To remove the need to duplicate the rest of the file.
diff --git a/fs/manifest_darwin.go b/fs/manifest_darwin.go
deleted file mode 100644
index ad502fa..0000000
--- a/fs/manifest_darwin.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// +build darwin
-
-package fs
-
-import (
- "os"
- "syscall"
-)
-
-const (
- defaultRootDirMode = os.ModeDir | 0700
- 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
-}
diff --git a/fs/manifest_unix.go b/fs/manifest_unix.go
index e1dd993..d2956f3 100644
--- a/fs/manifest_unix.go
+++ b/fs/manifest_unix.go
@@ -1,16 +1,24 @@
-// +build !windows,!darwin
+//go:build !windows
+// +build !windows
package fs
import (
"os"
+ "runtime"
"syscall"
)
-const (
- defaultRootDirMode = os.ModeDir | 0700
- defaultSymlinkMode = os.ModeSymlink | 0777
-)
+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)