mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-27 19:54:24 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6862c13bf7 | ||
|
|
9939c638ec | ||
|
|
ed3a512b4b | ||
|
|
7c988c927d | ||
|
|
bde9af44ea | ||
|
|
eee4d05642 | ||
|
|
9144594d77 | ||
|
|
1cb15242fd | ||
|
|
08498600d1 | ||
|
|
88c0c7779b | ||
|
|
67454d109e | ||
|
|
ce603c73b4 | ||
|
|
55218fc8f8 | ||
|
|
5d81c650e8 | ||
|
|
0726209172 | ||
|
|
bfec8aca51 | ||
|
|
a9b30edb06 | ||
|
|
cc6d698e63 | ||
|
|
2ba97d0fa3 | ||
|
|
d299b5aa7f | ||
|
|
0a209b60a5 | ||
|
|
fe8c6271f2 | ||
|
|
42fb085684 | ||
|
|
3faec00bf9 | ||
|
|
93669f1ee8 |
No files matched your search
@@ -1,6 +1,57 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
1.11.0
|
||||
-----
|
||||
- Commit depth option
|
||||
- Commit stats output
|
||||
|
||||
1.10.0
|
||||
-----
|
||||
- Add entropy option
|
||||
|
||||
1.9.0
|
||||
-----
|
||||
- exclude fork option
|
||||
|
||||
1.8.0
|
||||
-----
|
||||
- whitelist repos
|
||||
- sample config option
|
||||
|
||||
1.7.3
|
||||
-----
|
||||
- style points
|
||||
|
||||
1.7.2
|
||||
-----
|
||||
- Fixing dangling goroutines, removing channel messaging
|
||||
|
||||
1.7.1
|
||||
-----
|
||||
- Fixing bug where single repos were not being audited
|
||||
|
||||
1.7.0
|
||||
-----
|
||||
- Exit code == 2 on error
|
||||
- Cleaning up some logs
|
||||
- Removing some unreachable code
|
||||
|
||||
1.6.1
|
||||
-----
|
||||
- Recover from panic when diffing
|
||||
|
||||
1.6.0
|
||||
-----
|
||||
- Default maximum goroutines spawned is number of cores your cpu run with. See benchmarks in wiki.
|
||||
- Cleanup after each repo audit for organizations rather than waiting for the entire organization to complete. Eliminates risk of running out of disk space.
|
||||
|
||||
|
||||
1.5.0
|
||||
-----
|
||||
- Support for CSV reporting
|
||||
- Refactoring github user/owner audits
|
||||
|
||||
1.4.0
|
||||
-----
|
||||
- Support for single commit repos
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# Contributing Guidelines
|
||||
|
||||
The gitleaks project is under [GNU General Public License v3.0](LICENSE.md) and accepts
|
||||
contributions via GitHub pull requests.
|
||||
|
||||
## How to Contribute
|
||||
|
||||
Open a PR. Give the PR a descriptive title. Add some comments describing whats the purpose of the PR.
|
||||
|
||||
__BUT before you do that!__
|
||||
|
||||
Make sure you pass this list of requirements.
|
||||
|
||||
- You've ran `go fmt`.
|
||||
- You've ran `golint`.
|
||||
- Your Go changes are confined to `gitleaks_test.go` and `main.go`. This is subject to change as the project evolves. Stylistically, I like having a single go file considering the size of this project (its tiny).
|
||||
- You've added test cases for your changes.
|
||||
- You've updated [the changelog](CHANGELOG.md).
|
||||
- Your tests pass.
|
||||
|
||||
@@ -4,13 +4,12 @@ test:
|
||||
go get github.com/golang/lint/golint
|
||||
go fmt
|
||||
golint
|
||||
go test --race -cover
|
||||
go test --race --cover -run=Test$
|
||||
deploy:
|
||||
@echo "$(DOCKER_PASSWORD)" | docker login -u "$(DOCKER_USERNAME)" --password-stdin
|
||||
docker build -f Dockerfile -t $(REPO):$(TAG) .
|
||||
echo "Pushing $(REPO):$(COMMIT) $(REPO):$(TAG)"
|
||||
docker push $(REPO)
|
||||
|
||||
build-all:
|
||||
rm -rf build
|
||||
mkdir build
|
||||
@@ -21,3 +20,8 @@ build-all:
|
||||
env GOOS="linux" GOARCH="mips" go build -o "build/gitleaks-linux-mips"
|
||||
env GOOS="linux" GOARCH="mips" go build -o "build/gitleaks-linux-mips"
|
||||
env GOOS="darwin" GOARCH="amd64" go build -o "build/gitleaks-darwin-amd64"
|
||||
benchmark:
|
||||
go test -run=Benchmark -bench=. -benchtime=5s
|
||||
benchmark-fast:
|
||||
go test -bench=BenchmarkAuditLeakRepo -run=BenchmarkAuditLeakRepo$
|
||||
|
||||
@@ -26,12 +26,13 @@ Usage:
|
||||
|
||||
Application Options:
|
||||
-r, --repo= Repo url to audit
|
||||
--github-user= User url to audit
|
||||
--github-org= Organization url to audit
|
||||
--github-user= Github user to audit
|
||||
--github-org= Github organization to audit
|
||||
--github-url= GitHub API Base URL, use for GitHub Enterprise. Example: https://github.example.com/api/v3/ (default: https://api.github.com/)
|
||||
-p, --private Include private repos in audit
|
||||
-b, --branch= branch name to audit (defaults to HEAD)
|
||||
-c, --commit= sha of commit to stop at
|
||||
--depth= maximum commit depth
|
||||
--repo-path= Path to repo
|
||||
--owner-path= Path to owner directory (repos discovered)
|
||||
--max-go= Maximum number of concurrent go-routines gitleaks spawns
|
||||
@@ -40,19 +41,24 @@ Application Options:
|
||||
--single-search= single regular expression to search for
|
||||
--config= path to gitleaks config
|
||||
--ssh-key= path to ssh key
|
||||
--exclude-forks exclude forks for organization/user audits
|
||||
-e, --entropy= Include entropy checks during audit. Entropy scale: 0.0(no entropy) - 8.0(max entropy)
|
||||
-l, --log= log level
|
||||
-v, --verbose Show verbose output from gitleaks audit
|
||||
--report= path to write report file
|
||||
--csv report output to csv
|
||||
--redact redact secrets from log messages and report
|
||||
--version version number
|
||||
--sample-config prints a sample config file
|
||||
|
||||
Help Options:
|
||||
-h, --help Show this help message
|
||||
```
|
||||
#### Exit Codes
|
||||
```
|
||||
1: leaks present
|
||||
0: no leaks
|
||||
1: leaks present
|
||||
2: error encountered
|
||||
```
|
||||
|
||||
#### Additional Examples and Explanations
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ regex = '''(?i)twitter.*['\"][0-9a-zA-Z]{35,44}['\"]'''
|
||||
|
||||
[whitelist]
|
||||
regexes = [
|
||||
"AKIA.*",
|
||||
# "AKIA.*EXAMPLE",
|
||||
]
|
||||
files = [
|
||||
"(.*?)(jpg|gif|doc|pdf|bin|go)$"
|
||||
|
||||
+321
-40
@@ -56,6 +56,46 @@ regexes= [
|
||||
]
|
||||
`
|
||||
|
||||
const testWhitelistRepo = `
|
||||
[[regexes]]
|
||||
description = "AWS"
|
||||
regex = '''AKIA[0-9A-Z]{16}'''
|
||||
|
||||
[whitelist]
|
||||
repos = [
|
||||
"gronit",
|
||||
]
|
||||
`
|
||||
|
||||
var benchmarkRepo *RepoDescriptor
|
||||
var benchmarkLeaksRepo *RepoDescriptor
|
||||
|
||||
func getBenchmarkLeaksRepo() *RepoDescriptor {
|
||||
if benchmarkLeaksRepo != nil {
|
||||
return benchmarkLeaksRepo
|
||||
}
|
||||
leaksR, _ := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
|
||||
URL: "https://github.com/gitleakstest/gronit.git",
|
||||
})
|
||||
benchmarkLeaksRepo = &RepoDescriptor{
|
||||
repository: leaksR,
|
||||
}
|
||||
return benchmarkLeaksRepo
|
||||
}
|
||||
|
||||
func getBenchmarkRepo() *RepoDescriptor {
|
||||
if benchmarkRepo != nil {
|
||||
return benchmarkRepo
|
||||
}
|
||||
bmRepo, _ := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
|
||||
URL: "https://github.com/apple/swift-package-manager.git",
|
||||
})
|
||||
benchmarkRepo = &RepoDescriptor{
|
||||
repository: bmRepo,
|
||||
}
|
||||
return benchmarkRepo
|
||||
}
|
||||
|
||||
func TestGetRepo(t *testing.T) {
|
||||
var err error
|
||||
dir, err = ioutil.TempDir("", "gitleaksTestRepo")
|
||||
@@ -128,7 +168,7 @@ func TestGetRepo(t *testing.T) {
|
||||
g.Describe("TestGetRepo", func() {
|
||||
g.It(test.description, func() {
|
||||
opts = test.testOpts
|
||||
_, err := getRepo()
|
||||
_, err := cloneRepo()
|
||||
if err != nil {
|
||||
g.Assert(err.Error()).Equal(test.expectedErrMsg)
|
||||
}
|
||||
@@ -136,9 +176,9 @@ func TestGetRepo(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetOwnerRepo(t *testing.T) {
|
||||
func TestRun(t *testing.T) {
|
||||
var err error
|
||||
configsDir := testTomlLoader()
|
||||
|
||||
dir, err = ioutil.TempDir("", "gitleaksTestOwner")
|
||||
defer os.RemoveAll(dir)
|
||||
@@ -155,14 +195,16 @@ func TestGetOwnerRepo(t *testing.T) {
|
||||
testOpts Options
|
||||
description string
|
||||
expectedErrMsg string
|
||||
numRepos int
|
||||
whiteListRepos []string
|
||||
numLeaks int
|
||||
configPath string
|
||||
}{
|
||||
{
|
||||
testOpts: Options{
|
||||
GithubUser: "gitleakstest",
|
||||
},
|
||||
description: "test github user",
|
||||
numRepos: 2,
|
||||
numLeaks: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
@@ -171,7 +213,7 @@ func TestGetOwnerRepo(t *testing.T) {
|
||||
Disk: true,
|
||||
},
|
||||
description: "test github user on disk ",
|
||||
numRepos: 2,
|
||||
numLeaks: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
@@ -179,56 +221,92 @@ func TestGetOwnerRepo(t *testing.T) {
|
||||
GithubOrg: "gitleakstestorg",
|
||||
},
|
||||
description: "test github org",
|
||||
numRepos: 2,
|
||||
numLeaks: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: Options{
|
||||
OwnerPath: dir,
|
||||
},
|
||||
description: "test plain clone remote repo",
|
||||
numRepos: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: Options{
|
||||
GithubOrg: "gitleakstestorg",
|
||||
IncludePrivate: true,
|
||||
},
|
||||
description: "test private org no ssh",
|
||||
numRepos: 0,
|
||||
expectedErrMsg: "no ssh auth available",
|
||||
},
|
||||
{
|
||||
testOpts: Options{
|
||||
GithubOrg: "gitleakstestorg",
|
||||
Disk: true,
|
||||
},
|
||||
description: "test org on disk",
|
||||
numRepos: 2,
|
||||
numLeaks: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: Options{
|
||||
OwnerPath: dir,
|
||||
},
|
||||
description: "test owner path",
|
||||
numLeaks: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: Options{
|
||||
GithubOrg: "gitleakstestorg",
|
||||
IncludePrivate: true,
|
||||
Disk: true,
|
||||
SSHKey: "reallyreallyreallyreallywrongpath",
|
||||
},
|
||||
description: "test private org on disk no ssh",
|
||||
numRepos: 0,
|
||||
expectedErrMsg: "no ssh auth available",
|
||||
description: "test private org no ssh",
|
||||
numLeaks: 0,
|
||||
expectedErrMsg: "unable to generate ssh key: open reallyreallyreallyreallywrongpath: no such file or directory",
|
||||
},
|
||||
{
|
||||
testOpts: Options{
|
||||
Repo: "https://github.com/gitleakstest/gronit.git",
|
||||
},
|
||||
description: "test leak",
|
||||
numLeaks: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: Options{
|
||||
Repo: "https://github.com/gitleakstest/h1domains.git",
|
||||
},
|
||||
description: "test clean",
|
||||
numLeaks: 0,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: Options{
|
||||
Repo: "https://github.com/gitleakstest/empty.git",
|
||||
},
|
||||
description: "test empty",
|
||||
numLeaks: 0,
|
||||
expectedErrMsg: "reference not found",
|
||||
},
|
||||
{
|
||||
testOpts: Options{
|
||||
GithubOrg: "gitleakstestorg",
|
||||
},
|
||||
description: "test github org, whitelist repo",
|
||||
numLeaks: 0,
|
||||
expectedErrMsg: "",
|
||||
configPath: path.Join(configsDir, "repo"),
|
||||
},
|
||||
{
|
||||
testOpts: Options{
|
||||
GithubOrg: "gitleakstestorg",
|
||||
ExcludeForks: true,
|
||||
},
|
||||
description: "test github org, exclude forks",
|
||||
numLeaks: 0,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
}
|
||||
g := goblin.Goblin(t)
|
||||
for _, test := range tests {
|
||||
g.Describe("TestGetOwnerRepo", func() {
|
||||
g.Describe("TestRun", func() {
|
||||
g.It(test.description, func() {
|
||||
if test.configPath != "" {
|
||||
os.Setenv("GITLEAKS_CONFIG", test.configPath)
|
||||
}
|
||||
opts = test.testOpts
|
||||
repos, err := getOwnerRepos()
|
||||
leaks, err := run()
|
||||
if err != nil {
|
||||
g.Assert(err.Error()).Equal(test.expectedErrMsg)
|
||||
}
|
||||
g.Assert(len(repos)).Equal(test.numRepos)
|
||||
g.Assert(len(leaks)).Equal(test.numLeaks)
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -236,7 +314,8 @@ func TestGetOwnerRepo(t *testing.T) {
|
||||
|
||||
func TestWriteReport(t *testing.T) {
|
||||
tmpDir, _ := ioutil.TempDir("", "reportDir")
|
||||
reportFile := path.Join(tmpDir, "report.json")
|
||||
reportJSON := path.Join(tmpDir, "report.json")
|
||||
reportCSV := path.Join(tmpDir, "report.csv")
|
||||
defer os.RemoveAll(tmpDir)
|
||||
leaks := []Leak{
|
||||
{
|
||||
@@ -260,11 +339,21 @@ func TestWriteReport(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
leaks: leaks,
|
||||
reportFile: reportFile,
|
||||
reportFile: reportJSON,
|
||||
fileName: "report.json",
|
||||
description: "can we write a file",
|
||||
testOpts: Options{
|
||||
Report: reportFile,
|
||||
Report: reportJSON,
|
||||
},
|
||||
},
|
||||
{
|
||||
leaks: leaks,
|
||||
reportFile: reportCSV,
|
||||
fileName: "report.csv",
|
||||
description: "can we write a file",
|
||||
testOpts: Options{
|
||||
Report: reportCSV,
|
||||
CSV: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -288,6 +377,7 @@ func testTomlLoader() string {
|
||||
ioutil.WriteFile(path.Join(tmpDir, "branch"), []byte(testWhitelistBranch), 0644)
|
||||
ioutil.WriteFile(path.Join(tmpDir, "commit"), []byte(testWhitelistCommit), 0644)
|
||||
ioutil.WriteFile(path.Join(tmpDir, "file"), []byte(testWhitelistFile), 0644)
|
||||
ioutil.WriteFile(path.Join(tmpDir, "repo"), []byte(testWhitelistRepo), 0644)
|
||||
return tmpDir
|
||||
}
|
||||
|
||||
@@ -300,29 +390,38 @@ func TestAuditRepo(t *testing.T) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
leaksRepo, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
|
||||
leaksR, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
|
||||
URL: "https://github.com/gitleakstest/gronit.git",
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
leaksRepo := &RepoDescriptor{
|
||||
repository: leaksR,
|
||||
name: "gronit",
|
||||
}
|
||||
|
||||
cleanRepo, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
|
||||
cleanR, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
|
||||
URL: "https://github.com/gitleakstest/h1domains.git",
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
cleanRepo := &RepoDescriptor{
|
||||
repository: cleanR,
|
||||
name: "h1domains",
|
||||
}
|
||||
|
||||
var tests = []struct {
|
||||
testOpts Options
|
||||
description string
|
||||
expectedErrMsg string
|
||||
numLeaks int
|
||||
repo *git.Repository
|
||||
repo *RepoDescriptor
|
||||
whiteListFiles []*regexp.Regexp
|
||||
whiteListCommits map[string]bool
|
||||
whiteListBranches []string
|
||||
whiteListRepos []string
|
||||
whiteListRegexes []*regexp.Regexp
|
||||
configPath string
|
||||
}{
|
||||
@@ -336,7 +435,7 @@ func TestAuditRepo(t *testing.T) {
|
||||
description: "two leaks present limit goroutines",
|
||||
numLeaks: 2,
|
||||
testOpts: Options{
|
||||
MaxGoRoutines: 2,
|
||||
MaxGoRoutines: 4,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -447,6 +546,52 @@ func TestAuditRepo(t *testing.T) {
|
||||
configPath: path.Join(configsDir, "commit"),
|
||||
numLeaks: 2,
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "audit whitelist repo",
|
||||
numLeaks: 0,
|
||||
whiteListRepos: []string{
|
||||
"gronit",
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "toml whitelist repo",
|
||||
numLeaks: 0,
|
||||
configPath: path.Join(configsDir, "repo"),
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "leaks present with entropy",
|
||||
testOpts: Options{
|
||||
Entropy: 4.7,
|
||||
},
|
||||
numLeaks: 7,
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "Audit until specific commit",
|
||||
numLeaks: 1,
|
||||
testOpts: Options{
|
||||
Commit: "f6839959b7bbdcd23008f1fb16f797f35bcd3a0c",
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "commit depth = 1, no leaks",
|
||||
numLeaks: 0,
|
||||
testOpts: Options{
|
||||
Depth: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "commit depth = 2, one leak",
|
||||
numLeaks: 1,
|
||||
testOpts: Options{
|
||||
Depth: 2,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
whiteListCommits = make(map[string]bool)
|
||||
@@ -476,6 +621,11 @@ func TestAuditRepo(t *testing.T) {
|
||||
} else {
|
||||
whiteListRegexes = nil
|
||||
}
|
||||
if test.whiteListRepos != nil {
|
||||
whiteListRepos = test.whiteListRepos
|
||||
} else {
|
||||
whiteListRepos = nil
|
||||
}
|
||||
|
||||
// config paths
|
||||
if test.configPath != "" {
|
||||
@@ -483,7 +633,7 @@ func TestAuditRepo(t *testing.T) {
|
||||
loadToml()
|
||||
}
|
||||
|
||||
leaks, err = auditRepo(test.repo)
|
||||
leaks, err = auditGitRepo(test.repo)
|
||||
|
||||
if opts.Redact {
|
||||
g.Assert(leaks[0].Offender).Equal("REDACTED")
|
||||
@@ -568,6 +718,14 @@ func TestOptionGuard(t *testing.T) {
|
||||
description: "single search regex gaurd",
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: Options{
|
||||
GithubOrg: "fakeOrg",
|
||||
Entropy: 9,
|
||||
},
|
||||
description: "Invalid entropy level guard",
|
||||
expectedErrMsg: "The maximum level of entropy is 8",
|
||||
},
|
||||
}
|
||||
g := goblin.Goblin(t)
|
||||
for _, test := range tests {
|
||||
@@ -669,3 +827,126 @@ func TestLoadToml(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAuditRepo1Proc(b *testing.B) {
|
||||
loadToml()
|
||||
opts.MaxGoRoutines = 1
|
||||
benchmarkRepo = getBenchmarkRepo()
|
||||
for n := 0; n < b.N; n++ {
|
||||
auditGitRepo(benchmarkRepo)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAuditRepo2Proc(b *testing.B) {
|
||||
loadToml()
|
||||
opts.MaxGoRoutines = 2
|
||||
benchmarkRepo = getBenchmarkRepo()
|
||||
for n := 0; n < b.N; n++ {
|
||||
auditGitRepo(benchmarkRepo)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAuditRepo4Proc(b *testing.B) {
|
||||
loadToml()
|
||||
opts.MaxGoRoutines = 4
|
||||
benchmarkRepo = getBenchmarkRepo()
|
||||
for n := 0; n < b.N; n++ {
|
||||
auditGitRepo(benchmarkRepo)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAuditRepo8Proc(b *testing.B) {
|
||||
loadToml()
|
||||
opts.MaxGoRoutines = 8
|
||||
benchmarkRepo = getBenchmarkRepo()
|
||||
for n := 0; n < b.N; n++ {
|
||||
auditGitRepo(benchmarkRepo)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAuditRepo10Proc(b *testing.B) {
|
||||
loadToml()
|
||||
opts.MaxGoRoutines = 10
|
||||
benchmarkRepo = getBenchmarkRepo()
|
||||
for n := 0; n < b.N; n++ {
|
||||
auditGitRepo(benchmarkRepo)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAuditRepo100Proc(b *testing.B) {
|
||||
loadToml()
|
||||
opts.MaxGoRoutines = 100
|
||||
benchmarkRepo = getBenchmarkRepo()
|
||||
for n := 0; n < b.N; n++ {
|
||||
auditGitRepo(benchmarkRepo)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAuditRepo1000Proc(b *testing.B) {
|
||||
loadToml()
|
||||
opts.MaxGoRoutines = 1000
|
||||
benchmarkRepo = getBenchmarkRepo()
|
||||
for n := 0; n < b.N; n++ {
|
||||
auditGitRepo(benchmarkRepo)
|
||||
}
|
||||
}
|
||||
func BenchmarkAuditLeakRepo1Proc(b *testing.B) {
|
||||
loadToml()
|
||||
opts.MaxGoRoutines = 1
|
||||
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
||||
for n := 0; n < b.N; n++ {
|
||||
auditGitRepo(benchmarkRepo)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAuditLeakRepo2Proc(b *testing.B) {
|
||||
loadToml()
|
||||
opts.MaxGoRoutines = 2
|
||||
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
||||
for n := 0; n < b.N; n++ {
|
||||
auditGitRepo(benchmarkRepo)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAuditLeakRepo4Proc(b *testing.B) {
|
||||
loadToml()
|
||||
opts.MaxGoRoutines = 4
|
||||
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
||||
for n := 0; n < b.N; n++ {
|
||||
auditGitRepo(benchmarkRepo)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAuditLeakRepo8Proc(b *testing.B) {
|
||||
loadToml()
|
||||
opts.MaxGoRoutines = 8
|
||||
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
||||
for n := 0; n < b.N; n++ {
|
||||
auditGitRepo(benchmarkRepo)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAuditLeakRepo10Proc(b *testing.B) {
|
||||
loadToml()
|
||||
opts.MaxGoRoutines = 10
|
||||
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
||||
for n := 0; n < b.N; n++ {
|
||||
auditGitRepo(benchmarkRepo)
|
||||
}
|
||||
}
|
||||
func BenchmarkAuditLeakRepo100Proc(b *testing.B) {
|
||||
loadToml()
|
||||
opts.MaxGoRoutines = 100
|
||||
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
||||
for n := 0; n < b.N; n++ {
|
||||
auditGitRepo(benchmarkRepo)
|
||||
}
|
||||
}
|
||||
func BenchmarkAuditLeakRepo1000Proc(b *testing.B) {
|
||||
loadToml()
|
||||
opts.MaxGoRoutines = 1000
|
||||
benchmarkLeaksRepo = getBenchmarkLeaksRepo()
|
||||
for n := 0; n < b.N; n++ {
|
||||
auditGitRepo(benchmarkRepo)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user