Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
digest files in parallel
Michael Yang16fca86c4a6c
diff --git a/parser/parser.go b/parser/parser.goindex 9a98c8ea7..a14ac5ff4 100644--- a/parser/parser.go+++ b/parser/parser.go@@ -11,10 +11,13 @@ import ("os""os/user""path/filepath"+ "runtime""slices""strconv""strings"+ "sync"+ "golang.org/x/sync/errgroup""golang.org/x/text/encoding/unicode""golang.org/x/text/transform"@@ -144,12 +147,25 @@ func fileDigestMap(path string) (map[string]string, error) {files = []string{path}}+ var mu sync.Mutex+ var g errgroup.Group+ g.SetLimit(max(runtime.GOMAXPROCS(0)-1, 1))for _, f := range files {- digest, err := digestForFile(f)- if err != nil {- return nil, err- }- fl[f] = digest+ g.Go(func() error {+ digest, err := digestForFile(f)+ if err != nil {+ return err+ }++ mu.Lock()+ defer mu.Unlock()+ fl[f] = digest+ return nil+ })+ }++ if err := g.Wait(); err != nil {+ return nil, err}return fl, nil