Compare commits

..
3 Commits
3 changed files with 17 additions and 2 deletions

No files matched your search

+11 -1
View File
@@ -290,7 +290,17 @@ will be given precedence.
## Sponsorships ## Sponsorships
[![Tines-Sponsorship-Badge-Purple](https://user-images.githubusercontent.com/15034943/146411864-4878f936-b4f7-49a0-b625-f9f40c704bfa.png)](https://www.tines.com/?utm_source=oss&utm_medium=sponsorship&utm_campaign=gitleaks) <p align="left">
<a href="https://www.tines.com/?utm_source=oss&utm_medium=sponsorship&utm_campaign=gitleaks">
<img alt="Tines Sponsorship" src="https://user-images.githubusercontent.com/15034943/146411864-4878f936-b4f7-49a0-b625-f9f40c704bfa.png" width=200>
</a>
</p>
<a href="https://www.typeform.com/">
<img src="https://user-images.githubusercontent.com/15034943/146945294-a6473d55-86b8-4f53-941e-7f185ad6b3d7.png" width=200/>
</a>
</p>
## Exit Codes ## Exit Codes
+5
View File
@@ -20,6 +20,7 @@ func FromFiles(source string, cfg config.Config, outputOptions Options) ([]repor
findings []report.Finding findings []report.Finding
mu sync.Mutex mu sync.Mutex
) )
concurrentGoroutines := make(chan struct{}, 4)
g, _ := errgroup.WithContext(context.Background()) g, _ := errgroup.WithContext(context.Background())
paths := make(chan string) paths := make(chan string)
g.Go(func() error { g.Go(func() error {
@@ -41,12 +42,15 @@ func FromFiles(source string, cfg config.Config, outputOptions Options) ([]repor
for pa := range paths { for pa := range paths {
p := pa p := pa
g.Go(func() error { g.Go(func() error {
concurrentGoroutines <- struct{}{}
b, err := os.ReadFile(p) b, err := os.ReadFile(p)
if err != nil { if err != nil {
<-concurrentGoroutines
return err return err
} }
if !godocutil.IsText(b) { if !godocutil.IsText(b) {
<-concurrentGoroutines
return nil return nil
} }
fis := DetectFindings(cfg, b, p, "") fis := DetectFindings(cfg, b, p, "")
@@ -65,6 +69,7 @@ func FromFiles(source string, cfg config.Config, outputOptions Options) ([]repor
findings = append(findings, fi) findings = append(findings, fi)
mu.Unlock() mu.Unlock()
} }
<-concurrentGoroutines
return nil return nil
}) })
} }
+1 -1
View File
@@ -64,7 +64,7 @@ func messageText(f Finding) string {
} }
func getResults(findings []Finding) []Results { func getResults(findings []Finding) []Results {
var results []Results results := []Results{}
for _, f := range findings { for _, f := range findings {
r := Results{ r := Results{
Message: Message{ Message: Message{