func globGetFilesFromFilelist(filename string) ([]string, error) { fl, err := os.Open(filename) if err != nil { return nil, fmt.Errorf("Failed to open filelist %q: %v", filename, err) } defer fl.Close() lists := filelist.Lists{} if err := lists.ParseFilelist(fl); err != nil { return nil, err } return lists.Files, nil }
func categorizeEntry(path string, mode os.FileMode, list *filelist.Lists) error { switch { case mode.IsDir(): list.Dirs = append(list.Dirs, path) case mode.IsRegular(): list.Files = append(list.Files, path) case isSymlink(mode): list.Symlinks = append(list.Symlinks, path) default: return fmt.Errorf("unsupported file mode: %d (not a file, directory or symlink)", mode&os.ModeType) } return nil }