-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: pointer, functions and renaming (#202)
- Refactor reporting package to use pointers for Secret struct - Refactor code to move item and secret processing to separate functions - rename secrets to engine
- Loading branch information
Baruch Odem (Rothkoff)
authored
Feb 14, 2024
1 parent
a37deaf
commit ba811c5
Showing
7 changed files
with
53 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package cmd | ||
|
||
import ( | ||
"sync" | ||
|
||
"github.com/checkmarx/2ms/secrets" | ||
) | ||
|
||
func processItems(engine *secrets.Engine) { | ||
defer channels.WaitGroup.Done() | ||
|
||
wgItems := &sync.WaitGroup{} | ||
for item := range channels.Items { | ||
report.TotalItemsScanned++ | ||
wgItems.Add(1) | ||
go engine.Detect(item, secretsChan, wgItems, ignoreVar) | ||
} | ||
wgItems.Wait() | ||
close(secretsChan) | ||
} | ||
|
||
func processSecrets() { | ||
defer channels.WaitGroup.Done() | ||
|
||
for secret := range secretsChan { | ||
report.TotalSecretsFound++ | ||
report.Results[secret.ID] = append(report.Results[secret.ID], secret) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters