diff --git a/cmd/gogh/list.go b/cmd/gogh/list.go index a57ca8b..de76e53 100644 --- a/cmd/gogh/list.go +++ b/cmd/gogh/list.go @@ -38,6 +38,7 @@ var ( if err != nil { return err } + log.FromContext(ctx).Debugf("found %d projects in %q", len(projects), root) for _, project := range projects { str, err := f.Format(project) if err != nil { diff --git a/local.go b/local.go index ca04dac..623390a 100644 --- a/local.go +++ b/local.go @@ -7,6 +7,7 @@ import ( "os" "path/filepath" "strings" + "sync" "github.com/apex/log" git "github.com/go-git/go-git/v5" @@ -208,6 +209,8 @@ type LocalWalkOption struct { Query string } +var mu sync.Mutex + func (l *LocalController) Walk( ctx context.Context, opt *LocalWalkOption, @@ -251,6 +254,8 @@ func (l *LocalController) Walk( if opt != nil && !strings.Contains(p.RelPath(), opt.Query) { return nil } + mu.Lock() + defer mu.Unlock() return walkFn(p) }) }