diff options
Diffstat (limited to 'scanRepoDir.go')
| -rw-r--r-- | scanRepoDir.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scanRepoDir.go b/scanRepoDir.go index c138353..81149aa 100644 --- a/scanRepoDir.go +++ b/scanRepoDir.go @@ -1,11 +1,13 @@ package forgepb import ( + "errors" "fmt" "os" "path/filepath" "github.com/destel/rill" + "go.wit.com/lib/cobol" "go.wit.com/lib/config" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" @@ -36,7 +38,7 @@ func (f *Forge) checkNamespace(fullpath string) (*gitpb.Repo, error) { } func (f *Forge) ScanRepoDir() error { - dirs, err := gitDirectoriesNew(f.Config.ReposDir) + dirs, err := gitDirectoriesNew(config.Get("ReposDir")) if err != nil { return err } @@ -68,13 +70,13 @@ func (f *Forge) rillScanDirsNew(fullpaths []string) (int, error) { ids := rill.FromSlice(fullpaths, nil) // Read users from the API. // Concurrency = 20 - dirs := rill.Map(ids, int(f.Config.RillX), func(id string) (*gitpb.Repo, error) { + dirs := rill.Map(ids, cobol.Int(config.Get("RillX")), func(id string) (*gitpb.Repo, error) { return f.checkNamespace(id) }) var counter int // Activate users. // Concurrency = 10 - err := rill.ForEach(dirs, int(f.Config.RillY), func(repo *gitpb.Repo) error { + err := rill.ForEach(dirs, cobol.Int(config.Get("RillY")), func(repo *gitpb.Repo) error { if repo == nil { return nil } @@ -94,6 +96,10 @@ func (f *Forge) rillScanDirsNew(fullpaths []string) (int, error) { // doesn't enter the directory any further when it finds a .git/ // not stupid like my old version func gitDirectoriesNew(srcDir string) ([]string, error) { + if srcDir == "" { + log.Info("SCANNING DISALBED") + return nil, errors.New("SCANNING DISALBED") + } var all []string var trip bool err := filepath.WalkDir(srcDir, func(path string, d os.DirEntry, err error) error { |
