Last active
September 18, 2019 12:36
-
-
Save klashxx/0781f9b2e68e15e487d25b664e9aec96 to your computer and use it in GitHub Desktop.
Revisions
-
klashxx revised this gist
Sep 18, 2019 . 1 changed file with 0 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,9 +8,6 @@ func listDirectories(path string) ([]string, error) { for _, item := range items { // We only want directories if item.IsDir() { currentDir := filepath.Join(path, item.Name()) names = append(names, currentDir) -
klashxx created this gist
Sep 18, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ func listDirectories(path string) ([]string, error) { names := []string{} items, err := ioutil.ReadDir(path) if err != nil { return names, err } for _, item := range items { // We only want directories if item.IsDir() { if item.Name() == "testdata" { continue } currentDir := filepath.Join(path, item.Name()) names = append(names, currentDir) // Do some recursion subNames, err := listDirectories(currentDir) if err == nil { names = append(names, subNames...) } } } return names, nil }