Skip to content

Find, verify, and analyze leaked credentials

[chore] Address lint errors (#1133)

Miccah4efe5313f4fb
diff --git a/go.mod b/go.mod
index 30cbb8861..56cac7e53 100644
--- a/go.mod
+++ b/go.mod
@@ -57,7 +57,6 @@ require (
golang.org/x/oauth2 v0.5.0
golang.org/x/sync v0.1.0
golang.org/x/text v0.7.0
- google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c
google.golang.org/protobuf v1.28.1
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/h2non/gock.v1 v1.1.2
@@ -144,6 +143,7 @@ require (
golang.org/x/tools v0.3.0 // indirect
google.golang.org/api v0.103.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
+ google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c // indirect
google.golang.org/grpc v1.51.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
diff --git a/hack/generate/generate.go b/hack/generate/generate.go
index 47ccc50b0..6ea2ef5b4 100644
--- a/hack/generate/generate.go
+++ b/hack/generate/generate.go
@@ -9,6 +9,8 @@ import (
"text/template"
"github.com/go-errors/errors"
+ "golang.org/x/text/cases"
+ "golang.org/x/text/language"
"gopkg.in/alecthomas/kingpin.v2"
)
@@ -24,7 +26,7 @@ func main() {
log.SetPrefix("😲 [generate] ")
kingpin.MustParse(app.Parse(os.Args[1:]))
- nameTitle = strings.Title(*name)
+ nameTitle = cases.Title(language.AmericanEnglish).String(*name)
nameLower = strings.ToLower(*name)
nameUpper = strings.ToUpper(*name)
@@ -65,7 +67,7 @@ type templateJob struct {
}
func mustWriteTemplates(jobs []templateJob) {
- log.Printf("Generating %s %s\n", strings.Title(*kind), nameTitle)
+ log.Printf("Generating %s %s\n", cases.Title(language.AmericanEnglish).String(*kind), nameTitle)
// Make the folder.
log.Printf("Creating folder %s\n", folderPath())
@@ -84,7 +86,7 @@ func mustWriteTemplates(jobs []templateJob) {
for _, rplString := range job.ReplaceString {
tmplRaw = strings.ReplaceAll(tmplRaw, strings.ToLower(rplString), "<<.NameLower>>")
- tmplRaw = strings.ReplaceAll(tmplRaw, strings.Title(rplString), "<<.NameTitle>>")
+ tmplRaw = strings.ReplaceAll(tmplRaw, cases.Title(language.AmericanEnglish).String(rplString), "<<.NameTitle>>")
tmplRaw = strings.ReplaceAll(tmplRaw, strings.ToUpper(rplString), "<<.NameUpper>>")
}
diff --git a/hack/snifftest/main.go b/hack/snifftest/main.go
index 5066064d5..6d8f704b2 100644
--- a/hack/snifftest/main.go
+++ b/hack/snifftest/main.go
@@ -173,7 +173,9 @@ func main() {
}
for _, repo := range strings.Split(*scanCmdRepo, ",") {
- sem.Acquire(ctx, 1)
+ if err := sem.Acquire(ctx, 1); err != nil {
+ logFatal(err, "timed out waiting for semaphore")
+ }
wgChunkers.Add(1)
go func(r string) {
defer sem.Release(1)
diff --git a/pkg/common/secrets.go b/pkg/common/secrets.go
index 46fa1b5d0..cc759248e 100644
--- a/pkg/common/secrets.go
+++ b/pkg/common/secrets.go
@@ -7,9 +7,9 @@ import (
"time"
secretmanager "cloud.google.com/go/secretmanager/apiv1"
+ "cloud.google.com/go/secretmanager/apiv1/secretmanagerpb"
"github.com/joho/godotenv"
"github.com/pkg/errors"
- secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
)
type Secret struct{ kv map[string]string }
diff --git a/pkg/detectors/generic/generic.go b/pkg/detectors/generic/generic.go
index f23c444db..3bae29549 100644
--- a/pkg/detectors/generic/generic.go
+++ b/pkg/detectors/generic/generic.go
@@ -44,8 +44,6 @@ func New() Scanner {
}
type Scanner struct {
- wordList []string
- badList []string
programmingBookWords []string
excludeMatchers []*regexp.Regexp
}
diff --git a/pkg/detectors/uri/uri.go b/pkg/detectors/uri/uri.go
index bae409a7b..203b048ae 100644
--- a/pkg/detectors/uri/uri.go
+++ b/pkg/detectors/uri/uri.go
@@ -26,10 +26,6 @@ var (
client = common.SaneHttpClient()
)
-type proxyRes struct {
- Verified bool `json:"verified"`
-}
-
// Keywords are used for efficiently pre-filtering chunks.
// Use identifiers in the secret preferably, or the provider name.
func (s Scanner) Keywords() []string {
diff --git a/pkg/sources/git/git_test.go b/pkg/sources/git/git_test.go
index 6b4fdd6ce..012841352 100644
--- a/pkg/sources/git/git_test.go
+++ b/pkg/sources/git/git_test.go
@@ -137,7 +137,7 @@ func TestSource_Scan(t *testing.T) {
}
chunksCh := make(chan *sources.Chunk, 1)
go func() {
- s.Chunks(ctx, chunksCh)
+ assert.NoError(t, s.Chunks(ctx, chunksCh))
}()
gotChunk := <-chunksCh
gotChunk.Data = nil