IsRecursiveSymlink checks if the provided non-resolved file info is a recursive symlink
(f os.FileInfo, symlinkPath string)
| 13 | // IsRecursiveSymlink checks if the provided non-resolved file info |
| 14 | // is a recursive symlink |
| 15 | func IsRecursiveSymlink(f os.FileInfo, symlinkPath string) bool { |
| 16 | // check if recursive symlink |
| 17 | if f.Mode()&os.ModeSymlink == os.ModeSymlink { |
| 18 | resolvedPath, err := filepath.EvalSymlinks(symlinkPath) |
| 19 | if err != nil || strings.HasPrefix(symlinkPath, filepath.ToSlash(resolvedPath)) { |
| 20 | return true |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | return false |
| 25 | } |
| 26 | |
| 27 | // WriteToFile writes data to a file |
| 28 | func WriteToFile(data []byte, filePath string) error { |
no test coverage detected