Skip to content

Commit

Permalink
make getPackagePaths private
Browse files Browse the repository at this point in the history
  • Loading branch information
ruflin committed Sep 11, 2019
1 parent fe07686 commit 45eae83
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions util/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,6 @@ import (

var packageList []Package

// GetPackagePaths returns list of available packages, one for each version.
func GetPackagePaths(packagesPath string) ([]string, error) {

files, err := ioutil.ReadDir(packagesPath)
if err != nil {
return nil, err
}

var packages []string
for _, f := range files {
if !f.IsDir() {
continue
}

packages = append(packages, f.Name())
}

return packages, nil
}

// GetPackages returns a slice with all existing packages.
// The list is stored in memory and on the second request directly
// served from memory. This assumes chnages to packages only happen on restart.
Expand All @@ -35,7 +15,7 @@ func GetPackages(packagesBasePath string) ([]Package, error) {
return packageList, nil
}

packagePaths, err := GetPackagePaths(packagesBasePath)
packagePaths, err := getPackagePaths(packagesBasePath)
if err != nil {
return nil, err
}
Expand All @@ -49,3 +29,23 @@ func GetPackages(packagesBasePath string) ([]Package, error) {
}
return packageList, nil
}

// getPackagePaths returns list of available packages, one for each version.
func getPackagePaths(packagesPath string) ([]string, error) {

files, err := ioutil.ReadDir(packagesPath)
if err != nil {
return nil, err
}

var packages []string
for _, f := range files {
if !f.IsDir() {
continue
}

packages = append(packages, f.Name())
}

return packages, nil
}

0 comments on commit 45eae83

Please sign in to comment.