github.com/charlievieth/fastwalk@v1.0.3/zsyscall_darwin.go (about) 1 //go:build darwin && go1.12 2 // +build darwin,go1.12 3 4 package fastwalk 5 6 import "syscall" 7 8 // Copied from syscall/syscall_unix.go 9 10 // Do the interface allocations only once for common 11 // Errno values. 12 var ( 13 errEAGAIN error = syscall.EAGAIN 14 errEINVAL error = syscall.EINVAL 15 errENOENT error = syscall.ENOENT 16 ) 17 18 // errnoErr returns common boxed Errno values, to prevent 19 // allocations at runtime. 20 func errnoErr(e syscall.Errno) error { 21 switch e { 22 case 0: 23 return nil 24 case syscall.EAGAIN: 25 return errEAGAIN 26 case syscall.EINVAL: 27 return errEINVAL 28 case syscall.ENOENT: 29 return errENOENT 30 } 31 return e 32 }