OSReadDir expands a directory path into a list of files within that directory. Not recursive.
(root string)
| 52 | |
| 53 | // OSReadDir expands a directory path into a list of files within that directory. Not recursive. |
| 54 | func OSReadDir(root string) ([]string, error) { |
| 55 | var files []string |
| 56 | f, err := os.Open(root) |
| 57 | if err != nil { |
| 58 | return files, err |
| 59 | } |
| 60 | fileInfo, err := f.Readdir(-1) |
| 61 | f.Close() |
| 62 | if err != nil { |
| 63 | return files, err |
| 64 | } |
| 65 | for _, file := range fileInfo { |
| 66 | files = append(files, file.Name()) |
| 67 | } |
| 68 | return files, nil |
| 69 | } |
| 70 | |
| 71 | // CloneRepo clones a repo into the specified location. |
| 72 | func CloneRepo(stagePath string, repo string) string { |