Skip to content

Find, verify, and analyze leaked credentials

Fix NPD on mutex (#609)

Dustin Deckere3bbf293e2ea
diff --git a/pkg/sources/github/github.go b/pkg/sources/github/github.go
index 7866e9e8f..b2fc1f271 100644
--- a/pkg/sources/github/github.go
+++ b/pkg/sources/github/github.go
@@ -51,7 +51,7 @@ type Source struct {
conn *sourcespb.GitHub
jobSem *semaphore.Weighted
resumeInfoSlice []string
- resumeInfoMutex *sync.Mutex
+ resumeInfoMutex sync.Mutex
sources.Progress
}
diff --git a/pkg/sources/github/github_test.go b/pkg/sources/github/github_test.go
index a73f60fc5..0db9a5277 100644
--- a/pkg/sources/github/github_test.go
+++ b/pkg/sources/github/github_test.go
@@ -12,7 +12,6 @@ import (
"reflect"
"sort"
"strconv"
- "sync"
"testing"
"time"
@@ -362,9 +361,8 @@ func Test_setProgressCompleteWithRepo(t *testing.T) {
logger := logrus.New()
logger.Out = io.Discard
s := &Source{
- repos: []string{},
- log: logger.WithField("no", "output"),
- resumeInfoMutex: &sync.Mutex{},
+ repos: []string{},
+ log: logger.WithField("no", "output"),
}
for _, tt := range tests {
@@ -402,9 +400,8 @@ func Test_removeRepoFromResumeInfo(t *testing.T) {
logger := logrus.New()
logger.Out = io.Discard
s := &Source{
- repos: []string{},
- log: logger.WithField("no", "output"),
- resumeInfoMutex: &sync.Mutex{},
+ repos: []string{},
+ log: logger.WithField("no", "output"),
}
for _, tt := range tests {
@@ -434,9 +431,8 @@ func Test_encodeResumeInfo(t *testing.T) {
logger := logrus.New()
logger.Out = io.Discard
s := &Source{
- repos: []string{},
- log: logger.WithField("no", "output"),
- resumeInfoMutex: &sync.Mutex{},
+ repos: []string{},
+ log: logger.WithField("no", "output"),
}
for _, tt := range tests {
@@ -514,8 +510,7 @@ func Test_filterReposToResume(t *testing.T) {
for name, tt := range tests {
s := &Source{
- repos: startingRepos,
- resumeInfoMutex: &sync.Mutex{},
+ repos: startingRepos,
}
gotProgressOffsetCount := s.filterReposToResume(tt.resumeInfo)