Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
16fca86c
"vscode:/vscode.git/clone" did not exist on "03e40efa51a75a4e8385b64996af6468f42f6c06"
Commit
16fca86c
authored
Apr 04, 2025
by
Michael Yang
Committed by
Michael Yang
Apr 07, 2025
Browse files
digest files in parallel
parent
0f3f9e35
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
parser/parser.go
parser/parser.go
+21
-5
No files found.
parser/parser.go
View file @
16fca86c
...
...
@@ -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
{
g
.
Go
(
func
()
error
{
digest
,
err
:=
digestForFile
(
f
)
if
err
!=
nil
{
return
nil
,
err
return
err
}
mu
.
Lock
()
defer
mu
.
Unlock
()
fl
[
f
]
=
digest
return
nil
})
}
if
err
:=
g
.
Wait
();
err
!=
nil
{
return
nil
,
err
}
return
fl
,
nil
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment