Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
Enable errcheck and staticcheck for golangci-lint v2 and resolve all issues (#4924)
Amaan Ullah0fa069c12f0c
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.ymlindex ccea46b14..c0d73e468 100644--- a/.github/workflows/lint.yml+++ b/.github/workflows/lint.yml@@ -24,7 +24,7 @@ jobs:with:# NOTE: Version and args must match scripts/lint.shversion: v2.11.4- args: --disable errcheck,staticcheck --enable bodyclose,copyloopvar,misspell --timeout 10m+ args: --enable bodyclose,copyloopvar,misspell --timeout 10mman-page-staleness:name: man-page-stalenessruns-on: ubuntu-latestdiff --git a/hack/checksecretparts/main.go b/hack/checksecretparts/main.goindex 6bd8633f1..e300b32f1 100644--- a/hack/checksecretparts/main.go+++ b/hack/checksecretparts/main.go@@ -33,9 +33,9 @@ func main() {flag.BoolVar(&failOnFindings, "fail", false, "exit 1 if any findings are reported (default: warning-only)")flag.BoolVar(&quiet, "quiet", false, "suppress the summary line when no findings are reported")flag.Usage = func() {- fmt.Fprintf(flag.CommandLine.Output(), "Usage: %s [flags] [dir ...]\n", os.Args[0])- fmt.Fprintln(flag.CommandLine.Output(), "\nFinds detector packages that construct detectors.Result without setting SecretParts.")- fmt.Fprintln(flag.CommandLine.Output(), "\nFlags:")+ _, _ = fmt.Fprintf(flag.CommandLine.Output(), "Usage: %s [flags] [dir ...]\n", os.Args[0])+ _, _ = fmt.Fprintln(flag.CommandLine.Output(), "\nFinds detector packages that construct detectors.Result without setting SecretParts.")+ _, _ = fmt.Fprintln(flag.CommandLine.Output(), "\nFlags:")flag.PrintDefaults()}flag.Parse()diff --git a/hack/snifftest/main.go b/hack/snifftest/main.goindex fe401aa9e..b2c46eec8 100644--- a/hack/snifftest/main.go+++ b/hack/snifftest/main.go@@ -219,7 +219,7 @@ func main() {logFatal(err, "error scanning repo")}logger.Info("scanned repo", "repo", r)- defer os.RemoveAll(path)+ defer func() { _ = os.RemoveAll(path) }()}(repo)}diff --git a/main.go b/main.goindex a73df6c0b..4f5532425 100644--- a/main.go+++ b/main.go@@ -465,7 +465,7 @@ func run(state overseer.State, logSync func() error) {if *githubScanToken != "" {// NOTE: this kludge is here to do an authenticated shallow commit// TODO: refactor to better pass credentials- os.Setenv("GITHUB_TOKEN", *githubScanToken)+ _ = os.Setenv("GITHUB_TOKEN", *githubScanToken)}if *concurrency <= 0 {@@ -725,7 +725,7 @@ func runSingleScan(ctx context.Context, cmd string, cfg engine.Config) (metrics,handleFinishedMetrics := func(ctx context.Context, finishedMetrics <-chan sources.UnitMetrics, jobReportWriter io.WriteCloser) {go func() {defer func() {- jobReportWriter.Close()+ _ = jobReportWriter.Close()if namer, ok := jobReportWriter.(interface{ Name() string }); ok {ctx.Logger().Info("report written", "path", namer.Name())} else {diff --git a/pkg/analyzer/analyzers/airbrake/airbrake.go b/pkg/analyzer/analyzers/airbrake/airbrake.goindex eba06658f..494639e35 100644--- a/pkg/analyzer/analyzers/airbrake/airbrake.go+++ b/pkg/analyzer/analyzers/airbrake/airbrake.go@@ -25,8 +25,7 @@ func (Analyzer) Type() analyzers.AnalyzerType { return analyzers.AnalyzerTypeAirfunc (a Analyzer) Analyze(_ context.Context, credInfo map[string]string) (*analyzers.AnalyzerResult, error) {info, err := AnalyzePermissions(a.Cfg, credInfo["key"])if err != nil {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err,- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err)}return secretInfoToAnalyzerResult(info), nil}@@ -109,7 +108,7 @@ func validateKey(cfg *config.Config, key string) (bool, []Project, error) {}// read response- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// if status code is 200, decode responseif resp.StatusCode == 200 {@@ -150,7 +149,7 @@ func AnalyzePermissions(cfg *config.Config, key string) (*SecretInfo, error) {return nil, err}if !valid {- return nil, fmt.Errorf("Invalid Airbrake User API Key")+ return nil, fmt.Errorf("invalid Airbrake User API Key")}info := &SecretInfo{diff --git a/pkg/analyzer/analyzers/airtable/airtablepat/airtable.go b/pkg/analyzer/analyzers/airtable/airtablepat/airtable.goindex 2a8741799..97ca4f0fa 100644--- a/pkg/analyzer/analyzers/airtable/airtablepat/airtable.go+++ b/pkg/analyzer/analyzers/airtable/airtablepat/airtable.go@@ -119,7 +119,7 @@ func determineScope(token string, perm common.Permission, requiredIDs map[stringif requiredIDs != nil {for _, key := range endpoint.RequiredIDs {if value, ok := requiredIDs[key]; ok {- url = strings.Replace(url, fmt.Sprintf("{%s}", key), value, -1)+ url = strings.ReplaceAll(url, fmt.Sprintf("{%s}", key), value)}}}@@ -128,7 +128,7 @@ func determineScope(token string, perm common.Permission, requiredIDs map[stringif err != nil {return false, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode == endpoint.ExpectedSuccessStatus {scopeStatusMap[scopeString] = truediff --git a/pkg/analyzer/analyzers/airtable/airtablepat/requests.go b/pkg/analyzer/analyzers/airtable/airtablepat/requests.goindex 2afac070e..88766832e 100644--- a/pkg/analyzer/analyzers/airtable/airtablepat/requests.go+++ b/pkg/analyzer/analyzers/airtable/airtablepat/requests.go@@ -18,12 +18,12 @@ func fetchAirtableRecords(token string, baseID string, tableID string) ([]commonif !exists {return nil, fmt.Errorf("endpoint for ListRecordsEndpoint does not exist")}- url := strings.Replace(strings.Replace(endpoint.URL, "{baseID}", baseID, -1), "{tableID}", tableID, -1)+ url := strings.ReplaceAll(strings.ReplaceAll(endpoint.URL, "{baseID}", baseID), "{tableID}", tableID)resp, err := common.CallAirtableAPI(token, "GET", url)if err != nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode != http.StatusOK {return nil, fmt.Errorf("failed to fetch Airtable records, status: %d", resp.StatusCode)diff --git a/pkg/analyzer/analyzers/airtable/common/common.go b/pkg/analyzer/analyzers/airtable/common/common.goindex cf989ca84..6c9b7941d 100644--- a/pkg/analyzer/analyzers/airtable/common/common.go+++ b/pkg/analyzer/analyzers/airtable/common/common.go@@ -39,7 +39,7 @@ func FetchAirtableUserInfo(token string) (*AirtableUserInfo, error) {if err != nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode != http.StatusOK {return nil, fmt.Errorf("failed to fetch Airtable user info, status: %d", resp.StatusCode)@@ -62,7 +62,7 @@ func FetchAirtableBases(token string) (*AirtableBases, error) {if err != nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode != http.StatusOK {return nil, fmt.Errorf("failed to fetch Airtable bases, status: %d", resp.StatusCode)@@ -96,7 +96,7 @@ func fetchBaseSchema(token string, baseID string) (*Schema, error) {if err != nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode != http.StatusOK {return nil, fmt.Errorf("failed to fetch schema for base %s, status: %d", baseID, resp.StatusCode)diff --git a/pkg/analyzer/analyzers/analyzers.go b/pkg/analyzer/analyzers/analyzers.goindex be2ad171d..261bf95e2 100644--- a/pkg/analyzer/analyzers/analyzers.go+++ b/pkg/analyzer/analyzers/analyzers.go@@ -227,7 +227,7 @@ func (h *HttpStatusTest) RunTest(headers map[string]string) error {if err != nil {return err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check response status codeswitch {diff --git a/pkg/analyzer/analyzers/asana/asana.go b/pkg/analyzer/analyzers/asana/asana.goindex a25158ab2..d3c277ce5 100644--- a/pkg/analyzer/analyzers/asana/asana.go+++ b/pkg/analyzer/analyzers/asana/asana.go@@ -116,10 +116,10 @@ func AnalyzePermissions(cfg *config.Config, key string) (*SecretInfo, error) {}if resp.StatusCode != 200 {- return nil, fmt.Errorf("Invalid Asana API Key")+ return nil, fmt.Errorf("invalid Asana API Key")}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()err = json.NewDecoder(resp.Body).Decode(&me)if err != nil {@@ -127,7 +127,7 @@ func AnalyzePermissions(cfg *config.Config, key string) (*SecretInfo, error) {}if me.Data.Email == "" {- return nil, fmt.Errorf("Invalid Asana API Key")+ return nil, fmt.Errorf("invalid Asana API Key")}return &me, nil}diff --git a/pkg/analyzer/analyzers/bitbucket/bitbucket.go b/pkg/analyzer/analyzers/bitbucket/bitbucket.goindex fd8471998..59d0b211e 100644--- a/pkg/analyzer/analyzers/bitbucket/bitbucket.go+++ b/pkg/analyzer/analyzers/bitbucket/bitbucket.go@@ -146,7 +146,7 @@ func getScopesAndType(cfg *config.Config, key string) (string, []string, error)if err != nil {return "", nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// parse response headerscredentialType := resp.Header.Get("x-credential-type")@@ -198,7 +198,7 @@ func getRepositories(cfg *config.Config, key string, role string) (RepoJSON, errif err != nil {return repos, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// parse response bodyerr = json.NewDecoder(resp.Body).Decode(&repos)diff --git a/pkg/analyzer/analyzers/client.go b/pkg/analyzer/analyzers/client.goindex 1bd981867..0d16d50de 100644--- a/pkg/analyzer/analyzers/client.go+++ b/pkg/analyzer/analyzers/client.go@@ -107,7 +107,7 @@ func (r LoggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, errorif err != nil {return resp, fmt.Errorf("failed to open log file: %w", err)}- defer file.Close()+ defer func() { _ = file.Close() }()// Write log entry to file.if _, err := file.WriteString(logEntry); err != nil {diff --git a/pkg/analyzer/analyzers/datadog/requests.go b/pkg/analyzer/analyzers/datadog/requests.goindex 9a9f7fd92..a4919607a 100644--- a/pkg/analyzer/analyzers/datadog/requests.go+++ b/pkg/analyzer/analyzers/datadog/requests.go@@ -216,7 +216,7 @@ func ValidateApiKey(client *http.Client, baseURL, apiKey string) (bool, error) {case http.StatusForbidden:return false, nildefault:- return false, fmt.Errorf("Unable to validate api key with status code: %d", resp.StatusCode)+ return false, fmt.Errorf("unable to validate api key with status code: %d", resp.StatusCode)}}diff --git a/pkg/analyzer/analyzers/digitalocean/digitalocean.go b/pkg/analyzer/analyzers/digitalocean/digitalocean.goindex e2266deb9..0b870046b 100644--- a/pkg/analyzer/analyzers/digitalocean/digitalocean.go+++ b/pkg/analyzer/analyzers/digitalocean/digitalocean.go@@ -34,13 +34,11 @@ func (Analyzer) Type() analyzers.AnalyzerType { return analyzers.AnalyzerTypeDigfunc (a Analyzer) Analyze(_ context.Context, credInfo map[string]string) (*analyzers.AnalyzerResult, error) {key, ok := credInfo["key"]if !ok {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", errors.New("missing key in credInfo"),- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", errors.New("missing key in credInfo"))}info, err := AnalyzePermissions(a.Cfg, key)if err != nil {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err,- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err)}return secretInfoToAnalyzerResult(info), nil}@@ -125,7 +123,7 @@ func (h *HttpStatusTest) RunTest(cfg *config.Config, headers map[string]string)if err != nil {return false, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check response status codeswitch {@@ -232,7 +230,7 @@ func getUser(cfg *config.Config, token string) (*user, error) {if err != nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()switch resp.StatusCode {case http.StatusOK:diff --git a/pkg/analyzer/analyzers/elevenlabs/elevenlabs.go b/pkg/analyzer/analyzers/elevenlabs/elevenlabs.goindex 7cb07b578..1234a092c 100644--- a/pkg/analyzer/analyzers/elevenlabs/elevenlabs.go+++ b/pkg/analyzer/analyzers/elevenlabs/elevenlabs.go@@ -86,14 +86,12 @@ func (a Analyzer) Analyze(_ context.Context, credInfo map[string]string) (*analy// check if the `key` exist in the credentials infokey, exist := credInfo["key"]if !exist {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", errors.New("key not found in credentials info"),- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", errors.New("key not found in credentials info"))}info, err := AnalyzePermissions(a.Cfg, key)if err != nil {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err,- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err)}return secretInfoToAnalyzerResult(info), nil@@ -242,9 +240,10 @@ func fetchUser(client *http.Client, key string) (*User, error) {return nil, err}- if errorResp.Detail.Status == InvalidAPIKey || errorResp.Detail.Status == NotVerifiable {+ switch errorResp.Detail.Status {+ case InvalidAPIKey, NotVerifiable:return nil, errors.New("invalid api key")- } else if errorResp.Detail.Status == MissingPermissions {+ case MissingPermissions:// key is missing user read permissions but is validreturn nil, nil}diff --git a/pkg/analyzer/analyzers/figma/figma.go b/pkg/analyzer/analyzers/figma/figma.goindex fc381bede..a96f3435e 100644--- a/pkg/analyzer/analyzers/figma/figma.go+++ b/pkg/analyzer/analyzers/figma/figma.go@@ -83,7 +83,7 @@ func AnalyzePermissions(cfg *config.Config, token string) (*secretInfo, error) {if err != nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()body, err := io.ReadAll(resp.Body)if err != nil {return nil, errdiff --git a/pkg/analyzer/analyzers/github/finegrained/finegrained.go b/pkg/analyzer/analyzers/github/finegrained/finegrained.goindex d796a3001..2a0a94c17 100644--- a/pkg/analyzer/analyzers/github/finegrained/finegrained.go+++ b/pkg/analyzer/analyzers/github/finegrained/finegrained.go@@ -78,7 +78,7 @@ func permissionFormatter(key, val any) (string, string) {if perm, ok := val.(Permission); ok {permStr, err := perm.ToString()if err != nil {- log.Fatal(fmt.Errorf("Error converting permission to string: %v", err))+ log.Fatal(fmt.Errorf("error converting permission to string: %v", err))}var permissionStr stringswitch {@@ -217,7 +217,7 @@ func getCodeScanningAlertsPermission(client *gh.Client, repo *gh.Repository, cur// Risk: Extremely Low// -> GET request to /repos/{owner}/{repo}/code-scanning/alerts_, resp, err := client.CodeScanning.ListAlertsForRepo(context.Background(), *repo.Owner.Login, *repo.Name, nil)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()switch {case resp.StatusCode == 403:@@ -427,7 +427,7 @@ func getDependabotAlertsPermission(client *gh.Client, repo *gh.Repository, curre// Risk: Extremely Low// GET /repos/{owner}/{repo}/dependabot/alerts_, resp, err := client.Dependabot.ListRepoAlerts(context.Background(), *repo.Owner.Login, *repo.Name, &gh.ListAlertsOptions{})- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()switch resp.StatusCode {case 403:diff --git a/pkg/analyzer/analyzers/gitlab/gitlab.go b/pkg/analyzer/analyzers/gitlab/gitlab.goindex 62ab2a587..4fb260583 100644--- a/pkg/analyzer/analyzers/gitlab/gitlab.go+++ b/pkg/analyzer/analyzers/gitlab/gitlab.go@@ -155,7 +155,7 @@ func getPersonalAccessToken(cfg *config.Config, key, host string) (AccessTokenJSreturn tokens, resp.StatusCode, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if err := json.NewDecoder(resp.Body).Decode(&tokens); err != nil {return tokens, resp.StatusCode, err}@@ -183,7 +183,7 @@ func getAccessibleProjects(cfg *config.Config, key, host string) ([]ProjectsJSONreturn projects, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()bodyBytes, err := io.ReadAll(resp.Body)if err != nil {@@ -197,7 +197,7 @@ func getAccessibleProjects(cfg *config.Config, key, host string) ([]ProjectsJSONif err := json.NewDecoder(newBody()).Decode(&projects); err != nil {var e ErrorJSONif err := json.NewDecoder(newBody()).Decode(&e); err == nil {- return projects, fmt.Errorf("Insufficient Scope to query for projects. We need api or read_api permissions.")+ return projects, errors.New("insufficient scope to query for projects: we need api or read_api permissions")}return projects, err}@@ -219,7 +219,7 @@ func getMetadata(cfg *config.Config, key, host string) (MetadataJSON, error) {return metadata, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()bodyBytes, err := io.ReadAll(resp.Body)if err != nil {@@ -239,7 +239,7 @@ func getMetadata(cfg *config.Config, key, host string) (MetadataJSON, error) {if err := json.NewDecoder(newBody()).Decode(&e); err != nil {return metadata, err}- return metadata, fmt.Errorf("Insufficient Scope to query for metadata. We need read_user, ai_features, api or read_api permissions.")+ return metadata, errors.New("insufficient scope to query for metadata: we need read_user, ai_features, api or read_api permissions")}return metadata, nil@@ -258,7 +258,7 @@ func AnalyzePermissions(cfg *config.Config, key string, host string) (*SecretInfreturn nil, err}if statusCode != http.StatusOK {- return nil, fmt.Errorf("Invalid GitLab Access Token")+ return nil, errors.New("invalid GitLab access token")}meta, err := getMetadata(cfg, key, host)diff --git a/pkg/analyzer/analyzers/huggingface/huggingface.go b/pkg/analyzer/analyzers/huggingface/huggingface.goindex b7ca38fc7..73bf9b1a9 100644--- a/pkg/analyzer/analyzers/huggingface/huggingface.go+++ b/pkg/analyzer/analyzers/huggingface/huggingface.go@@ -33,14 +33,12 @@ func (Analyzer) Type() analyzers.AnalyzerType { return analyzers.AnalyzerTypeHugfunc (a Analyzer) Analyze(_ context.Context, credInfo map[string]string) (*analyzers.AnalyzerResult, error) {key, ok := credInfo["key"]if !ok || key == "" {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", fmt.Errorf("key not found in credentialInfo"),- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", fmt.Errorf("key not found in credentialInfo"))}info, err := AnalyzePermissions(a.Cfg, key)if err != nil {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err,- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err)}return secretInfoToAnalyzerResult(info), nil}@@ -99,15 +97,17 @@ func bakefineGrainedBindings(allModels []Model, tokenJSON HFTokenJSON) []analyzeValue: string(analyzers.NONE),}for _, perm := range permission.Permissions {- if perm == "repo.content.read" {+ switch perm {+ case "repo.content.read":privs.Value = string(analyzers.READ)- } else if perm == "repo.write" {+ case "repo.write":privs.Value = string(analyzers.WRITE)}}- if permission.Entity.Type == "user" || permission.Entity.Type == "org" {+ switch permission.Entity.Type {+ case "user", "org":nameToPermissions[permission.Entity.Name] = privs- } else if permission.Entity.Type == "model" {+ case "model":nameToPermissions[modelNameLookup(allModels, permission.Entity.ID)] = privs}}@@ -334,7 +334,7 @@ func getModelsByAuthor(cfg *config.Config, key string, author string) ([]Model,}// defer the response body closing- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// read responseif err := json.NewDecoder(resp.Body).Decode(&modelsJSON); err != nil {@@ -370,7 +370,7 @@ func getTokenInfo(cfg *config.Config, key string) (HFTokenJSON, bool, error) {}// defer the response body closing- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// read responseif err := json.NewDecoder(resp.Body).Decode(&tokenJSON); err != nil {@@ -392,7 +392,7 @@ func AnalyzePermissions(cfg *config.Config, key string) (*SecretInfo, error) {}if !success {- return nil, fmt.Errorf("Invalid HuggingFace Access Token")+ return nil, fmt.Errorf("invalid HuggingFace Access Token")}// get all models by username@@ -609,15 +609,17 @@ func printAccessibleModels(allModels []Model, tokenJSON HFTokenJSON) {read := falsewrite := falsefor _, perm := range permission.Permissions {- if perm == "repo.content.read" {+ switch perm {+ case "repo.content.read":read = true- } else if perm == "repo.write" {+ case "repo.write":write = true}}- if permission.Entity.Type == "user" || permission.Entity.Type == "org" {+ switch permission.Entity.Type {+ case "user", "org":nameToPermissions[permission.Entity.Name] = Permissions{Read: read, Write: write}- } else if permission.Entity.Type == "model" {+ case "model":nameToPermissions[modelNameLookup(allModels, permission.Entity.ID)] = Permissions{Read: read, Write: write}}}diff --git a/pkg/analyzer/analyzers/jira/requests.go b/pkg/analyzer/analyzers/jira/requests.goindex bac24b913..43bb6edc8 100644--- a/pkg/analyzer/analyzers/jira/requests.go+++ b/pkg/analyzer/analyzers/jira/requests.go@@ -428,13 +428,12 @@ func captureAuditLogs(client *http.Client, domain, email, token string, secretIn}func handleStatusCode(statusCode int, endpoint string) error {- switch {- case statusCode == http.StatusOK:+ switch statusCode {+ case http.StatusOK:return nil- case statusCode == http.StatusBadRequest:+ case http.StatusBadRequest:return fmt.Errorf("bad request for API: %s", endpoint)- case statusCode == http.StatusUnauthorized, statusCode == http.StatusForbidden,- statusCode == http.StatusNotFound, statusCode == http.StatusConflict:+ case http.StatusUnauthorized, http.StatusForbidden, http.StatusNotFound, http.StatusConflict:return nildefault:return fmt.Errorf("unexpected status code: %d for API: %s", statusCode, endpoint)diff --git a/pkg/analyzer/analyzers/mailchimp/mailchimp.go b/pkg/analyzer/analyzers/mailchimp/mailchimp.goindex 514f25d3d..316c232d8 100644--- a/pkg/analyzer/analyzers/mailchimp/mailchimp.go+++ b/pkg/analyzer/analyzers/mailchimp/mailchimp.go@@ -146,7 +146,7 @@ func getMetadata(cfg *config.Config, key string) (MetadataJSON, error) {return metadata, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if err := json.NewDecoder(resp.Body).Decode(&metadata); err != nil {return metadata, err@@ -177,7 +177,7 @@ func getDomains(cfg *config.Config, key string) (DomainsJSON, error) {return domains, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if err := json.NewDecoder(resp.Body).Decode(&domains); err != nil {return domains, err@@ -198,7 +198,7 @@ func AnalyzePermissions(cfg *config.Config, key string) (*SecretInfo, error) {return nil, err}if metadata.AccountID == "" {- return nil, fmt.Errorf("Invalid Mailchimp API key")+ return nil, fmt.Errorf("invalid Mailchimp API key")}// get sending domainsdiff --git a/pkg/analyzer/analyzers/mailgun/requests.go b/pkg/analyzer/analyzers/mailgun/requests.goindex ab7da22da..8f9f65333 100644--- a/pkg/analyzer/analyzers/mailgun/requests.go+++ b/pkg/analyzer/analyzers/mailgun/requests.go@@ -53,7 +53,7 @@ func getDomains(client *http.Client, apiKey string, secretInfo *SecretInfo) erroif err != nil {return err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode != 200 {return fmt.Errorf("invalid Mailgun API key")@@ -83,7 +83,7 @@ func getKeys(client *http.Client, apiKey string, secretInfo *SecretInfo) error {if err != nil {return err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode != 200 {return fmt.Errorf("invalid Mailgun API key")diff --git a/pkg/analyzer/analyzers/mux/models.go b/pkg/analyzer/analyzers/mux/models.goindex e7d3b52af..87e978dd1 100644--- a/pkg/analyzer/analyzers/mux/models.go+++ b/pkg/analyzer/analyzers/mux/models.go@@ -56,9 +56,10 @@ func (info *secretInfo) addPermission(resourceType ResourceType, permission strireturn}- if permission == "read" {+ switch permission {+ case "read":info.Permissions[resourceType] = Read- } else if permission == "write" {+ case "write":info.Permissions[resourceType] = FullAccess}}diff --git a/pkg/analyzer/analyzers/mysql/mysql.go b/pkg/analyzer/analyzers/mysql/mysql.goindex 213ed6757..131634911 100644--- a/pkg/analyzer/analyzers/mysql/mysql.go+++ b/pkg/analyzer/analyzers/mysql/mysql.go@@ -292,7 +292,7 @@ func AnalyzePermissions(cfg *config.Config, connectionStr string) (*SecretInfo,if err != nil {return nil, fmt.Errorf("connecting to the MySQL database: %w", err)}- defer db.Close()+ defer func() { _ = db.Close() }()// Get the current useruser, err := getUser(db)@@ -434,7 +434,7 @@ func getDatabases(db *sql.DB, databases map[string]*Database) error {if err != nil {return err}- defer rows.Close()+ defer func() { _ = rows.Close() }()for rows.Next() {var dbName string@@ -462,7 +462,7 @@ func getTables(db *sql.DB, databases map[string]*Database) error {if err != nil {return err}- defer rows.Close()+ defer func() { _ = rows.Close() }()for rows.Next() {var dbName string@@ -486,7 +486,7 @@ func getRoutines(db *sql.DB, databases map[string]*Database) error {if err != nil {return err}- defer rows.Close()+ defer func() { _ = rows.Close() }()for rows.Next() {var dbName string@@ -513,7 +513,7 @@ func getGrants(db *sql.DB) ([]string, error) {if err != nil {return nil, err}- defer rows.Close()+ defer func() { _ = rows.Close() }()var grants []stringfor rows.Next() {@@ -568,7 +568,7 @@ func processGrant(grant string, databases map[string]*Database, globalPrivs *Glo// Split on " ON "parts := strings.Split(grant, " ON ")if len(parts) < 2 {- return fmt.Errorf("Error processing grant: %s", grant)+ return fmt.Errorf("error processing grant: %s", grant)}// Put privs in a slicediff --git a/pkg/analyzer/analyzers/notion/notion.go b/pkg/analyzer/analyzers/notion/notion.goindex 35c7e0c1d..fe78cc20c 100644--- a/pkg/analyzer/analyzers/notion/notion.go+++ b/pkg/analyzer/analyzers/notion/notion.go@@ -30,13 +30,11 @@ func (Analyzer) Type() analyzers.AnalyzerType { return analyzers.AnalyzerTypeNotfunc (a Analyzer) Analyze(_ context.Context, credInfo map[string]string) (*analyzers.AnalyzerResult, error) {key, ok := credInfo["key"]if !ok {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", errors.New("missing key in credInfo"),- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", errors.New("missing key in credInfo"))}info, err := AnalyzePermissions(a.Cfg, key)if err != nil {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err,- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err)}return secretInfoToAnalyzerResult(info), nil}@@ -143,7 +141,7 @@ func (h *HttpStatusTest) RunTest(cfg *config.Config, headers map[string]string)if err != nil {return false, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check response status codeswitch {@@ -330,7 +328,7 @@ func getBotInfo(client *http.Client, key string) (*bot, error) {if err != nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()switch resp.StatusCode {case http.StatusOK:@@ -368,7 +366,7 @@ func getWorkspaceUsers(client *http.Client, key string) ([]user, error) {if err != nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()switch resp.StatusCode {case http.StatusOK:diff --git a/pkg/analyzer/analyzers/openai/openai.go b/pkg/analyzer/analyzers/openai/openai.goindex d7057db05..69c4410a5 100644--- a/pkg/analyzer/analyzers/openai/openai.go+++ b/pkg/analyzer/analyzers/openai/openai.go@@ -31,8 +31,7 @@ func (Analyzer) Type() analyzers.AnalyzerType { return analyzers.AnalyzerTypeOpefunc (a Analyzer) Analyze(_ context.Context, credInfo map[string]string) (*analyzers.AnalyzerResult, error) {info, err := AnalyzePermissions(a.Cfg, credInfo["key"])if err != nil {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err,- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err)}return secretInfoToAnalyzerResult(info), nil}@@ -214,7 +213,7 @@ func openAIRequest(cfg *config.Config, method string, url string, key string, dareturn nil, nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()outBody, err := io.ReadAll(resp.Body)if err != nil {diff --git a/pkg/analyzer/analyzers/opsgenie/opsgenie.go b/pkg/analyzer/analyzers/opsgenie/opsgenie.goindex 6c13a92ef..90c3bea58 100644--- a/pkg/analyzer/analyzers/opsgenie/opsgenie.go+++ b/pkg/analyzer/analyzers/opsgenie/opsgenie.go@@ -30,13 +30,11 @@ func (Analyzer) Type() analyzers.AnalyzerType { return analyzers.AnalyzerTypeOpsfunc (a Analyzer) Analyze(_ context.Context, credInfo map[string]string) (*analyzers.AnalyzerResult, error) {key, ok := credInfo["key"]if !ok {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", errors.New("missing key in credInfo"),- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", errors.New("missing key in credInfo"))}info, err := AnalyzePermissions(a.Cfg, key)if err != nil {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err,- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err)}return secretInfoToAnalyzerResult(info), nil}@@ -159,7 +157,7 @@ func (h *HttpStatusTest) RunTest(cfg *config.Config, headers map[string]string)if err != nil {return false, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check response status codeswitch {@@ -231,7 +229,7 @@ func getUserList(cfg *config.Config, key string) ([]User, error) {if err != nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Decode response bodyvar userList UsersJSONdiff --git a/pkg/analyzer/analyzers/plaid/plaid.go b/pkg/analyzer/analyzers/plaid/plaid.goindex fc44e9810..5b2f936c2 100644--- a/pkg/analyzer/analyzers/plaid/plaid.go+++ b/pkg/analyzer/analyzers/plaid/plaid.go@@ -108,7 +108,7 @@ func getPlaidAccounts(client *http.Client, clientID string, secret string, accesif err != nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode != http.StatusOK {return nil, fmt.Errorf("received non-OK HTTP status: %d", resp.StatusCode)diff --git a/pkg/analyzer/analyzers/planetscale/planetscale.go b/pkg/analyzer/analyzers/planetscale/planetscale.goindex 9d356be9c..ddbbd3953 100644--- a/pkg/analyzer/analyzers/planetscale/planetscale.go+++ b/pkg/analyzer/analyzers/planetscale/planetscale.go@@ -137,7 +137,7 @@ func (h *HttpStatusTest) RunTest(cfg *config.Config, headers map[string]string,if err != nil {return false, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check response status codeswitch {@@ -539,7 +539,7 @@ func sendGetRequest(cfg *config.Config, id, key, url string, responseObj interfaif err != nil {return err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check response status codeswitch resp.StatusCode {diff --git a/pkg/analyzer/analyzers/postgres/postgres.go b/pkg/analyzer/analyzers/postgres/postgres.goindex 3d5a8265a..313c46ada 100644--- a/pkg/analyzer/analyzers/postgres/postgres.go+++ b/pkg/analyzer/analyzers/postgres/postgres.go@@ -278,7 +278,7 @@ func AnalyzePermissions(cfg *config.Config, connectionStr string) (*SecretInfo,if err != nil {return nil, fmt.Errorf("failed to connect to Postgres database: %w", err)}- defer db.Close()+ defer func() { _ = db.Close() }()role, privs, err := getUserPrivs(db)if err != nil {@@ -372,7 +372,7 @@ func getUserPrivs(db *sql.DB) (string, map[string]bool, error) {if err != nil {return "", nil, err}- defer rows.Close()+ defer func() { _ = rows.Close() }()var roleName stringvar isSuperuser, canInherit, canCreateRole, canCreateDB, canLogin, isReplicationRole, bypassesRLS bool@@ -389,7 +389,7 @@ func getUserPrivs(db *sql.DB) (string, map[string]bool, error) {}// Map roles to privileges- var mapRoles map[string]bool = map[string]bool{+ var mapRoles = map[string]bool{"Superuser": isSuperuser,"Inheritance of Privs": canInherit,"Create Role": canCreateRole,@@ -427,7 +427,7 @@ func getDBPrivs(db *sql.DB) (string, []DB, error) {if err != nil {return "", nil, err}- defer rows.Close()+ defer func() { _ = rows.Close() }()dbs := make([]DB, 0)@@ -501,7 +501,7 @@ func getDBWriter(db DB, current_user string) func(a ...interface{}) string {func buildSliceDBNames(dbs []DB) []string {var dbNames []stringfor _, db := range dbs {- if db.DBPrivs.Connect {+ if db.Connect {dbNames = append(dbNames, db.DatabaseName)}}@@ -519,7 +519,7 @@ func getTablePrivs(params map[string]string, databases []string) (map[string]map// color.Red("[x] Failed to connect to Postgres database: %s", dbase)continue}- defer db.Close()+ defer func() { _ = db.Close() }()// Get table privsquery := `@@ -543,7 +543,7 @@ func getTablePrivs(params map[string]string, databases []string) (map[string]mapif err != nil {return nil, err}- defer rows.Close()+ defer func() { _ = rows.Close() }()// Iterate through the result setfor rows.Next() {@@ -589,7 +589,7 @@ func getTablePrivs(params map[string]string, databases []string) (map[string]mapif err = rows.Err(); err != nil {return nil, err}- db.Close()+ _ = db.Close()}return tablePrivileges, nildiff --git a/pkg/analyzer/analyzers/posthog/posthog.go b/pkg/analyzer/analyzers/posthog/posthog.goindex 2706e988c..81399e47f 100644--- a/pkg/analyzer/analyzers/posthog/posthog.go+++ b/pkg/analyzer/analyzers/posthog/posthog.go@@ -37,13 +37,11 @@ func (Analyzer) Type() analyzers.AnalyzerType { return analyzers.AnalyzerTypePosfunc (a Analyzer) Analyze(_ context.Context, credInfo map[string]string) (*analyzers.AnalyzerResult, error) {key, ok := credInfo["key"]if !ok {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", errors.New("missing key in credInfo"),- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", errors.New("missing key in credInfo"))}info, err := AnalyzePermissions(a.Cfg, key)if err != nil {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err,- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err)}return secretInfoToAnalyzerResult(info), nil}@@ -166,7 +164,7 @@ func (h *HttpStatusTest) RunTest(cfg *config.Config, client *http.Client, domainif err != nil {return false, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check response status codeswitch {@@ -302,7 +300,7 @@ func AnalyzePermissions(cfg *config.Config, key string) (*SecretInfo, error) {// we need to determine if the key is for US or EU domaindomain, user, err := resolveDomainAndUser(cfg, client, key)if err != nil {- return nil, fmt.Errorf("Invalid API Key: %w", err)+ return nil, fmt.Errorf("invalid API key: %w", err)}info.user = user@@ -439,7 +437,7 @@ func resolveDomainAndUser(cfg *config.Config, client *http.Client, key string) (if err != nil {return "", nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()switch resp.StatusCode {case http.StatusOK:@@ -476,7 +474,7 @@ func getOrganization(cfg *config.Config, client *http.Client, domain string, keyif err != nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()switch resp.StatusCode {case http.StatusOK:diff --git a/pkg/analyzer/analyzers/postman/postman.go b/pkg/analyzer/analyzers/postman/postman.goindex 93a09ffca..b3291be88 100644--- a/pkg/analyzer/analyzers/postman/postman.go+++ b/pkg/analyzer/analyzers/postman/postman.go@@ -26,13 +26,11 @@ func (Analyzer) Type() analyzers.AnalyzerType { return analyzers.AnalyzerTypePosfunc (a Analyzer) Analyze(_ context.Context, credInfo map[string]string) (*analyzers.AnalyzerResult, error) {key, ok := credInfo["key"]if !ok {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", fmt.Errorf("missing key in credInfo"),- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", fmt.Errorf("missing key in credInfo"))}info, err := AnalyzePermissions(a.Cfg, key)if err != nil {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err,- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err)}return secretInfoToAnalyzerResult(info), nil}@@ -148,7 +146,7 @@ func getUserInfo(cfg *config.Config, key string) (UserInfoJSON, error) {}// read response- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// if status code is 200, decode responseif resp.StatusCode == 200 {@@ -175,7 +173,7 @@ func getWorkspaces(cfg *config.Config, key string) (WorkspaceJSON, error) {}// read response- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// if status code is 200, decode responseif resp.StatusCode == 200 {@@ -224,7 +222,7 @@ func AnalyzePermissions(cfg *config.Config, key string) (*SecretInfo, error) {}if me.User.Username == "" {- return nil, fmt.Errorf("Invalid Postman API Key")+ return nil, fmt.Errorf("invalid Postman API Key")}// get workspaces, if there is error user with empty workspaces will be returneddiff --git a/pkg/analyzer/analyzers/shopify/shopify.go b/pkg/analyzer/analyzers/shopify/shopify.goindex ad1cafa92..dd26bf38a 100644--- a/pkg/analyzer/analyzers/shopify/shopify.go+++ b/pkg/analyzer/analyzers/shopify/shopify.go@@ -213,7 +213,7 @@ func getShopInfo(cfg *config.Config, key string, store string) (ShopInfoJSON, erreturn shopInfo, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()err = json.NewDecoder(resp.Body).Decode(&shopInfo)if err != nil {@@ -252,7 +252,7 @@ func getAccessScopes(cfg *config.Config, key string, store string) (AccessScopesreturn accessScopes, resp.StatusCode, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()err = json.NewDecoder(resp.Body).Decode(&accessScopes)if err != nil {diff --git a/pkg/analyzer/analyzers/slack/slack.go b/pkg/analyzer/analyzers/slack/slack.goindex a8d55f6e2..62a6b2893 100644--- a/pkg/analyzer/analyzers/slack/slack.go+++ b/pkg/analyzer/analyzers/slack/slack.go@@ -141,7 +141,7 @@ func getSlackOAuthScopes(cfg *config.Config, key string) (scopes string, userDatif err != nil {return scopes, userData, err}- defer resp.Body.Close() // Close the response body when the function returns+ defer func() { _ = resp.Body.Close() }() // Close the response body when the function returns// print bodybody, err := io.ReadAll(resp.Body)diff --git a/pkg/analyzer/analyzers/sourcegraph/sourcegraph.go b/pkg/analyzer/analyzers/sourcegraph/sourcegraph.goindex 609d3aee0..9c8033797 100644--- a/pkg/analyzer/analyzers/sourcegraph/sourcegraph.go+++ b/pkg/analyzer/analyzers/sourcegraph/sourcegraph.go@@ -26,13 +26,11 @@ func (Analyzer) Type() analyzers.AnalyzerType { return analyzers.AnalyzerTypeSoufunc (a Analyzer) Analyze(_ context.Context, credInfo map[string]string) (*analyzers.AnalyzerResult, error) {key, ok := credInfo["key"]if !ok {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", fmt.Errorf("missing key in credInfo"),- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationValidateCredentials, analyzers.ServiceConfig, "", fmt.Errorf("missing key in credInfo"))}info, err := AnalyzePermissions(a.Cfg, key)if err != nil {- return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err,- )+ return nil, analyzers.NewAnalysisError(a.Type().String(), analyzers.OperationAnalyzePermissions, analyzers.ServiceAPI, "", err)}return secretInfoToAnalyzerResult(info), nil}@@ -116,7 +114,7 @@ func getUserInfo(cfg *config.Config, key string) (UserInfoJSON, error) {return userInfo, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()err = json.NewDecoder(resp.Body).Decode(&userInfo)if err != nil {@@ -151,7 +149,7 @@ func checkSiteAdmin(cfg *config.Config, key string) (bool, error) {return false, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()var response GraphQLResponsediff --git a/pkg/analyzer/analyzers/square/square.go b/pkg/analyzer/analyzers/square/square.goindex 104b21190..bb0a26a6d 100644--- a/pkg/analyzer/analyzers/square/square.go+++ b/pkg/analyzer/analyzers/square/square.go@@ -173,7 +173,7 @@ func getPermissions(cfg *config.Config, key string) (PermissionsJSON, error) {return permissions, nil}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()err = json.NewDecoder(resp.Body).Decode(&permissions)if err != nil {@@ -210,7 +210,7 @@ func getUsers(cfg *config.Config, key string) (TeamJSON, error) {return team, nil}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()err = json.NewDecoder(resp.Body).Decode(&team)if err != nil {diff --git a/pkg/analyzer/analyzers/stripe/stripe.go b/pkg/analyzer/analyzers/stripe/stripe.goindex 65325406e..d100182e5 100644--- a/pkg/analyzer/analyzers/stripe/stripe.go+++ b/pkg/analyzer/analyzers/stripe/stripe.go@@ -162,7 +162,7 @@ func (h *HttpStatusTest) RunTest(cfg *config.Config, headers map[string]string)if err != nil {return false, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check response status codeswitch {@@ -195,7 +195,7 @@ func checkKeyType(key string) (string, error) {} else if strings.HasPrefix(key, RESTRICTED_PREFIX) {return RESTRICTED, nil}- return "", errors.New("Invalid Stripe key format")+ return "", errors.New("invalid Stripe key format")}func checkKeyEnv(key string) (string, error) {@@ -226,7 +226,7 @@ func checkValidity(cfg *config.Config, key string) (bool, error) {if err != nil {return false, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check the response. Valid is 200 (secret/restricted) or 403 (restricted)if resp.StatusCode == 200 || resp.StatusCode == 403 {@@ -290,15 +290,17 @@ func AnalyzeAndPrintPermissions(cfg *config.Config, key string) {color.Green("[!] Valid Stripe API Key\n\n")- if info.KeyType == SECRET {+ switch info.KeyType {+ case SECRET:color.Green("[i] Key Type: %s", info.KeyType)- } else if info.KeyType == RESTRICTED {+ case RESTRICTED:color.Yellow("[i] Key Type: %s", info.KeyType)}- if info.KeyEnv == LIVE {+ switch info.KeyEnv {+ case LIVE:color.Green("[i] Key Environment: %s", info.KeyEnv)- } else if info.KeyEnv == TEST {+ case TEST:color.Red("[i] Key Environment: %s", info.KeyEnv)}diff --git a/pkg/analyzer/analyzers/twilio/twilio.go b/pkg/analyzer/analyzers/twilio/twilio.goindex 87229f662..3a92d2bc0 100644--- a/pkg/analyzer/analyzers/twilio/twilio.go+++ b/pkg/analyzer/analyzers/twilio/twilio.go@@ -49,7 +49,8 @@ func (a *Analyzer) Analyze(ctx context.Context, credentialInfo map[string]string}var permissions []Permission- if info.AccountStatusCode == 200 {+ switch info.AccountStatusCode {+ case 200:permissions = []Permission{AccountManagementRead,AccountManagementWrite,@@ -68,7 +69,7 @@ func (a *Analyzer) Analyze(ctx context.Context, credentialInfo map[string]stringCallManagementRead,CallManagementWrite,}- } else if info.AccountStatusCode == 401 {+ case 401:permissions = []Permission{ServiceVerificationRead,ServiceVerificationWrite,@@ -159,7 +160,7 @@ func getAccountsStatusCode(cfg *config.Config, sid string, secret string) (int,if err != nil {return 0, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()return resp.StatusCode, nil}@@ -196,7 +197,7 @@ func getVerifyServicesStatusCode(cfg *config.Config, sid string, secret string)if err != nil {return serviceRes, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// read responseif err := json.NewDecoder(resp.Body).Decode(&serviceRes); err != nil {@@ -224,7 +225,7 @@ func listTwilioAccounts(cfg *config.Config, sid, secret string) ([]service, erroif err != nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()var result struct {Accounts []service `json:"accounts"`@@ -287,11 +288,12 @@ func printPermissions(statusCode int) {color.Green("[!] Valid Twilio API Key\n")color.Green("[i] Expires: Never")- if statusCode == 401 {+ switch statusCode {+ case 401:color.Yellow("[i] Key type: Standard")color.Yellow("[i] Permissions: All EXCEPT key management and account/subaccount configuration.")- } else if statusCode == 200 {+ case 200:color.Green("[i] Key type: Main (aka Admin)")color.Green("[i] Permissions: All")}diff --git a/pkg/analyzer/generate_permissions/generate_permissions.go b/pkg/analyzer/generate_permissions/generate_permissions.goindex c26b61e41..c541670e3 100644--- a/pkg/analyzer/generate_permissions/generate_permissions.go+++ b/pkg/analyzer/generate_permissions/generate_permissions.go@@ -111,7 +111,7 @@ func main() {if err != nil {log.Fatalf("Failed to open YAML file: %v", err)}- defer file.Close()+ defer func() { _ = file.Close() }()var data PermissionsDatadecoder := yaml.NewDecoder(file)@@ -135,7 +135,7 @@ func main() {if err != nil {log.Fatalf("Failed to create output file: %v", err)}- defer outputFile.Close()+ defer func() { _ = outputFile.Close() }()err = tmpl.Execute(outputFile, data)if err != nil {diff --git a/pkg/buffers/buffer/buffer.go b/pkg/buffers/buffer/buffer.goindex b3bd17749..b25b9507c 100644--- a/pkg/buffers/buffer/buffer.go+++ b/pkg/buffers/buffer/buffer.go@@ -47,11 +47,11 @@ func (b *Buffer) Write(data []byte) (int, error) {}size := len(data)- bufferLength := b.Buffer.Len()+ bufferLength := b.Len()totalSizeNeeded := bufferLength + size// If the total size is within the threshold, write to the buffer.- availableSpace := b.Buffer.Cap() - bufferLength+ availableSpace := b.Cap() - bufferLengthgrowSize := totalSizeNeeded - bufferLengthif growSize > availableSpace {// We are manually growing the buffer so we can track the growth via metrics.diff --git a/pkg/cleantemp/cleantemp.go b/pkg/cleantemp/cleantemp.goindex 8a9d39e48..5a2fedc28 100644--- a/pkg/cleantemp/cleantemp.go+++ b/pkg/cleantemp/cleantemp.go@@ -73,7 +73,7 @@ func CleanTempArtifacts(ctx logContext.Context) error {if err != nil {return fmt.Errorf("error opening temp dir: %w", err)}- defer dir.Close()+ defer func() { _ = dir.Close() }()for {entries, err := dir.ReadDir(1) // read only one entrydiff --git a/pkg/common/filter_test.go b/pkg/common/filter_test.goindex a4df8db62..29bf6e9a2 100644--- a/pkg/common/filter_test.go+++ b/pkg/common/filter_test.go@@ -144,14 +144,14 @@ func TestFilterFromFile(t *testing.T) {if err := testFilterWriteFile(includeTestFile, []byte(test.includeFileContents)); err != nil {t.Fatalf("failed to create include rules file: %s", err)}- defer os.Remove(includeTestFile)+ defer func() { _ = os.Remove(includeTestFile) }()}if test.excludeFile {excludeTestFile = "/tmp/trufflehog_test_xfilter.txt"if err := testFilterWriteFile(excludeTestFile, []byte(test.excludeFileContents)); err != nil {t.Fatalf("failed to create include rules file: %s", err)}- defer os.Remove(excludeTestFile)+ defer func() { _ = os.Remove(excludeTestFile) }()}filter, err := FilterFromFiles(includeTestFile, excludeTestFile)diff --git a/pkg/common/http_test.go b/pkg/common/http_test.goindex 34d602886..55e37e48d 100644--- a/pkg/common/http_test.go+++ b/pkg/common/http_test.go@@ -395,7 +395,7 @@ func TestSaneHttpClientMetrics(t *testing.T) {resp, err := client.Get(requestURL)require.NoError(t, err)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()assert.Equal(t, tc.expectedStatusCode, resp.StatusCode)// Check that request counter was incremented@@ -462,7 +462,7 @@ func TestRetryableHttpClientMetrics(t *testing.T) {resp, err := client.Get(requestURL)require.NoError(t, err)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()assert.Equal(t, tc.expectedStatusCode, resp.StatusCode)// Check that request counter was incremented@@ -494,7 +494,7 @@ func TestInstrumentedTransport(t *testing.T) {// Make a requestresp, err := client.Get(server.URL)require.NoError(t, err)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Verify the request was successfulassert.Equal(t, http.StatusOK, resp.StatusCode)diff --git a/pkg/common/secrets.go b/pkg/common/secrets.goindex cc759248e..0dc444e17 100644--- a/pkg/common/secrets.go+++ b/pkg/common/secrets.go@@ -54,7 +54,7 @@ func GetSecret(ctx context.Context, gcpProject, name string) (secret *Secret, erif err != nil {return nil, errors.Errorf("failed to create secretmanager client: %v", err)}- defer client.Close()+ defer func() { _ = client.Close() }()req := &secretmanagerpb.AccessSecretVersionRequest{Name: parent,diff --git a/pkg/decoders/html_test.go b/pkg/decoders/html_test.goindex 403ebdb2f..296d7ae44 100644--- a/pkg/decoders/html_test.go+++ b/pkg/decoders/html_test.go@@ -208,7 +208,7 @@ func TestHTML_FromChunk(t *testing.T) {{// Block elements (<p>) produce newline boundaries so adjacent// paragraphs don't merge tokens.- name: "block elements produce newlines",+ name: "block elements produce newlines",chunk: &sources.Chunk{Data: []byte(`<div><p>first</p><p>second</p></div>`)},want: "first\nsecond",},@@ -336,39 +336,39 @@ func TestHTML_FromChunk(t *testing.T) {{// Zero-width spaces inserted between characters by rich text editors// are stripped so detector regexes can match the full token.- name: "zero-width space stripped from secret",+ name: "zero-width space stripped from secret",chunk: &sources.Chunk{Data: []byte("<p>TOKEN_\u200BABCDEF_1234</p>")},- want: "TOKEN_ABCDEF_1234",+ want: "TOKEN_ABCDEF_1234",},{// Multiple invisible codepoint types mixed into a single token.- name: "multiple invisible character types stripped",+ name: "multiple invisible character types stripped",chunk: &sources.Chunk{Data: []byte("<p>SECRET\u200C_VALUE\u00AD_HERE\u2060_END\uFEFF</p>")},- want: "SECRET_VALUE_HERE_END",+ want: "SECRET_VALUE_HERE_END",},// --- SVG xlink:href attribute extraction ---{// SVG elements use xlink:href for URLs which may contain tokens.- name: "xlink:href extracted from SVG element",+ name: "xlink:href extracted from SVG element",chunk: &sources.Chunk{Data: []byte(`<svg><a xlink:href="https://api.example.com?token=secret_value_123">icon</a></svg>`)},- want: "https://api.example.com?token=secret_value_123\nicon",+ want: "https://api.example.com?token=secret_value_123\nicon",},// --- Double-encoded HTML entity decoding ---{// Content double-encoded as &amp; becomes & after the parser's// first pass; the residual entity replacer decodes it to &.- name: "double-encoded ampersand decoded",+ name: "double-encoded ampersand decoded",chunk: &sources.Chunk{Data: []byte(`<p>key=abc&amp;secret=val</p>`)},- want: "key=abc&secret=val",+ want: "key=abc&secret=val",},{// Single-encoded entities are handled by the parser; verify the// residual replacer does not corrupt already-decoded content.- name: "single-encoded entities not double-decoded",+ name: "single-encoded entities not double-decoded",chunk: &sources.Chunk{Data: []byte(`<p>5 > 3 & 2 < 4</p>`)},- want: "5 > 3 & 2 < 4",+ want: "5 > 3 & 2 < 4",},// --- Integration: all extraction types in one chunk ---@@ -398,7 +398,7 @@ func TestHTML_FromChunk(t *testing.T) {if tt.wantNil {if got != nil {- t.Errorf("FromChunk() = %q, want nil", string(got.Chunk.Data))+ t.Errorf("FromChunk() = %q, want nil", string(got.Data))}return}@@ -409,8 +409,8 @@ func TestHTML_FromChunk(t *testing.T) {if got.DecoderType != detectorspb.DecoderType_HTML {t.Errorf("DecoderType = %v, want %v", got.DecoderType, detectorspb.DecoderType_HTML)}- if string(got.Chunk.Data) != tt.want {- t.Errorf("FromChunk() data =\n%q\nwant:\n%q", string(got.Chunk.Data), tt.want)+ if string(got.Data) != tt.want {+ t.Errorf("FromChunk() data =\n%q\nwant:\n%q", string(got.Data), tt.want)}})}@@ -423,7 +423,7 @@ func TestHTML_FeatureFlagDisabled(t *testing.T) {d := &HTML{}chunk := &sources.Chunk{Data: []byte(`<p>secret: hunter2</p>`)}if got := d.FromChunk(chunk); got != nil {- t.Errorf("FromChunk() should return nil when disabled, got %q", string(got.Chunk.Data))+ t.Errorf("FromChunk() should return nil when disabled, got %q", string(got.Data))}}@@ -439,8 +439,8 @@ func TestHTML_FeatureFlagEnabled(t *testing.T) {if got == nil {t.Fatal("FromChunk() returned nil, want decoded chunk")}- if string(got.Chunk.Data) != "secret: hunter2" {- t.Errorf("FromChunk() data = %q, want %q", string(got.Chunk.Data), "secret: hunter2")+ if string(got.Data) != "secret: hunter2" {+ t.Errorf("FromChunk() data = %q, want %q", string(got.Data), "secret: hunter2")}}diff --git a/pkg/detectors/abstract/abstract.go b/pkg/detectors/abstract/abstract.goindex cd2b63bdf..620571b52 100644--- a/pkg/detectors/abstract/abstract.go+++ b/pkg/detectors/abstract/abstract.go@@ -3,10 +3,11 @@ package abstractimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -80,7 +81,7 @@ func verifyAbstract(ctx context.Context, client *http.Client, resMatch string) (if err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()// https://docs.abstractapi.com/exchange-rates#response-and-error-codesswitch res.StatusCode {diff --git a/pkg/detectors/abuseipdb/abuseipdb.go b/pkg/detectors/abuseipdb/abuseipdb.goindex 906a614af..685f931d8 100644--- a/pkg/detectors/abuseipdb/abuseipdb.go+++ b/pkg/detectors/abuseipdb/abuseipdb.go@@ -83,7 +83,7 @@ func verifyAbuseIPDB(ctx context.Context, client *http.Client, resMatch string)if err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/abyssale/abyssale.go b/pkg/detectors/abyssale/abyssale.goindex 6865f811a..3ff29716a 100644--- a/pkg/detectors/abyssale/abyssale.go+++ b/pkg/detectors/abyssale/abyssale.go@@ -81,7 +81,7 @@ func verifyAbyssale(ctx context.Context, client *http.Client, resMatch string) (if err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/accuweather/v1/accuweather.go b/pkg/detectors/accuweather/v1/accuweather.goindex e2f61563d..32a167ea3 100644--- a/pkg/detectors/accuweather/v1/accuweather.go+++ b/pkg/detectors/accuweather/v1/accuweather.go@@ -93,7 +93,7 @@ func verifyAccuweather(ctx context.Context, client *http.Client, key string) (boif err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()// https://developer.accuweather.com/accuweather-locations-api/apis/get/locations/v1/cities/autocompleteswitch res.StatusCode {diff --git a/pkg/detectors/adafruitio/adafruitio.go b/pkg/detectors/adafruitio/adafruitio.goindex 95145920b..b7c3555d7 100644--- a/pkg/detectors/adafruitio/adafruitio.go+++ b/pkg/detectors/adafruitio/adafruitio.go@@ -79,7 +79,7 @@ func verifyAdafruitIO(ctx context.Context, client *http.Client, resMatch string)if err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()// https://learn.adafruit.com/adafruit-io/http-status-codesswitch res.StatusCode {diff --git a/pkg/detectors/adzuna/adzuna.go b/pkg/detectors/adzuna/adzuna.goindex 0cdb23b34..f662049c6 100644--- a/pkg/detectors/adzuna/adzuna.go+++ b/pkg/detectors/adzuna/adzuna.go@@ -91,7 +91,7 @@ func verifyAdzuna(ctx context.Context, client *http.Client, resMatch, resIdMatchif err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()// https://developer.adzuna.com/overviewswitch res.StatusCode {diff --git a/pkg/detectors/aeroworkflow/aeroworkflow.go b/pkg/detectors/aeroworkflow/aeroworkflow.goindex 10e1c6301..2c798a56d 100644--- a/pkg/detectors/aeroworkflow/aeroworkflow.go+++ b/pkg/detectors/aeroworkflow/aeroworkflow.go@@ -93,7 +93,7 @@ func verifyAeroworkflow(ctx context.Context, client *http.Client, resMatch, resIif err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()// https://api.aeroworkflow.com/swagger/index.htmlswitch res.StatusCode {diff --git a/pkg/detectors/agora/agora.go b/pkg/detectors/agora/agora.goindex a2284b4ce..328497a0b 100644--- a/pkg/detectors/agora/agora.go+++ b/pkg/detectors/agora/agora.go@@ -99,7 +99,7 @@ func verifyAgora(ctx context.Context, client *http.Client, resMatch, resSecret sif err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()// https://docs.agora.io/en/voice-calling/reference/agora-console-rest-api#get-all-projectsswitch res.StatusCode {diff --git a/pkg/detectors/aha/aha.go b/pkg/detectors/aha/aha.goindex b17bb82bb..27fc01e46 100644--- a/pkg/detectors/aha/aha.go+++ b/pkg/detectors/aha/aha.go@@ -106,7 +106,7 @@ func verifyAha(ctx context.Context, client *http.Client, resMatch, resURLMatch sif err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()// https://www.aha.io/apiswitch res.StatusCode {diff --git a/pkg/detectors/alibaba/alibaba.go b/pkg/detectors/alibaba/alibaba.goindex 91417aae6..bc8a7bb16 100644--- a/pkg/detectors/alibaba/alibaba.go+++ b/pkg/detectors/alibaba/alibaba.go@@ -75,9 +75,9 @@ func GetSignature(input, key string) string {}func buildStringToSign(method, input string) string {- filter := strings.Replace(input, "+", "%20", -1)- filter = strings.Replace(filter, "%7E", "~", -1)- filter = strings.Replace(filter, "*", "%2A", -1)+ filter := strings.ReplaceAll(input, "+", "%20")+ filter = strings.ReplaceAll(filter, "%7E", "~")+ filter = strings.ReplaceAll(filter, "*", "%2A")filter = method + "&%2F&" + url.QueryEscape(filter)return filter}@@ -155,7 +155,7 @@ func verifyAlibaba(ctx context.Context, client *http.Client, resIdMatch, resMatcif err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()var alibabaResp alibabaRespif err = json.NewDecoder(res.Body).Decode(&alibabaResp); err != nil {diff --git a/pkg/detectors/anthropic/anthropic.go b/pkg/detectors/anthropic/anthropic.goindex 59897102d..20de25165 100644--- a/pkg/detectors/anthropic/anthropic.go+++ b/pkg/detectors/anthropic/anthropic.go@@ -106,7 +106,7 @@ func verifyAnthropicKey(ctx context.Context, client *http.Client, endpoint, keyif err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/apacta/apacta_test.go b/pkg/detectors/apacta/apacta_test.goindex b03975ac3..35ef67642 100644--- a/pkg/detectors/apacta/apacta_test.go+++ b/pkg/detectors/apacta/apacta_test.go@@ -37,7 +37,7 @@ func TestApacta_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"abcd1234-ef56-gh78-ij90-klmn1234opqr"},@@ -73,7 +73,7 @@ func TestApacta_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/appoptics/appoptics.go b/pkg/detectors/appoptics/appoptics.goindex fdd1805e0..7db69ac67 100644--- a/pkg/detectors/appoptics/appoptics.go+++ b/pkg/detectors/appoptics/appoptics.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -65,7 +66,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/audd/audd.go b/pkg/detectors/audd/audd.goindex 6cf65ed74..313191a69 100644--- a/pkg/detectors/audd/audd.go+++ b/pkg/detectors/audd/audd.go@@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `"status":"success"`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/autodesk/autodesk.go b/pkg/detectors/autodesk/autodesk.goindex 368943ff7..0ae61b471 100644--- a/pkg/detectors/autodesk/autodesk.go+++ b/pkg/detectors/autodesk/autodesk.go@@ -65,7 +65,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/x-www-form-urlencoded")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/autopilot/autopilot.go b/pkg/detectors/autopilot/autopilot.goindex c893af85b..53d79c6c2 100644--- a/pkg/detectors/autopilot/autopilot.go+++ b/pkg/detectors/autopilot/autopilot.go@@ -2,10 +2,11 @@ package autopilotimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("autopilotapikey", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/aws/session_keys/sessionkey.go b/pkg/detectors/aws/session_keys/sessionkey.goindex 2fe5bb5c9..03f13fd19 100644--- a/pkg/detectors/aws/session_keys/sessionkey.go+++ b/pkg/detectors/aws/session_keys/sessionkey.go@@ -336,7 +336,7 @@ func (s scanner) CleanResults(results []detectors.Result) []detectors.Result {// Reference: https://nitter.poast.org/TalBeerySec/status/1816449053841838223#mfunc checkSessionToken(sessionToken string, secret string) bool {- if !(strings.Contains(sessionToken, "YXdz") || strings.Contains(sessionToken, "Jb3JpZ2luX2Vj")) ||+ if (!strings.Contains(sessionToken, "YXdz") && !strings.Contains(sessionToken, "Jb3JpZ2luX2Vj")) ||strings.Contains(sessionToken, secret) {// Handle error if the sessionToken is not a valid base64 stringreturn falsediff --git a/pkg/detectors/azure_batch/azurebatch.go b/pkg/detectors/azure_batch/azurebatch.goindex 56df04edb..32d3f8037 100644--- a/pkg/detectors/azure_batch/azurebatch.go+++ b/pkg/detectors/azure_batch/azurebatch.go@@ -116,7 +116,7 @@ func verifyMatch(ctx context.Context, client *http.Client, endpoint, accountName}return false, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()switch resp.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/azureapimanagement/repositorykey/repositorykey.go b/pkg/detectors/azureapimanagement/repositorykey/repositorykey.goindex 403a519c8..62864cbac 100644--- a/pkg/detectors/azureapimanagement/repositorykey/repositorykey.go+++ b/pkg/detectors/azureapimanagement/repositorykey/repositorykey.go@@ -30,7 +30,7 @@ var (passwordPat = regexp.MustCompile(detectors.PrefixRegex([]string{"azure", "password"}) + `\b(git&[0-9]{12}&[a-zA-Z0-9\/+]{85}[a-zA-Z0-9]==)`)invalidHosts = simple.NewCache[struct{}]()- noSuchHostErr = errors.New("Could not resolve host")+ errNoSuchHost = errors.New("could not resolve host"))const (@@ -82,7 +82,7 @@ EndpointLoop:isVerified, err := verifyUrlPassword(ctx, urlMatch, azureGitUsername, passwordMatch)s1.Verified = isVerifiedif err != nil {- if errors.Is(err, noSuchHostErr) {+ if errors.Is(err, errNoSuchHost) {invalidHosts.Set(urlMatch, struct{}{})continue EndpointLoop}@@ -156,7 +156,7 @@ func verifyUrlPassword(_ context.Context, repoUrl, user, password string) (bool,if strings.Contains(outputString, "Authentication failed") {return false, nil} else if strings.Contains(outputString, "Could not resolve host") {- return false, noSuchHostErr+ return false, errNoSuchHost}return false, err}diff --git a/pkg/detectors/azureapimanagementsubscriptionkey/azureapimanagementsubscriptionkey.go b/pkg/detectors/azureapimanagementsubscriptionkey/azureapimanagementsubscriptionkey.goindex 97841c92a..2a2795d9a 100644--- a/pkg/detectors/azureapimanagementsubscriptionkey/azureapimanagementsubscriptionkey.go+++ b/pkg/detectors/azureapimanagementsubscriptionkey/azureapimanagementsubscriptionkey.go@@ -31,7 +31,7 @@ var (keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"azure", ".azure-api.net", "subscription", "key"}) + `([a-zA-Z-0-9]{32})`) // pattern for both Primary and secondary keyinvalidHosts = simple.NewCache[struct{}]()- noSuchHostErr = errors.New("no such host")+ errNoSuchHost = errors.New("no such host"))// Keywords are used for efficiently pre-filtering chunks.@@ -81,7 +81,7 @@ EndpointLoop:isVerified, verificationErr := s.verifyMatch(ctx, client, baseUrl, key)s1.Verified = isVerifiedif verificationErr != nil {- if errors.Is(verificationErr, noSuchHostErr) {+ if errors.Is(verificationErr, errNoSuchHost) {invalidHosts.Set(baseUrl, struct{}{})continue EndpointLoop}@@ -120,7 +120,7 @@ func (s Scanner) verifyMatch(ctx context.Context, client *http.Client, baseUrl,if err != nil {return false, nil}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()switch resp.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/azureappconfigconnectionstring/azureappconfigconnectionstring.go b/pkg/detectors/azureappconfigconnectionstring/azureappconfigconnectionstring.goindex 0beecd260..bce5cbb6f 100644--- a/pkg/detectors/azureappconfigconnectionstring/azureappconfigconnectionstring.go+++ b/pkg/detectors/azureappconfigconnectionstring/azureappconfigconnectionstring.go@@ -153,7 +153,7 @@ func (s Scanner) verifyMatch(ctx context.Context, client *http.Client, endpoint,if err != nil {return false, fmt.Errorf("request failed: %w", err)}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check the response statusswitch resp.StatusCode {diff --git a/pkg/detectors/azurecontainerregistry/azurecontainerregistry.go b/pkg/detectors/azurecontainerregistry/azurecontainerregistry.goindex e2556eeb8..2e585736d 100644--- a/pkg/detectors/azurecontainerregistry/azurecontainerregistry.go+++ b/pkg/detectors/azurecontainerregistry/azurecontainerregistry.go@@ -104,7 +104,7 @@ EndpointLoop:r.Verified = true}if verificationErr != nil {- if errors.Is(verificationErr, noSuchHostErr) {+ if errors.Is(verificationErr, errNoSuchHost) {invalidHosts.Set(username, struct{}{})continue EndpointLoop}@@ -126,7 +126,7 @@ func (s Scanner) IsFalsePositive(_ detectors.Result) (bool, string) {return false, ""}-var noSuchHostErr = errors.New("no such host")+var errNoSuchHost = errors.New("no such host")func verifyMatch(ctx context.Context, client *http.Client, username string, password string) (bool, error) {req, err := http.NewRequestWithContext(ctx, http.MethodGet, fmt.Sprintf("https://%s.azurecr.io/v2/", username), nil)@@ -139,7 +139,7 @@ func verifyMatch(ctx context.Context, client *http.Client, username string, passif err != nil {// lookup foo.azurecr.io: no such hostif strings.Contains(err.Error(), "no such host") {- return false, noSuchHostErr+ return false, errNoSuchHost}return false, err}diff --git a/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go b/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.goindex b020c72dc..edf1b03e1 100644--- a/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go+++ b/pkg/detectors/azuredevopspersonalaccesstoken/azuredevopspersonalaccesstoken.go@@ -68,7 +68,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth("", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()hasVerifiedRes, _ := common.ResponseContainsSubstring(res.Body, "lastUpdateTime")if res.StatusCode >= 200 && res.StatusCode < 300 && hasVerifiedRes {s1.Verified = truediff --git a/pkg/detectors/azuredirectmanagementkey/azuredirectmanagementkey.go b/pkg/detectors/azuredirectmanagementkey/azuredirectmanagementkey.goindex b03481486..66af785f0 100644--- a/pkg/detectors/azuredirectmanagementkey/azuredirectmanagementkey.go+++ b/pkg/detectors/azuredirectmanagementkey/azuredirectmanagementkey.go@@ -37,7 +37,7 @@ var (keyPat = regexp.MustCompile(detectors.PrefixRegex([]string{"azure", ".management.azure-api.net"}) + `([a-zA-Z0-9+\/]{83,85}[a-zA-Z0-9]==)`) // pattern for both Primary and secondary keyinvalidHosts = simple.NewCache[struct{}]()- noSuchHostErr = errors.New("no such host")+ errNoSuchHost = errors.New("no such host"))// Keywords are used for efficiently pre-filtering chunks.@@ -87,7 +87,7 @@ EndpointLoop:isVerified, verificationErr := s.verifyMatch(ctx, client, baseUrl, serviceName, key)s1.Verified = isVerifiedif verificationErr != nil {- if errors.Is(verificationErr, noSuchHostErr) {+ if errors.Is(verificationErr, errNoSuchHost) {invalidHosts.Set(baseUrl, struct{}{})continue EndpointLoop}@@ -133,7 +133,7 @@ func (s Scanner) verifyMatch(ctx context.Context, client *http.Client, baseUrl,if err != nil {return false, nil}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()switch resp.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/azurefunctionkey/azurefunctionkey.go b/pkg/detectors/azurefunctionkey/azurefunctionkey.goindex 9a93494b1..2bf02b877 100644--- a/pkg/detectors/azurefunctionkey/azurefunctionkey.go+++ b/pkg/detectors/azurefunctionkey/azurefunctionkey.go@@ -64,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/azuresastoken/azuresastoken.go b/pkg/detectors/azuresastoken/azuresastoken.goindex a887a9ed3..e5a74327a 100644--- a/pkg/detectors/azuresastoken/azuresastoken.go+++ b/pkg/detectors/azuresastoken/azuresastoken.go@@ -37,7 +37,7 @@ var (invalidStorageAccounts = simple.NewCache[struct{}]()- noSuchHostErr = errors.New("no such host")+ errNoSuchHost = errors.New("no such host"))func (s Scanner) Keywords() []string {@@ -101,7 +101,7 @@ UrlLoop:s1.Verified = isVerifiedif verificationErr != nil {- if errors.Is(verificationErr, noSuchHostErr) {+ if errors.Is(verificationErr, errNoSuchHost) {invalidStorageAccounts.Set(storageAccount, struct{}{})continue UrlLoop}@@ -131,11 +131,11 @@ func verifyMatch(ctx context.Context, client *http.Client, url, key string, retrres, err := client.Do(req)if err != nil {if strings.Contains(err.Error(), "no such host") {- return false, noSuchHostErr+ return false, errNoSuchHost}return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {diff --git a/pkg/detectors/azuresearchadminkey/azuresearchadminkey.go b/pkg/detectors/azuresearchadminkey/azuresearchadminkey.goindex bf76892f9..65af1b9d3 100644--- a/pkg/detectors/azuresearchadminkey/azuresearchadminkey.go+++ b/pkg/detectors/azuresearchadminkey/azuresearchadminkey.go@@ -69,7 +69,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 || res.StatusCode == 403 {diff --git a/pkg/detectors/azuresearchquerykey/azuresearchquerykey.go b/pkg/detectors/azuresearchquerykey/azuresearchquerykey.goindex 25a68e744..e15905fce 100644--- a/pkg/detectors/azuresearchquerykey/azuresearchquerykey.go+++ b/pkg/detectors/azuresearchquerykey/azuresearchquerykey.go@@ -69,7 +69,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 || res.StatusCode == 403 {diff --git a/pkg/detectors/bannerbear/v1/bannerbear_test.go b/pkg/detectors/bannerbear/v1/bannerbear_test.goindex 009862310..ffd623e7a 100644--- a/pkg/detectors/bannerbear/v1/bannerbear_test.go+++ b/pkg/detectors/bannerbear/v1/bannerbear_test.go@@ -39,7 +39,7 @@ func TestBannerBear_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"yvxpthLIcYpZweFpPOVeCOtt"},@@ -77,7 +77,7 @@ func TestBannerBear_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/bannerbear/v2/bannerbear_test.go b/pkg/detectors/bannerbear/v2/bannerbear_test.goindex f75714a71..b8ccbac0e 100644--- a/pkg/detectors/bannerbear/v2/bannerbear_test.go+++ b/pkg/detectors/bannerbear/v2/bannerbear_test.go@@ -39,7 +39,7 @@ func TestBannerBear_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"bb_pr_abcdc2b40ef44abcd8cbf3739aabcd"},@@ -77,7 +77,7 @@ func TestBannerBear_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/baremetrics/baremetrics_test.go b/pkg/detectors/baremetrics/baremetrics_test.goindex 71ae28b90..aca628dcd 100644--- a/pkg/detectors/baremetrics/baremetrics_test.go+++ b/pkg/detectors/baremetrics/baremetrics_test.go@@ -39,7 +39,7 @@ func TestBareMetrics_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"sk_nGDJWCkPiFAKE5XFTzUUA"},@@ -77,7 +77,7 @@ func TestBareMetrics_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/beamer/beamer_test.go b/pkg/detectors/beamer/beamer_test.goindex 2a9b710f0..d59867ccd 100644--- a/pkg/detectors/beamer/beamer_test.go+++ b/pkg/detectors/beamer/beamer_test.go@@ -38,7 +38,7 @@ func TestBeamer_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"DyVdf7+cAXw4MH9gT1CPotU31RMl__aLKbrABRWvT7TyO="},@@ -75,7 +75,7 @@ func TestBeamer_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/beebole/beebole_test.go b/pkg/detectors/beebole/beebole_test.goindex b9f668f06..8ea8ba05b 100644--- a/pkg/detectors/beebole/beebole_test.go+++ b/pkg/detectors/beebole/beebole_test.go@@ -39,7 +39,7 @@ func TestBeeBole_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"bn6htprmfpukfalts4muwalxh9j15ucvnrfdme8t"},@@ -77,7 +77,7 @@ func TestBeeBole_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/besnappy/besnappy_test.go b/pkg/detectors/besnappy/besnappy_test.goindex 0ad239321..0528d2925 100644--- a/pkg/detectors/besnappy/besnappy_test.go+++ b/pkg/detectors/besnappy/besnappy_test.go@@ -39,7 +39,7 @@ func TestBeSnappy_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"f58c5d37d7876d32cfdd823f8fe4ded364a8d483b5dbfadcc55ad801b3be8523"},@@ -77,7 +77,7 @@ func TestBeSnappy_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/besttime/besttime_test.go b/pkg/detectors/besttime/besttime_test.goindex 3af4f58f1..06f4d71eb 100644--- a/pkg/detectors/besttime/besttime_test.go+++ b/pkg/detectors/besttime/besttime_test.go@@ -36,7 +36,7 @@ func TestBestTime_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"pri_099889f14d114dfaae476569b395eade"},@@ -71,7 +71,7 @@ func TestBestTime_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/betterstack/betterstack_test.go b/pkg/detectors/betterstack/betterstack_test.goindex 45ff9579b..b5d7e35b5 100644--- a/pkg/detectors/betterstack/betterstack_test.go+++ b/pkg/detectors/betterstack/betterstack_test.go@@ -38,7 +38,7 @@ func TestBetterStack_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}func getBetterStackToken() string{ return "ntJD0ER8QpuT0O1WqsclApO2" }`,@@ -76,7 +76,7 @@ func TestBetterStack_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}func getBetterStackToken() string{ return "DyntJD0ER8QpuT0O1WqsclApO2" }`,diff --git a/pkg/detectors/billomat/billomat_test.go b/pkg/detectors/billomat/billomat_test.goindex 0aa00263d..587e289ce 100644--- a/pkg/detectors/billomat/billomat_test.go+++ b/pkg/detectors/billomat/billomat_test.go@@ -38,7 +38,7 @@ func TestBilloMat_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check response statusif resp.StatusCode == http.StatusOK {diff --git a/pkg/detectors/bingsubscriptionkey/bingsubscriptionkey_test.go b/pkg/detectors/bingsubscriptionkey/bingsubscriptionkey_test.goindex 52a8a61d1..2122f6a0a 100644--- a/pkg/detectors/bingsubscriptionkey/bingsubscriptionkey_test.go+++ b/pkg/detectors/bingsubscriptionkey/bingsubscriptionkey_test.go@@ -39,7 +39,7 @@ func TestBingsubscriptionkey_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"89017d414ed64edb9c776d4a52102b9a"},},@@ -77,7 +77,7 @@ func TestBingsubscriptionkey_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{},},diff --git a/pkg/detectors/bitbar/bitbar_test.go b/pkg/detectors/bitbar/bitbar_test.goindex a598ef4aa..6b643a733 100644--- a/pkg/detectors/bitbar/bitbar_test.go+++ b/pkg/detectors/bitbar/bitbar_test.go@@ -42,7 +42,7 @@ func TestBitBar_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"64pq66z15thg8fh3acd00l35lpyg7c82"},@@ -83,7 +83,7 @@ func TestBitBar_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/bitcoinaverage/bitcoinaverage_test.go b/pkg/detectors/bitcoinaverage/bitcoinaverage_test.goindex d92960ca6..9f2499802 100644--- a/pkg/detectors/bitcoinaverage/bitcoinaverage_test.go+++ b/pkg/detectors/bitcoinaverage/bitcoinaverage_test.go@@ -43,7 +43,7 @@ func TestBitCoinAverage_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"WZizqeWvRnhZmFlpc5pMc92NP1Du19wxxpd5zjsYY8F"},@@ -85,7 +85,7 @@ func TestBitCoinAverage_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken_test.go b/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken_test.goindex a79913f78..4a17e192d 100644--- a/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken_test.go+++ b/pkg/detectors/bitlyaccesstoken/bitlyaccesstoken_test.go@@ -39,7 +39,7 @@ func TestBitlyAccessToken_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"2xN7puShxzNf5fZleQthTg305lKr7KrbW95D3gSD"},@@ -77,7 +77,7 @@ func TestBitlyAccessToken_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/bitmex/bitmex_test.go b/pkg/detectors/bitmex/bitmex_test.goindex 209e1afd2..9e90b3bfc 100644--- a/pkg/detectors/bitmex/bitmex_test.go+++ b/pkg/detectors/bitmex/bitmex_test.go@@ -46,7 +46,7 @@ func TestBitmex_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"EPwUIxOIveS463D_2O9LFgkzW_HlMtrmELzXm4bSlWv49JLcgvg5hvu467WbbnpmoEA-RjrY"},@@ -91,7 +91,7 @@ func TestBitmex_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/blazemeter/blazemeter_test.go b/pkg/detectors/blazemeter/blazemeter_test.goindex 2f5d6f45d..61362cd85 100644--- a/pkg/detectors/blazemeter/blazemeter_test.go+++ b/pkg/detectors/blazemeter/blazemeter_test.go@@ -39,7 +39,7 @@ func TestBlazeMeter_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"sjbuxa3m-vs4n-ykl8-8jpv-i09hdidciolp"},@@ -77,7 +77,7 @@ func TestBlazeMeter_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/blitapp/blitapp_test.go b/pkg/detectors/blitapp/blitapp_test.goindex a759f7949..fe0a86aac 100644--- a/pkg/detectors/blitapp/blitapp_test.go+++ b/pkg/detectors/blitapp/blitapp_test.go@@ -39,7 +39,7 @@ func TestBlitApp_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"I_MncTA8nlFcqlBCakI5vwkwFD4_zRUYZKt8hyd"},@@ -77,7 +77,7 @@ func TestBlitApp_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/blocknative/blocknative_test.go b/pkg/detectors/blocknative/blocknative_test.goindex 406bacafc..6b34453c1 100644--- a/pkg/detectors/blocknative/blocknative_test.go+++ b/pkg/detectors/blocknative/blocknative_test.go@@ -39,7 +39,7 @@ func TestBlockNative_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"76e50995-059f-3d1a-af8e-cc85fc05eb03"},@@ -77,7 +77,7 @@ func TestBlockNative_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/blogger/blogger_test.go b/pkg/detectors/blogger/blogger_test.goindex c7586c90f..dce3c7a1c 100644--- a/pkg/detectors/blogger/blogger_test.go+++ b/pkg/detectors/blogger/blogger_test.go@@ -34,7 +34,7 @@ func TestBlogger_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check response statusif resp.StatusCode == http.StatusOK {@@ -74,7 +74,7 @@ func TestBlogger_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check response statusif resp.StatusCode == http.StatusOK {diff --git a/pkg/detectors/boostnote/boostnote_test.go b/pkg/detectors/boostnote/boostnote_test.goindex 871e2cabf..223a85312 100644--- a/pkg/detectors/boostnote/boostnote_test.go+++ b/pkg/detectors/boostnote/boostnote_test.go@@ -39,7 +39,7 @@ func TestBoostNote_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"fb1026ac5994e3ad01799fe040289317ba2594a20e9e45307a143be82b49d213"},@@ -77,7 +77,7 @@ func TestBoostNote_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/borgbase/borgbase_test.go b/pkg/detectors/borgbase/borgbase_test.goindex 603979627..628f54991 100644--- a/pkg/detectors/borgbase/borgbase_test.go+++ b/pkg/detectors/borgbase/borgbase_test.go@@ -40,7 +40,7 @@ func TestBorgBase_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"FoHclCFSi_aV09jowJQ4RUF_MiqW6ioqq6_OcyB0PFlV-mQ1yoFjk5JLlxbzRUzKTA6vsfR8wq6TNc83rtNKlkD092Sj1c9CbPVBXlHksy.sT2I/so6bMGdPcqxzbjrxYgAUiORgqJDeTet4gKOQlZpt"},@@ -79,7 +79,7 @@ func TestBorgBase_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/braintreepayments/braintreepayments.go b/pkg/detectors/braintreepayments/braintreepayments.goindex 74578caec..9704331bd 100644--- a/pkg/detectors/braintreepayments/braintreepayments.go+++ b/pkg/detectors/braintreepayments/braintreepayments.go@@ -113,7 +113,7 @@ func verifyBraintree(ctx context.Context, client *http.Client, url, pubKey, priv}()bodyString := string(bodyBytes)- if !(res.StatusCode == http.StatusOK) {+ if res.StatusCode != http.StatusOK {return false, fmt.Errorf("unexpected HTTP response status %d", res.StatusCode)}diff --git a/pkg/detectors/braintreepayments/braintreepayments_test.go b/pkg/detectors/braintreepayments/braintreepayments_test.goindex 6c5ea244d..281fc6218 100644--- a/pkg/detectors/braintreepayments/braintreepayments_test.go+++ b/pkg/detectors/braintreepayments/braintreepayments_test.go@@ -40,7 +40,7 @@ func TestBrainTreePayments_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"f7b3cb83a7fdb915a71ce17ab8a903cc"},@@ -79,7 +79,7 @@ func TestBrainTreePayments_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/brandfetch/v1/brandfetch_test.go b/pkg/detectors/brandfetch/v1/brandfetch_test.goindex b06e6ea82..f2846dd35 100644--- a/pkg/detectors/brandfetch/v1/brandfetch_test.go+++ b/pkg/detectors/brandfetch/v1/brandfetch_test.go@@ -39,7 +39,7 @@ func TestBrandFetch_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"uHOAdwfQ7sD2yOpur72UqyUeIqnFwILOIlEPyBtJ"},@@ -77,7 +77,7 @@ func TestBrandFetch_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/brandfetch/v2/brandfetch.go b/pkg/detectors/brandfetch/v2/brandfetch.goindex 2dacb7ddd..ed9ff4828 100644--- a/pkg/detectors/brandfetch/v2/brandfetch.go+++ b/pkg/detectors/brandfetch/v2/brandfetch.go@@ -95,7 +95,7 @@ func VerifyMatch(ctx context.Context, client *http.Client, token string) (bool,if err != nil {return false, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()switch resp.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/brandfetch/v2/brandfetch_test.go b/pkg/detectors/brandfetch/v2/brandfetch_test.goindex e991b6c92..b6c22fb3e 100644--- a/pkg/detectors/brandfetch/v2/brandfetch_test.go+++ b/pkg/detectors/brandfetch/v2/brandfetch_test.go@@ -49,7 +49,7 @@ func TestBrandFetch_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check response statusif resp.StatusCode == http.StatusOK {@@ -104,7 +104,7 @@ func TestBrandFetch_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/browserstack/browserstack.go b/pkg/detectors/browserstack/browserstack.goindex 0804cbb63..1bae92601 100644--- a/pkg/detectors/browserstack/browserstack.go+++ b/pkg/detectors/browserstack/browserstack.go@@ -106,7 +106,7 @@ func verifyBrowserStackCredentials(ctx context.Context, client *http.Client, useif err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode == http.StatusOK {return true, nildiff --git a/pkg/detectors/browserstack/browserstack_test.go b/pkg/detectors/browserstack/browserstack_test.goindex 97478c750..2493bb8d0 100644--- a/pkg/detectors/browserstack/browserstack_test.go+++ b/pkg/detectors/browserstack/browserstack_test.go@@ -44,7 +44,7 @@ func TestBrowserStack_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{@@ -92,7 +92,7 @@ func TestBrowserStack_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/browshot/browshot_test.go b/pkg/detectors/browshot/browshot_test.goindex 16ba249ba..6fae5960d 100644--- a/pkg/detectors/browshot/browshot_test.go+++ b/pkg/detectors/browshot/browshot_test.go@@ -36,7 +36,7 @@ func TestBrowShot_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check response statusif resp.StatusCode == http.StatusOK {@@ -78,7 +78,7 @@ func TestBrowShot_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/bscscan/bscscan_test.go b/pkg/detectors/bscscan/bscscan_test.goindex e5649eab9..1614a61a4 100644--- a/pkg/detectors/bscscan/bscscan_test.go+++ b/pkg/detectors/bscscan/bscscan_test.go@@ -36,7 +36,7 @@ func TestBscScan_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"HYZHPP4PBYXCOZAVK4FH55W4MRHYLALPU1"},@@ -71,7 +71,7 @@ func TestBscScan_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/buddyns/buddyns_test.go b/pkg/detectors/buddyns/buddyns_test.goindex 078d9f7d6..014df7627 100644--- a/pkg/detectors/buddyns/buddyns_test.go+++ b/pkg/detectors/buddyns/buddyns_test.go@@ -39,7 +39,7 @@ func TestBuddyNs_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"kkmvdiolccw4v0tue4lu7l7kmnnb4ao8z25ezink"},@@ -77,7 +77,7 @@ func TestBuddyNs_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/budibase/budibase_test.go b/pkg/detectors/budibase/budibase_test.goindex e5aa858a8..130e757b5 100644--- a/pkg/detectors/budibase/budibase_test.go+++ b/pkg/detectors/budibase/budibase_test.go@@ -38,7 +38,7 @@ func TestBudiBase_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"b256def166fcdf4a429a1e83175105d5-fd36f3da1e934bf533cd0e68dbb80ed6a42e1178bd4200428d83e876e7d05e40b21e3a68888f826d"},@@ -75,7 +75,7 @@ func TestBudiBase_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/bugherd/bugherd_test.go b/pkg/detectors/bugherd/bugherd_test.goindex c6088709a..756a934cb 100644--- a/pkg/detectors/bugherd/bugherd_test.go+++ b/pkg/detectors/bugherd/bugherd_test.go@@ -39,7 +39,7 @@ func TestBugHerd_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"fisy6bbu6il4x96bekx587"},@@ -77,7 +77,7 @@ func TestBugHerd_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/bugsnag/bugsnag_test.go b/pkg/detectors/bugsnag/bugsnag_test.goindex 7b31971b2..0b31beabc 100644--- a/pkg/detectors/bugsnag/bugsnag_test.go+++ b/pkg/detectors/bugsnag/bugsnag_test.go@@ -39,7 +39,7 @@ func TestBugSnag_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"wz9450iu-iewm-jonx-eab8-0ibxwadddm8i"},@@ -77,7 +77,7 @@ func TestBugSnag_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/buildkite/v1/buildkite_test.go b/pkg/detectors/buildkite/v1/buildkite_test.goindex e4aa9d298..7137736c9 100644--- a/pkg/detectors/buildkite/v1/buildkite_test.go+++ b/pkg/detectors/buildkite/v1/buildkite_test.go@@ -39,7 +39,7 @@ func TestBuildKite_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"kimu4axq3jxxdj8un0kpo3ua2ucr05zmhh4de0r6"},@@ -77,7 +77,7 @@ func TestBuildKite_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/buildkite/v2/buildkite_test.go b/pkg/detectors/buildkite/v2/buildkite_test.goindex c7eeb19f6..5f2b466a7 100644--- a/pkg/detectors/buildkite/v2/buildkite_test.go+++ b/pkg/detectors/buildkite/v2/buildkite_test.go@@ -39,7 +39,7 @@ func TestBuildKiteV2_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"bkua_hqlh73m51jtho0jh12wcf2758c8fcdbv05z023ly"},@@ -77,7 +77,7 @@ func TestBuildKiteV2_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/bulbul/bulbul_test.go b/pkg/detectors/bulbul/bulbul_test.goindex e9f4ced11..013ba9998 100644--- a/pkg/detectors/bulbul/bulbul_test.go+++ b/pkg/detectors/bulbul/bulbul_test.go@@ -36,7 +36,7 @@ func TestBulBul_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"3kx19qpx748ldb75lsjicbs6ipit6ssm"},@@ -71,7 +71,7 @@ func TestBulBul_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/bulksms/bulksms_test.go b/pkg/detectors/bulksms/bulksms_test.goindex 792b8cfcc..a33b5c2d5 100644--- a/pkg/detectors/bulksms/bulksms_test.go+++ b/pkg/detectors/bulksms/bulksms_test.go@@ -41,7 +41,7 @@ func TestBulkSMS_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"QGxPqRyzvt%xEKcV&#ePJGn)k0d9a381A26C47380B85F2DB572314-ACBDC267B-8"},@@ -81,7 +81,7 @@ func TestBulkSMS_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/buttercms/buttercms_test.go b/pkg/detectors/buttercms/buttercms_test.goindex 9fbd03692..b66c7f350 100644--- a/pkg/detectors/buttercms/buttercms_test.go+++ b/pkg/detectors/buttercms/buttercms_test.go@@ -36,7 +36,7 @@ func TestButterCMS_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: []string{"l7psk7wkedkpiyp4jrx5fjdnno8c89243of6yde8"},@@ -71,7 +71,7 @@ func TestButterCMS_Pattern(t *testing.T) {// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}`,want: nil,diff --git a/pkg/detectors/calendarific/calendarific.go b/pkg/detectors/calendarific/calendarific.goindex 6aaa64cf2..7fbd77760 100644--- a/pkg/detectors/calendarific/calendarific.go+++ b/pkg/detectors/calendarific/calendarific.go@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/calendlyapikey/calendlyapikey.go b/pkg/detectors/calendlyapikey/calendlyapikey.goindex 8323f930f..5a4684b69 100644--- a/pkg/detectors/calendlyapikey/calendlyapikey.go+++ b/pkg/detectors/calendlyapikey/calendlyapikey.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/calorieninja/calorieninja.go b/pkg/detectors/calorieninja/calorieninja.goindex fd93a5689..81c4f0201 100644--- a/pkg/detectors/calorieninja/calorieninja.go+++ b/pkg/detectors/calorieninja/calorieninja.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Api-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/campayn/campayn.go b/pkg/detectors/campayn/campayn.goindex 9ea5e75b6..8a4360eb1 100644--- a/pkg/detectors/campayn/campayn.go+++ b/pkg/detectors/campayn/campayn.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", "TRUEREST apikey="+resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cannyio/cannyio.go b/pkg/detectors/cannyio/cannyio.goindex 2bbcc4908..aa74f9f95 100644--- a/pkg/detectors/cannyio/cannyio.go+++ b/pkg/detectors/cannyio/cannyio.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/x-www-form-urlencoded")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/capsulecrm/capsulecrm.go b/pkg/detectors/capsulecrm/capsulecrm.goindex 645d35820..faf21d95d 100644--- a/pkg/detectors/capsulecrm/capsulecrm.go+++ b/pkg/detectors/capsulecrm/capsulecrm.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/captaindata/v1/captaindata.go b/pkg/detectors/captaindata/v1/captaindata.goindex 55b0316a4..438818323 100644--- a/pkg/detectors/captaindata/v1/captaindata.go+++ b/pkg/detectors/captaindata/v1/captaindata.go@@ -67,7 +67,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-api-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/carboninterface/carboninterface.go b/pkg/detectors/carboninterface/carboninterface.goindex 848b54591..e02d76b09 100644--- a/pkg/detectors/carboninterface/carboninterface.go+++ b/pkg/detectors/carboninterface/carboninterface.go@@ -56,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cashboard/cashboard.go b/pkg/detectors/cashboard/cashboard.goindex 2fda6ef13..8e7b08da1 100644--- a/pkg/detectors/cashboard/cashboard.go+++ b/pkg/detectors/cashboard/cashboard.go@@ -69,7 +69,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/caspio/caspio.go b/pkg/detectors/caspio/caspio.goindex 3ae65f4d2..137a490b3 100644--- a/pkg/detectors/caspio/caspio.go+++ b/pkg/detectors/caspio/caspio.go@@ -73,7 +73,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "text/plain")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/censys/censys.go b/pkg/detectors/censys/censys.goindex 3db0f273c..3c311f2c6 100644--- a/pkg/detectors/censys/censys.go+++ b/pkg/detectors/censys/censys.go@@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(userPatMatch, tokenPatMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/centralstationcrm/centralstationcrm.go b/pkg/detectors/centralstationcrm/centralstationcrm.goindex 46127f3b7..f5e22530e 100644--- a/pkg/detectors/centralstationcrm/centralstationcrm.go+++ b/pkg/detectors/centralstationcrm/centralstationcrm.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-apikey", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cexio/cexio.go b/pkg/detectors/cexio/cexio.goindex 1cb92a610..750fa854a 100644--- a/pkg/detectors/cexio/cexio.go+++ b/pkg/detectors/cexio/cexio.go@@ -88,7 +88,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/x-www-form-urlencoded")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()body, err := io.ReadAll(res.Body)if err != nil {diff --git a/pkg/detectors/chartmogul/chartmogul.go b/pkg/detectors/chartmogul/chartmogul.goindex d8f612a58..a4a52ea05 100644--- a/pkg/detectors/chartmogul/chartmogul.go+++ b/pkg/detectors/chartmogul/chartmogul.go@@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/chatbot/chatbot.go b/pkg/detectors/chatbot/chatbot.goindex cb6b5f7a8..60d54bd17 100644--- a/pkg/detectors/chatbot/chatbot.go+++ b/pkg/detectors/chatbot/chatbot.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/chatfule/chatfule.go b/pkg/detectors/chatfule/chatfule.goindex 6319dda29..91772f4ec 100644--- a/pkg/detectors/chatfule/chatfule.go+++ b/pkg/detectors/chatfule/chatfule.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/checio/checio.go b/pkg/detectors/checio/checio.goindex 981e5abf2..587dc216b 100644--- a/pkg/detectors/checio/checio.go+++ b/pkg/detectors/checio/checio.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/checklyhq/checklyhq.go b/pkg/detectors/checklyhq/checklyhq.goindex a9d6c3bc8..6f8165646 100644--- a/pkg/detectors/checklyhq/checklyhq.go+++ b/pkg/detectors/checklyhq/checklyhq.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/checkout/checkout.go b/pkg/detectors/checkout/checkout.goindex 879005ca8..84f2234e8 100644--- a/pkg/detectors/checkout/checkout.go+++ b/pkg/detectors/checkout/checkout.go@@ -66,7 +66,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/checkvist/checkvist.go b/pkg/detectors/checkvist/checkvist.goindex 94f9260d0..30c5b8731 100644--- a/pkg/detectors/checkvist/checkvist.go+++ b/pkg/detectors/checkvist/checkvist.go@@ -71,7 +71,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/x-www-form-urlencoded")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cicero/cicero.go b/pkg/detectors/cicero/cicero.goindex 88271e94d..801ee6dfa 100644--- a/pkg/detectors/cicero/cicero.go+++ b/pkg/detectors/cicero/cicero.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/clarifai/clarifai.go b/pkg/detectors/clarifai/clarifai.goindex a8feaf6c1..725c8da52 100644--- a/pkg/detectors/clarifai/clarifai.go+++ b/pkg/detectors/clarifai/clarifai.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Key %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}@@ -69,7 +69,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Key %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/clearbit/clearbit.go b/pkg/detectors/clearbit/clearbit.goindex 590cf028c..e149a4fc1 100644--- a/pkg/detectors/clearbit/clearbit.go+++ b/pkg/detectors/clearbit/clearbit.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/clicksendsms/clicksendsms.go b/pkg/detectors/clicksendsms/clicksendsms.goindex 51e002c05..ef6a9b68a 100644--- a/pkg/detectors/clicksendsms/clicksendsms.go+++ b/pkg/detectors/clicksendsms/clicksendsms.go@@ -69,7 +69,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cliengo/cliengo.go b/pkg/detectors/cliengo/cliengo.goindex 625f3d482..c751b672c 100644--- a/pkg/detectors/cliengo/cliengo.go+++ b/pkg/detectors/cliengo/cliengo.go@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := detectors.DoWithDedup(client, detector_typepb.DetectorType_Cliengo, resMatch, req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/clinchpad/clinchpad.go b/pkg/detectors/clinchpad/clinchpad.goindex 60ed04968..ab8f6d4d0 100644--- a/pkg/detectors/clinchpad/clinchpad.go+++ b/pkg/detectors/clinchpad/clinchpad.go@@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/clockify/clockify.go b/pkg/detectors/clockify/clockify.goindex b0e4f0e71..de4acfcac 100644--- a/pkg/detectors/clockify/clockify.go+++ b/pkg/detectors/clockify/clockify.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Api-Key", resMatch)res, err := detectors.DoWithDedup(client, detector_typepb.DetectorType_Clockify, resMatch, req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/clockworksms/clockworksms.go b/pkg/detectors/clockworksms/clockworksms.goindex 4a167e5e7..a3996e5fd 100644--- a/pkg/detectors/clockworksms/clockworksms.go+++ b/pkg/detectors/clockworksms/clockworksms.go@@ -65,7 +65,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("access_token", tokenRes)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/closecrm/close.go b/pkg/detectors/closecrm/close.goindex 41df5ec70..aa7f579f5 100644--- a/pkg/detectors/closecrm/close.go+++ b/pkg/detectors/closecrm/close.go@@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cloudconvert/cloudconvert.go b/pkg/detectors/cloudconvert/cloudconvert.goindex 4d62b4fe2..0c2e48e93 100644--- a/pkg/detectors/cloudconvert/cloudconvert.go+++ b/pkg/detectors/cloudconvert/cloudconvert.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cloudelements/cloudelements.go b/pkg/detectors/cloudelements/cloudelements.goindex dfa788c86..78e5f3b93 100644--- a/pkg/detectors/cloudelements/cloudelements.go+++ b/pkg/detectors/cloudelements/cloudelements.go@@ -66,7 +66,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("User %s, Organization %s", resMatch, resOrgMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go b/pkg/detectors/cloudflareapitoken/cloudflareapitoken.goindex 7645d81d7..e848cc3e8 100644--- a/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go+++ b/pkg/detectors/cloudflareapitoken/cloudflareapitoken.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go b/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.goindex ac2d268cd..9ab63e450 100644--- a/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go+++ b/pkg/detectors/cloudflareglobalapikey/cloudflareglobalapikey.go@@ -70,7 +70,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cloudimage/cloudimage.go b/pkg/detectors/cloudimage/cloudimage.goindex a992e4276..2cf168664 100644--- a/pkg/detectors/cloudimage/cloudimage.go+++ b/pkg/detectors/cloudimage/cloudimage.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Client-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cloudmersive/cloudmersive.go b/pkg/detectors/cloudmersive/cloudmersive.goindex 2589a73b1..a7c626c4b 100644--- a/pkg/detectors/cloudmersive/cloudmersive.go+++ b/pkg/detectors/cloudmersive/cloudmersive.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Apikey", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cloudplan/cloudplan.go b/pkg/detectors/cloudplan/cloudplan.goindex cba92389b..817998bdf 100644--- a/pkg/detectors/cloudplan/cloudplan.go+++ b/pkg/detectors/cloudplan/cloudplan.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("session_id", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cloudsmith/cloudsmith.go b/pkg/detectors/cloudsmith/cloudsmith.goindex a0278c16d..e400c7964 100644--- a/pkg/detectors/cloudsmith/cloudsmith.go+++ b/pkg/detectors/cloudsmith/cloudsmith.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Api-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {var r responseif err := json.NewDecoder(res.Body).Decode(&r); err != nil {diff --git a/pkg/detectors/cloverly/cloverly.go b/pkg/detectors/cloverly/cloverly.goindex d9f227564..4a090286f 100644--- a/pkg/detectors/cloverly/cloverly.go+++ b/pkg/detectors/cloverly/cloverly.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cloze/cloze.go b/pkg/detectors/cloze/cloze.goindex eb22cd275..ca821d808 100644--- a/pkg/detectors/cloze/cloze.go+++ b/pkg/detectors/cloze/cloze.go@@ -66,7 +66,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/clustdoc/clustdoc.go b/pkg/detectors/clustdoc/clustdoc.goindex fbe50ce13..9fcd611fe 100644--- a/pkg/detectors/clustdoc/clustdoc.go+++ b/pkg/detectors/clustdoc/clustdoc.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/coda/coda.go b/pkg/detectors/coda/coda.goindex e89e51ab5..2d29c2571 100644--- a/pkg/detectors/coda/coda.go+++ b/pkg/detectors/coda/coda.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/codacy/codacy.go b/pkg/detectors/codacy/codacy.goindex 3b6f5abf3..562c15545 100644--- a/pkg/detectors/codacy/codacy.go+++ b/pkg/detectors/codacy/codacy.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("api-token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/codeclimate/codeclimate.go b/pkg/detectors/codeclimate/codeclimate.goindex fac992d69..9875fd3b5 100644--- a/pkg/detectors/codeclimate/codeclimate.go+++ b/pkg/detectors/codeclimate/codeclimate.go@@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Token token=%s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {var r responseif err := json.NewDecoder(res.Body).Decode(&r); err != nil {diff --git a/pkg/detectors/codemagic/codemagic.go b/pkg/detectors/codemagic/codemagic.goindex 63f3afed9..c22cd0591 100644--- a/pkg/detectors/codemagic/codemagic.go+++ b/pkg/detectors/codemagic/codemagic.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-auth-token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/codequiry/codequiry.go b/pkg/detectors/codequiry/codequiry.goindex d8d191ef2..7b3250f8b 100644--- a/pkg/detectors/codequiry/codequiry.go+++ b/pkg/detectors/codequiry/codequiry.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("apikey", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/coinapi/coinapi.go b/pkg/detectors/coinapi/coinapi.goindex 1732055a3..9d822b1c7 100644--- a/pkg/detectors/coinapi/coinapi.go+++ b/pkg/detectors/coinapi/coinapi.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-CoinAPI-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/coinlayer/coinlayer.go b/pkg/detectors/coinlayer/coinlayer.goindex 71df5549c..2fdcadf4b 100644--- a/pkg/detectors/coinlayer/coinlayer.go+++ b/pkg/detectors/coinlayer/coinlayer.go@@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `"success": true`) || strings.Contains(bodyString, `"info":"Access Restricted - Your current Subscription Plan does not support HTTPS Encryption."`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/coinlib/coinlib.go b/pkg/detectors/coinlib/coinlib.goindex 8dfda739e..a023bb75e 100644--- a/pkg/detectors/coinlib/coinlib.go+++ b/pkg/detectors/coinlib/coinlib.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/collect2/collect2.go b/pkg/detectors/collect2/collect2.goindex 851142d7a..753914bc0 100644--- a/pkg/detectors/collect2/collect2.go+++ b/pkg/detectors/collect2/collect2.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/column/column.go b/pkg/detectors/column/column.goindex cf8173a42..a4e083a5c 100644--- a/pkg/detectors/column/column.go+++ b/pkg/detectors/column/column.go@@ -56,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(resMatch))))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else {diff --git a/pkg/detectors/commercejs/commercejs.go b/pkg/detectors/commercejs/commercejs.goindex 4c5209d91..82b006673 100644--- a/pkg/detectors/commercejs/commercejs.go+++ b/pkg/detectors/commercejs/commercejs.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/commodities/commodities.go b/pkg/detectors/commodities/commodities.goindex 6dc0e6884..a0a6fde5f 100644--- a/pkg/detectors/commodities/commodities.go+++ b/pkg/detectors/commodities/commodities.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `"success":true`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/companyhub/companyhub.go b/pkg/detectors/companyhub/companyhub.goindex e6fca68f2..f1945be52 100644--- a/pkg/detectors/companyhub/companyhub.go+++ b/pkg/detectors/companyhub/companyhub.go@@ -66,7 +66,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/confluent/confluent.go b/pkg/detectors/confluent/confluent.goindex 530e3c4f3..ae4157ef7 100644--- a/pkg/detectors/confluent/confluent.go+++ b/pkg/detectors/confluent/confluent.go@@ -68,7 +68,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go b/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.goindex 30525dafb..8926787a0 100644--- a/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go+++ b/pkg/detectors/contentfulpersonalaccesstoken/contentfulpersonalaccesstoken.go@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", keyRes))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/conversiontools/conversiontools.go b/pkg/detectors/conversiontools/conversiontools.goindex b0f9656c6..d6393e185 100644--- a/pkg/detectors/conversiontools/conversiontools.go+++ b/pkg/detectors/conversiontools/conversiontools.go@@ -56,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/convertapi/convertapi.go b/pkg/detectors/convertapi/convertapi.goindex b70e2c90e..0430c171e 100644--- a/pkg/detectors/convertapi/convertapi.go+++ b/pkg/detectors/convertapi/convertapi.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/convertkit/convertkit.go b/pkg/detectors/convertkit/convertkit.goindex cc23ebfab..122baa87c 100644--- a/pkg/detectors/convertkit/convertkit.go+++ b/pkg/detectors/convertkit/convertkit.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/convier/convier.go b/pkg/detectors/convier/convier.goindex ac890a525..9fcf405ba 100644--- a/pkg/detectors/convier/convier.go+++ b/pkg/detectors/convier/convier.go@@ -64,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `"error":false`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/countrylayer/countrylayer.go b/pkg/detectors/countrylayer/countrylayer.goindex 245841d59..400237f03 100644--- a/pkg/detectors/countrylayer/countrylayer.go+++ b/pkg/detectors/countrylayer/countrylayer.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/courier/courier.go b/pkg/detectors/courier/courier.goindex 8ca8f52f7..2afa8b9bd 100644--- a/pkg/detectors/courier/courier.go+++ b/pkg/detectors/courier/courier.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/coveralls/coveralls.go b/pkg/detectors/coveralls/coveralls.goindex 2e6d4f1ef..43f733040 100644--- a/pkg/detectors/coveralls/coveralls.go+++ b/pkg/detectors/coveralls/coveralls.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("token %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/craftmypdf/craftmypdf.go b/pkg/detectors/craftmypdf/craftmypdf.goindex b4933bc89..afb26da9f 100644--- a/pkg/detectors/craftmypdf/craftmypdf.go+++ b/pkg/detectors/craftmypdf/craftmypdf.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-API-KEY", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/crowdin/crowdin.go b/pkg/detectors/crowdin/crowdin.goindex 670f17705..8944bf6d7 100644--- a/pkg/detectors/crowdin/crowdin.go+++ b/pkg/detectors/crowdin/crowdin.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/cryptocompare/cryptocompare.go b/pkg/detectors/cryptocompare/cryptocompare.goindex f8a5133dc..782628ce6 100644--- a/pkg/detectors/cryptocompare/cryptocompare.go+++ b/pkg/detectors/cryptocompare/cryptocompare.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}bodyString := string(bodyBytes)errCode := strings.Contains(bodyString, `"Response":"Success"`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if errCode {s1.Verified = truediff --git a/pkg/detectors/currencycloud/currencycloud.go b/pkg/detectors/currencycloud/currencycloud.goindex 77e89fd42..9c3f90a59 100644--- a/pkg/detectors/currencycloud/currencycloud.go+++ b/pkg/detectors/currencycloud/currencycloud.go@@ -67,7 +67,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/currencyfreaks/currencyfreaks.go b/pkg/detectors/currencyfreaks/currencyfreaks.goindex f7f782d6e..c82272e28 100644--- a/pkg/detectors/currencyfreaks/currencyfreaks.go+++ b/pkg/detectors/currencyfreaks/currencyfreaks.go@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/currencylayer/currencylayer.go b/pkg/detectors/currencylayer/currencylayer.goindex d4e230783..ede023918 100644--- a/pkg/detectors/currencylayer/currencylayer.go+++ b/pkg/detectors/currencylayer/currencylayer.go@@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err2 == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `"success": true`) || strings.Contains(bodyString, `"info":"Access Restricted - Your current Subscription Plan does not support HTTPS Encryption."`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/currencyscoop/currencyscoop.go b/pkg/detectors/currencyscoop/currencyscoop.goindex 2808a4c2d..a9c511a52 100644--- a/pkg/detectors/currencyscoop/currencyscoop.go+++ b/pkg/detectors/currencyscoop/currencyscoop.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/customerguru/customerguru.go b/pkg/detectors/customerguru/customerguru.goindex c235ea817..e82873834 100644--- a/pkg/detectors/customerguru/customerguru.go+++ b/pkg/detectors/customerguru/customerguru.go@@ -64,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/customerio/customerio.go b/pkg/detectors/customerio/customerio.goindex cc600eb0e..c1dea10b1 100644--- a/pkg/detectors/customerio/customerio.go+++ b/pkg/detectors/customerio/customerio.go@@ -70,7 +70,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/d7network/d7network.go b/pkg/detectors/d7network/d7network.goindex 14b17d79b..36f107de9 100644--- a/pkg/detectors/d7network/d7network.go+++ b/pkg/detectors/d7network/d7network.go@@ -50,7 +50,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", "Basic "+resMatch)res, err := detectors.DetectorHttpClientWithNoLocalAddresses.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/dailyco/dailyco.go b/pkg/detectors/dailyco/dailyco.goindex 1eae0ff5f..0c77fcae5 100644--- a/pkg/detectors/dailyco/dailyco.go+++ b/pkg/detectors/dailyco/dailyco.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/dandelion/dandelion.go b/pkg/detectors/dandelion/dandelion.goindex 6f1d83dc9..a498cafc6 100644--- a/pkg/detectors/dandelion/dandelion.go+++ b/pkg/detectors/dandelion/dandelion.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/dareboost/dareboost.go b/pkg/detectors/dareboost/dareboost.goindex 2dcc5128f..049297aed 100644--- a/pkg/detectors/dareboost/dareboost.go+++ b/pkg/detectors/dareboost/dareboost.go@@ -64,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultbodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `"status":200`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/databox/databox.go b/pkg/detectors/databox/databox.goindex a2c4e2e3d..5a11384dd 100644--- a/pkg/detectors/databox/databox.go+++ b/pkg/detectors/databox/databox.go@@ -67,7 +67,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := detectors.DoWithDedup(client, detector_typepb.DetectorType_Databox, resMatch, req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/datadogtoken/datadogtoken.go b/pkg/detectors/datadogtoken/datadogtoken.goindex 42922941e..c74446612 100644--- a/pkg/detectors/datadogtoken/datadogtoken.go+++ b/pkg/detectors/datadogtoken/datadogtoken.go@@ -140,7 +140,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("DD-APPLICATION-KEY", resAppMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = trues1.SecretParts["endpoint"] = baseURLdiff --git a/pkg/detectors/datagov/datagov.go b/pkg/detectors/datagov/datagov.goindex a5cb91f89..8fe15d5ad 100644--- a/pkg/detectors/datagov/datagov.go+++ b/pkg/detectors/datagov/datagov.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/debounce/debounce.go b/pkg/detectors/debounce/debounce.goindex a2a535020..12781f3e5 100644--- a/pkg/detectors/debounce/debounce.go+++ b/pkg/detectors/debounce/debounce.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/deepai/deepai.go b/pkg/detectors/deepai/deepai.goindex 686bd07bf..befc7e701 100644--- a/pkg/detectors/deepai/deepai.go+++ b/pkg/detectors/deepai/deepai.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err != nil {continue}- writer.Close()+ _ = writer.Close()req, err := http.NewRequestWithContext(ctx, "POST", "https://api.deepai.org/api/text-tagging", bytes.NewReader(body.Bytes()))if err != nil {continue@@ -68,7 +68,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("api-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/deepgram/deepgram.go b/pkg/detectors/deepgram/deepgram.goindex 18e41438e..92991cf73 100644--- a/pkg/detectors/deepgram/deepgram.go+++ b/pkg/detectors/deepgram/deepgram.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/delighted/delighted.go b/pkg/detectors/delighted/delighted.goindex fe8f42998..748ec5e81 100644--- a/pkg/detectors/delighted/delighted.go+++ b/pkg/detectors/delighted/delighted.go@@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/demio/demio.go b/pkg/detectors/demio/demio.goindex a94921fc8..b1ef8ffe7 100644--- a/pkg/detectors/demio/demio.go+++ b/pkg/detectors/demio/demio.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/deno/denodeploy.go b/pkg/detectors/deno/denodeploy.goindex 838fd3942..c0cc4a822 100644--- a/pkg/detectors/deno/denodeploy.go+++ b/pkg/detectors/deno/denodeploy.go@@ -65,8 +65,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()- if res.StatusCode == 200 {+ defer func() { _ = res.Body.Close() }()+ switch res.StatusCode {+ case 200:s1.Verified = truebody, err := io.ReadAll(res.Body)@@ -82,9 +83,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}}}- } else if res.StatusCode == 401 {+ case 401:// The secret is determinately not verified (nothing to do)- } else {+ default:err = fmt.Errorf("unexpected HTTP response status %d", res.StatusCode)s1.SetVerificationError(err, token)}diff --git a/pkg/detectors/deputy/deputy.go b/pkg/detectors/deputy/deputy.goindex 10e1fa4f9..1d27b4a12 100644--- a/pkg/detectors/deputy/deputy.go+++ b/pkg/detectors/deputy/deputy.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("OAuth %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/detectify/detectify.go b/pkg/detectors/detectify/detectify.goindex 82484c723..ba9c02530 100644--- a/pkg/detectors/detectify/detectify.go+++ b/pkg/detectors/detectify/detectify.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Detectify-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/detectlanguage/detectlanguage.go b/pkg/detectors/detectlanguage/detectlanguage.goindex 55fefb6de..10a04f91e 100644--- a/pkg/detectors/detectlanguage/detectlanguage.go+++ b/pkg/detectors/detectlanguage/detectlanguage.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/dfuse/dfuse.go b/pkg/detectors/dfuse/dfuse.goindex c57bcc3f9..408b35fb8 100644--- a/pkg/detectors/dfuse/dfuse.go+++ b/pkg/detectors/dfuse/dfuse.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/diffbot/diffbot.go b/pkg/detectors/diffbot/diffbot.goindex 0b5385a08..63f77d4a6 100644--- a/pkg/detectors/diffbot/diffbot.go+++ b/pkg/detectors/diffbot/diffbot.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `"token":`) && strings.Contains(bodyString, `"planCredits":`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/diggernaut/diggernaut.go b/pkg/detectors/diggernaut/diggernaut.goindex 13754ce1c..4d28aadad 100644--- a/pkg/detectors/diggernaut/diggernaut.go+++ b/pkg/detectors/diggernaut/diggernaut.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/digitaloceantoken/digitaloceantoken.go b/pkg/detectors/digitaloceantoken/digitaloceantoken.goindex 4506d43d1..43bace232 100644--- a/pkg/detectors/digitaloceantoken/digitaloceantoken.go+++ b/pkg/detectors/digitaloceantoken/digitaloceantoken.go@@ -75,7 +75,7 @@ func verifyDigitalOceanToken(ctx context.Context, client *http.Client, token strif err != nil {return false, fmt.Errorf("failed to make request: %w", err)}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()switch resp.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/digitaloceanv2/digitaloceanv2.go b/pkg/detectors/digitaloceanv2/digitaloceanv2.goindex fbd7bbae3..215c41902 100644--- a/pkg/detectors/digitaloceanv2/digitaloceanv2.go+++ b/pkg/detectors/digitaloceanv2/digitaloceanv2.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result// Check if the token is a refresh token or an access tokenswitch {case strings.HasPrefix(token, "dor_v1_"):- verified, verificationErr, newAccessToken := verifyRefreshToken(ctx, client, token)+ verified, newAccessToken, verificationErr := verifyRefreshToken(ctx, client, token)s1.SetVerificationError(verificationErr)s1.Verified = verifiedif s1.Verified {@@ -84,42 +84,42 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result// If the token is valid, it returns the new access token and no error.// If the token is invalid/expired, it returns an empty string and no error.// If an error is encountered, it returns an empty string along and the error.-func verifyRefreshToken(ctx context.Context, client *http.Client, token string) (bool, error, string) {+func verifyRefreshToken(ctx context.Context, client *http.Client, token string) (bool, string, error) {// Ref: https://docs.digitalocean.com/reference/api/oauth/url := "https://cloud.digitalocean.com/v1/oauth/token?grant_type=refresh_token&refresh_token=" + tokenreq, err := http.NewRequestWithContext(ctx, http.MethodPost, url, nil)if err != nil {- return false, fmt.Errorf("failed to create request: %w", err), ""+ return false, "", fmt.Errorf("failed to create request: %w", err)}res, err := client.Do(req)if err != nil {- return false, fmt.Errorf("failed to make request: %w", err), ""+ return false, "", fmt.Errorf("failed to make request: %w", err)}bodyBytes, err := io.ReadAll(res.Body)if err != nil {- return false, fmt.Errorf("failed to read response body: %w", err), ""+ return false, "", fmt.Errorf("failed to read response body: %w", err)}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK:var responseMap map[string]interface{}if err := json.Unmarshal(bodyBytes, &responseMap); err != nil {- return false, fmt.Errorf("failed to parse response body: %w", err), ""+ return false, "", fmt.Errorf("failed to parse response body: %w", err)}// Extract the access token from the responseaccessToken, exists := responseMap["access_token"].(string)if !exists {- return false, fmt.Errorf("access_token not found in response: %s", string(bodyBytes)), ""+ return false, "", fmt.Errorf("access_token not found in response: %s", string(bodyBytes))}- return true, nil, accessToken+ return true, accessToken, nilcase http.StatusUnauthorized:- return false, nil, ""+ return false, "", nildefault:- return false, fmt.Errorf("unexpected status code: %d", res.StatusCode), ""+ return false, "", fmt.Errorf("unexpected status code: %d", res.StatusCode)}}@@ -141,7 +141,7 @@ func verifyAccessToken(ctx context.Context, client *http.Client, token string) (if err != nil {return false, fmt.Errorf("failed to make request: %w", err)}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/discordbottoken/discordbottoken.go b/pkg/detectors/discordbottoken/discordbottoken.goindex e1b0d3360..432b8dc8e 100644--- a/pkg/detectors/discordbottoken/discordbottoken.go+++ b/pkg/detectors/discordbottoken/discordbottoken.go@@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bot %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/discordwebhook/discordwebhook.go b/pkg/detectors/discordwebhook/discordwebhook.goindex 6fb040c04..97e177543 100644--- a/pkg/detectors/discordwebhook/discordwebhook.go+++ b/pkg/detectors/discordwebhook/discordwebhook.go@@ -48,7 +48,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/disqus/disqus.go b/pkg/detectors/disqus/disqus.goindex 119bfd1c3..7d304b1cf 100644--- a/pkg/detectors/disqus/disqus.go+++ b/pkg/detectors/disqus/disqus.go@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/ditto/ditto.go b/pkg/detectors/ditto/ditto.goindex 1655eaee6..47e589fa2 100644--- a/pkg/detectors/ditto/ditto.go+++ b/pkg/detectors/ditto/ditto.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("token %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/dnscheck/dnscheck.go b/pkg/detectors/dnscheck/dnscheck.goindex 8c87fbf67..117691427 100644--- a/pkg/detectors/dnscheck/dnscheck.go+++ b/pkg/detectors/dnscheck/dnscheck.go@@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/dockerhub/v1/dockerhub.go b/pkg/detectors/dockerhub/v1/dockerhub.goindex b05f45b4d..2062cae0c 100644--- a/pkg/detectors/dockerhub/v1/dockerhub.go+++ b/pkg/detectors/dockerhub/v1/dockerhub.go@@ -113,13 +113,14 @@ func (s Scanner) verifyMatch(ctx context.Context, username string, password striif err != nil {return false, nil, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()body, err := io.ReadAll(res.Body)if err != nil {return false, nil, err}- if res.StatusCode == http.StatusOK {+ switch res.StatusCode {+ case http.StatusOK:var tokenRes tokenResponseif err := json.Unmarshal(body, &tokenRes); (err != nil || tokenRes == tokenResponse{}) {return false, nil, err@@ -140,7 +141,7 @@ func (s Scanner) verifyMatch(ctx context.Context, username string, password strireturn true, extraData, nil}return true, nil, nil- } else if res.StatusCode == http.StatusUnauthorized {+ case http.StatusUnauthorized:// Valid credentials can still return a 401 status code if 2FA is enabledvar mfaRes mfaRequiredResponseif err := json.Unmarshal(body, &mfaRes); err != nil || mfaRes.MfaToken == "" {@@ -152,7 +153,7 @@ func (s Scanner) verifyMatch(ctx context.Context, username string, password stri"2fa_required": "true",}return true, extraData, nil- } else {+ default:return false, nil, fmt.Errorf("unexpected response status %d", res.StatusCode)}}diff --git a/pkg/detectors/dockerhub/v2/dockerhub.go b/pkg/detectors/dockerhub/v2/dockerhub.goindex 19a7ec386..a29867644 100644--- a/pkg/detectors/dockerhub/v2/dockerhub.go+++ b/pkg/detectors/dockerhub/v2/dockerhub.go@@ -113,13 +113,14 @@ func (s Scanner) verifyMatch(ctx context.Context, username string, password striif err != nil {return false, nil, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()body, err := io.ReadAll(res.Body)if err != nil {return false, nil, err}- if res.StatusCode == http.StatusOK {+ switch res.StatusCode {+ case http.StatusOK:var tokenRes tokenResponseif err := json.Unmarshal(body, &tokenRes); (err != nil || tokenRes == tokenResponse{}) {return false, nil, err@@ -140,7 +141,7 @@ func (s Scanner) verifyMatch(ctx context.Context, username string, password strireturn true, extraData, nil}return true, nil, nil- } else if res.StatusCode == http.StatusUnauthorized {+ case http.StatusUnauthorized:// Valid credentials can still return a 401 status code if 2FA is enabledvar mfaRes mfaRequiredResponseif err := json.Unmarshal(body, &mfaRes); err != nil || mfaRes.MfaToken == "" {@@ -152,7 +153,7 @@ func (s Scanner) verifyMatch(ctx context.Context, username string, password stri"2fa_required": "true",}return true, extraData, nil- } else {+ default:return false, nil, fmt.Errorf("unexpected response status %d", res.StatusCode)}}diff --git a/pkg/detectors/docparser/docparser.go b/pkg/detectors/docparser/docparser.goindex f8b1bc825..01a98131b 100644--- a/pkg/detectors/docparser/docparser.go+++ b/pkg/detectors/docparser/docparser.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/documo/documo.go b/pkg/detectors/documo/documo.goindex 461836511..8a2dab351 100644--- a/pkg/detectors/documo/documo.go+++ b/pkg/detectors/documo/documo.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/docusign/docusign.go b/pkg/detectors/docusign/docusign.goindex aacd1e061..dc5715738 100644--- a/pkg/detectors/docusign/docusign.go+++ b/pkg/detectors/docusign/docusign.go@@ -83,7 +83,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}verifiedBodyResponse, err := common.ResponseContainsSubstring(res.Body, "ey")- res.Body.Close()+ _ = res.Body.Close()if err != nil {return nil, errdiff --git a/pkg/detectors/doppler/doppler.go b/pkg/detectors/doppler/doppler.goindex d711d846a..32e240e70 100644--- a/pkg/detectors/doppler/doppler.go+++ b/pkg/detectors/doppler/doppler.go@@ -73,7 +73,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = truevar r responsediff --git a/pkg/detectors/dronahq/dronahq.go b/pkg/detectors/dronahq/dronahq.goindex 83d24f63d..63166205e 100644--- a/pkg/detectors/dronahq/dronahq.go+++ b/pkg/detectors/dronahq/dronahq.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/droneci/droneci.go b/pkg/detectors/droneci/droneci.goindex e16609ad4..7bc3e6df7 100644--- a/pkg/detectors/droneci/droneci.go+++ b/pkg/detectors/droneci/droneci.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/duply/duply.go b/pkg/detectors/duply/duply.goindex 03a1574cd..c83d4a34b 100644--- a/pkg/detectors/duply/duply.go+++ b/pkg/detectors/duply/duply.go@@ -65,7 +65,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/dynalist/dynalist.go b/pkg/detectors/dynalist/dynalist.goindex 21d69765c..c734571f2 100644--- a/pkg/detectors/dynalist/dynalist.go+++ b/pkg/detectors/dynalist/dynalist.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `"_code":"Ok"`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/dyspatch/dyspatch.go b/pkg/detectors/dyspatch/dyspatch.goindex f4772b3d4..974f4e9ca 100644--- a/pkg/detectors/dyspatch/dyspatch.go+++ b/pkg/detectors/dyspatch/dyspatch.go@@ -56,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go b/pkg/detectors/eagleeyenetworks/eagleeyenetworks.goindex af48b0415..6e4d600d6 100644--- a/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go+++ b/pkg/detectors/eagleeyenetworks/eagleeyenetworks.go@@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/ecostruxureit/ecostruxureit.go b/pkg/detectors/ecostruxureit/ecostruxureit.goindex 24e143ce0..f70caa4e8 100644--- a/pkg/detectors/ecostruxureit/ecostruxureit.go+++ b/pkg/detectors/ecostruxureit/ecostruxureit.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/edamam/edamam.go b/pkg/detectors/edamam/edamam.goindex afb6edceb..77563cc2a 100644--- a/pkg/detectors/edamam/edamam.go+++ b/pkg/detectors/edamam/edamam.go@@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/edenai/edenai.go b/pkg/detectors/edenai/edenai.goindex d43d83ac0..16c563dc0 100644--- a/pkg/detectors/edenai/edenai.go+++ b/pkg/detectors/edenai/edenai.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/eightxeight/eightxeight.go b/pkg/detectors/eightxeight/eightxeight.goindex 6543a86e2..7df28a91a 100644--- a/pkg/detectors/eightxeight/eightxeight.go+++ b/pkg/detectors/eightxeight/eightxeight.go@@ -71,7 +71,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/elasticemail/elasticemail.go b/pkg/detectors/elasticemail/elasticemail.goindex d49470b4f..0225a8431 100644--- a/pkg/detectors/elasticemail/elasticemail.go+++ b/pkg/detectors/elasticemail/elasticemail.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {data, readErr := io.ReadAll(res.Body)- res.Body.Close()+ _ = res.Body.Close()if readErr == nil {var ResVar struct {Success bool `json:"success"`diff --git a/pkg/detectors/enablex/enablex.go b/pkg/detectors/enablex/enablex.goindex 2fbf690c9..ca1e0c9c6 100644--- a/pkg/detectors/enablex/enablex.go+++ b/pkg/detectors/enablex/enablex.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(userPatMatch, tokenPatMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/enigma/enigma.go b/pkg/detectors/enigma/enigma.goindex 18df615e0..df6f175d7 100644--- a/pkg/detectors/enigma/enigma.go+++ b/pkg/detectors/enigma/enigma.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-api-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/envoyapikey/envoyapikey.go b/pkg/detectors/envoyapikey/envoyapikey.goindex 5ef0d8203..153c4f011 100644--- a/pkg/detectors/envoyapikey/envoyapikey.go+++ b/pkg/detectors/envoyapikey/envoyapikey.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Api-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()body, _ := io.ReadAll(res.Body)// Invalid API keys can also return status code 200, so check for presence of 'status 401' in response body.diff --git a/pkg/detectors/etherscan/etherscan.go b/pkg/detectors/etherscan/etherscan.goindex e46d2d99f..c519f486e 100644--- a/pkg/detectors/etherscan/etherscan.go+++ b/pkg/detectors/etherscan/etherscan.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/ethplorer/ethplorer.go b/pkg/detectors/ethplorer/ethplorer.goindex b113206a2..08ce6327e 100644--- a/pkg/detectors/ethplorer/ethplorer.go+++ b/pkg/detectors/ethplorer/ethplorer.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/x-www-form-urlencoded")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/everhour/everhour.go b/pkg/detectors/everhour/everhour.goindex c04ddb966..a2583ef0d 100644--- a/pkg/detectors/everhour/everhour.go+++ b/pkg/detectors/everhour/everhour.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Api-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/exchangeratesapi/exchangeratesapi.go b/pkg/detectors/exchangeratesapi/exchangeratesapi.goindex 20c600312..88f65b2d0 100644--- a/pkg/detectors/exchangeratesapi/exchangeratesapi.go+++ b/pkg/detectors/exchangeratesapi/exchangeratesapi.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/exportsdk/exportsdk.go b/pkg/detectors/exportsdk/exportsdk.goindex aaf81e8e5..81590080c 100644--- a/pkg/detectors/exportsdk/exportsdk.go+++ b/pkg/detectors/exportsdk/exportsdk.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-API-KEY", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/extractorapi/extractorapi.go b/pkg/detectors/extractorapi/extractorapi.goindex 6bd17a1e2..4ad6ee34c 100644--- a/pkg/detectors/extractorapi/extractorapi.go+++ b/pkg/detectors/extractorapi/extractorapi.go@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/facebookoauth/facebookoauth.go b/pkg/detectors/facebookoauth/facebookoauth.goindex 1793b59be..e81b0c7f7 100644--- a/pkg/detectors/facebookoauth/facebookoauth.go+++ b/pkg/detectors/facebookoauth/facebookoauth.go@@ -67,7 +67,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/faceplusplus/faceplusplus.go b/pkg/detectors/faceplusplus/faceplusplus.goindex 4a771336a..c9f1ea805 100644--- a/pkg/detectors/faceplusplus/faceplusplus.go+++ b/pkg/detectors/faceplusplus/faceplusplus.go@@ -64,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/fastforex/fastforex.go b/pkg/detectors/fastforex/fastforex.goindex 88ebaf8ae..2d7271d4e 100644--- a/pkg/detectors/fastforex/fastforex.go+++ b/pkg/detectors/fastforex/fastforex.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/feedier/feedier.go b/pkg/detectors/feedier/feedier.goindex 3c066449f..c1a5939ec 100644--- a/pkg/detectors/feedier/feedier.go+++ b/pkg/detectors/feedier/feedier.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/figmapersonalaccesstoken/v1/figmapersonalaccesstoken.go b/pkg/detectors/figmapersonalaccesstoken/v1/figmapersonalaccesstoken.goindex d8d6d6932..3d01872cc 100644--- a/pkg/detectors/figmapersonalaccesstoken/v1/figmapersonalaccesstoken.go+++ b/pkg/detectors/figmapersonalaccesstoken/v1/figmapersonalaccesstoken.go@@ -66,7 +66,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Figma-Token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode != 403 {diff --git a/pkg/detectors/figmapersonalaccesstoken/v2/figmapersonalaccesstoken_v2.go b/pkg/detectors/figmapersonalaccesstoken/v2/figmapersonalaccesstoken_v2.goindex 75d8ce62b..5dc5ba4ff 100644--- a/pkg/detectors/figmapersonalaccesstoken/v2/figmapersonalaccesstoken_v2.go+++ b/pkg/detectors/figmapersonalaccesstoken/v2/figmapersonalaccesstoken_v2.go@@ -70,7 +70,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Figma-Token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode != 403 {diff --git a/pkg/detectors/fileio/fileio.go b/pkg/detectors/fileio/fileio.goindex 8b6ec9c86..4dcb0e887 100644--- a/pkg/detectors/fileio/fileio.go+++ b/pkg/detectors/fileio/fileio.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultbodyBytes, err := io.ReadAll(res.Body)if err == nil {isJson := json.Valid(bodyBytes)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if isJson {s1.Verified = truediff --git a/pkg/detectors/finage/finage.go b/pkg/detectors/finage/finage.goindex 27b5a1038..a4251d0d4 100644--- a/pkg/detectors/finage/finage.go+++ b/pkg/detectors/finage/finage.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := detectors.DoWithDedup(client, detector_typepb.DetectorType_Finage, resMatch, req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/financialmodelingprep/financialmodelingprep.go b/pkg/detectors/financialmodelingprep/financialmodelingprep.goindex e0309dcd9..b350d5459 100644--- a/pkg/detectors/financialmodelingprep/financialmodelingprep.go+++ b/pkg/detectors/financialmodelingprep/financialmodelingprep.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result// error response is in jsonvalidResponse := strings.Contains(bodyString, `[ "`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/findl/findl.go b/pkg/detectors/findl/findl.goindex 657b5e09f..c77f6085b 100644--- a/pkg/detectors/findl/findl.go+++ b/pkg/detectors/findl/findl.go@@ -56,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-API-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/finnhub/finnhub.go b/pkg/detectors/finnhub/finnhub.goindex a8014d7db..85c531d50 100644--- a/pkg/detectors/finnhub/finnhub.go+++ b/pkg/detectors/finnhub/finnhub.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/fixerio/fixerio.go b/pkg/detectors/fixerio/fixerio.goindex d499c6d0a..26e1d7853 100644--- a/pkg/detectors/fixerio/fixerio.go+++ b/pkg/detectors/fixerio/fixerio.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continue@@ -66,7 +66,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result// ingenious!validResponse := strings.Contains(body, `"success": true`) || strings.Contains(body, `"info":"Access Restricted - Your current Subscription Plan does not support HTTPS Encryption."`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 && validResponse {s1.Verified = truediff --git a/pkg/detectors/flatio/flatio.go b/pkg/detectors/flatio/flatio.goindex 7af1ce365..2d215d758 100644--- a/pkg/detectors/flatio/flatio.go+++ b/pkg/detectors/flatio/flatio.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/fleetbase/fleetbase.go b/pkg/detectors/fleetbase/fleetbase.goindex a00efc3d1..12c035230 100644--- a/pkg/detectors/fleetbase/fleetbase.go+++ b/pkg/detectors/fleetbase/fleetbase.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/flickr/flickr.go b/pkg/detectors/flickr/flickr.goindex f01c00892..da8592c5e 100644--- a/pkg/detectors/flickr/flickr.go+++ b/pkg/detectors/flickr/flickr.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/flightapi/flightapi.go b/pkg/detectors/flightapi/flightapi.goindex 2d480caf7..67d1fc6b6 100644--- a/pkg/detectors/flightapi/flightapi.go+++ b/pkg/detectors/flightapi/flightapi.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/flightstats/flightstats.go b/pkg/detectors/flightstats/flightstats.goindex b2aace0b2..5a5e6fe0e 100644--- a/pkg/detectors/flightstats/flightstats.go+++ b/pkg/detectors/flightstats/flightstats.go@@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/float/float.go b/pkg/detectors/float/float.goindex 186825f6c..28da924c4 100644--- a/pkg/detectors/float/float.go+++ b/pkg/detectors/float/float.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("User-Agent", "TruffleHog3 ([email protected])")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/flowflu/flowflu.go b/pkg/detectors/flowflu/flowflu.goindex 95acf15e3..e0cc5cc4e 100644--- a/pkg/detectors/flowflu/flowflu.go+++ b/pkg/detectors/flowflu/flowflu.go@@ -70,7 +70,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultbodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `total_result`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/flutterwave/flutterwave.go b/pkg/detectors/flutterwave/flutterwave.goindex 5f5bf3d34..19a8cf798 100644--- a/pkg/detectors/flutterwave/flutterwave.go+++ b/pkg/detectors/flutterwave/flutterwave.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/fmfw/fmfw.go b/pkg/detectors/fmfw/fmfw.goindex 92266ba39..7b85d371f 100644--- a/pkg/detectors/fmfw/fmfw.go+++ b/pkg/detectors/fmfw/fmfw.go@@ -64,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(userPatMatch, tokenPatMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/formbucket/formbucket.go b/pkg/detectors/formbucket/formbucket.goindex 3f7cd8942..76441a2ce 100644--- a/pkg/detectors/formbucket/formbucket.go+++ b/pkg/detectors/formbucket/formbucket.go@@ -56,14 +56,14 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()body, errBody := io.ReadAll(res.Body)if errBody != nil {continue}bodyString := string(body)validResponse := strings.Contains(bodyString, `created_on`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if errBody == nil {if res.StatusCode >= 200 && res.StatusCode < 300 && validResponse {s1.Verified = truediff --git a/pkg/detectors/formcraft/formcraft.go b/pkg/detectors/formcraft/formcraft.goindex 3590fa0ac..b1c9754ab 100644--- a/pkg/detectors/formcraft/formcraft.go+++ b/pkg/detectors/formcraft/formcraft.go@@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/formio/formio.go b/pkg/detectors/formio/formio.goindex 53f3088a3..3c13423c2 100644--- a/pkg/detectors/formio/formio.go+++ b/pkg/detectors/formio/formio.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-jwt-token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/formsite/formsite.go b/pkg/detectors/formsite/formsite.goindex 2373d4839..dc0e19e75 100644--- a/pkg/detectors/formsite/formsite.go+++ b/pkg/detectors/formsite/formsite.go@@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/foursquare/foursquare.go b/pkg/detectors/foursquare/foursquare.goindex c42a862cd..979bbd63a 100644--- a/pkg/detectors/foursquare/foursquare.go+++ b/pkg/detectors/foursquare/foursquare.go@@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/frameio/frameio.go b/pkg/detectors/frameio/frameio.goindex a6f869019..52e23dae6 100644--- a/pkg/detectors/frameio/frameio.go+++ b/pkg/detectors/frameio/frameio.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/freshbooks/freshbooks.go b/pkg/detectors/freshbooks/freshbooks.goindex d3c2385f2..c6b8c3d45 100644--- a/pkg/detectors/freshbooks/freshbooks.go+++ b/pkg/detectors/freshbooks/freshbooks.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/freshdesk/freshdesk.go b/pkg/detectors/freshdesk/freshdesk.goindex 0631aeda4..9b4a66ee6 100644--- a/pkg/detectors/freshdesk/freshdesk.go+++ b/pkg/detectors/freshdesk/freshdesk.go@@ -64,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/front/front.go b/pkg/detectors/front/front.goindex e6a50b0f9..060c221df 100644--- a/pkg/detectors/front/front.go+++ b/pkg/detectors/front/front.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/ftp/ftp.go b/pkg/detectors/ftp/ftp.goindex 16ad41dcc..db757b35e 100644--- a/pkg/detectors/ftp/ftp.go+++ b/pkg/detectors/ftp/ftp.go@@ -70,7 +70,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultrawURL, _ := url.Parse(urlMatch)rawURL.Path = ""- redact := strings.TrimSpace(strings.Replace(rawURL.String(), password, "********", -1))+ redact := strings.TrimSpace(strings.ReplaceAll(rawURL.String(), password, "********"))s1 := detectors.Result{DetectorType: detector_typepb.DetectorType_FTP,@@ -139,7 +139,7 @@ func verifyFTP(timeout time.Duration, u *url.URL) error {return nil, err}if err := conn.SetDeadline(time.Now().Add(timeout)); err != nil {- conn.Close()+ _ = conn.Close()return nil, err}return conn, nildiff --git a/pkg/detectors/fulcrum/fulcrum.go b/pkg/detectors/fulcrum/fulcrum.goindex 57113c605..065eb7ef7 100644--- a/pkg/detectors/fulcrum/fulcrum.go+++ b/pkg/detectors/fulcrum/fulcrum.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-ApiToken", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/fullstory/v1/fullstory.go b/pkg/detectors/fullstory/v1/fullstory.goindex 15cdce5ea..e5de71e78 100644--- a/pkg/detectors/fullstory/v1/fullstory.go+++ b/pkg/detectors/fullstory/v1/fullstory.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/fullstory/v2/fullstory_v2.go b/pkg/detectors/fullstory/v2/fullstory_v2.goindex 1918ad6a3..aa719c70a 100644--- a/pkg/detectors/fullstory/v2/fullstory_v2.go+++ b/pkg/detectors/fullstory/v2/fullstory_v2.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/fxmarket/fxmarket.go b/pkg/detectors/fxmarket/fxmarket.goindex cbadf5bc4..f0e824cb2 100644--- a/pkg/detectors/fxmarket/fxmarket.go+++ b/pkg/detectors/fxmarket/fxmarket.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/gcp/gcp.go b/pkg/detectors/gcp/gcp.goindex dc911d80b..e7b8ee2f9 100644--- a/pkg/detectors/gcp/gcp.go+++ b/pkg/detectors/gcp/gcp.go@@ -212,7 +212,7 @@ func findMatchingCertificateKID(ctx context.Context, certsURL, privateKeyPEM str}// Compare RSA public keys- if publicKey.PublicKey.N.Cmp(certPublicKey.N) == 0 && publicKey.PublicKey.E == certPublicKey.E {+ if publicKey.N.Cmp(certPublicKey.N) == 0 && publicKey.E == certPublicKey.E {return kid, nil}}@@ -233,7 +233,7 @@ func fetchServiceAccountCerts(ctx context.Context, certsURL string) (map[string]if err != nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode < 200 || resp.StatusCode >= 300 {return nil, nildiff --git a/pkg/detectors/geckoboard/geckoboard.go b/pkg/detectors/geckoboard/geckoboard.goindex 4bd76c802..46e81f25f 100644--- a/pkg/detectors/geckoboard/geckoboard.go+++ b/pkg/detectors/geckoboard/geckoboard.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/gemini/gemini.go b/pkg/detectors/gemini/gemini.goindex 283723d5b..5fe1eac66 100644--- a/pkg/detectors/gemini/gemini.go+++ b/pkg/detectors/gemini/gemini.go@@ -77,7 +77,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/gengo/gengo.go b/pkg/detectors/gengo/gengo.goindex d1aa53b5c..7c74d9615 100644--- a/pkg/detectors/gengo/gengo.go+++ b/pkg/detectors/gengo/gengo.go@@ -77,7 +77,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Accept", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()body, errBody := io.ReadAll(res.Body)if errBody == nil {diff --git a/pkg/detectors/geoapify/geoapify.go b/pkg/detectors/geoapify/geoapify.goindex 09d6739e0..956cd9090 100644--- a/pkg/detectors/geoapify/geoapify.go+++ b/pkg/detectors/geoapify/geoapify.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/geocode/geocode.go b/pkg/detectors/geocode/geocode.goindex 265d595d5..c1a5a030b 100644--- a/pkg/detectors/geocode/geocode.go+++ b/pkg/detectors/geocode/geocode.go@@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `"remaining_credits" :`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/geocodify/geocodify.go b/pkg/detectors/geocodify/geocodify.goindex 9a592a76f..db3538895 100644--- a/pkg/detectors/geocodify/geocodify.go+++ b/pkg/detectors/geocodify/geocodify.go@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/geocodio/geocodio.go b/pkg/detectors/geocodio/geocodio.goindex c9ced6834..157d0b488 100644--- a/pkg/detectors/geocodio/geocodio.go+++ b/pkg/detectors/geocodio/geocodio.go@@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/geoipifi/geoipifi.go b/pkg/detectors/geoipifi/geoipifi.goindex 7547362ae..b03f6e132 100644--- a/pkg/detectors/geoipifi/geoipifi.go+++ b/pkg/detectors/geoipifi/geoipifi.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/getemail/getemail.go b/pkg/detectors/getemail/getemail.goindex deab794a3..6ddf51f35 100644--- a/pkg/detectors/getemail/getemail.go+++ b/pkg/detectors/getemail/getemail.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}bodyString := string(bodyBytes)errCode := strings.Contains(bodyString, `"code":"USER_NOT_EXIST"`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if errCode {s1.Verified = falsediff --git a/pkg/detectors/getemails/getemails.go b/pkg/detectors/getemails/getemails.goindex a509ff0f2..e049b45e2 100644--- a/pkg/detectors/getemails/getemails.go+++ b/pkg/detectors/getemails/getemails.go@@ -64,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/getgeoapi/getgeoapi.go b/pkg/detectors/getgeoapi/getgeoapi.goindex bff3e7c36..2a723b60f 100644--- a/pkg/detectors/getgeoapi/getgeoapi.go+++ b/pkg/detectors/getgeoapi/getgeoapi.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/getgist/getgist.go b/pkg/detectors/getgist/getgist.goindex 87fbb1343..2b88b53ad 100644--- a/pkg/detectors/getgist/getgist.go+++ b/pkg/detectors/getgist/getgist.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/getresponse/getresponse.go b/pkg/detectors/getresponse/getresponse.goindex 7b02af941..c89a7a21e 100644--- a/pkg/detectors/getresponse/getresponse.go+++ b/pkg/detectors/getresponse/getresponse.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Auth-Token", fmt.Sprintf("api-key %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/getsandbox/getsandbox.go b/pkg/detectors/getsandbox/getsandbox.goindex 248be740f..67157a530 100644--- a/pkg/detectors/getsandbox/getsandbox.go+++ b/pkg/detectors/getsandbox/getsandbox.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("API-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/github/v1/github_old.go b/pkg/detectors/github/v1/github_old.goindex f907b36f3..393c16553 100644--- a/pkg/detectors/github/v1/github_old.go+++ b/pkg/detectors/github/v1/github_old.go@@ -170,7 +170,7 @@ func (s Scanner) VerifyGithub(ctx context.Context, client *http.Client, token stif res.StatusCode >= 200 && res.StatusCode < 300 {var userResponse UserReserr = json.NewDecoder(res.Body).Decode(&userResponse)- res.Body.Close()+ _ = res.Body.Close()if err == nil {// GitHub does not seem to consistently return this header.scopes := res.Header.Get("X-OAuth-Scopes")diff --git a/pkg/detectors/githubapp/githubapp.go b/pkg/detectors/githubapp/githubapp.goindex 25f82b0b1..dd3b18403 100644--- a/pkg/detectors/githubapp/githubapp.go+++ b/pkg/detectors/githubapp/githubapp.go@@ -86,7 +86,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", tokenString))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/gitlab/v1/gitlab.go b/pkg/detectors/gitlab/v1/gitlab.goindex bae6e6631..d08cdb421 100644--- a/pkg/detectors/gitlab/v1/gitlab.go+++ b/pkg/detectors/gitlab/v1/gitlab.go@@ -132,7 +132,7 @@ func VerifyGitlab(ctx context.Context, client *http.Client, baseEndpoint, resMatreturn false, nil, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {diff --git a/pkg/detectors/gitter/gitter.go b/pkg/detectors/gitter/gitter.goindex ca047ecea..c167897d5 100644--- a/pkg/detectors/gitter/gitter.go+++ b/pkg/detectors/gitter/gitter.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := detectors.DoWithDedup(client, detector_typepb.DetectorType_Gitter, resMatch, req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/glassnode/glassnode.go b/pkg/detectors/glassnode/glassnode.goindex 4b08a50d4..0ca330818 100644--- a/pkg/detectors/glassnode/glassnode.go+++ b/pkg/detectors/glassnode/glassnode.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/gocanvas/gocanvas.go b/pkg/detectors/gocanvas/gocanvas.goindex 0fbfeb62c..f13168c70 100644--- a/pkg/detectors/gocanvas/gocanvas.go+++ b/pkg/detectors/gocanvas/gocanvas.go@@ -70,7 +70,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()body, errBody := io.ReadAll(res.Body)if errBody == nil {diff --git a/pkg/detectors/gocardless/gocardless.go b/pkg/detectors/gocardless/gocardless.goindex 8bc90a8eb..7edc19c19 100644--- a/pkg/detectors/gocardless/gocardless.go+++ b/pkg/detectors/gocardless/gocardless.go@@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("GoCardless-Version", "2015-07-06")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/goodday/goodday.go b/pkg/detectors/goodday/goodday.goindex 11aff376b..c41a8f8d0 100644--- a/pkg/detectors/goodday/goodday.go+++ b/pkg/detectors/goodday/goodday.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("gd-api-token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/googleoauth2/googleoauth2_access_token.go b/pkg/detectors/googleoauth2/googleoauth2_access_token.goindex 2939e7540..a7c1845b0 100644--- a/pkg/detectors/googleoauth2/googleoauth2_access_token.go+++ b/pkg/detectors/googleoauth2/googleoauth2_access_token.go@@ -88,7 +88,8 @@ func (s Scanner) verify(ctx context.Context, token string) (bool, map[string]str_, _ = io.Copy(io.Discard, res.Body)}()- if res.StatusCode == http.StatusOK {+ switch res.StatusCode {+ case http.StatusOK:var token tokenInfoif err := json.NewDecoder(res.Body).Decode(&token); err != nil {return false, nil, fmt.Errorf("failed to decode response: %w", err)@@ -106,7 +107,7 @@ func (s Scanner) verify(ctx context.Context, token string) (bool, map[string]strextraData["expires_at"] = time.Unix(exp, 0).String()}return true, extraData, nil- } else if res.StatusCode == http.StatusBadRequest {+ case http.StatusBadRequest:var errInfo errorInfoif err := json.NewDecoder(res.Body).Decode(&errInfo); err != nil {return false, nil, fmt.Errorf("failed to decode response: %w", err)@@ -118,7 +119,7 @@ func (s Scanner) verify(ctx context.Context, token string) (bool, map[string]str} else {return false, nil, fmt.Errorf("unexpected error description '%s' for %s", errInfo.Error, req.URL)}- } else {+ default:return false, nil, fmt.Errorf("unexpected response %d for %s", res.StatusCode, req.URL)}}diff --git a/pkg/detectors/grafanaserviceaccount/grafanaserviceaccount.go b/pkg/detectors/grafanaserviceaccount/grafanaserviceaccount.goindex a98e7b8fc..02fab0ed7 100644--- a/pkg/detectors/grafanaserviceaccount/grafanaserviceaccount.go+++ b/pkg/detectors/grafanaserviceaccount/grafanaserviceaccount.go@@ -68,7 +68,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", key))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/graphcms/graphcms.go b/pkg/detectors/graphcms/graphcms.goindex 73c843cf5..6c1e1ab01 100644--- a/pkg/detectors/graphcms/graphcms.go+++ b/pkg/detectors/graphcms/graphcms.go@@ -65,7 +65,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/graphhopper/graphhopper.go b/pkg/detectors/graphhopper/graphhopper.goindex 00a7022ae..a528a1b5e 100644--- a/pkg/detectors/graphhopper/graphhopper.go+++ b/pkg/detectors/graphhopper/graphhopper.go@@ -49,7 +49,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/groovehq/groovehq.go b/pkg/detectors/groovehq/groovehq.goindex bcb8ebb5a..141a61754 100644--- a/pkg/detectors/groovehq/groovehq.go+++ b/pkg/detectors/groovehq/groovehq.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/gtmetrix/gtmetrix.go b/pkg/detectors/gtmetrix/gtmetrix.goindex 6d989a72e..b61e6ae83 100644--- a/pkg/detectors/gtmetrix/gtmetrix.go+++ b/pkg/detectors/gtmetrix/gtmetrix.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(resMatch, "")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/guardianapi/guardianapi.go b/pkg/detectors/guardianapi/guardianapi.goindex 07ee12bd2..d7255d820 100644--- a/pkg/detectors/guardianapi/guardianapi.go+++ b/pkg/detectors/guardianapi/guardianapi.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/gumroad/gumroad.go b/pkg/detectors/gumroad/gumroad.goindex 86cc11361..6f77a49d2 100644--- a/pkg/detectors/gumroad/gumroad.go+++ b/pkg/detectors/gumroad/gumroad.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/x-www-form-urlencoded")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/guru/guru.go b/pkg/detectors/guru/guru.goindex b0e564f91..fd19de83c 100644--- a/pkg/detectors/guru/guru.go+++ b/pkg/detectors/guru/guru.go@@ -67,7 +67,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", encoded))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/gyazo/gyazo.go b/pkg/detectors/gyazo/gyazo.goindex 02cb9825d..6948b6a66 100644--- a/pkg/detectors/gyazo/gyazo.go+++ b/pkg/detectors/gyazo/gyazo.go@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/happyscribe/happyscribe.go b/pkg/detectors/happyscribe/happyscribe.goindex a86cefe9f..e210c5c79 100644--- a/pkg/detectors/happyscribe/happyscribe.go+++ b/pkg/detectors/happyscribe/happyscribe.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/harvest/harvest.go b/pkg/detectors/harvest/harvest.goindex 7f4aabc1e..7dc03bc7b 100644--- a/pkg/detectors/harvest/harvest.go+++ b/pkg/detectors/harvest/harvest.go@@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/hellosign/hellosign.go b/pkg/detectors/hellosign/hellosign.goindex 668ba59ad..92b15dbd7 100644--- a/pkg/detectors/hellosign/hellosign.go+++ b/pkg/detectors/hellosign/hellosign.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(resMatch, "")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/helpcrunch/helpcrunch.go b/pkg/detectors/helpcrunch/helpcrunch.goindex 4c2a0ae9f..cc4b18af9 100644--- a/pkg/detectors/helpcrunch/helpcrunch.go+++ b/pkg/detectors/helpcrunch/helpcrunch.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/helpscout/helpscout.go b/pkg/detectors/helpscout/helpscout.goindex b258c69fa..a9886a22c 100644--- a/pkg/detectors/helpscout/helpscout.go+++ b/pkg/detectors/helpscout/helpscout.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(resMatch, "X")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/hereapi/hereapi.go b/pkg/detectors/hereapi/hereapi.goindex 5e2decbbb..e0e2467c3 100644--- a/pkg/detectors/hereapi/hereapi.go+++ b/pkg/detectors/hereapi/hereapi.go@@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/hive/hive.go b/pkg/detectors/hive/hive.goindex fd959d5d7..b1bfdd10d 100644--- a/pkg/detectors/hive/hive.go+++ b/pkg/detectors/hive/hive.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/hiveage/hiveage.go b/pkg/detectors/hiveage/hiveage.goindex 00db0ad9b..390db1e61 100644--- a/pkg/detectors/hiveage/hiveage.go+++ b/pkg/detectors/hiveage/hiveage.go@@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", encoded))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/holidayapi/holidayapi.go b/pkg/detectors/holidayapi/holidayapi.goindex aa1405f25..7bb34952f 100644--- a/pkg/detectors/holidayapi/holidayapi.go+++ b/pkg/detectors/holidayapi/holidayapi.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := detectors.DoWithDedup(client, detector_typepb.DetectorType_HolidayAPI, resMatch, req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/holistic/holistic.go b/pkg/detectors/holistic/holistic.goindex 713e01362..e5157a7dd 100644--- a/pkg/detectors/holistic/holistic.go+++ b/pkg/detectors/holistic/holistic.go@@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultbodyString := string(bodyBytes)errorResponse := strings.Contains(bodyString, `"data":[]`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 && !errorResponse {s1.Verified = true}diff --git a/pkg/detectors/honeycomb/honeycomb.go b/pkg/detectors/honeycomb/honeycomb.goindex d9b8fe7c9..83145288e 100644--- a/pkg/detectors/honeycomb/honeycomb.go+++ b/pkg/detectors/honeycomb/honeycomb.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Honeycomb-Team", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/host/host.go b/pkg/detectors/host/host.goindex b95ef6713..4cc96d295 100644--- a/pkg/detectors/host/host.go+++ b/pkg/detectors/host/host.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/html2pdf/html2pdf.go b/pkg/detectors/html2pdf/html2pdf.goindex 43a33952e..c6f5146b2 100644--- a/pkg/detectors/html2pdf/html2pdf.go+++ b/pkg/detectors/html2pdf/html2pdf.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := http.Post("https://api.html2pdf.app/v1/generate", "application/json", reqBuf)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/http.go b/pkg/detectors/http.goindex 8624d8346..1a2ba817c 100644--- a/pkg/detectors/http.go+++ b/pkg/detectors/http.go@@ -226,7 +226,7 @@ func (t *singleflightTransport) RoundTrip(req *http.Request) (*http.Response, erif err != nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()body, err := io.ReadAll(resp.Body)if err != nil {diff --git a/pkg/detectors/http_test.go b/pkg/detectors/http_test.goindex 242151963..a2596785c 100644--- a/pkg/detectors/http_test.go+++ b/pkg/detectors/http_test.go@@ -63,7 +63,7 @@ func TestWithNoLocalIP(t *testing.T) {conn, err := transport.DialContext(context.Background(), "tcp", "google.com:80")assert.NoError(t, err)assert.NotNil(t, conn)- conn.Close()+ _ = conn.Close()})t.Run("Allows dialing non-local IP", func(t *testing.T) {@@ -76,7 +76,7 @@ func TestWithNoLocalIP(t *testing.T) {conn, err := transport.DialContext(context.Background(), "tcp", "1.1.1.1:80")assert.NoError(t, err)assert.NotNil(t, conn)- conn.Close()+ _ = conn.Close()})t.Run("Handles invalid address", func(t *testing.T) {@@ -114,7 +114,7 @@ func TestDoWithDedup_Singleflight(t *testing.T) {server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {n := atomic.AddInt32(&requestCount, 1)time.Sleep(20 * time.Millisecond)- fmt.Fprintf(w, `{"request":%d}`, n)+ _, _ = fmt.Fprintf(w, `{"request":%d}`, n)}))defer server.Close()@@ -140,7 +140,7 @@ func TestDoWithDedup_Singleflight(t *testing.T) {errs[i] = errreturn}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()var buf [512]byten, _ := resp.Body.Read(buf[:])bodies[i] = string(buf[:n])@@ -201,7 +201,7 @@ func TestDoWithDedup_WaiterContextCancelled(t *testing.T) {results[i] = result{err: err}return}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()results[i] = result{status: resp.StatusCode}}(i, ctx)}@@ -249,7 +249,7 @@ func TestDoWithDedup_FirstCallerContextCancelled(t *testing.T) {firstErr = errreturn}- resp.Body.Close()+ _ = resp.Body.Close()}()// Cancel the first caller once the server is processing, then immediately@@ -268,7 +268,7 @@ func TestDoWithDedup_FirstCallerContextCancelled(t *testing.T) {secondErr = errreturn}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()secondStatus = resp.StatusCode}()@@ -300,7 +300,7 @@ func TestDoWithDedup_DeadlinePreserved(t *testing.T) {start := time.Now()resp, err := DoWithDedup(client, detector_typepb.DetectorType_Meraki, "cred", req)if err == nil {- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}elapsed := time.Since(start)diff --git a/pkg/detectors/huggingface/huggingface.go b/pkg/detectors/huggingface/huggingface.goindex af6655d2b..c09c16432 100644--- a/pkg/detectors/huggingface/huggingface.go+++ b/pkg/detectors/huggingface/huggingface.go@@ -78,7 +78,7 @@ func (s Scanner) verifyResult(ctx context.Context, apiKey string) (bool, map[strreturn false, nil, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {whoamiRes := whoamiResponse{}err := json.NewDecoder(res.Body).Decode(&whoamiRes)diff --git a/pkg/detectors/humanity/humanity.go b/pkg/detectors/humanity/humanity.goindex f6247843a..959860dfa 100644--- a/pkg/detectors/humanity/humanity.go+++ b/pkg/detectors/humanity/humanity.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/hunter/hunter.go b/pkg/detectors/hunter/hunter.goindex 246d94fdc..589ff0325 100644--- a/pkg/detectors/hunter/hunter.go+++ b/pkg/detectors/hunter/hunter.go@@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/hybiscus/hybiscus.go b/pkg/detectors/hybiscus/hybiscus.goindex d39e970eb..7f7fbd78e 100644--- a/pkg/detectors/hybiscus/hybiscus.go+++ b/pkg/detectors/hybiscus/hybiscus.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-API-KEY", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/hypertrack/hypertrack.go b/pkg/detectors/hypertrack/hypertrack.goindex ab18081fa..b9095ddb2 100644--- a/pkg/detectors/hypertrack/hypertrack.go+++ b/pkg/detectors/hypertrack/hypertrack.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go b/pkg/detectors/ibmclouduserkey/ibmclouduserkey.goindex 6367b6061..494be3e42 100644--- a/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go+++ b/pkg/detectors/ibmclouduserkey/ibmclouduserkey.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", "Basic Yng6Yng=")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/iconfinder/iconfinder.go b/pkg/detectors/iconfinder/iconfinder.goindex d9fd8627b..bf805236f 100644--- a/pkg/detectors/iconfinder/iconfinder.go+++ b/pkg/detectors/iconfinder/iconfinder.go@@ -3,10 +3,11 @@ package iconfinderimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/iexapis/iexapis.go b/pkg/detectors/iexapis/iexapis.goindex 0733fecab..083c35323 100644--- a/pkg/detectors/iexapis/iexapis.go+++ b/pkg/detectors/iexapis/iexapis.go@@ -2,10 +2,11 @@ package iexapisimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/iexcloud/iexcloud.go b/pkg/detectors/iexcloud/iexcloud.goindex 780f3c6fb..c3605aca4 100644--- a/pkg/detectors/iexcloud/iexcloud.go+++ b/pkg/detectors/iexcloud/iexcloud.go@@ -3,10 +3,11 @@ package iexcloudimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/imagekit/imagekit.go b/pkg/detectors/imagekit/imagekit.goindex 78899e66b..aa253842c 100644--- a/pkg/detectors/imagekit/imagekit.go+++ b/pkg/detectors/imagekit/imagekit.go@@ -2,10 +2,11 @@ package imagekitimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/imagga/imagga.go b/pkg/detectors/imagga/imagga.goindex b04d11f4b..688ab28aa 100644--- a/pkg/detectors/imagga/imagga.go+++ b/pkg/detectors/imagga/imagga.go@@ -3,10 +3,11 @@ package imaggaimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/impala/impala.go b/pkg/detectors/impala/impala.goindex 037d13374..040419409 100644--- a/pkg/detectors/impala/impala.go+++ b/pkg/detectors/impala/impala.go@@ -2,10 +2,11 @@ package impalaimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-api-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/infura/infura.go b/pkg/detectors/infura/infura.goindex e988aa8e8..a659d883c 100644--- a/pkg/detectors/infura/infura.go+++ b/pkg/detectors/infura/infura.go@@ -2,11 +2,12 @@ package infuraimport ("context"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/insightly/insightly.go b/pkg/detectors/insightly/insightly.goindex 806198213..22c9e77e5 100644--- a/pkg/detectors/insightly/insightly.go+++ b/pkg/detectors/insightly/insightly.go@@ -2,10 +2,11 @@ package insightlyimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(resMatch, "")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/instabot/instabot.go b/pkg/detectors/instabot/instabot.goindex 64362555a..9d47bec36 100644--- a/pkg/detectors/instabot/instabot.go+++ b/pkg/detectors/instabot/instabot.go@@ -2,10 +2,11 @@ package instabotimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Instabot-Api-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/instamojo/instamojo.go b/pkg/detectors/instamojo/instamojo.goindex e36ac2c43..c79c4c54f 100644--- a/pkg/detectors/instamojo/instamojo.go+++ b/pkg/detectors/instamojo/instamojo.go@@ -70,7 +70,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/x-www-form-urlencoded")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/intercom/intercom.go b/pkg/detectors/intercom/intercom.goindex cdfbd56c2..5680d5e2c 100644--- a/pkg/detectors/intercom/intercom.go+++ b/pkg/detectors/intercom/intercom.go@@ -3,10 +3,11 @@ package intercomimport ("context""encoding/base64"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -63,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/interseller/interseller.go b/pkg/detectors/interseller/interseller.goindex 6eee0a98b..ac2c9e38f 100644--- a/pkg/detectors/interseller/interseller.go+++ b/pkg/detectors/interseller/interseller.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-API-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/intra42/intra42.go b/pkg/detectors/intra42/intra42.goindex cc741b10b..31346cd34 100644--- a/pkg/detectors/intra42/intra42.go+++ b/pkg/detectors/intra42/intra42.go@@ -102,7 +102,7 @@ func verifyIntra42(ctx context.Context, client *http.Client, resMatch string, reif err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/intrinio/intrinio.go b/pkg/detectors/intrinio/intrinio.goindex 0cf5c3298..9a8ba435d 100644--- a/pkg/detectors/intrinio/intrinio.go+++ b/pkg/detectors/intrinio/intrinio.go@@ -3,10 +3,11 @@ package intrinioimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/invoiceocean/invoiceocean.go b/pkg/detectors/invoiceocean/invoiceocean.goindex a0cde7882..460820903 100644--- a/pkg/detectors/invoiceocean/invoiceocean.go+++ b/pkg/detectors/invoiceocean/invoiceocean.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/ip2location/ip2location.go b/pkg/detectors/ip2location/ip2location.goindex 8b5adcdf9..f0bc0e607 100644--- a/pkg/detectors/ip2location/ip2location.go+++ b/pkg/detectors/ip2location/ip2location.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/ipapi/ipapi.go b/pkg/detectors/ipapi/ipapi.goindex 2ba194933..76070ce23 100644--- a/pkg/detectors/ipapi/ipapi.go+++ b/pkg/detectors/ipapi/ipapi.go@@ -3,11 +3,12 @@ package ipapiimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -59,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultbodyString := string(bodyBytes)valid := strings.Contains(bodyString, "continent_code") || strings.Contains(bodyString, `"info":"Access Restricted - Your current Subscription Plan does not support HTTPS Encryption."`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if valid {s1.Verified = truediff --git a/pkg/detectors/ipgeolocation/ipgeolocation.go b/pkg/detectors/ipgeolocation/ipgeolocation.goindex 13fe2ee72..52a3883b5 100644--- a/pkg/detectors/ipgeolocation/ipgeolocation.go+++ b/pkg/detectors/ipgeolocation/ipgeolocation.go@@ -3,10 +3,11 @@ package ipgeolocationimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/ipinfo/ipinfo.go b/pkg/detectors/ipinfo/ipinfo.goindex ec3165606..a8d8632a2 100644--- a/pkg/detectors/ipinfo/ipinfo.go+++ b/pkg/detectors/ipinfo/ipinfo.go@@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := detectors.DoWithDedup(client, detector_typepb.DetectorType_IPInfo, resMatch, req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 403 {diff --git a/pkg/detectors/ipinfodb/ipinfodb.go b/pkg/detectors/ipinfodb/ipinfodb.goindex 496dde166..431f2e2d7 100644--- a/pkg/detectors/ipinfodb/ipinfodb.go+++ b/pkg/detectors/ipinfodb/ipinfodb.go@@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `"statusCode": "OK"`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/ipstack/ipstack.go b/pkg/detectors/ipstack/ipstack.goindex 3d80a33dc..c32c963ef 100644--- a/pkg/detectors/ipstack/ipstack.go+++ b/pkg/detectors/ipstack/ipstack.go@@ -2,11 +2,12 @@ package ipstackimport ("context"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/jdbc/jdbc.go b/pkg/detectors/jdbc/jdbc.goindex 364e971b2..e3ef7a235 100644--- a/pkg/detectors/jdbc/jdbc.go+++ b/pkg/detectors/jdbc/jdbc.go@@ -250,7 +250,7 @@ func pingErr(ctx context.Context, driverName, conn string) error {if err != nil {return err}- defer db.Close()+ defer func() { _ = db.Close() }()if err := db.PingContext(ctx); err != nil {return errdiff --git a/pkg/detectors/jotform/jotform.go b/pkg/detectors/jotform/jotform.goindex 199549413..fb94224f0 100644--- a/pkg/detectors/jotform/jotform.go+++ b/pkg/detectors/jotform/jotform.go@@ -2,10 +2,11 @@ package jotformimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/jumpcloud/jumpcloud.go b/pkg/detectors/jumpcloud/jumpcloud.goindex 2f43fb336..ae6c4e9b7 100644--- a/pkg/detectors/jumpcloud/jumpcloud.go+++ b/pkg/detectors/jumpcloud/jumpcloud.go@@ -2,10 +2,11 @@ package jumpcloudimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/jupiterone/jupiterone.go b/pkg/detectors/jupiterone/jupiterone.goindex 13d647a3b..243a56948 100644--- a/pkg/detectors/jupiterone/jupiterone.go+++ b/pkg/detectors/jupiterone/jupiterone.go@@ -68,12 +68,13 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()- if res.StatusCode == 200 {+ defer func() { _ = res.Body.Close() }()+ switch res.StatusCode {+ case 200:s1.Verified = true- } else if res.StatusCode == 401 {+ case 401:// The secret is determinately not verified (nothing to do)- } else {+ default:s1.SetVerificationError(fmt.Errorf("unexpected HTTP response status %d", res.StatusCode), resMatch)}} else {diff --git a/pkg/detectors/juro/juro.go b/pkg/detectors/juro/juro.goindex ad23a0d57..676ed0b8e 100644--- a/pkg/detectors/juro/juro.go+++ b/pkg/detectors/juro/juro.go@@ -2,10 +2,11 @@ package juroimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-api-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/jwt/jwt.go b/pkg/detectors/jwt/jwt.goindex 827443391..d7390a968 100644--- a/pkg/detectors/jwt/jwt.go+++ b/pkg/detectors/jwt/jwt.go@@ -223,7 +223,7 @@ func verifyJWT(ctx context.Context, client *http.Client, tokenParts []string, paif err != nil {return false, fmt.Errorf("failed to perform OIDC discovery: %w", err)}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode != 200 {return false, fmt.Errorf("bad status for OIDC discovery document: %v", resp.Status)}@@ -250,7 +250,7 @@ func verifyJWT(ctx context.Context, client *http.Client, tokenParts []string, paif err != nil {return false, fmt.Errorf("failed to fetch JWKS: %w", err)}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode != 200 {return false, fmt.Errorf("bad status for JWKS: %v", resp.Status)}diff --git a/pkg/detectors/kanban/kanban.go b/pkg/detectors/kanban/kanban.goindex 6c7a9f3a9..d50f30f10 100644--- a/pkg/detectors/kanban/kanban.go+++ b/pkg/detectors/kanban/kanban.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/kanbantool/kanbantool.go b/pkg/detectors/kanbantool/kanbantool.goindex d187081aa..8854f0532 100644--- a/pkg/detectors/kanbantool/kanbantool.go+++ b/pkg/detectors/kanbantool/kanbantool.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/karmacrm/karmacrm.go b/pkg/detectors/karmacrm/karmacrm.goindex ebeeefb11..17d6aead8 100644--- a/pkg/detectors/karmacrm/karmacrm.go+++ b/pkg/detectors/karmacrm/karmacrm.go@@ -3,10 +3,11 @@ package karmacrmimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/keenio/keenio.go b/pkg/detectors/keenio/keenio.goindex 2b72e1b63..6080a4979 100644--- a/pkg/detectors/keenio/keenio.go+++ b/pkg/detectors/keenio/keenio.go@@ -2,10 +2,11 @@ package keenioimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -60,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/kickbox/kickbox.go b/pkg/detectors/kickbox/kickbox.goindex cb38ee471..9dc64e540 100644--- a/pkg/detectors/kickbox/kickbox.go+++ b/pkg/detectors/kickbox/kickbox.go@@ -2,10 +2,11 @@ package kickboximport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/klaviyo/klaviyo.go b/pkg/detectors/klaviyo/klaviyo.goindex e31d0d2ed..372c4b4fe 100644--- a/pkg/detectors/klaviyo/klaviyo.go+++ b/pkg/detectors/klaviyo/klaviyo.go@@ -4,10 +4,11 @@ import ("context""encoding/json""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -73,7 +74,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Set("Authorization", "Klaviyo-API-Key "+resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 403 {diff --git a/pkg/detectors/klipfolio/klipfolio.go b/pkg/detectors/klipfolio/klipfolio.goindex 2a66e3696..28ce4746b 100644--- a/pkg/detectors/klipfolio/klipfolio.go+++ b/pkg/detectors/klipfolio/klipfolio.go@@ -2,10 +2,11 @@ package klipfolioimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("kf-api-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/knapsackpro/knapsackpro.go b/pkg/detectors/knapsackpro/knapsackpro.goindex b0254ce98..0882c9d2d 100644--- a/pkg/detectors/knapsackpro/knapsackpro.go+++ b/pkg/detectors/knapsackpro/knapsackpro.go@@ -2,10 +2,11 @@ package knapsackproimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/kraken/kraken.go b/pkg/detectors/kraken/kraken.goindex ac78ccc89..a037d53ff 100644--- a/pkg/detectors/kraken/kraken.go+++ b/pkg/detectors/kraken/kraken.go@@ -86,7 +86,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()out, _ := io.ReadAll(res.Body)if !strings.Contains(string(out), "Invalid key") {s1.Verified = truediff --git a/pkg/detectors/kucoin/kucoin.go b/pkg/detectors/kucoin/kucoin.goindex 743788d94..7e4b24b51 100644--- a/pkg/detectors/kucoin/kucoin.go+++ b/pkg/detectors/kucoin/kucoin.go@@ -5,12 +5,13 @@ import ("crypto/hmac""crypto/sha256""encoding/base64"- regexp "github.com/wasilibs/go-re2""net/http""strconv""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -88,7 +89,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/kylas/kylas.go b/pkg/detectors/kylas/kylas.goindex a94fd7376..d7df79dbf 100644--- a/pkg/detectors/kylas/kylas.go+++ b/pkg/detectors/kylas/kylas.go@@ -2,10 +2,11 @@ package kylasimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("api-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/languagelayer/languagelayer.go b/pkg/detectors/languagelayer/languagelayer.goindex 135edd961..c271921e3 100644--- a/pkg/detectors/languagelayer/languagelayer.go+++ b/pkg/detectors/languagelayer/languagelayer.go@@ -3,11 +3,12 @@ package languagelayerimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -57,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `results`) || strings.Contains(bodyString, `"info":"Access Restricted - Your current Subscription Plan does not support HTTPS Encryption."`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/larksuiteapikey/larksuiteapikey.go b/pkg/detectors/larksuiteapikey/larksuiteapikey.goindex 3a8d9e6a6..5aefe72cc 100644--- a/pkg/detectors/larksuiteapikey/larksuiteapikey.go+++ b/pkg/detectors/larksuiteapikey/larksuiteapikey.go@@ -116,7 +116,7 @@ func verifyCredentials(ctx context.Context, client *http.Client, appId, appSecreif bodyResponse.Code == 0 {return true, nil} else {- return false, fmt.Errorf("Verification failed code %d, message %s", bodyResponse.Code, bodyResponse.Message)+ return false, fmt.Errorf("verification failed code %d, message %s", bodyResponse.Code, bodyResponse.Message)}}default:diff --git a/pkg/detectors/leadfeeder/leadfeeder.go b/pkg/detectors/leadfeeder/leadfeeder.goindex f619c711f..794cb031c 100644--- a/pkg/detectors/leadfeeder/leadfeeder.go+++ b/pkg/detectors/leadfeeder/leadfeeder.go@@ -3,10 +3,11 @@ package leadfeederimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Token token=%s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/lemlist/lemlist.go b/pkg/detectors/lemlist/lemlist.goindex c8d779ebb..05b1c785a 100644--- a/pkg/detectors/lemlist/lemlist.go+++ b/pkg/detectors/lemlist/lemlist.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -56,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/lemonsqueezy/lemonsqueezy.go b/pkg/detectors/lemonsqueezy/lemonsqueezy.goindex d70476446..31034a15c 100644--- a/pkg/detectors/lemonsqueezy/lemonsqueezy.go+++ b/pkg/detectors/lemonsqueezy/lemonsqueezy.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/lendflow/lendflow.go b/pkg/detectors/lendflow/lendflow.goindex 1723957fd..5585f831d 100644--- a/pkg/detectors/lendflow/lendflow.go+++ b/pkg/detectors/lendflow/lendflow.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Accept", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go b/pkg/detectors/lessannoyingcrm/lessannoyingcrm.goindex 9232d985f..bf69f7aeb 100644--- a/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go+++ b/pkg/detectors/lessannoyingcrm/lessannoyingcrm.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Accept", "application/vnd.lessannoyingcrm+json; version=3")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/lexigram/lexigram.go b/pkg/detectors/lexigram/lexigram.goindex c72b6734b..6e29f16fe 100644--- a/pkg/detectors/lexigram/lexigram.go+++ b/pkg/detectors/lexigram/lexigram.go@@ -3,10 +3,11 @@ package lexigramimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/linearapi/linearapi.go b/pkg/detectors/linearapi/linearapi.goindex f6ae661f7..09363bb0e 100644--- a/pkg/detectors/linearapi/linearapi.go+++ b/pkg/detectors/linearapi/linearapi.go@@ -2,11 +2,12 @@ package linearapiimport ("context"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -56,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/linemessaging/linemessaging.go b/pkg/detectors/linemessaging/linemessaging.goindex 9d5d0ea9f..1febd9d64 100644--- a/pkg/detectors/linemessaging/linemessaging.go+++ b/pkg/detectors/linemessaging/linemessaging.go@@ -3,10 +3,11 @@ package linemessagingimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/linenotify/linenotify.go b/pkg/detectors/linenotify/linenotify.goindex 9688eb918..00af92baa 100644--- a/pkg/detectors/linenotify/linenotify.go+++ b/pkg/detectors/linenotify/linenotify.go@@ -3,10 +3,11 @@ package linenotifyimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/linkpreview/linkpreview.go b/pkg/detectors/linkpreview/linkpreview.goindex f2118c5ec..dce295e9d 100644--- a/pkg/detectors/linkpreview/linkpreview.go+++ b/pkg/detectors/linkpreview/linkpreview.go@@ -3,10 +3,11 @@ package linkpreviewimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -50,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/liveagent/liveagent.go b/pkg/detectors/liveagent/liveagent.goindex 09628f2ec..2d110628e 100644--- a/pkg/detectors/liveagent/liveagent.go+++ b/pkg/detectors/liveagent/liveagent.go@@ -67,7 +67,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("apikey", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 403 {diff --git a/pkg/detectors/livestorm/livestorm.go b/pkg/detectors/livestorm/livestorm.goindex e16bf9645..58704ed71 100644--- a/pkg/detectors/livestorm/livestorm.go+++ b/pkg/detectors/livestorm/livestorm.go@@ -2,10 +2,11 @@ package livestormimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/loadmill/loadmill.go b/pkg/detectors/loadmill/loadmill.goindex 826465711..902f826e0 100644--- a/pkg/detectors/loadmill/loadmill.go+++ b/pkg/detectors/loadmill/loadmill.go@@ -3,10 +3,11 @@ package loadmillimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := detectors.DoWithDedup(client, detector_typepb.DetectorType_Loadmill, resMatch, req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/lob/lob.go b/pkg/detectors/lob/lob.goindex c86abb288..a0902356f 100644--- a/pkg/detectors/lob/lob.go+++ b/pkg/detectors/lob/lob.go@@ -2,10 +2,11 @@ package lobimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(resMatch, "")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/locationiq/locationiq.go b/pkg/detectors/locationiq/locationiq.goindex 17e2ddbb7..8935b8967 100644--- a/pkg/detectors/locationiq/locationiq.go+++ b/pkg/detectors/locationiq/locationiq.go@@ -2,10 +2,11 @@ package locationiqimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/loggly/loggly.go b/pkg/detectors/loggly/loggly.goindex 463c7fa76..006ce1136 100644--- a/pkg/detectors/loggly/loggly.go+++ b/pkg/detectors/loggly/loggly.go@@ -69,7 +69,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", key))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/loginradius/loginradius.go b/pkg/detectors/loginradius/loginradius.goindex b357b0211..eb3394248 100644--- a/pkg/detectors/loginradius/loginradius.go+++ b/pkg/detectors/loginradius/loginradius.go@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/logzio/logzio.go b/pkg/detectors/logzio/logzio.goindex 265dd6918..50b7d3d83 100644--- a/pkg/detectors/logzio/logzio.go+++ b/pkg/detectors/logzio/logzio.go@@ -3,10 +3,11 @@ package logzioimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -59,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json; charset=utf-8")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/loyverse/loyverse.go b/pkg/detectors/loyverse/loyverse.goindex 1434256dc..94a88229e 100644--- a/pkg/detectors/loyverse/loyverse.go+++ b/pkg/detectors/loyverse/loyverse.go@@ -3,10 +3,11 @@ package loyverseimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/lunchmoney/lunchmoney.go b/pkg/detectors/lunchmoney/lunchmoney.goindex 7baf13876..e26faef5f 100644--- a/pkg/detectors/lunchmoney/lunchmoney.go+++ b/pkg/detectors/lunchmoney/lunchmoney.go@@ -3,10 +3,11 @@ package lunchmoneyimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/luno/luno.go b/pkg/detectors/luno/luno.goindex 262c5db19..03c2ec50c 100644--- a/pkg/detectors/luno/luno.go+++ b/pkg/detectors/luno/luno.go@@ -2,10 +2,11 @@ package lunoimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -60,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(userPatMatch, tokenPatMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/m3o/m3o.go b/pkg/detectors/m3o/m3o.goindex a510e32d9..90509c6cd 100644--- a/pkg/detectors/m3o/m3o.go+++ b/pkg/detectors/m3o/m3o.go@@ -3,10 +3,11 @@ package m3oimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -58,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/madkudu/madkudu.go b/pkg/detectors/madkudu/madkudu.goindex 8dc391d30..97570bb0a 100644--- a/pkg/detectors/madkudu/madkudu.go+++ b/pkg/detectors/madkudu/madkudu.go@@ -2,10 +2,11 @@ package madkuduimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(resMatch, "")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/magicbell/magicbell.go b/pkg/detectors/magicbell/magicbell.goindex 6252058aa..4bfb68703 100644--- a/pkg/detectors/magicbell/magicbell.go+++ b/pkg/detectors/magicbell/magicbell.go@@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-MAGICBELL-USER-EMAIL", emailMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/magnetic/magnetic.go b/pkg/detectors/magnetic/magnetic.goindex f25e63c23..4dd370e99 100644--- a/pkg/detectors/magnetic/magnetic.go+++ b/pkg/detectors/magnetic/magnetic.go@@ -2,10 +2,11 @@ package magneticimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mailboxlayer/mailboxlayer.go b/pkg/detectors/mailboxlayer/mailboxlayer.goindex a7b48ea91..48f451b9b 100644--- a/pkg/detectors/mailboxlayer/mailboxlayer.go+++ b/pkg/detectors/mailboxlayer/mailboxlayer.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/mailchimp/mailchimp.go b/pkg/detectors/mailchimp/mailchimp.goindex d1ac569cd..f2b16e043 100644--- a/pkg/detectors/mailchimp/mailchimp.go+++ b/pkg/detectors/mailchimp/mailchimp.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("accept", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {result.Verified = true}diff --git a/pkg/detectors/mailerlite/mailerlite.go b/pkg/detectors/mailerlite/mailerlite.goindex c6facbbcd..1b2019b21 100644--- a/pkg/detectors/mailerlite/mailerlite.go+++ b/pkg/detectors/mailerlite/mailerlite.go@@ -2,10 +2,11 @@ package mailerliteimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-MailerLite-ApiKey", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mailgun/mailgun.go b/pkg/detectors/mailgun/mailgun.goindex 0f6cc497e..47359d7d4 100644--- a/pkg/detectors/mailgun/mailgun.go+++ b/pkg/detectors/mailgun/mailgun.go@@ -103,7 +103,8 @@ func verifyMatch(ctx context.Context, client *http.Client, token string) (bool,_ = res.Body.Close()}()- if res.StatusCode == http.StatusOK {+ switch res.StatusCode {+ case http.StatusOK:var domains domainResponseif err := json.NewDecoder(res.Body).Decode(&domains); err != nil {return false, nil, fmt.Errorf("error decoding response body: %w", err)@@ -132,9 +133,9 @@ func verifyMatch(ctx context.Context, client *http.Client, token string) (bool,}return true, extraData, nil- } else if res.StatusCode == http.StatusUnauthorized {+ case http.StatusUnauthorized:return false, nil, nil- } else {+ default:return false, nil, fmt.Errorf("unexpected HTTP response status %d", res.StatusCode)}}diff --git a/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go b/pkg/detectors/mailjetbasicauth/mailjetbasicauth.goindex 09a66a2e9..53b73ba46 100644--- a/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go+++ b/pkg/detectors/mailjetbasicauth/mailjetbasicauth.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mailjetsms/mailjetsms.go b/pkg/detectors/mailjetsms/mailjetsms.goindex 871a5a68c..e88500d01 100644--- a/pkg/detectors/mailjetsms/mailjetsms.go+++ b/pkg/detectors/mailjetsms/mailjetsms.go@@ -3,10 +3,11 @@ package mailjetsmsimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mailmodo/mailmodo.go b/pkg/detectors/mailmodo/mailmodo.goindex f3781d602..eeebb0971 100644--- a/pkg/detectors/mailmodo/mailmodo.go+++ b/pkg/detectors/mailmodo/mailmodo.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("mmApiKey", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mailsac/mailsac.go b/pkg/detectors/mailsac/mailsac.goindex ad6ff4010..733afaefa 100644--- a/pkg/detectors/mailsac/mailsac.go+++ b/pkg/detectors/mailsac/mailsac.go@@ -2,10 +2,11 @@ package mailsacimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Mailsac-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mandrill/mandrill.go b/pkg/detectors/mandrill/mandrill.goindex 9b4a16f2e..3d25cb04a 100644--- a/pkg/detectors/mandrill/mandrill.go+++ b/pkg/detectors/mandrill/mandrill.go@@ -3,10 +3,11 @@ package mandrillimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/manifest/manifest.go b/pkg/detectors/manifest/manifest.goindex f33a6a669..2a4ba92bc 100644--- a/pkg/detectors/manifest/manifest.go+++ b/pkg/detectors/manifest/manifest.go@@ -2,10 +2,11 @@ package manifestimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mapbox/mapbox.go b/pkg/detectors/mapbox/mapbox.goindex d2feda74b..53482d2a3 100644--- a/pkg/detectors/mapbox/mapbox.go+++ b/pkg/detectors/mapbox/mapbox.go@@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mapquest/mapquest.go b/pkg/detectors/mapquest/mapquest.goindex 30efb0f55..e771f2a53 100644--- a/pkg/detectors/mapquest/mapquest.go+++ b/pkg/detectors/mapquest/mapquest.go@@ -2,10 +2,11 @@ package mapquestimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/marketstack/marketstack.go b/pkg/detectors/marketstack/marketstack.goindex 1f5c3fc23..4ab8bfe42 100644--- a/pkg/detectors/marketstack/marketstack.go+++ b/pkg/detectors/marketstack/marketstack.go@@ -3,10 +3,11 @@ package marketstackimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go b/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.goindex 28b097bf4..73938cc87 100644--- a/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go+++ b/pkg/detectors/mattermostpersonaltoken/mattermostpersonaltoken.go@@ -65,7 +65,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mavenlink/mavenlink.go b/pkg/detectors/mavenlink/mavenlink.goindex 961ed4c07..2474385e6 100644--- a/pkg/detectors/mavenlink/mavenlink.go+++ b/pkg/detectors/mavenlink/mavenlink.go@@ -3,10 +3,11 @@ package mavenlinkimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/maxmindlicense/v1/maxmindlicense.go b/pkg/detectors/maxmindlicense/v1/maxmindlicense.goindex da21ec899..e278a6446 100644--- a/pkg/detectors/maxmindlicense/v1/maxmindlicense.go+++ b/pkg/detectors/maxmindlicense/v1/maxmindlicense.go@@ -67,7 +67,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(idRes, keyRes)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/meaningcloud/meaningcloud.go b/pkg/detectors/meaningcloud/meaningcloud.goindex 8428e6877..d91281370 100644--- a/pkg/detectors/meaningcloud/meaningcloud.go+++ b/pkg/detectors/meaningcloud/meaningcloud.go@@ -4,12 +4,13 @@ import ("bytes""context""encoding/json"- regexp "github.com/wasilibs/go-re2""io""mime/multipart""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -71,7 +72,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err != nil {continue}- writer.Close()+ _ = writer.Close()req, err := http.NewRequestWithContext(ctx, "POST", "https://api.meaningcloud.com/lang-4.0/identification", bytes.NewReader(body.Bytes()))if err != nil {continue@@ -79,7 +80,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", writer.FormDataContentType())res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {var r responseif err := json.NewDecoder(res.Body).Decode(&r); err != nil {diff --git a/pkg/detectors/mediastack/mediastack.go b/pkg/detectors/mediastack/mediastack.goindex ac44fe833..ffacab9ad 100644--- a/pkg/detectors/mediastack/mediastack.go+++ b/pkg/detectors/mediastack/mediastack.go@@ -3,11 +3,12 @@ package mediastackimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -55,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/meistertask/meistertask.go b/pkg/detectors/meistertask/meistertask.goindex e6b5e346e..a8161c67f 100644--- a/pkg/detectors/meistertask/meistertask.go+++ b/pkg/detectors/meistertask/meistertask.go@@ -3,10 +3,11 @@ package meistertaskimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mesibo/mesibo.go b/pkg/detectors/mesibo/mesibo.goindex 2dcc70344..83e30a895 100644--- a/pkg/detectors/mesibo/mesibo.go+++ b/pkg/detectors/mesibo/mesibo.go@@ -96,7 +96,7 @@ func (s Scanner) verify(ctx context.Context, token string) (bool, error) {if err != nil {return false, fmt.Errorf("failed to execute request: %w", err)}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()// The backend API always returns HTTP 200, with the actual result encoded in the// JSON response body.diff --git a/pkg/detectors/messagebird/messagebird.go b/pkg/detectors/messagebird/messagebird.goindex 59c164f21..6a9e07cbf 100644--- a/pkg/detectors/messagebird/messagebird.go+++ b/pkg/detectors/messagebird/messagebird.go@@ -3,10 +3,11 @@ package messagebirdimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("AccessKey %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/metaapi/metaapi.go b/pkg/detectors/metaapi/metaapi.goindex 93b8939f7..301cac6e4 100644--- a/pkg/detectors/metaapi/metaapi.go+++ b/pkg/detectors/metaapi/metaapi.go@@ -3,11 +3,12 @@ package metaapiimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -62,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("apikey", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()body, errBody := io.ReadAll(res.Body)if errBody == nil {diff --git a/pkg/detectors/metabase/metabase.go b/pkg/detectors/metabase/metabase.goindex 406bebc7a..289f1e32e 100644--- a/pkg/detectors/metabase/metabase.go+++ b/pkg/detectors/metabase/metabase.go@@ -73,7 +73,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Metabase-Session", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()body, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/metrilo/metrilo.go b/pkg/detectors/metrilo/metrilo.goindex daa2202c9..b9d6d96bb 100644--- a/pkg/detectors/metrilo/metrilo.go+++ b/pkg/detectors/metrilo/metrilo.go@@ -2,10 +2,11 @@ package metriloimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Length", `0`)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go b/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.goindex 4a5c993c3..823e6cd93 100644--- a/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go+++ b/pkg/detectors/microsoftteamswebhook/microsoftteamswebhook.go@@ -81,7 +81,7 @@ func verifyWebhook(ctx context.Context, client *http.Client, webhookURL string)if err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()body, err := io.ReadAll(res.Body)if err != nil {diff --git a/pkg/detectors/mindmeister/mindmeister.go b/pkg/detectors/mindmeister/mindmeister.goindex 5f9f045dd..c8ee0c186 100644--- a/pkg/detectors/mindmeister/mindmeister.go+++ b/pkg/detectors/mindmeister/mindmeister.go@@ -3,11 +3,12 @@ package mindmeisterimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -58,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `"stat":"ok"`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/miro/miro.go b/pkg/detectors/miro/miro.goindex 535ea0784..618d23d30 100644--- a/pkg/detectors/miro/miro.go+++ b/pkg/detectors/miro/miro.go@@ -3,10 +3,11 @@ package miroimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mite/mite.go b/pkg/detectors/mite/mite.goindex e21554ca8..c91c75d2e 100644--- a/pkg/detectors/mite/mite.go+++ b/pkg/detectors/mite/mite.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-MiteApiKey", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mixmax/mixmax.go b/pkg/detectors/mixmax/mixmax.goindex 0322c59c5..1ab50d09c 100644--- a/pkg/detectors/mixmax/mixmax.go+++ b/pkg/detectors/mixmax/mixmax.go@@ -2,10 +2,11 @@ package mixmaximport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-API-Token", resMatch)res, err := detectors.DoWithDedup(client, detector_typepb.DetectorType_Mixmax, resMatch, req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mixpanel/mixpanel.go b/pkg/detectors/mixpanel/mixpanel.goindex 9a2e63d1e..76d01a80f 100644--- a/pkg/detectors/mixpanel/mixpanel.go+++ b/pkg/detectors/mixpanel/mixpanel.go@@ -2,10 +2,11 @@ package mixpanelimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -60,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(userPatMatch, tokenPatMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mockaroo/mockaroo.go b/pkg/detectors/mockaroo/mockaroo.goindex c005331aa..55e152b45 100644--- a/pkg/detectors/mockaroo/mockaroo.go+++ b/pkg/detectors/mockaroo/mockaroo.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {var t typeReserr = json.NewDecoder(res.Body).Decode(&t)diff --git a/pkg/detectors/moderation/moderation.go b/pkg/detectors/moderation/moderation.goindex ade9f0b15..2a12d69d8 100644--- a/pkg/detectors/moderation/moderation.go+++ b/pkg/detectors/moderation/moderation.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mongodb/mongodb.go b/pkg/detectors/mongodb/mongodb.goindex aea2d6c88..810b46fb2 100644--- a/pkg/detectors/mongodb/mongodb.go+++ b/pkg/detectors/mongodb/mongodb.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}// If the query string contains `&` the options will not be parsed.- connStr := strings.Replace(strings.TrimSpace(match[1]), "&", "&", -1)+ connStr := strings.ReplaceAll(strings.TrimSpace(match[1]), "&", "&")connUrl, err := url.Parse(connStr)if err != nil {logger.V(3).Info("Skipping invalid URL", "err", err)diff --git a/pkg/detectors/monkeylearn/monkeylearn.go b/pkg/detectors/monkeylearn/monkeylearn.goindex 938be4f77..a2a1ed2e2 100644--- a/pkg/detectors/monkeylearn/monkeylearn.go+++ b/pkg/detectors/monkeylearn/monkeylearn.go@@ -3,10 +3,11 @@ package monkeylearnimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/moonclerk/moonclerk.go b/pkg/detectors/moonclerk/moonclerk.goindex 3bf6115dc..1014d6c34 100644--- a/pkg/detectors/moonclerk/moonclerk.go+++ b/pkg/detectors/moonclerk/moonclerk.go@@ -2,10 +2,11 @@ package moonclerkimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", "Token token="+resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/moosend/moosend.go b/pkg/detectors/moosend/moosend.goindex 75e5b8446..3b3951e5c 100644--- a/pkg/detectors/moosend/moosend.go+++ b/pkg/detectors/moosend/moosend.go@@ -2,11 +2,12 @@ package moosendimport ("context"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/moralis/moralis.go b/pkg/detectors/moralis/moralis.goindex ae505af22..eb74e6e0f 100644--- a/pkg/detectors/moralis/moralis.go+++ b/pkg/detectors/moralis/moralis.go@@ -2,10 +2,11 @@ package moralisimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-API-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/mrticktock/mrticktock.go b/pkg/detectors/mrticktock/mrticktock.goindex 4452a5713..c783d8995 100644--- a/pkg/detectors/mrticktock/mrticktock.go+++ b/pkg/detectors/mrticktock/mrticktock.go@@ -65,7 +65,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/x-www-form-urlencoded")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/mux/mux.go b/pkg/detectors/mux/mux.goindex 3f28f2ba1..d04a949bd 100644--- a/pkg/detectors/mux/mux.go+++ b/pkg/detectors/mux/mux.go@@ -65,7 +65,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(resMatch, resSecretMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/myfreshworks/myfreshworks.go b/pkg/detectors/myfreshworks/myfreshworks.goindex 9790fb78c..307dadbec 100644--- a/pkg/detectors/myfreshworks/myfreshworks.go+++ b/pkg/detectors/myfreshworks/myfreshworks.go@@ -4,11 +4,12 @@ import ("context""encoding/json""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -86,7 +87,7 @@ func verifyMyfreshworks(ctx context.Context, client *http.Client, resMatch, resIif err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode == http.StatusOK {body, err := io.ReadAll(res.Body)@@ -95,7 +96,7 @@ func verifyMyfreshworks(ctx context.Context, client *http.Client, resMatch, resI}return json.Valid(body), nil- } else if !(res.StatusCode == http.StatusUnauthorized || res.StatusCode == http.StatusForbidden) {+ } else if res.StatusCode != http.StatusUnauthorized && res.StatusCode != http.StatusForbidden {return false, fmt.Errorf("unexpected HTTP response status %d", res.StatusCode)}diff --git a/pkg/detectors/myintervals/myintervals.go b/pkg/detectors/myintervals/myintervals.goindex d802115b4..5887442a8 100644--- a/pkg/detectors/myintervals/myintervals.go+++ b/pkg/detectors/myintervals/myintervals.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -57,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go b/pkg/detectors/nasdaqdatalink/nasdaqdatalink.goindex 283b8a1f5..f4ea104a4 100644--- a/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go+++ b/pkg/detectors/nasdaqdatalink/nasdaqdatalink.go@@ -3,11 +3,12 @@ package nasdaqdatalinkimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -55,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/nethunt/nethunt.go b/pkg/detectors/nethunt/nethunt.goindex 649e613dd..d68978b26 100644--- a/pkg/detectors/nethunt/nethunt.go+++ b/pkg/detectors/nethunt/nethunt.go@@ -2,10 +2,11 @@ package nethuntimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -60,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(userPatMatch, tokenPatMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/netsuite/netsuite.go b/pkg/detectors/netsuite/netsuite.goindex 10f448895..82ce63ef5 100644--- a/pkg/detectors/netsuite/netsuite.go+++ b/pkg/detectors/netsuite/netsuite.go@@ -127,7 +127,7 @@ func (s Scanner) Description() string {func verifyCredentials(ctx context.Context, client *http.Client, cs credentialSet) (bool, error) {// for url, filter or replace underscore in accountID if needed and lower case the accountID- urlAccountId := strings.ToLower(strings.Replace(cs.accountID, "_", "-", -1))+ urlAccountId := strings.ToLower(strings.ReplaceAll(cs.accountID, "_", "-"))baseUrl := "https://" + urlAccountId + ".suitetalk.api.netsuite.com"@@ -169,7 +169,7 @@ func verifyCredentials(ctx context.Context, client *http.Client, cs credentialSe}return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK:return true, nildiff --git a/pkg/detectors/neutrinoapi/neutrinoapi.go b/pkg/detectors/neutrinoapi/neutrinoapi.goindex 5bcbd0c1c..16a577c0a 100644--- a/pkg/detectors/neutrinoapi/neutrinoapi.go+++ b/pkg/detectors/neutrinoapi/neutrinoapi.go@@ -4,12 +4,13 @@ import ("bytes""context""fmt"- regexp "github.com/wasilibs/go-re2""io""mime/multipart""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -67,7 +68,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err != nil {continue}- writer.Close()+ _ = writer.Close()req, err := http.NewRequestWithContext(ctx, "POST", fmt.Sprintf("https://neutrinoapi.net/url-info?user-id=%s&api-key=%s", resIdMatch, resMatch), bytes.NewReader(body.Bytes()))if err != nil {continue@@ -75,7 +76,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", writer.FormDataContentType())res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go b/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.goindex 56dc90e45..cea6dd87c 100644--- a/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go+++ b/pkg/detectors/newrelicpersonalapikey/newrelicpersonalapikey.go@@ -58,12 +58,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultresEU, errEU := client.Do(reqEU)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}} else if errEU == nil {- defer resEU.Body.Close()+ defer func() { _ = resEU.Body.Close() }()if resEU.StatusCode >= 200 && resEU.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/newsapi/newsapi.go b/pkg/detectors/newsapi/newsapi.goindex b928f0141..1ab3dee1f 100644--- a/pkg/detectors/newsapi/newsapi.go+++ b/pkg/detectors/newsapi/newsapi.go@@ -2,10 +2,11 @@ package newsapiimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/newscatcher/newscatcher.go b/pkg/detectors/newscatcher/newscatcher.goindex 47a7bdd6d..3ff0e0c7a 100644--- a/pkg/detectors/newscatcher/newscatcher.go+++ b/pkg/detectors/newscatcher/newscatcher.go@@ -2,10 +2,11 @@ package newscatcherimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-api-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/nexmoapikey/nexmoapikey.go b/pkg/detectors/nexmoapikey/nexmoapikey.goindex a3969ac53..1cc0bd506 100644--- a/pkg/detectors/nexmoapikey/nexmoapikey.go+++ b/pkg/detectors/nexmoapikey/nexmoapikey.go@@ -2,10 +2,11 @@ package nexmoapikeyimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -61,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/nftport/nftport.go b/pkg/detectors/nftport/nftport.goindex 155cd217d..0dd666d0a 100644--- a/pkg/detectors/nftport/nftport.go+++ b/pkg/detectors/nftport/nftport.go@@ -2,10 +2,11 @@ package nftportimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/ngc/ngc.go b/pkg/detectors/ngc/ngc.goindex 79b1b2f12..9cd1e1644 100644--- a/pkg/detectors/ngc/ngc.go+++ b/pkg/detectors/ngc/ngc.go@@ -3,10 +3,11 @@ package ngcimport ("context""encoding/base64"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -63,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/nicereply/nicereply.go b/pkg/detectors/nicereply/nicereply.goindex f70b5875b..6ee0917de 100644--- a/pkg/detectors/nicereply/nicereply.go+++ b/pkg/detectors/nicereply/nicereply.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -56,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/nightfall/nightfall.go b/pkg/detectors/nightfall/nightfall.goindex 6e0cfface..382b5e470 100644--- a/pkg/detectors/nightfall/nightfall.go+++ b/pkg/detectors/nightfall/nightfall.go@@ -3,10 +3,11 @@ package nightfallimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -56,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/nimble/nimble.go b/pkg/detectors/nimble/nimble.goindex 7b8519994..5102b933b 100644--- a/pkg/detectors/nimble/nimble.go+++ b/pkg/detectors/nimble/nimble.go@@ -3,10 +3,11 @@ package nimbleimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/noticeable/noticeable.go b/pkg/detectors/noticeable/noticeable.goindex 505ff9b67..0cbda5544 100644--- a/pkg/detectors/noticeable/noticeable.go+++ b/pkg/detectors/noticeable/noticeable.go@@ -3,10 +3,11 @@ package noticeableimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -55,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Apikey %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/notion/notion.go b/pkg/detectors/notion/notion.goindex 4e069c5ba..c53c42f40 100644--- a/pkg/detectors/notion/notion.go+++ b/pkg/detectors/notion/notion.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 || res.StatusCode == 403 {// if >= 200 and < 300, the secret is valid and has privileges for the /v1/users endpoint// If 403, the secret is valid, but does not have privileges for the /v1/users endpoint,diff --git a/pkg/detectors/nozbeteams/nozbeteams.go b/pkg/detectors/nozbeteams/nozbeteams.goindex c30252e53..33edc2dcd 100644--- a/pkg/detectors/nozbeteams/nozbeteams.go+++ b/pkg/detectors/nozbeteams/nozbeteams.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/npmtoken/npmtoken.go b/pkg/detectors/npmtoken/npmtoken.goindex 332b6ee39..f50beb993 100644--- a/pkg/detectors/npmtoken/npmtoken.go+++ b/pkg/detectors/npmtoken/npmtoken.go@@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/npmtokenv2/npmtokenv2.go b/pkg/detectors/npmtokenv2/npmtokenv2.goindex cff2c0e9c..ca0eb5a0e 100644--- a/pkg/detectors/npmtokenv2/npmtokenv2.go+++ b/pkg/detectors/npmtokenv2/npmtokenv2.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/nugetapikey/nugetapikey.go b/pkg/detectors/nugetapikey/nugetapikey.goindex 19f8bba82..0340bc006 100644--- a/pkg/detectors/nugetapikey/nugetapikey.go+++ b/pkg/detectors/nugetapikey/nugetapikey.go@@ -2,10 +2,11 @@ package nugetapikeyimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-NuGet-ApiKey", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()// we can either match on response code "400" or "Bad Request" responseif res.StatusCode == 400 {s1.Verified = truediff --git a/pkg/detectors/numverify/numverify.go b/pkg/detectors/numverify/numverify.goindex 4d907c191..0b7793144 100644--- a/pkg/detectors/numverify/numverify.go+++ b/pkg/detectors/numverify/numverify.go@@ -3,11 +3,12 @@ package numverifyimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `country_code`) || strings.Contains(bodyString, `"info":"Access Restricted - Your current Subscription Plan does not support HTTPS Encryption."`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/nutritionix/nutritionix.go b/pkg/detectors/nutritionix/nutritionix.goindex 086c43925..e70c55c84 100644--- a/pkg/detectors/nutritionix/nutritionix.go+++ b/pkg/detectors/nutritionix/nutritionix.go@@ -2,10 +2,11 @@ package nutritioniximport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -63,7 +64,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-app-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/nylas/nylas.go b/pkg/detectors/nylas/nylas.goindex 8c779901a..c6579b1c6 100644--- a/pkg/detectors/nylas/nylas.go+++ b/pkg/detectors/nylas/nylas.go@@ -3,10 +3,11 @@ package nylasimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/oanda/oanda.go b/pkg/detectors/oanda/oanda.goindex 3715d8444..6eabcafdd 100644--- a/pkg/detectors/oanda/oanda.go+++ b/pkg/detectors/oanda/oanda.go@@ -3,10 +3,11 @@ package oandaimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/okta/okta.go b/pkg/detectors/okta/okta.goindex 56b7bad68..27e22d2c6 100644--- a/pkg/detectors/okta/okta.go+++ b/pkg/detectors/okta/okta.go@@ -98,7 +98,7 @@ func verifyOktaToken(ctx context.Context, client *http.Client, domain, token strif err != nil {return false, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()switch resp.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/omnisend/omnisend.go b/pkg/detectors/omnisend/omnisend.goindex 70ea501c7..70f315841 100644--- a/pkg/detectors/omnisend/omnisend.go+++ b/pkg/detectors/omnisend/omnisend.go@@ -2,10 +2,11 @@ package omnisendimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-API-KEY", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/onedesk/onedesk.go b/pkg/detectors/onedesk/onedesk.goindex 475c0fb8b..83b1ee06f 100644--- a/pkg/detectors/onedesk/onedesk.go+++ b/pkg/detectors/onedesk/onedesk.go@@ -65,7 +65,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/onelogin/onelogin.go b/pkg/detectors/onelogin/onelogin.goindex 64b7a1058..699e129fb 100644--- a/pkg/detectors/onelogin/onelogin.go+++ b/pkg/detectors/onelogin/onelogin.go@@ -3,11 +3,12 @@ package oneloginimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb")@@ -65,7 +66,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json; charset=utf-8")res, err := client.Do(req)if err == nil {- res.Body.Close() // The request body is unused.+ _ = res.Body.Close() // The request body is unused.if res.StatusCode >= 200 && res.StatusCode < 300 {result.Verified = truediff --git a/pkg/detectors/onepagecrm/onepagecrm.go b/pkg/detectors/onepagecrm/onepagecrm.goindex 536a865d4..adbbcc598 100644--- a/pkg/detectors/onepagecrm/onepagecrm.go+++ b/pkg/detectors/onepagecrm/onepagecrm.go@@ -2,10 +2,11 @@ package onepagecrmimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -59,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(userPatMatch, tokenPatMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/onesignal/onesignal.go b/pkg/detectors/onesignal/onesignal.goindex 839007378..3843161ce 100644--- a/pkg/detectors/onesignal/onesignal.go+++ b/pkg/detectors/onesignal/onesignal.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -57,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/oopspam/oopspam.go b/pkg/detectors/oopspam/oopspam.goindex 92d398a5e..f39759f50 100644--- a/pkg/detectors/oopspam/oopspam.go+++ b/pkg/detectors/oopspam/oopspam.go@@ -2,10 +2,11 @@ package oopspamimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Api-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/opencagedata/opencagedata.go b/pkg/detectors/opencagedata/opencagedata.goindex 9ca1b56ac..ba644575f 100644--- a/pkg/detectors/opencagedata/opencagedata.go+++ b/pkg/detectors/opencagedata/opencagedata.go@@ -3,10 +3,11 @@ package opencagedataimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := detectors.DoWithDedup(client, detector_typepb.DetectorType_OpenCageData, resMatch, req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/openuv/openuv.go b/pkg/detectors/openuv/openuv.goindex daeaf7be6..af0ffbd18 100644--- a/pkg/detectors/openuv/openuv.go+++ b/pkg/detectors/openuv/openuv.go@@ -2,10 +2,11 @@ package openuvimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-access-token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/openvpn/openvpn.go b/pkg/detectors/openvpn/openvpn.goindex 1feca62e4..fc157dfd2 100644--- a/pkg/detectors/openvpn/openvpn.go+++ b/pkg/detectors/openvpn/openvpn.go@@ -81,7 +81,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("content-type", "application/x-www-form-urlencoded")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/openweather/openweather.go b/pkg/detectors/openweather/openweather.goindex 8d8895dfb..9ae6567da 100644--- a/pkg/detectors/openweather/openweather.go+++ b/pkg/detectors/openweather/openweather.go@@ -2,10 +2,11 @@ package openweatherimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/optimizely/optimizely.go b/pkg/detectors/optimizely/optimizely.goindex 55827f93f..4392470d8 100644--- a/pkg/detectors/optimizely/optimizely.go+++ b/pkg/detectors/optimizely/optimizely.go@@ -3,10 +3,11 @@ package optimizelyimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/overloop/overloop.go b/pkg/detectors/overloop/overloop.goindex 93e5c7ecd..a8e10d0b0 100644--- a/pkg/detectors/overloop/overloop.go+++ b/pkg/detectors/overloop/overloop.go@@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Set("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/owlbot/owlbot.go b/pkg/detectors/owlbot/owlbot.goindex 34725279d..95a5840d7 100644--- a/pkg/detectors/owlbot/owlbot.go+++ b/pkg/detectors/owlbot/owlbot.go@@ -3,10 +3,11 @@ package owlbotimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/packagecloud/packagecloud.go b/pkg/detectors/packagecloud/packagecloud.goindex 2b5055a46..6c619adba 100644--- a/pkg/detectors/packagecloud/packagecloud.go+++ b/pkg/detectors/packagecloud/packagecloud.go@@ -2,10 +2,11 @@ package packagecloudimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(resMatch, "")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go b/pkg/detectors/pagerdutyapikey/pagerdutyapikey.goindex 01aefe3ef..a61f2ee00 100644--- a/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go+++ b/pkg/detectors/pagerdutyapikey/pagerdutyapikey.go@@ -80,7 +80,7 @@ func verifyPagerdutyapikey(ctx context.Context, client *http.Client, token strinif err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/pandadoc/pandadoc.go b/pkg/detectors/pandadoc/pandadoc.goindex 9ee3ef07c..9c471a33f 100644--- a/pkg/detectors/pandadoc/pandadoc.go+++ b/pkg/detectors/pandadoc/pandadoc.go@@ -3,10 +3,11 @@ package pandadocimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("API-Key %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/pandascore/pandascore.go b/pkg/detectors/pandascore/pandascore.goindex e4b24cfa4..4caffed79 100644--- a/pkg/detectors/pandascore/pandascore.go+++ b/pkg/detectors/pandascore/pandascore.go@@ -3,10 +3,11 @@ package pandascoreimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else {diff --git a/pkg/detectors/paperform/paperform.go b/pkg/detectors/paperform/paperform.goindex 84e78f9e1..61bd259f3 100644--- a/pkg/detectors/paperform/paperform.go+++ b/pkg/detectors/paperform/paperform.go@@ -3,10 +3,11 @@ package paperformimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/paralleldots/paralleldots.go b/pkg/detectors/paralleldots/paralleldots.goindex fd65488c4..b39d9c82f 100644--- a/pkg/detectors/paralleldots/paralleldots.go+++ b/pkg/detectors/paralleldots/paralleldots.go@@ -3,12 +3,13 @@ package paralleldotsimport ("bytes""context"- regexp "github.com/wasilibs/go-re2""io""mime/multipart""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -66,7 +67,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err != nil {continue}- writer.Close()+ _ = writer.Close()req, err := http.NewRequestWithContext(ctx, "POST", "https://apis.paralleldots.com/v4/intent", bytes.NewReader(payload.Bytes()))if err != nil {continue@@ -74,7 +75,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", writer.FormDataContentType())res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/parsehub/parsehub.go b/pkg/detectors/parsehub/parsehub.goindex 032392456..1732a52c5 100644--- a/pkg/detectors/parsehub/parsehub.go+++ b/pkg/detectors/parsehub/parsehub.go@@ -3,10 +3,11 @@ package parsehubimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/parsers/parsers.go b/pkg/detectors/parsers/parsers.goindex f71d32e32..1398fecff 100644--- a/pkg/detectors/parsers/parsers.go+++ b/pkg/detectors/parsers/parsers.go@@ -2,10 +2,11 @@ package parsersimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-api-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/parseur/parseur.go b/pkg/detectors/parseur/parseur.goindex 0d068f133..edf5a04a7 100644--- a/pkg/detectors/parseur/parseur.go+++ b/pkg/detectors/parseur/parseur.go@@ -73,7 +73,7 @@ func verifyResult(ctx context.Context, client *http.Client, token string) (bool,return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {return true, nil}diff --git a/pkg/detectors/partnerstack/partnerstack.go b/pkg/detectors/partnerstack/partnerstack.goindex 3ab42b13c..22dd40178 100644--- a/pkg/detectors/partnerstack/partnerstack.go+++ b/pkg/detectors/partnerstack/partnerstack.go@@ -3,10 +3,11 @@ package partnerstackimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/pastebin/pastebin.go b/pkg/detectors/pastebin/pastebin.goindex 5b585fb42..c5d6d3f36 100644--- a/pkg/detectors/pastebin/pastebin.go+++ b/pkg/detectors/pastebin/pastebin.go@@ -3,12 +3,13 @@ package pastebinimport ("bytes""context"- regexp "github.com/wasilibs/go-re2""io""mime/multipart""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -74,7 +75,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err != nil {continue}- writer.Close()+ _ = writer.Close()req, err := http.NewRequestWithContext(ctx, "POST", "https://pastebin.com/api/api_post.php", bytes.NewReader(body.Bytes()))if err != nil {continue@@ -82,7 +83,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", writer.FormDataContentType())res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/paydirtapp/paydirtapp.go b/pkg/detectors/paydirtapp/paydirtapp.goindex 82fe2422a..6e2560e85 100644--- a/pkg/detectors/paydirtapp/paydirtapp.go+++ b/pkg/detectors/paydirtapp/paydirtapp.go@@ -2,10 +2,11 @@ package paydirtappimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/paymoapp/paymoapp.go b/pkg/detectors/paymoapp/paymoapp.goindex 58940fc00..5eda513d2 100644--- a/pkg/detectors/paymoapp/paymoapp.go+++ b/pkg/detectors/paymoapp/paymoapp.go@@ -3,10 +3,11 @@ package paymoappimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/paymongo/paymongo.go b/pkg/detectors/paymongo/paymongo.goindex 20b0a2d61..4f97ce5b6 100644--- a/pkg/detectors/paymongo/paymongo.go+++ b/pkg/detectors/paymongo/paymongo.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(resMatch, "")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/paypaloauth/paypaloauth.go b/pkg/detectors/paypaloauth/paypaloauth.goindex c9f15264e..6cd467d8e 100644--- a/pkg/detectors/paypaloauth/paypaloauth.go+++ b/pkg/detectors/paypaloauth/paypaloauth.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -66,7 +67,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", encoded))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/paystack/paystack.go b/pkg/detectors/paystack/paystack.goindex 5326f0919..c7294da3e 100644--- a/pkg/detectors/paystack/paystack.go+++ b/pkg/detectors/paystack/paystack.go@@ -3,10 +3,11 @@ package paystackimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/pdflayer/pdflayer.go b/pkg/detectors/pdflayer/pdflayer.goindex 24b400f18..710ce447a 100644--- a/pkg/detectors/pdflayer/pdflayer.go+++ b/pkg/detectors/pdflayer/pdflayer.go@@ -3,11 +3,12 @@ package pdflayerimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -57,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `Contents`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/pdfshift/pdfshift.go b/pkg/detectors/pdfshift/pdfshift.goindex 8cb9d0a6d..a89545cbb 100644--- a/pkg/detectors/pdfshift/pdfshift.go+++ b/pkg/detectors/pdfshift/pdfshift.go@@ -2,10 +2,11 @@ package pdfshiftimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth("api", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/peopledatalabs/peopledatalabs.go b/pkg/detectors/peopledatalabs/peopledatalabs.goindex 951e5a177..e13119861 100644--- a/pkg/detectors/peopledatalabs/peopledatalabs.go+++ b/pkg/detectors/peopledatalabs/peopledatalabs.go@@ -2,10 +2,11 @@ package peopledatalabsimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Api-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/pepipost/pepipost.go b/pkg/detectors/pepipost/pepipost.goindex 18be9866f..fa2029e75 100644--- a/pkg/detectors/pepipost/pepipost.go+++ b/pkg/detectors/pepipost/pepipost.go@@ -2,10 +2,11 @@ package pepipostimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("api_key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/percy/percy.go b/pkg/detectors/percy/percy.goindex 81c45344c..619beddef 100644--- a/pkg/detectors/percy/percy.go+++ b/pkg/detectors/percy/percy.go@@ -3,10 +3,11 @@ package percyimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/pinata/pinata.go b/pkg/detectors/pinata/pinata.goindex 465dda391..d22292f98 100644--- a/pkg/detectors/pinata/pinata.go+++ b/pkg/detectors/pinata/pinata.go@@ -2,11 +2,12 @@ package pinataimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -65,7 +66,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("pinata_secret_api_key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/pipedream/pipedream.go b/pkg/detectors/pipedream/pipedream.goindex ad4874737..2048e2d41 100644--- a/pkg/detectors/pipedream/pipedream.go+++ b/pkg/detectors/pipedream/pipedream.go@@ -3,11 +3,12 @@ package pipedreamimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -56,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/pipedrive/pipedrive.go b/pkg/detectors/pipedrive/pipedrive.goindex 587de4427..81e009848 100644--- a/pkg/detectors/pipedrive/pipedrive.go+++ b/pkg/detectors/pipedrive/pipedrive.go@@ -3,10 +3,11 @@ package pipedriveimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/pivotaltracker/pivotaltracker.go b/pkg/detectors/pivotaltracker/pivotaltracker.goindex c872968bc..23aa0e837 100644--- a/pkg/detectors/pivotaltracker/pivotaltracker.go+++ b/pkg/detectors/pivotaltracker/pivotaltracker.go@@ -2,9 +2,10 @@ package pivotaltrackerimport ("context"- regexp "github.com/wasilibs/go-re2""net/http"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -55,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-TrackerToken", token)res, err := client.Do(req)if err == nil {- res.Body.Close() // The request body is unused.+ _ = res.Body.Close() // The request body is unused.if res.StatusCode >= 200 && res.StatusCode < 300 {result.Verified = truediff --git a/pkg/detectors/pixabay/pixabay.go b/pkg/detectors/pixabay/pixabay.goindex 37da38040..efdae3695 100644--- a/pkg/detectors/pixabay/pixabay.go+++ b/pkg/detectors/pixabay/pixabay.go@@ -3,10 +3,11 @@ package pixabayimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/plaidkey/plaidkey.go b/pkg/detectors/plaidkey/plaidkey.goindex b010c6598..74a8ac899 100644--- a/pkg/detectors/plaidkey/plaidkey.go+++ b/pkg/detectors/plaidkey/plaidkey.go@@ -114,7 +114,7 @@ func verifyMatch(ctx context.Context, client *http.Client, id string, secret strif err != nil {return false, nil, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/planetscale/planetscale.go b/pkg/detectors/planetscale/planetscale.goindex b45624079..6b47107a3 100644--- a/pkg/detectors/planetscale/planetscale.go+++ b/pkg/detectors/planetscale/planetscale.go@@ -68,7 +68,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result// Send HTTP requestres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/planetscaledb/planetscaledb.go b/pkg/detectors/planetscaledb/planetscaledb.goindex 4a9db7b9a..8c78de0b5 100644--- a/pkg/detectors/planetscaledb/planetscaledb.go+++ b/pkg/detectors/planetscaledb/planetscaledb.go@@ -70,7 +70,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result} else {s1.SetVerificationError(err, password[0])}- db.Close()+ _ = db.Close()}}diff --git a/pkg/detectors/planviewleankit/planviewleankit.go b/pkg/detectors/planviewleankit/planviewleankit.goindex 1aa14091d..185037caa 100644--- a/pkg/detectors/planviewleankit/planviewleankit.go+++ b/pkg/detectors/planviewleankit/planviewleankit.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/planyo/planyo.go b/pkg/detectors/planyo/planyo.goindex f85b7ecf1..2880285a4 100644--- a/pkg/detectors/planyo/planyo.go+++ b/pkg/detectors/planyo/planyo.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Accept", "application/vnd.planyo+json; version=3")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/plivo/plivo.go b/pkg/detectors/plivo/plivo.goindex c47de4a29..2af3b51d3 100644--- a/pkg/detectors/plivo/plivo.go+++ b/pkg/detectors/plivo/plivo.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -65,7 +66,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", decodeSecret))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/podio/podio.go b/pkg/detectors/podio/podio.goindex 87c9390cb..a2aef0591 100644--- a/pkg/detectors/podio/podio.go+++ b/pkg/detectors/podio/podio.go@@ -3,10 +3,11 @@ package podioimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/pollsapi/pollsapi.go b/pkg/detectors/pollsapi/pollsapi.goindex 6d0c92319..34c0abcac 100644--- a/pkg/detectors/pollsapi/pollsapi.go+++ b/pkg/detectors/pollsapi/pollsapi.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("api-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/poloniex/poloniex.go b/pkg/detectors/poloniex/poloniex.goindex 584bafb14..5215b8df5 100644--- a/pkg/detectors/poloniex/poloniex.go+++ b/pkg/detectors/poloniex/poloniex.go@@ -5,13 +5,14 @@ import ("crypto/hmac""crypto/sha512""encoding/hex"- regexp "github.com/wasilibs/go-re2""net/http""net/url""strconv""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -80,7 +81,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Sign", signature)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/polygon/polygon.go b/pkg/detectors/polygon/polygon.goindex c206fc309..5f2794b5b 100644--- a/pkg/detectors/polygon/polygon.go+++ b/pkg/detectors/polygon/polygon.go@@ -2,10 +2,11 @@ package polygonimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/portainer/portainer.go b/pkg/detectors/portainer/portainer.goindex d40a99da1..11b7ad073 100644--- a/pkg/detectors/portainer/portainer.go+++ b/pkg/detectors/portainer/portainer.go@@ -75,7 +75,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 || res.StatusCode == 403 {diff --git a/pkg/detectors/portainertoken/portainertoken.go b/pkg/detectors/portainertoken/portainertoken.goindex 539473799..2f706141f 100644--- a/pkg/detectors/portainertoken/portainertoken.go+++ b/pkg/detectors/portainertoken/portainertoken.go@@ -79,7 +79,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/positionstack/positionstack.go b/pkg/detectors/positionstack/positionstack.goindex 6e0c3af08..6b1695ff0 100644--- a/pkg/detectors/positionstack/positionstack.go+++ b/pkg/detectors/positionstack/positionstack.go@@ -3,10 +3,11 @@ package positionstackimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/postageapp/postageapp.go b/pkg/detectors/postageapp/postageapp.goindex 8f2935215..79cf4481d 100644--- a/pkg/detectors/postageapp/postageapp.go+++ b/pkg/detectors/postageapp/postageapp.go@@ -2,10 +2,11 @@ package postageappimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Transfer-Encoding", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/postbacks/postbacks.go b/pkg/detectors/postbacks/postbacks.goindex 341468a80..d09d3843f 100644--- a/pkg/detectors/postbacks/postbacks.go+++ b/pkg/detectors/postbacks/postbacks.go@@ -2,11 +2,12 @@ package postbacksimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -57,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Postbacks-Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/postgres/postgres.go b/pkg/detectors/postgres/postgres.goindex 3474e370e..ab7990f87 100644--- a/pkg/detectors/postgres/postgres.go+++ b/pkg/detectors/postgres/postgres.go@@ -278,7 +278,7 @@ func verifyPostgres(params map[string]string) (bool, error) {if err != nil {return false, err}- defer db.Close()+ defer func() { _ = db.Close() }()err = db.Ping()switch {diff --git a/pkg/detectors/posthog/posthog.go b/pkg/detectors/posthog/posthog.goindex 20048b05c..f8920d482 100644--- a/pkg/detectors/posthog/posthog.go+++ b/pkg/detectors/posthog/posthog.go@@ -57,14 +57,14 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {// Try EU Endpoint only if other one fails.res, err := client.Do(reqEU)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/postman/postman.go b/pkg/detectors/postman/postman.goindex 954dc1da3..3e7a217ef 100644--- a/pkg/detectors/postman/postman.go+++ b/pkg/detectors/postman/postman.go@@ -80,7 +80,7 @@ func verifyPostman(ctx context.Context, client *http.Client, token string) (boolif err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/powrbot/powrbot.go b/pkg/detectors/powrbot/powrbot.goindex 9a1a5d8f7..2884d80ca 100644--- a/pkg/detectors/powrbot/powrbot.go+++ b/pkg/detectors/powrbot/powrbot.go@@ -3,10 +3,11 @@ package powrbotimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("secret-key %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/prefect/prefect.go b/pkg/detectors/prefect/prefect.goindex 0d2761eda..1aed862b7 100644--- a/pkg/detectors/prefect/prefect.go+++ b/pkg/detectors/prefect/prefect.go@@ -3,10 +3,11 @@ package prefectimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/privacy/privacy.go b/pkg/detectors/privacy/privacy.goindex da59c9a05..208fb86bf 100644--- a/pkg/detectors/privacy/privacy.go+++ b/pkg/detectors/privacy/privacy.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Set("Authorization", "api-key "+resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/privatekey/privatekey.go b/pkg/detectors/privatekey/privatekey.goindex b02b7cea9..c65d57925 100644--- a/pkg/detectors/privatekey/privatekey.go+++ b/pkg/detectors/privatekey/privatekey.go@@ -222,7 +222,7 @@ func LookupFingerprint(ctx context.Context, publicKeyFingerprintInHex string) (*if err != nil {return nil, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()results := DriftwoodResult{}err = json.NewDecoder(res.Body).Decode(&results)diff --git a/pkg/detectors/privatekey/ssh_integration.go b/pkg/detectors/privatekey/ssh_integration.goindex 5f0a8cbc5..913a1acd8 100644--- a/pkg/detectors/privatekey/ssh_integration.go+++ b/pkg/detectors/privatekey/ssh_integration.go@@ -64,13 +64,13 @@ func firstResponseFromSSH(ctx context.Context, parsedKey any, username, hostport}return "", err}- defer client.Close()+ defer func() { _ = client.Close() }()session, err := client.NewSession()if err != nil {return "", err}- defer session.Close()+ defer func() { _ = session.Close() }()var output bytes.Buffersession.Stderr = &output@@ -93,7 +93,7 @@ func sshDialWithContext(ctx context.Context, network, addr string, config *ssh.Cncc, chans, reqs, err := ssh.NewClientConn(conn, addr, config)if err != nil {- conn.Close()+ _ = conn.Close()return nil, fmt.Errorf("error creating SSH connection to %s: %w", addr, err)}diff --git a/pkg/detectors/prodpad/prodpad.go b/pkg/detectors/prodpad/prodpad.goindex f3d7f6726..b0417a961 100644--- a/pkg/detectors/prodpad/prodpad.go+++ b/pkg/detectors/prodpad/prodpad.go@@ -3,10 +3,11 @@ package prodpadimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/prospectcrm/prospectcrm.go b/pkg/detectors/prospectcrm/prospectcrm.goindex 3ebbbb533..0f26e8c2d 100644--- a/pkg/detectors/prospectcrm/prospectcrm.go+++ b/pkg/detectors/prospectcrm/prospectcrm.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/protocolsio/protocolsio.go b/pkg/detectors/protocolsio/protocolsio.goindex 2e70a028f..a2ef1470b 100644--- a/pkg/detectors/protocolsio/protocolsio.go+++ b/pkg/detectors/protocolsio/protocolsio.go@@ -3,10 +3,11 @@ package protocolsioimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/proxycrawl/proxycrawl.go b/pkg/detectors/proxycrawl/proxycrawl.goindex 842c9f09a..0579a2d5a 100644--- a/pkg/detectors/proxycrawl/proxycrawl.go+++ b/pkg/detectors/proxycrawl/proxycrawl.go@@ -3,11 +3,12 @@ package proxycrawlimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -55,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := detectors.DoWithDedup(client, detector_typepb.DetectorType_ProxyCrawl, resMatch, req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go b/pkg/detectors/pubnubpublishkey/pubnubpublishkey.goindex 281372b32..7229ffd8e 100644--- a/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go+++ b/pkg/detectors/pubnubpublishkey/pubnubpublishkey.go@@ -91,10 +91,10 @@ func verifyPubNub(ctx context.Context, client *http.Client, resMatch, ressubMatcreturn false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {return true, nil- } else if !(res.StatusCode == 400 || res.StatusCode == 403) {+ } else if res.StatusCode != 400 && res.StatusCode != 403 {// 403 is suggested by the API docs (https://www.pubnub.com/docs/sdks/rest-api/send-signal-to-channel)// 400 is what actually seems to be coming back for invalid credentialsreturn false, fmt.Errorf("unexpected HTTP response status %d", res.StatusCode)diff --git a/pkg/detectors/pulumi/pulumi.go b/pkg/detectors/pulumi/pulumi.goindex c727abe1a..cbe9133e0 100644--- a/pkg/detectors/pulumi/pulumi.go+++ b/pkg/detectors/pulumi/pulumi.go@@ -3,10 +3,11 @@ package pulumiimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -55,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("token %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/purestake/purestake.go b/pkg/detectors/purestake/purestake.goindex e6cc2d5e3..8f7855687 100644--- a/pkg/detectors/purestake/purestake.go+++ b/pkg/detectors/purestake/purestake.go@@ -2,10 +2,11 @@ package purestakeimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-api-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/pushbulletapikey/pushbulletapikey.go b/pkg/detectors/pushbulletapikey/pushbulletapikey.goindex f94e8fb1a..d365d4674 100644--- a/pkg/detectors/pushbulletapikey/pushbulletapikey.go+++ b/pkg/detectors/pushbulletapikey/pushbulletapikey.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Access-Token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/pypi/pypi.go b/pkg/detectors/pypi/pypi.goindex 7982041fe..e2746a9c0 100644--- a/pkg/detectors/pypi/pypi.go+++ b/pkg/detectors/pypi/pypi.go@@ -80,7 +80,7 @@ func verifyMatch(ctx context.Context, client *http.Client, token string) (bool,_ = writer.WriteField("content", "dummy-content")// Close the writer to finalize the form- writer.Close()+ _ = writer.Close()// Create a new POST request to the PyPI legacy upload URLreq, err := http.NewRequestWithContext(ctx, http.MethodPost, "https://upload.pypi.org/legacy/", &body)@@ -104,7 +104,8 @@ func verifyMatch(ctx context.Context, client *http.Client, token string) (bool,}()// Check for expected status codes for verification- if res.StatusCode == http.StatusBadRequest {+ switch res.StatusCode {+ case http.StatusBadRequest:verified, err := common.ResponseContainsSubstring(res.Body, "Include at least one message digest.")if err != nil {return false, nil, err@@ -112,7 +113,7 @@ func verifyMatch(ctx context.Context, client *http.Client, token string) (bool,if verified {return true, nil, nil}- } else if res.StatusCode == http.StatusForbidden {+ case http.StatusForbidden:// If we get a 403 status, the key is invalidreturn false, nil, nil}diff --git a/pkg/detectors/rabbitmq/rabbitmq.go b/pkg/detectors/rabbitmq/rabbitmq.goindex af7fcffb2..d4ee7b98e 100644--- a/pkg/detectors/rabbitmq/rabbitmq.go+++ b/pkg/detectors/rabbitmq/rabbitmq.go@@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultDetectorType: detector_typepb.DetectorType_RabbitMQ,Raw: []byte(urlMatch),SecretParts: map[string]string{"key": urlMatch},- Redacted: strings.TrimSpace(strings.Replace(parsedURL.String(), password, "********", -1)),+ Redacted: strings.TrimSpace(strings.ReplaceAll(parsedURL.String(), password, "********")),}if verify {diff --git a/pkg/detectors/railwayapp/railwayapp.go b/pkg/detectors/railwayapp/railwayapp.goindex d0f61bca4..b964c8b07 100644--- a/pkg/detectors/railwayapp/railwayapp.go+++ b/pkg/detectors/railwayapp/railwayapp.go@@ -119,7 +119,7 @@ func verifyRailwayApp(ctx context.Context, client *http.Client, match string) (bif err != nil {return false, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()/*GraphQL queries return response with 200 OK status code even for errorsdiff --git a/pkg/detectors/ramp/ramp.go b/pkg/detectors/ramp/ramp.goindex a4d6a3df6..b9599d468 100644--- a/pkg/detectors/ramp/ramp.go+++ b/pkg/detectors/ramp/ramp.go@@ -78,7 +78,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Set("Content-Type", "application/x-www-form-urlencoded")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/rapidapi/rapidapi.go b/pkg/detectors/rapidapi/rapidapi.goindex 5f9bfdcd4..f3378cece 100644--- a/pkg/detectors/rapidapi/rapidapi.go+++ b/pkg/detectors/rapidapi/rapidapi.go@@ -2,10 +2,11 @@ package rapidapiimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-rapidapi-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/raven/raven.go b/pkg/detectors/raven/raven.goindex 4e05da246..a59a84511 100644--- a/pkg/detectors/raven/raven.go+++ b/pkg/detectors/raven/raven.go@@ -4,11 +4,12 @@ import ("context""encoding/json""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -58,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err != nil {continue}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if json.Valid(bodyBytes) {s1.Verified = truediff --git a/pkg/detectors/rawg/rawg.go b/pkg/detectors/rawg/rawg.goindex c2f89615d..9b63105a4 100644--- a/pkg/detectors/rawg/rawg.go+++ b/pkg/detectors/rawg/rawg.go@@ -2,10 +2,11 @@ package rawgimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/razorpay/razorpay.go b/pkg/detectors/razorpay/razorpay.goindex 10cdf4849..d9323fa2d 100644--- a/pkg/detectors/razorpay/razorpay.go+++ b/pkg/detectors/razorpay/razorpay.go@@ -68,7 +68,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err != nil {continue}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if json.Valid(bodyBytes) {s1.Verified = truediff --git a/pkg/detectors/reachmail/reachmail.go b/pkg/detectors/reachmail/reachmail.goindex f4797ea95..7468327ff 100644--- a/pkg/detectors/reachmail/reachmail.go+++ b/pkg/detectors/reachmail/reachmail.go@@ -3,10 +3,11 @@ package reachmailimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -55,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/readme/readme.go b/pkg/detectors/readme/readme.goindex 12a286017..da87e4001 100644--- a/pkg/detectors/readme/readme.go+++ b/pkg/detectors/readme/readme.go@@ -2,10 +2,11 @@ package readmeimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb")@@ -50,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("accept", "application/json")res, err := http.DefaultClient.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/reallysimplesystems/reallysimplesystems.go b/pkg/detectors/reallysimplesystems/reallysimplesystems.goindex ea7506c5e..d5835289d 100644--- a/pkg/detectors/reallysimplesystems/reallysimplesystems.go+++ b/pkg/detectors/reallysimplesystems/reallysimplesystems.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err != nil {continue}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if json.Valid(bodyBytes) {s1.Verified = truediff --git a/pkg/detectors/rebrandly/rebrandly.go b/pkg/detectors/rebrandly/rebrandly.goindex 7ce567e42..d830943bc 100644--- a/pkg/detectors/rebrandly/rebrandly.go+++ b/pkg/detectors/rebrandly/rebrandly.go@@ -2,10 +2,11 @@ package rebrandlyimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("apikey", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/rechargepayments/rechargepayments.go b/pkg/detectors/rechargepayments/rechargepayments.goindex 6cf5282ae..f6e2c2225 100644--- a/pkg/detectors/rechargepayments/rechargepayments.go+++ b/pkg/detectors/rechargepayments/rechargepayments.go@@ -2,9 +2,10 @@ package rechargepaymentsimport ("context"- regexp "github.com/wasilibs/go-re2""net/http"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -57,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Recharge-Access-Token", token)res, err := client.Do(req)if err == nil {- res.Body.Close() // The request body is unused.+ _ = res.Body.Close() // The request body is unused.if res.StatusCode == http.StatusOK {result.Verified = truediff --git a/pkg/detectors/redis/redis.go b/pkg/detectors/redis/redis.goindex 4c4c39f73..35f19659a 100644--- a/pkg/detectors/redis/redis.go+++ b/pkg/detectors/redis/redis.go@@ -56,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultcontinue}- redact := strings.TrimSpace(strings.Replace(urlMatch, password, "*******", -1))+ redact := strings.TrimSpace(strings.ReplaceAll(urlMatch, password, "*******"))s := detectors.Result{DetectorType: detector_typepb.DetectorType_Redis,@@ -99,7 +99,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultcontinue}- redact := strings.TrimSpace(strings.Replace(urlMatch, password, "*******", -1))+ redact := strings.TrimSpace(strings.ReplaceAll(urlMatch, password, "*******"))s := detectors.Result{DetectorType: detector_typepb.DetectorType_Redis,diff --git a/pkg/detectors/refiner/refiner.go b/pkg/detectors/refiner/refiner.goindex a226cbdea..c7f689bb4 100644--- a/pkg/detectors/refiner/refiner.go+++ b/pkg/detectors/refiner/refiner.go@@ -3,10 +3,11 @@ package refinerimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -55,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/rentman/rentman.go b/pkg/detectors/rentman/rentman.goindex d24294923..fc0464233 100644--- a/pkg/detectors/rentman/rentman.go+++ b/pkg/detectors/rentman/rentman.go@@ -3,10 +3,11 @@ package rentmanimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/repairshopr/repairshopr.go b/pkg/detectors/repairshopr/repairshopr.goindex 203096388..5bdf9a3e9 100644--- a/pkg/detectors/repairshopr/repairshopr.go+++ b/pkg/detectors/repairshopr/repairshopr.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/replicate/replicate.go b/pkg/detectors/replicate/replicate.goindex 04ba7298e..68923d5d7 100644--- a/pkg/detectors/replicate/replicate.go+++ b/pkg/detectors/replicate/replicate.go@@ -3,10 +3,11 @@ package replicateimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/replyio/replyio.go b/pkg/detectors/replyio/replyio.goindex b0740ae00..8fff1e3ff 100644--- a/pkg/detectors/replyio/replyio.go+++ b/pkg/detectors/replyio/replyio.go@@ -3,10 +3,11 @@ package replyioimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -55,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Api-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/requestfinance/requestfinance.go b/pkg/detectors/requestfinance/requestfinance.goindex 4f10dbd24..4216cd8f2 100644--- a/pkg/detectors/requestfinance/requestfinance.go+++ b/pkg/detectors/requestfinance/requestfinance.go@@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go b/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.goindex 8f9ec60f6..f73545086 100644--- a/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go+++ b/pkg/detectors/restpackhtmltopdfapi/restpackhtmltopdfapi.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Access-Token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go b/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.goindex c4e4652de..4f0bfcbd1 100644--- a/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go+++ b/pkg/detectors/restpackscreenshotapi/restpackscreenshotapi.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Access-Token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/rev/rev.go b/pkg/detectors/rev/rev.goindex 27e7e93c6..a6628b293 100644--- a/pkg/detectors/rev/rev.go+++ b/pkg/detectors/rev/rev.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Rev %s:%s", resClientMatch, resUserMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/revampcrm/revampcrm.go b/pkg/detectors/revampcrm/revampcrm.goindex 2e4088344..844b17158 100644--- a/pkg/detectors/revampcrm/revampcrm.go+++ b/pkg/detectors/revampcrm/revampcrm.go@@ -2,10 +2,11 @@ package revampcrmimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -59,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(userPatMatch, tokenPatMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/ringcentral/ringcentral.go b/pkg/detectors/ringcentral/ringcentral.goindex 75d7026a9..43a2adf31 100644--- a/pkg/detectors/ringcentral/ringcentral.go+++ b/pkg/detectors/ringcentral/ringcentral.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/ritekit/ritekit.go b/pkg/detectors/ritekit/ritekit.goindex 692a47388..18b0288d4 100644--- a/pkg/detectors/ritekit/ritekit.go+++ b/pkg/detectors/ritekit/ritekit.go@@ -3,10 +3,11 @@ package ritekitimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/roaring/roaring.go b/pkg/detectors/roaring/roaring.goindex e6b3b2b7c..6ac68f33b 100644--- a/pkg/detectors/roaring/roaring.go+++ b/pkg/detectors/roaring/roaring.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -68,7 +69,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/rocketreach/rocketreach.go b/pkg/detectors/rocketreach/rocketreach.goindex 4db1d9250..b57e5c991 100644--- a/pkg/detectors/rocketreach/rocketreach.go+++ b/pkg/detectors/rocketreach/rocketreach.go@@ -2,10 +2,11 @@ package rocketreachimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Api-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/rootly/rootly.go b/pkg/detectors/rootly/rootly.goindex 524305a14..aa3283250 100644--- a/pkg/detectors/rootly/rootly.go+++ b/pkg/detectors/rootly/rootly.go@@ -72,7 +72,7 @@ func verifyMatch(ctx context.Context, client *http.Client, token string) (bool,if err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK, http.StatusNotFound:diff --git a/pkg/detectors/route4me/route4me.go b/pkg/detectors/route4me/route4me.goindex 696576561..b6de75caa 100644--- a/pkg/detectors/route4me/route4me.go+++ b/pkg/detectors/route4me/route4me.go@@ -2,10 +2,11 @@ package route4meimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/rownd/rownd.go b/pkg/detectors/rownd/rownd.goindex 98999f9b3..a65c0622f 100644--- a/pkg/detectors/rownd/rownd.go+++ b/pkg/detectors/rownd/rownd.go@@ -2,10 +2,11 @@ package rowndimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -70,7 +71,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-rownd-app-secret", secretMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/rubygems/rubygems.go b/pkg/detectors/rubygems/rubygems.goindex d7dacbce9..f8ab04210 100644--- a/pkg/detectors/rubygems/rubygems.go+++ b/pkg/detectors/rubygems/rubygems.go@@ -2,10 +2,11 @@ package rubygemsimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 || res.StatusCode == http.StatusForbidden {s1.Verified = true}diff --git a/pkg/detectors/runrunit/runrunit.go b/pkg/detectors/runrunit/runrunit.goindex 365e3f8bd..6fce3c8d3 100644--- a/pkg/detectors/runrunit/runrunit.go+++ b/pkg/detectors/runrunit/runrunit.go@@ -2,10 +2,11 @@ package runrunitimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -60,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("User-Token", resUserTokenMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/salesblink/salesblink.go b/pkg/detectors/salesblink/salesblink.goindex 5dfac3d26..771af9669 100644--- a/pkg/detectors/salesblink/salesblink.go+++ b/pkg/detectors/salesblink/salesblink.go@@ -2,10 +2,11 @@ package salesblinkimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/salescookie/salescookie.go b/pkg/detectors/salescookie/salescookie.goindex b30af186c..eb68e8dec 100644--- a/pkg/detectors/salescookie/salescookie.go+++ b/pkg/detectors/salescookie/salescookie.go@@ -2,10 +2,11 @@ package salescookieimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/salesflare/salesflare.go b/pkg/detectors/salesflare/salesflare.goindex 41b6ebdd3..af0fbf2be 100644--- a/pkg/detectors/salesflare/salesflare.go+++ b/pkg/detectors/salesflare/salesflare.go@@ -3,10 +3,11 @@ package salesflareimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/salesforce/salesforce.go b/pkg/detectors/salesforce/salesforce.goindex d9d88dd25..89ca42861 100644--- a/pkg/detectors/salesforce/salesforce.go+++ b/pkg/detectors/salesforce/salesforce.go@@ -82,7 +82,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultverifiedBodyResponse, err := common.ResponseContainsSubstring(res.Body, "records")- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 && verifiedBodyResponse {s1.Verified = true} else if res.StatusCode >= 200 && res.StatusCode < 300 && !verifiedBodyResponse {diff --git a/pkg/detectors/salesmate/salesmate.go b/pkg/detectors/salesmate/salesmate.goindex 1bdadef1d..582e33492 100644--- a/pkg/detectors/salesmate/salesmate.go+++ b/pkg/detectors/salesmate/salesmate.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("sessionToken", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/satismeterwritekey/satismeterwritekey_test.go b/pkg/detectors/satismeterwritekey/satismeterwritekey_test.goindex 6ab32f061..8b2f1a915 100644--- a/pkg/detectors/satismeterwritekey/satismeterwritekey_test.go+++ b/pkg/detectors/satismeterwritekey/satismeterwritekey_test.go@@ -33,7 +33,7 @@ var (// Perform the requestclient := &http.Client{}resp, _ := client.Do(req)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()// Check response statusif resp.StatusCode == http.StatusNoContent {diff --git a/pkg/detectors/scalewaykey/scalewaykey.go b/pkg/detectors/scalewaykey/scalewaykey.goindex e6fd1189d..b9eb69217 100644--- a/pkg/detectors/scalewaykey/scalewaykey.go+++ b/pkg/detectors/scalewaykey/scalewaykey.go@@ -2,10 +2,11 @@ package scalewaykeyimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Auth-Token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/scalr/scalr.go b/pkg/detectors/scalr/scalr.goindex e4ef42b8f..283d72671 100644--- a/pkg/detectors/scalr/scalr.go+++ b/pkg/detectors/scalr/scalr.go@@ -3,10 +3,11 @@ package scalrimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -61,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Prefer", "profile=preview")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/scrapeowl/scrapeowl.go b/pkg/detectors/scrapeowl/scrapeowl.goindex a18329bcd..c515d2264 100644--- a/pkg/detectors/scrapeowl/scrapeowl.go+++ b/pkg/detectors/scrapeowl/scrapeowl.go@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/scraperapi/scraperapi.go b/pkg/detectors/scraperapi/scraperapi.goindex 96f93691f..e291a3147 100644--- a/pkg/detectors/scraperapi/scraperapi.go+++ b/pkg/detectors/scraperapi/scraperapi.go@@ -3,11 +3,12 @@ package scraperapiimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/scraperbox/scraperbox.go b/pkg/detectors/scraperbox/scraperbox.goindex 4a12dbad6..65f9e8220 100644--- a/pkg/detectors/scraperbox/scraperbox.go+++ b/pkg/detectors/scraperbox/scraperbox.go@@ -3,11 +3,12 @@ package scraperboximport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -55,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/scrapestack/scrapestack.go b/pkg/detectors/scrapestack/scrapestack.goindex 50c03e419..adf909b4d 100644--- a/pkg/detectors/scrapestack/scrapestack.go+++ b/pkg/detectors/scrapestack/scrapestack.go@@ -3,11 +3,12 @@ package scrapestackimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -57,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `html`) || strings.Contains(bodyString, `"info":"Access Restricted - Your current Subscription Plan does not support HTTPS Encryption."`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/scrapfly/scrapfly.go b/pkg/detectors/scrapfly/scrapfly.goindex 780f71963..92dc9f9f8 100644--- a/pkg/detectors/scrapfly/scrapfly.go+++ b/pkg/detectors/scrapfly/scrapfly.go@@ -3,11 +3,12 @@ package scrapflyimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -59,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/scrapingant/scrapingant.go b/pkg/detectors/scrapingant/scrapingant.goindex 75fade77e..312aec86b 100644--- a/pkg/detectors/scrapingant/scrapingant.go+++ b/pkg/detectors/scrapingant/scrapingant.go@@ -89,11 +89,12 @@ func verifyScrapingAnt(ctx context.Context, client *http.Client, apiKey string)_ = resp.Body.Close()}()- if resp.StatusCode == http.StatusOK {+ switch resp.StatusCode {+ case http.StatusOK:return true, nil- } else if resp.StatusCode == http.StatusUnauthorized || resp.StatusCode == http.StatusForbidden {+ case http.StatusUnauthorized, http.StatusForbidden:return false, nil- } else {+ default:return false, fmt.Errorf("unexpected status code: %d", resp.StatusCode)}}diff --git a/pkg/detectors/screenshotapi/screenshotapi.go b/pkg/detectors/screenshotapi/screenshotapi.goindex d4df2c733..8d10a2b0c 100644--- a/pkg/detectors/screenshotapi/screenshotapi.go+++ b/pkg/detectors/screenshotapi/screenshotapi.go@@ -3,11 +3,12 @@ package screenshotapiimport ("context""encoding/json"- regexp "github.com/wasilibs/go-re2""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -59,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()var r responseif err := json.NewDecoder(res.Body).Decode(&r); err != nil {s1.SetVerificationError(err, resMatch)diff --git a/pkg/detectors/screenshotlayer/screenshotlayer.go b/pkg/detectors/screenshotlayer/screenshotlayer.goindex 346124a69..6c98c8b5b 100644--- a/pkg/detectors/screenshotlayer/screenshotlayer.go+++ b/pkg/detectors/screenshotlayer/screenshotlayer.go@@ -3,12 +3,13 @@ package screenshotlayerimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -58,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `PNG`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/scrutinizerci/scrutinizerci.go b/pkg/detectors/scrutinizerci/scrutinizerci.goindex 61ab7ff46..4c32c7c1b 100644--- a/pkg/detectors/scrutinizerci/scrutinizerci.go+++ b/pkg/detectors/scrutinizerci/scrutinizerci.go@@ -2,10 +2,11 @@ package scrutinizerciimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/securitytrails/securitytrails.go b/pkg/detectors/securitytrails/securitytrails.goindex d3faffc7a..a8bf7f8be 100644--- a/pkg/detectors/securitytrails/securitytrails.go+++ b/pkg/detectors/securitytrails/securitytrails.go@@ -2,10 +2,11 @@ package securitytrailsimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("APIKEY", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/segmentapikey/segmentapikey.go b/pkg/detectors/segmentapikey/segmentapikey.goindex e7c3c92fb..935b43ada 100644--- a/pkg/detectors/segmentapikey/segmentapikey.go+++ b/pkg/detectors/segmentapikey/segmentapikey.go@@ -3,10 +3,11 @@ package segmentapikeyimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/selectpdf/selectpdf.go b/pkg/detectors/selectpdf/selectpdf.goindex 400b7f6b5..e456b9ef7 100644--- a/pkg/detectors/selectpdf/selectpdf.go+++ b/pkg/detectors/selectpdf/selectpdf.go@@ -3,11 +3,12 @@ package selectpdfimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -55,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/semaphore/semaphore.go b/pkg/detectors/semaphore/semaphore.goindex 874c36b24..049ed987c 100644--- a/pkg/detectors/semaphore/semaphore.go+++ b/pkg/detectors/semaphore/semaphore.go@@ -3,11 +3,12 @@ package semaphoreimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -58,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Accept", "application/vnd.semaphore+json; version=3")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/sendbird/sendbird.go b/pkg/detectors/sendbird/sendbird.goindex 3785de53e..026cff7a7 100644--- a/pkg/detectors/sendbird/sendbird.go+++ b/pkg/detectors/sendbird/sendbird.go@@ -4,10 +4,11 @@ import ("context""encoding/json""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -75,7 +76,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 400 { // Sendbird returns 400 for all errorsdiff --git a/pkg/detectors/sendbirdorganizationapi/sendbirdorganizationapi.go b/pkg/detectors/sendbirdorganizationapi/sendbirdorganizationapi.goindex 10b265e98..f0e3e320b 100644--- a/pkg/detectors/sendbirdorganizationapi/sendbirdorganizationapi.go+++ b/pkg/detectors/sendbirdorganizationapi/sendbirdorganizationapi.go@@ -63,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err != nil {s1.SetVerificationError(err, resMatch)} else {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode != http.StatusForbidden {diff --git a/pkg/detectors/sendinbluev2/sendinbluev2.go b/pkg/detectors/sendinbluev2/sendinbluev2.goindex 63508b2ea..fb16ed94d 100644--- a/pkg/detectors/sendinbluev2/sendinbluev2.go+++ b/pkg/detectors/sendinbluev2/sendinbluev2.go@@ -2,10 +2,11 @@ package sendinbluev2import ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("api-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/serphouse/serphouse.go b/pkg/detectors/serphouse/serphouse.goindex 772e0470f..1832f4e39 100644--- a/pkg/detectors/serphouse/serphouse.go+++ b/pkg/detectors/serphouse/serphouse.go@@ -3,10 +3,11 @@ package serphouseimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/serpstack/serpstack.go b/pkg/detectors/serpstack/serpstack.goindex 79c905ae0..65ea2cbf0 100644--- a/pkg/detectors/serpstack/serpstack.go+++ b/pkg/detectors/serpstack/serpstack.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `search_url`) || strings.Contains(bodyString, `"info":"Access Restricted - Your current Subscription Plan does not support HTTPS Encryption."`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/sheety/sheety.go b/pkg/detectors/sheety/sheety.goindex 46f409a52..13bb3f20a 100644--- a/pkg/detectors/sheety/sheety.go+++ b/pkg/detectors/sheety/sheety.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/sherpadesk/sherpadesk.go b/pkg/detectors/sherpadesk/sherpadesk.goindex 0ec99b5a3..ff9e1f91f 100644--- a/pkg/detectors/sherpadesk/sherpadesk.go+++ b/pkg/detectors/sherpadesk/sherpadesk.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -57,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/shipday/shipday.go b/pkg/detectors/shipday/shipday.goindex 82434b87a..e1e0796ed 100644--- a/pkg/detectors/shipday/shipday.go+++ b/pkg/detectors/shipday/shipday.go@@ -3,10 +3,11 @@ package shipdayimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/shodankey/shodankey.go b/pkg/detectors/shodankey/shodankey.goindex 1b56b3586..ffd38ee48 100644--- a/pkg/detectors/shodankey/shodankey.go+++ b/pkg/detectors/shodankey/shodankey.go@@ -3,11 +3,12 @@ package shodankeyimport ("context""encoding/json"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -81,7 +82,7 @@ func verifyToken(ctx context.Context, client *http.Client, token string) bool {if err != nil {return false}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode < 200 || res.StatusCode >= 300 {return falsediff --git a/pkg/detectors/shopify/shopify.go b/pkg/detectors/shopify/shopify.goindex 467d2440b..ceee223f1 100644--- a/pkg/detectors/shopify/shopify.go+++ b/pkg/detectors/shopify/shopify.go@@ -82,7 +82,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result"access_scopes": strings.Join(handleArray, ","),}}- res.Body.Close()+ _ = res.Body.Close()}}}diff --git a/pkg/detectors/shotstack/shotstack.go b/pkg/detectors/shotstack/shotstack.goindex 3735ca167..d4a8bf511 100644--- a/pkg/detectors/shotstack/shotstack.go+++ b/pkg/detectors/shotstack/shotstack.go@@ -2,10 +2,11 @@ package shotstackimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -84,7 +85,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-api-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/shutterstock/shutterstock.go b/pkg/detectors/shutterstock/shutterstock.goindex cdd6f116b..3e1abccdf 100644--- a/pkg/detectors/shutterstock/shutterstock.go+++ b/pkg/detectors/shutterstock/shutterstock.go@@ -2,10 +2,11 @@ package shutterstockimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -60,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(resMatch, resSecretMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/shutterstockoauth/shutterstockoauth.go b/pkg/detectors/shutterstockoauth/shutterstockoauth.goindex 61937ec45..4f955088a 100644--- a/pkg/detectors/shutterstockoauth/shutterstockoauth.go+++ b/pkg/detectors/shutterstockoauth/shutterstockoauth.go@@ -55,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/signable/signable.go b/pkg/detectors/signable/signable.goindex cf10728ba..4c6b5da0d 100644--- a/pkg/detectors/signable/signable.go+++ b/pkg/detectors/signable/signable.go@@ -99,7 +99,7 @@ func verifyResult(ctx context.Context, client *http.Client, token string) (bool,return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {return true, nil}diff --git a/pkg/detectors/signalwire/signalwire.go b/pkg/detectors/signalwire/signalwire.goindex 87ce6eae2..1e86e714d 100644--- a/pkg/detectors/signalwire/signalwire.go+++ b/pkg/detectors/signalwire/signalwire.go@@ -69,7 +69,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/signaturit/signaturit.go b/pkg/detectors/signaturit/signaturit.goindex e941bc4a3..a51327987 100644--- a/pkg/detectors/signaturit/signaturit.go+++ b/pkg/detectors/signaturit/signaturit.go@@ -3,10 +3,11 @@ package signaturitimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/signupgenius/signupgenius.go b/pkg/detectors/signupgenius/signupgenius.goindex 0c1dc4370..afe61c142 100644--- a/pkg/detectors/signupgenius/signupgenius.go+++ b/pkg/detectors/signupgenius/signupgenius.go@@ -2,10 +2,11 @@ package signupgeniusimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/sigopt/sigopt.go b/pkg/detectors/sigopt/sigopt.goindex 68d7c176d..120385557 100644--- a/pkg/detectors/sigopt/sigopt.go+++ b/pkg/detectors/sigopt/sigopt.go@@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/simfin/simfin.go b/pkg/detectors/simfin/simfin.goindex 8a079ac2a..687be6b81 100644--- a/pkg/detectors/simfin/simfin.go+++ b/pkg/detectors/simfin/simfin.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}bodyString := string(bodyBytes)validResponse := !strings.Contains(bodyString, `"error"`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 && validResponse {s1.Verified = true}diff --git a/pkg/detectors/simplesat/simplesat.go b/pkg/detectors/simplesat/simplesat.goindex d5ea5f216..4ba46e532 100644--- a/pkg/detectors/simplesat/simplesat.go+++ b/pkg/detectors/simplesat/simplesat.go@@ -2,10 +2,11 @@ package simplesatimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Simplesat-Token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/simplynoted/simplynoted.go b/pkg/detectors/simplynoted/simplynoted.goindex fca259feb..f7c987f89 100644--- a/pkg/detectors/simplynoted/simplynoted.go+++ b/pkg/detectors/simplynoted/simplynoted.go@@ -3,10 +3,11 @@ package simplynotedimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/simvoly/simvoly.go b/pkg/detectors/simvoly/simvoly.goindex b4ba6fcb2..d8f891a24 100644--- a/pkg/detectors/simvoly/simvoly.go+++ b/pkg/detectors/simvoly/simvoly.go@@ -3,10 +3,11 @@ package simvolyimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/sinchmessage/sinchmessage.go b/pkg/detectors/sinchmessage/sinchmessage.goindex b1f840558..0d6516f0c 100644--- a/pkg/detectors/sinchmessage/sinchmessage.go+++ b/pkg/detectors/sinchmessage/sinchmessage.go@@ -3,10 +3,11 @@ package sinchmessageimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -66,7 +67,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/sirv/sirv.go b/pkg/detectors/sirv/sirv.goindex 21f135bbb..12cdfa93a 100644--- a/pkg/detectors/sirv/sirv.go+++ b/pkg/detectors/sirv/sirv.go@@ -3,11 +3,12 @@ package sirvimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -64,7 +65,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/siteleaf/siteleaf.go b/pkg/detectors/siteleaf/siteleaf.goindex f53d506af..d8a3544ee 100644--- a/pkg/detectors/siteleaf/siteleaf.go+++ b/pkg/detectors/siteleaf/siteleaf.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -65,7 +66,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/skrappio/skrappio.go b/pkg/detectors/skrappio/skrappio.goindex 500c98f0d..f248d20df 100644--- a/pkg/detectors/skrappio/skrappio.go+++ b/pkg/detectors/skrappio/skrappio.go@@ -2,10 +2,11 @@ package skrappioimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Access-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/slack/slack.go b/pkg/detectors/slack/slack.goindex 1eaa0055d..2f85716a7 100644--- a/pkg/detectors/slack/slack.go+++ b/pkg/detectors/slack/slack.go@@ -83,7 +83,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()var authResponse authResif err := json.NewDecoder(res.Body).Decode(&authResponse); err != nil {err = fmt.Errorf("failed to decode auth response: %w", err)diff --git a/pkg/detectors/slackwebhook/slackwebhook.go b/pkg/detectors/slackwebhook/slackwebhook.goindex c81c33fc1..1f5800d8a 100644--- a/pkg/detectors/slackwebhook/slackwebhook.go+++ b/pkg/detectors/slackwebhook/slackwebhook.go@@ -73,13 +73,13 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continue}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch {case res.StatusCode >= http.StatusOK && res.StatusCode < http.StatusMultipleChoices:diff --git a/pkg/detectors/smartystreets/smartystreets.go b/pkg/detectors/smartystreets/smartystreets.goindex 4e7228f72..9cea9e764 100644--- a/pkg/detectors/smartystreets/smartystreets.go+++ b/pkg/detectors/smartystreets/smartystreets.go@@ -3,10 +3,11 @@ package smartystreetsimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -59,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/smooch/smooch.go b/pkg/detectors/smooch/smooch.goindex 85209aecc..5a2dd9db2 100644--- a/pkg/detectors/smooch/smooch.go+++ b/pkg/detectors/smooch/smooch.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -68,7 +69,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/snipcart/snipcart.go b/pkg/detectors/snipcart/snipcart.goindex ebcb57334..ba9b8432a 100644--- a/pkg/detectors/snipcart/snipcart.go+++ b/pkg/detectors/snipcart/snipcart.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -57,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/snowflake/snowflake.go b/pkg/detectors/snowflake/snowflake.goindex 7466baf04..1b559eb8a 100644--- a/pkg/detectors/snowflake/snowflake.go+++ b/pkg/detectors/snowflake/snowflake.go@@ -173,7 +173,7 @@ func verifyMatch(ctx context.Context, account, username, password string) (bool,if err != nil {return false, fmt.Errorf("failed to send request: %w", err)}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()body, err := io.ReadAll(resp.Body)if err != nil {diff --git a/pkg/detectors/snykkey/snykkey.go b/pkg/detectors/snykkey/snykkey.goindex afe4afdd6..3ae0995cf 100644--- a/pkg/detectors/snykkey/snykkey.go+++ b/pkg/detectors/snykkey/snykkey.go@@ -80,7 +80,8 @@ func (s Scanner) doVerification(ctx context.Context, token string) (bool, map[st_, _ = io.Copy(io.Discard, res.Body)_ = res.Body.Close()}()- if res.StatusCode == http.StatusOK {+ switch res.StatusCode {+ case http.StatusOK:userDetails := userDetailsResponse{}err := json.NewDecoder(res.Body).Decode(&userDetails)if err != nil {@@ -103,10 +104,10 @@ func (s Scanner) doVerification(ctx context.Context, token string) (bool, map[stextraData["Organizations"] = strings.Join(orgs, ",")}return true, extraData, nil- } else if res.StatusCode == http.StatusUnauthorized {+ case http.StatusUnauthorized:// The secret is determinately not verified (nothing to do)return false, nil, nil- } else {+ default:err = fmt.Errorf("unexpected HTTP response status %d", res.StatusCode)return false, nil, err}diff --git a/pkg/detectors/sourcegraph/sourcegraph.go b/pkg/detectors/sourcegraph/sourcegraph.goindex dd9576fb8..ee2fd2544 100644--- a/pkg/detectors/sourcegraph/sourcegraph.go+++ b/pkg/detectors/sourcegraph/sourcegraph.go@@ -66,7 +66,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = truediff --git a/pkg/detectors/sourcegraphcody/sourcegraphcody.go b/pkg/detectors/sourcegraphcody/sourcegraphcody.goindex b26882d05..304e0aebc 100644--- a/pkg/detectors/sourcegraphcody/sourcegraphcody.go+++ b/pkg/detectors/sourcegraphcody/sourcegraphcody.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 403 || res.StatusCode == 401 {diff --git a/pkg/detectors/sparkpost/sparkpost.go b/pkg/detectors/sparkpost/sparkpost.goindex d5e39e1fd..b6e2f8fe3 100644--- a/pkg/detectors/sparkpost/sparkpost.go+++ b/pkg/detectors/sparkpost/sparkpost.go@@ -2,10 +2,11 @@ package sparkpostimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/speechtextai/speechtextai.go b/pkg/detectors/speechtextai/speechtextai.goindex c090483c5..71419880c 100644--- a/pkg/detectors/speechtextai/speechtextai.go+++ b/pkg/detectors/speechtextai/speechtextai.go@@ -3,10 +3,11 @@ package speechtextaiimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -56,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go b/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.goindex a15becbae..3c6b13da1 100644--- a/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go+++ b/pkg/detectors/splunkobservabilitytoken/splunkobservabilitytoken.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Set("X-Sf-Token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/spoonacular/spoonacular.go b/pkg/detectors/spoonacular/spoonacular.goindex ee383d620..45867a66d 100644--- a/pkg/detectors/spoonacular/spoonacular.go+++ b/pkg/detectors/spoonacular/spoonacular.go@@ -3,10 +3,11 @@ package spoonacularimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/sportsmonk/sportsmonk.go b/pkg/detectors/sportsmonk/sportsmonk.goindex 63fe85e66..5d8894e52 100644--- a/pkg/detectors/sportsmonk/sportsmonk.go+++ b/pkg/detectors/sportsmonk/sportsmonk.go@@ -2,10 +2,11 @@ package sportsmonkimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/sqlserver/sqlserver.go b/pkg/detectors/sqlserver/sqlserver.goindex 220974d8f..5466578f1 100644--- a/pkg/detectors/sqlserver/sqlserver.go+++ b/pkg/detectors/sqlserver/sqlserver.go@@ -138,7 +138,7 @@ var ping = func(ctx context.Context, config msdsn.Config) (bool, error) {if err != nil {return false, err}- defer tcpConn.Close()+ defer func() { _ = tcpConn.Close() }()cleanConfig := msdsn.Config{}cleanConfig.Host = config.Hostdiff --git a/pkg/detectors/square/square.go b/pkg/detectors/square/square.goindex 7f47b26e2..74e193e94 100644--- a/pkg/detectors/square/square.go+++ b/pkg/detectors/square/square.go@@ -70,7 +70,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result// req.Header.Add("Square-Version", "2020-08-12")res, err := client.Do(req)if err == nil {- res.Body.Close() // The request body is unused.+ _ = res.Body.Close() // The request body is unused.// 200 means good key and has `merchants` scope - default allowed by square// 401 is bad keydiff --git a/pkg/detectors/squarespace/squarespace.go b/pkg/detectors/squarespace/squarespace.goindex bad86c3c5..aa37fe2ab 100644--- a/pkg/detectors/squarespace/squarespace.go+++ b/pkg/detectors/squarespace/squarespace.go@@ -3,10 +3,11 @@ package squarespaceimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/sslmate/sslmate.go b/pkg/detectors/sslmate/sslmate.goindex ea931dd98..1075b5e05 100644--- a/pkg/detectors/sslmate/sslmate.go+++ b/pkg/detectors/sslmate/sslmate.go@@ -3,10 +3,11 @@ package sslmateimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/statuscake/statuscake.go b/pkg/detectors/statuscake/statuscake.goindex 0eb8f395e..a65c314ed 100644--- a/pkg/detectors/statuscake/statuscake.go+++ b/pkg/detectors/statuscake/statuscake.go@@ -3,10 +3,11 @@ package statuscakeimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/statuspage/statuspage.go b/pkg/detectors/statuspage/statuspage.goindex bab989d21..df02537e2 100644--- a/pkg/detectors/statuspage/statuspage.go+++ b/pkg/detectors/statuspage/statuspage.go@@ -2,10 +2,11 @@ package statuspageimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/statuspal/statuspal.go b/pkg/detectors/statuspal/statuspal.goindex a7ab099ba..85d3b92a0 100644--- a/pkg/detectors/statuspal/statuspal.go+++ b/pkg/detectors/statuspal/statuspal.go@@ -2,10 +2,11 @@ package statuspalimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/stitchdata/stitchdata.go b/pkg/detectors/stitchdata/stitchdata.goindex dfd5a3f99..fb1814236 100644--- a/pkg/detectors/stitchdata/stitchdata.go+++ b/pkg/detectors/stitchdata/stitchdata.go@@ -3,10 +3,11 @@ package stitchdataimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/stockdata/stockdata.go b/pkg/detectors/stockdata/stockdata.goindex d8de59edf..da836d925 100644--- a/pkg/detectors/stockdata/stockdata.go+++ b/pkg/detectors/stockdata/stockdata.go@@ -2,10 +2,11 @@ package stockdataimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/storecove/storecove.go b/pkg/detectors/storecove/storecove.goindex a019b323a..2fc7ea01c 100644--- a/pkg/detectors/storecove/storecove.go+++ b/pkg/detectors/storecove/storecove.go@@ -3,10 +3,11 @@ package storecoveimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/stormboard/stormboard.go b/pkg/detectors/stormboard/stormboard.goindex e7b2ede18..dc8d40e28 100644--- a/pkg/detectors/stormboard/stormboard.go+++ b/pkg/detectors/stormboard/stormboard.go@@ -2,10 +2,11 @@ package stormboardimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-API-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/stormglass/stormglass.go b/pkg/detectors/stormglass/stormglass.goindex 7bad5e5cc..3bdf9809d 100644--- a/pkg/detectors/stormglass/stormglass.go+++ b/pkg/detectors/stormglass/stormglass.go@@ -2,10 +2,11 @@ package stormglassimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/storychief/storychief.go b/pkg/detectors/storychief/storychief.goindex 94c371d7c..57dbe62db 100644--- a/pkg/detectors/storychief/storychief.go+++ b/pkg/detectors/storychief/storychief.go@@ -3,10 +3,11 @@ package storychiefimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/strava/strava.go b/pkg/detectors/strava/strava.goindex bcb11cc86..aecf26911 100644--- a/pkg/detectors/strava/strava.go+++ b/pkg/detectors/strava/strava.go@@ -2,10 +2,11 @@ package stravaimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -70,7 +71,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/x-www-form-urlencoded")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/streak/streak.go b/pkg/detectors/streak/streak.goindex 4d16eb958..f4fe12a6a 100644--- a/pkg/detectors/streak/streak.go+++ b/pkg/detectors/streak/streak.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -56,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/stripe/stripe.go b/pkg/detectors/stripe/stripe.goindex 125d9e070..ba1b6b895 100644--- a/pkg/detectors/stripe/stripe.go+++ b/pkg/detectors/stripe/stripe.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- res.Body.Close() // The request body is unused.+ _ = res.Body.Close() // The request body is unused.if res.StatusCode == http.StatusOK || res.StatusCode == http.StatusForbidden {result.Verified = truediff --git a/pkg/detectors/stripo/stripo.go b/pkg/detectors/stripo/stripo.goindex 02e42976e..d500b2c42 100644--- a/pkg/detectors/stripo/stripo.go+++ b/pkg/detectors/stripo/stripo.go@@ -3,10 +3,11 @@ package stripoimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -57,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Stripo-Api-Auth", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/stytch/stytch.go b/pkg/detectors/stytch/stytch.goindex 00c25fb6f..e5aa7decd 100644--- a/pkg/detectors/stytch/stytch.go+++ b/pkg/detectors/stytch/stytch.go@@ -2,10 +2,11 @@ package stytchimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -58,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(userPatMatch, tokenPatMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/sugester/sugester.go b/pkg/detectors/sugester/sugester.goindex 8f75b4463..9fd9a611d 100644--- a/pkg/detectors/sugester/sugester.go+++ b/pkg/detectors/sugester/sugester.go@@ -58,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Accept", "application/vnd.sugester+json; version=3")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/supabasetoken/supabasetoken.go b/pkg/detectors/supabasetoken/supabasetoken.goindex 35c54bf29..3e42704fd 100644--- a/pkg/detectors/supabasetoken/supabasetoken.go+++ b/pkg/detectors/supabasetoken/supabasetoken.go@@ -3,10 +3,11 @@ package supabasetokenimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/supernotesapi/supernotesapi.go b/pkg/detectors/supernotesapi/supernotesapi.goindex de4410245..7dfed4e50 100644--- a/pkg/detectors/supernotesapi/supernotesapi.go+++ b/pkg/detectors/supernotesapi/supernotesapi.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Api-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/surveyanyplace/surveyanyplace.go b/pkg/detectors/surveyanyplace/surveyanyplace.goindex f24eaa544..7705f2eaa 100644--- a/pkg/detectors/surveyanyplace/surveyanyplace.go+++ b/pkg/detectors/surveyanyplace/surveyanyplace.go@@ -3,10 +3,11 @@ package surveyanyplaceimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -67,7 +68,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/surveybot/surveybot.go b/pkg/detectors/surveybot/surveybot.goindex 232722d0a..8f828d9a4 100644--- a/pkg/detectors/surveybot/surveybot.go+++ b/pkg/detectors/surveybot/surveybot.go@@ -3,10 +3,11 @@ package surveybotimport ("context""encoding/json"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -58,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Api-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {var r responseif err := json.NewDecoder(res.Body).Decode(&r); err != nil {diff --git a/pkg/detectors/surveysparrow/surveysparrow.go b/pkg/detectors/surveysparrow/surveysparrow.goindex 1edd6f013..67ed2496f 100644--- a/pkg/detectors/surveysparrow/surveysparrow.go+++ b/pkg/detectors/surveysparrow/surveysparrow.go@@ -3,10 +3,11 @@ package surveysparrowimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/survicate/survicate.go b/pkg/detectors/survicate/survicate.goindex 400341852..5fa3e85ae 100644--- a/pkg/detectors/survicate/survicate.go+++ b/pkg/detectors/survicate/survicate.go@@ -3,10 +3,11 @@ package survicateimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/swell/swell.go b/pkg/detectors/swell/swell.goindex 585e41579..d7ffeffab 100644--- a/pkg/detectors/swell/swell.go+++ b/pkg/detectors/swell/swell.go@@ -2,10 +2,11 @@ package swellimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -59,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(userPatMatch, tokenPatMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/swiftype/swiftype.go b/pkg/detectors/swiftype/swiftype.goindex acd67dab0..dd74df69b 100644--- a/pkg/detectors/swiftype/swiftype.go+++ b/pkg/detectors/swiftype/swiftype.go@@ -2,10 +2,11 @@ package swiftypeimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/tailscale/tailscale.go b/pkg/detectors/tailscale/tailscale.goindex e155c5312..696400afa 100644--- a/pkg/detectors/tailscale/tailscale.go+++ b/pkg/detectors/tailscale/tailscale.go@@ -3,11 +3,12 @@ package tailscaleimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""net/url""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -56,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Set("Content-Type", "application/x-www-form-urlencoded")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusNoContent:s1.Verified = truediff --git a/pkg/detectors/tallyfy/tallyfy.go b/pkg/detectors/tallyfy/tallyfy.goindex cfb003bae..401a9cacc 100644--- a/pkg/detectors/tallyfy/tallyfy.go+++ b/pkg/detectors/tallyfy/tallyfy.go@@ -57,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/tatumio/tatumio.go b/pkg/detectors/tatumio/tatumio.goindex 9c0494b45..7fac9fc58 100644--- a/pkg/detectors/tatumio/tatumio.go+++ b/pkg/detectors/tatumio/tatumio.go@@ -2,10 +2,11 @@ package tatumioimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-api-key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/taxjar/taxjar.go b/pkg/detectors/taxjar/taxjar.goindex 3707612a9..08ba1f81d 100644--- a/pkg/detectors/taxjar/taxjar.go+++ b/pkg/detectors/taxjar/taxjar.go@@ -3,10 +3,11 @@ package taxjarimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/teamgate/teamgate.go b/pkg/detectors/teamgate/teamgate.goindex dc87d52b7..36f951666 100644--- a/pkg/detectors/teamgate/teamgate.go+++ b/pkg/detectors/teamgate/teamgate.go@@ -2,10 +2,11 @@ package teamgateimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -61,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/teamworkcrm/teamworkcrm.go b/pkg/detectors/teamworkcrm/teamworkcrm.goindex 6f5387d46..5f651bc67 100644--- a/pkg/detectors/teamworkcrm/teamworkcrm.go+++ b/pkg/detectors/teamworkcrm/teamworkcrm.go@@ -3,10 +3,11 @@ package teamworkcrmimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/teamworkdesk/teamworkdesk.go b/pkg/detectors/teamworkdesk/teamworkdesk.goindex 507171c29..dc96b4360 100644--- a/pkg/detectors/teamworkdesk/teamworkdesk.go+++ b/pkg/detectors/teamworkdesk/teamworkdesk.go@@ -3,10 +3,11 @@ package teamworkdeskimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/teamworkspaces/teamworkspaces.go b/pkg/detectors/teamworkspaces/teamworkspaces.goindex c2fcd8d2a..cf77e426a 100644--- a/pkg/detectors/teamworkspaces/teamworkspaces.go+++ b/pkg/detectors/teamworkspaces/teamworkspaces.go@@ -3,10 +3,11 @@ package teamworkspacesimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go b/pkg/detectors/technicalanalysisapi/technicalanalysisapi.goindex 2ec3dbdf1..1f9bbadba 100644--- a/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go+++ b/pkg/detectors/technicalanalysisapi/technicalanalysisapi.go@@ -3,11 +3,12 @@ package technicalanalysisapiimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings""time"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -55,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/tefter/tefter.go b/pkg/detectors/tefter/tefter.goindex 93eba4b0b..79ae9ec55 100644--- a/pkg/detectors/tefter/tefter.go+++ b/pkg/detectors/tefter/tefter.go@@ -3,11 +3,12 @@ package tefterimport ("context""encoding/json"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -61,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}validResponse := json.Valid(bodyBytes)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 && validResponse {s1.Verified = true}diff --git a/pkg/detectors/telegrambottoken/telegrambottoken.go b/pkg/detectors/telegrambottoken/telegrambottoken.goindex 6010fadbc..f68b17fb5 100644--- a/pkg/detectors/telegrambottoken/telegrambottoken.go+++ b/pkg/detectors/telegrambottoken/telegrambottoken.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = truediff --git a/pkg/detectors/teletype/teletype.go b/pkg/detectors/teletype/teletype.goindex 7368e6516..1580f4bea 100644--- a/pkg/detectors/teletype/teletype.go+++ b/pkg/detectors/teletype/teletype.go@@ -2,11 +2,12 @@ package teletypeimport ("context"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -62,7 +63,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultbodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `"code":401`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = falsediff --git a/pkg/detectors/telnyx/telnyx.go b/pkg/detectors/telnyx/telnyx.goindex d6af0965c..b2ed2bd9e 100644--- a/pkg/detectors/telnyx/telnyx.go+++ b/pkg/detectors/telnyx/telnyx.go@@ -3,10 +3,11 @@ package telnyximport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go b/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.goindex 5c1adf13c..d72af7032 100644--- a/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go+++ b/pkg/detectors/terraformcloudpersonaltoken/terraformcloudpersonaltoken.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/textmagic/textmagic.go b/pkg/detectors/textmagic/textmagic.goindex 3efefa834..c81b68dc0 100644--- a/pkg/detectors/textmagic/textmagic.go+++ b/pkg/detectors/textmagic/textmagic.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -68,7 +69,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/theoddsapi/theoddsapi.go b/pkg/detectors/theoddsapi/theoddsapi.goindex 60ee52ec4..80ee5d994 100644--- a/pkg/detectors/theoddsapi/theoddsapi.go+++ b/pkg/detectors/theoddsapi/theoddsapi.go@@ -2,10 +2,11 @@ package theoddsapiimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/thinkific/thinkific.go b/pkg/detectors/thinkific/thinkific.goindex bdbcbcb34..50deded99 100644--- a/pkg/detectors/thinkific/thinkific.go+++ b/pkg/detectors/thinkific/thinkific.go@@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/thousandeyes/thousandeyes.go b/pkg/detectors/thousandeyes/thousandeyes.goindex 7bc3df09c..b246247cd 100644--- a/pkg/detectors/thousandeyes/thousandeyes.go+++ b/pkg/detectors/thousandeyes/thousandeyes.go@@ -2,10 +2,11 @@ package thousandeyesimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -60,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.SetBasicAuth(userPatMatch, tokenPatMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/ticketmaster/ticketmaster.go b/pkg/detectors/ticketmaster/ticketmaster.goindex e7c68dcce..b097ac36f 100644--- a/pkg/detectors/ticketmaster/ticketmaster.go+++ b/pkg/detectors/ticketmaster/ticketmaster.go@@ -3,10 +3,11 @@ package ticketmasterimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/tiingo/tiingo.go b/pkg/detectors/tiingo/tiingo.goindex 3a1e124ea..3bc121876 100644--- a/pkg/detectors/tiingo/tiingo.go+++ b/pkg/detectors/tiingo/tiingo.go@@ -3,10 +3,11 @@ package tiingoimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/timecamp/timecamp.go b/pkg/detectors/timecamp/timecamp.goindex 168b6e333..51f7fd1d5 100644--- a/pkg/detectors/timecamp/timecamp.go+++ b/pkg/detectors/timecamp/timecamp.go@@ -2,10 +2,11 @@ package timecampimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/timezoneapi/timezoneapi.go b/pkg/detectors/timezoneapi/timezoneapi.goindex a1433612c..5b243e87a 100644--- a/pkg/detectors/timezoneapi/timezoneapi.go+++ b/pkg/detectors/timezoneapi/timezoneapi.go@@ -2,10 +2,11 @@ package timezoneapiimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -56,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err != nil {return nil, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 && verifiedBodyResponse {s1.Verified = true}diff --git a/pkg/detectors/tineswebhook/tineswebhook.go b/pkg/detectors/tineswebhook/tineswebhook.goindex 55415b2cc..333db9d9e 100644--- a/pkg/detectors/tineswebhook/tineswebhook.go+++ b/pkg/detectors/tineswebhook/tineswebhook.go@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/tly/tly.go b/pkg/detectors/tly/tly.goindex 8e38eafe9..d756125e4 100644--- a/pkg/detectors/tly/tly.go+++ b/pkg/detectors/tly/tly.go@@ -2,10 +2,11 @@ package tlyimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/tmetric/tmetric.go b/pkg/detectors/tmetric/tmetric.goindex c9d6e8b0e..703ed4b82 100644--- a/pkg/detectors/tmetric/tmetric.go+++ b/pkg/detectors/tmetric/tmetric.go@@ -3,10 +3,11 @@ package tmetricimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/todoist/todoist.go b/pkg/detectors/todoist/todoist.goindex 6181f9d72..612ad8410 100644--- a/pkg/detectors/todoist/todoist.go+++ b/pkg/detectors/todoist/todoist.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/toggltrack/toggltrack.go b/pkg/detectors/toggltrack/toggltrack.goindex 909533407..5c267a344 100644--- a/pkg/detectors/toggltrack/toggltrack.go+++ b/pkg/detectors/toggltrack/toggltrack.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -57,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := detectors.DoWithDedup(client, detector_typepb.DetectorType_TogglTrack, resMatch, req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/tokeet/tokeet.go b/pkg/detectors/tokeet/tokeet.goindex e0823f10a..f658716db 100644--- a/pkg/detectors/tokeet/tokeet.go+++ b/pkg/detectors/tokeet/tokeet.go@@ -3,10 +3,11 @@ package tokeetimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -60,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/tomorrowio/tomorrowio.go b/pkg/detectors/tomorrowio/tomorrowio.goindex 4a9011ac8..6252d2131 100644--- a/pkg/detectors/tomorrowio/tomorrowio.go+++ b/pkg/detectors/tomorrowio/tomorrowio.go@@ -3,10 +3,11 @@ package tomorrowioimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/tomtom/tomtom.go b/pkg/detectors/tomtom/tomtom.goindex 007f1eeb0..e3085e26b 100644--- a/pkg/detectors/tomtom/tomtom.go+++ b/pkg/detectors/tomtom/tomtom.go@@ -51,7 +51,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/tradier/tradier.go b/pkg/detectors/tradier/tradier.goindex dedd679e9..0bb66bb35 100644--- a/pkg/detectors/tradier/tradier.go+++ b/pkg/detectors/tradier/tradier.go@@ -3,10 +3,11 @@ package tradierimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/transferwise/transferwise.go b/pkg/detectors/transferwise/transferwise.goindex 1fa16c9e8..d2d1ae2e7 100644--- a/pkg/detectors/transferwise/transferwise.go+++ b/pkg/detectors/transferwise/transferwise.go@@ -3,10 +3,11 @@ package transferwiseimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/travelpayouts/travelpayouts.go b/pkg/detectors/travelpayouts/travelpayouts.goindex aaee81115..a663ba0db 100644--- a/pkg/detectors/travelpayouts/travelpayouts.go+++ b/pkg/detectors/travelpayouts/travelpayouts.go@@ -3,10 +3,11 @@ package travelpayoutsimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/travisci/travisci.go b/pkg/detectors/travisci/travisci.goindex bcfbbd033..5597a45b0 100644--- a/pkg/detectors/travisci/travisci.go+++ b/pkg/detectors/travisci/travisci.go@@ -3,10 +3,11 @@ package travisciimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Travis-API-Version", "3")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/trelloapikey/trelloapikey.go b/pkg/detectors/trelloapikey/trelloapikey.goindex ed6962486..76ef96d4d 100644--- a/pkg/detectors/trelloapikey/trelloapikey.go+++ b/pkg/detectors/trelloapikey/trelloapikey.go@@ -2,10 +2,11 @@ package trelloapikeyimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -58,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/tru/tru.go b/pkg/detectors/tru/tru.goindex 3ba432c35..45eb53b4a 100644--- a/pkg/detectors/tru/tru.go+++ b/pkg/detectors/tru/tru.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -68,7 +69,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", baseToken))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/trufflehogenterprise/trufflehogenterprise.go b/pkg/detectors/trufflehogenterprise/trufflehogenterprise.goindex d0415b3c8..248336e1f 100644--- a/pkg/detectors/trufflehogenterprise/trufflehogenterprise.go+++ b/pkg/detectors/trufflehogenterprise/trufflehogenterprise.go@@ -3,10 +3,11 @@ package trufflehogenterpriseimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -75,7 +76,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreturn nil, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 && verifiedBodyResponse {s1.Verified = truediff --git a/pkg/detectors/twelvedata/twelvedata.go b/pkg/detectors/twelvedata/twelvedata.goindex 5f779eea7..a6df49260 100644--- a/pkg/detectors/twelvedata/twelvedata.go+++ b/pkg/detectors/twelvedata/twelvedata.go@@ -2,11 +2,12 @@ package twelvedataimport ("context"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/twist/twist.go b/pkg/detectors/twist/twist.goindex c59f90cf8..24d4f20db 100644--- a/pkg/detectors/twist/twist.go+++ b/pkg/detectors/twist/twist.go@@ -3,10 +3,11 @@ package twistimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -58,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", setAuth))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/twitch/twitch.go b/pkg/detectors/twitch/twitch.goindex c5276b9b4..e6ef01968 100644--- a/pkg/detectors/twitch/twitch.go+++ b/pkg/detectors/twitch/twitch.go@@ -108,7 +108,7 @@ func verifyTwitch(ctx context.Context, client *http.Client, resMatch string, resif err != nil {return false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/twitter/v1/twitter_v1.go b/pkg/detectors/twitter/v1/twitter_v1.goindex 094288f18..12f686b2c 100644--- a/pkg/detectors/twitter/v1/twitter_v1.go+++ b/pkg/detectors/twitter/v1/twitter_v1.go@@ -94,7 +94,7 @@ func (s Scanner) VerifyTwitterToken(ctx context.Context, client *http.Client, toreturn false, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK:return true, nildiff --git a/pkg/detectors/twitterconsumerkey/twitterconsumerkey.go b/pkg/detectors/twitterconsumerkey/twitterconsumerkey.goindex 3a6687b9b..9e0b2b20c 100644--- a/pkg/detectors/twitterconsumerkey/twitterconsumerkey.go+++ b/pkg/detectors/twitterconsumerkey/twitterconsumerkey.go@@ -103,7 +103,7 @@ func verifyBearerToken(ctx context.Context, client *http.Client, token string) (req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK, http.StatusForbidden:// 403 indicates lack of permission, but valid token (could be due to twitter free tier)@@ -132,7 +132,7 @@ func fetchBearerToken(ctx context.Context, client *http.Client, key, secret striif err != nil {return "", err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()switch res.StatusCode {case http.StatusOK:diff --git a/pkg/detectors/tyntec/tyntec.go b/pkg/detectors/tyntec/tyntec.goindex 692fa4907..fc81b1d28 100644--- a/pkg/detectors/tyntec/tyntec.go+++ b/pkg/detectors/tyntec/tyntec.go@@ -2,10 +2,11 @@ package tyntecimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("apiKey", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/typeform/v2/typeform.go b/pkg/detectors/typeform/v2/typeform.goindex 89885dc08..d44bd65bf 100644--- a/pkg/detectors/typeform/v2/typeform.go+++ b/pkg/detectors/typeform/v2/typeform.go@@ -100,16 +100,17 @@ func verifyMatch(ctx context.Context, client *http.Client, secret string) (bool,_ = res.Body.Close()}()- if res.StatusCode == 200 {+ switch res.StatusCode {+ case 200:var response *TypeFormResponseif err = json.NewDecoder(res.Body).Decode(&response); err != nil {return false, nil, err}return true, response, nil- } else if res.StatusCode == 401 || res.StatusCode == 403 {+ case 401, 403:return false, nil, nil- } else {+ default:return false, nil, fmt.Errorf("unexpected status code %d", res.StatusCode)}}diff --git a/pkg/detectors/typetalk/typetalk.go b/pkg/detectors/typetalk/typetalk.goindex c27764be4..d7938aac9 100644--- a/pkg/detectors/typetalk/typetalk.go+++ b/pkg/detectors/typetalk/typetalk.go@@ -3,10 +3,11 @@ package typetalkimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -59,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/ubidots/ubidots.go b/pkg/detectors/ubidots/ubidots.goindex b18ea4e18..a6f7e28e4 100644--- a/pkg/detectors/ubidots/ubidots.go+++ b/pkg/detectors/ubidots/ubidots.go@@ -2,10 +2,11 @@ package ubidotsimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-Auth-Token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/uclassify/uclassify.go b/pkg/detectors/uclassify/uclassify.goindex c97189fe7..21710289d 100644--- a/pkg/detectors/uclassify/uclassify.go+++ b/pkg/detectors/uclassify/uclassify.go@@ -3,10 +3,11 @@ package uclassifyimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -55,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/unifyid/unifyid.go b/pkg/detectors/unifyid/unifyid.goindex 25a4b2ad5..991b31d96 100644--- a/pkg/detectors/unifyid/unifyid.go+++ b/pkg/detectors/unifyid/unifyid.go@@ -2,11 +2,12 @@ package unifyidimport ("context"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -55,7 +56,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("X-API-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/unplugg/unplugg.go b/pkg/detectors/unplugg/unplugg.goindex 981d9381f..1d90993a1 100644--- a/pkg/detectors/unplugg/unplugg.go+++ b/pkg/detectors/unplugg/unplugg.go@@ -2,10 +2,11 @@ package unpluggimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("x-access-token", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/unsplash/unsplash.go b/pkg/detectors/unsplash/unsplash.goindex fce516866..7638ab3c2 100644--- a/pkg/detectors/unsplash/unsplash.go+++ b/pkg/detectors/unsplash/unsplash.go@@ -2,10 +2,11 @@ package unsplashimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/upcdatabase/upcdatabase.go b/pkg/detectors/upcdatabase/upcdatabase.goindex b0227be30..b6f60110a 100644--- a/pkg/detectors/upcdatabase/upcdatabase.go+++ b/pkg/detectors/upcdatabase/upcdatabase.go@@ -3,11 +3,12 @@ package upcdatabaseimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -57,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `added_time`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/uplead/uplead.go b/pkg/detectors/uplead/uplead.goindex 536300baa..da41156eb 100644--- a/pkg/detectors/uplead/uplead.go+++ b/pkg/detectors/uplead/uplead.go@@ -2,10 +2,11 @@ package upleadimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/uploadcare/uploadcare.go b/pkg/detectors/uploadcare/uploadcare.goindex 12ba6f78e..d05452fae 100644--- a/pkg/detectors/uploadcare/uploadcare.go+++ b/pkg/detectors/uploadcare/uploadcare.go@@ -3,10 +3,11 @@ package uploadcareimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -60,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Uploadcare.Simple %s:%s", publicKeyMatch, resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/uptimerobot/uptimerobot.go b/pkg/detectors/uptimerobot/uptimerobot.goindex 18c372f8a..76bddc3ac 100644--- a/pkg/detectors/uptimerobot/uptimerobot.go+++ b/pkg/detectors/uptimerobot/uptimerobot.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `"ok"`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/upwave/upwave.go b/pkg/detectors/upwave/upwave.goindex 95d22f650..ecf542db4 100644--- a/pkg/detectors/upwave/upwave.go+++ b/pkg/detectors/upwave/upwave.go@@ -3,10 +3,11 @@ package upwaveimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/urlscan/urlscan.go b/pkg/detectors/urlscan/urlscan.goindex 2291df6af..05ec485ff 100644--- a/pkg/detectors/urlscan/urlscan.go+++ b/pkg/detectors/urlscan/urlscan.go@@ -2,10 +2,11 @@ package urlscanimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("API-Key", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/user/user.go b/pkg/detectors/user/user.goindex 50c224226..953610140 100644--- a/pkg/detectors/user/user.go+++ b/pkg/detectors/user/user.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Token %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/userflow/userflow.go b/pkg/detectors/userflow/userflow.goindex 118ce97f6..7982fa5d4 100644--- a/pkg/detectors/userflow/userflow.go+++ b/pkg/detectors/userflow/userflow.go@@ -3,10 +3,11 @@ package userflowimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/userstack/userstack.go b/pkg/detectors/userstack/userstack.goindex 6d0a201a4..8132d716b 100644--- a/pkg/detectors/userstack/userstack.go+++ b/pkg/detectors/userstack/userstack.go@@ -3,11 +3,12 @@ package userstackimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -57,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)valid := strings.Contains(bodyString, `is_mobile_device`) || strings.Contains(bodyString, `"info":"Access Restricted - Your current Subscription Plan does not support HTTPS Encryption."`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if valid {s1.Verified = true} else {diff --git a/pkg/detectors/vagrantcloudpersonaltoken/vagrantcloudpersonaltoken.go b/pkg/detectors/vagrantcloudpersonaltoken/vagrantcloudpersonaltoken.goindex 3dd2cf7e8..f38a71631 100644--- a/pkg/detectors/vagrantcloudpersonaltoken/vagrantcloudpersonaltoken.go+++ b/pkg/detectors/vagrantcloudpersonaltoken/vagrantcloudpersonaltoken.go@@ -60,7 +60,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/vatlayer/vatlayer.go b/pkg/detectors/vatlayer/vatlayer.goindex 3f1629891..d0022ce5e 100644--- a/pkg/detectors/vatlayer/vatlayer.go+++ b/pkg/detectors/vatlayer/vatlayer.go@@ -3,11 +3,12 @@ package vatlayerimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -57,7 +58,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultif err == nil {bodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `vat_number`) || strings.Contains(bodyString, `"info":"Access Restricted - Your current Subscription Plan does not support HTTPS Encryption."`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/vbout/vbout.go b/pkg/detectors/vbout/vbout.goindex 477e2dee6..0738b6686 100644--- a/pkg/detectors/vbout/vbout.go+++ b/pkg/detectors/vbout/vbout.go@@ -3,10 +3,11 @@ package vboutimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/vercel/vercel.go b/pkg/detectors/vercel/vercel.goindex 336ed1d4b..fb443fed9 100644--- a/pkg/detectors/vercel/vercel.go+++ b/pkg/detectors/vercel/vercel.go@@ -3,10 +3,11 @@ package vercelimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/verifier/verifier.go b/pkg/detectors/verifier/verifier.goindex d13df44c1..61218168e 100644--- a/pkg/detectors/verifier/verifier.go+++ b/pkg/detectors/verifier/verifier.go@@ -61,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/verimail/verimail.go b/pkg/detectors/verimail/verimail.goindex 24c2fc958..b1e7c7957 100644--- a/pkg/detectors/verimail/verimail.go+++ b/pkg/detectors/verimail/verimail.go@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/veriphone/veriphone.go b/pkg/detectors/veriphone/veriphone.goindex e3a3ca6e2..b8bf1b0ab 100644--- a/pkg/detectors/veriphone/veriphone.go+++ b/pkg/detectors/veriphone/veriphone.go@@ -52,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := detectors.DoWithDedup(client, detector_typepb.DetectorType_Veriphone, resMatch, req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/versioneye/versioneye.go b/pkg/detectors/versioneye/versioneye.goindex e32474089..880fb7d83 100644--- a/pkg/detectors/versioneye/versioneye.go+++ b/pkg/detectors/versioneye/versioneye.go@@ -2,10 +2,11 @@ package versioneyeimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("apiKey", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/viewneo/viewneo.go b/pkg/detectors/viewneo/viewneo.goindex eb3381567..7916f16bf 100644--- a/pkg/detectors/viewneo/viewneo.go+++ b/pkg/detectors/viewneo/viewneo.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/virustotal/virustotal.go b/pkg/detectors/virustotal/virustotal.goindex 591d8de9f..7937f3806 100644--- a/pkg/detectors/virustotal/virustotal.go+++ b/pkg/detectors/virustotal/virustotal.go@@ -2,10 +2,11 @@ package virustotalimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -64,7 +65,7 @@ func verifyToken(ctx context.Context, client *http.Client, token string) bool {if err != nil {return false}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode < 200 || res.StatusCode >= 300 {return falsediff --git a/pkg/detectors/visualcrossing/visualcrossing.go b/pkg/detectors/visualcrossing/visualcrossing.goindex 01eded31e..24844e07c 100644--- a/pkg/detectors/visualcrossing/visualcrossing.go+++ b/pkg/detectors/visualcrossing/visualcrossing.go@@ -54,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/voiceflow/voiceflow.go b/pkg/detectors/voiceflow/voiceflow.goindex 59ba768a0..30d6d3462 100644--- a/pkg/detectors/voiceflow/voiceflow.go+++ b/pkg/detectors/voiceflow/voiceflow.go@@ -67,11 +67,12 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- if res.StatusCode == http.StatusOK {+ switch res.StatusCode {+ case http.StatusOK:s1.Verified = true- } else if res.StatusCode == http.StatusUnauthorized {+ case http.StatusUnauthorized:// The secret is determinately not verified (nothing to do)- } else {+ default:var buf bytes.Buffervar bodyString string_, err = io.Copy(&buf, res.Body)diff --git a/pkg/detectors/voicegain/voicegain.go b/pkg/detectors/voicegain/voicegain.goindex 538b103b6..efa81366d 100644--- a/pkg/detectors/voicegain/voicegain.go+++ b/pkg/detectors/voicegain/voicegain.go@@ -3,10 +3,11 @@ package voicegainimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/voodoosms/voodoosms.go b/pkg/detectors/voodoosms/voodoosms.goindex 5fe86f6d9..ce0dfe697 100644--- a/pkg/detectors/voodoosms/voodoosms.go+++ b/pkg/detectors/voodoosms/voodoosms.go@@ -3,10 +3,11 @@ package voodoosmsimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/vouchery/vouchery.go b/pkg/detectors/vouchery/vouchery.goindex cf2f3369c..1cb4324fd 100644--- a/pkg/detectors/vouchery/vouchery.go+++ b/pkg/detectors/vouchery/vouchery.go@@ -3,10 +3,11 @@ package voucheryimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -65,7 +66,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/vpnapi/vpnapi.go b/pkg/detectors/vpnapi/vpnapi.goindex 9cc630afa..29138432a 100644--- a/pkg/detectors/vpnapi/vpnapi.go+++ b/pkg/detectors/vpnapi/vpnapi.go@@ -2,10 +2,11 @@ package vpnapiimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/vultrapikey/vultrapikey.go b/pkg/detectors/vultrapikey/vultrapikey.goindex d3210ec93..7beca19b9 100644--- a/pkg/detectors/vultrapikey/vultrapikey.go+++ b/pkg/detectors/vultrapikey/vultrapikey.go@@ -3,10 +3,11 @@ package vultrapikeyimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/vyte/vyte.go b/pkg/detectors/vyte/vyte.goindex 5127a9ebb..c166a1c31 100644--- a/pkg/detectors/vyte/vyte.go+++ b/pkg/detectors/vyte/vyte.go@@ -2,10 +2,11 @@ package vyteimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", resMatch)res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/walkscore/walkscore.go b/pkg/detectors/walkscore/walkscore.goindex 3b6f26951..4608c6fda 100644--- a/pkg/detectors/walkscore/walkscore.go+++ b/pkg/detectors/walkscore/walkscore.go@@ -3,11 +3,12 @@ package walkscoreimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/weatherbit/weatherbit.go b/pkg/detectors/weatherbit/weatherbit.goindex 02b7e6b29..4c07720e9 100644--- a/pkg/detectors/weatherbit/weatherbit.go+++ b/pkg/detectors/weatherbit/weatherbit.go@@ -3,10 +3,11 @@ package weatherbitimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/weatherstack/weatherstack.go b/pkg/detectors/weatherstack/weatherstack.goindex 685d360d7..a33098f6d 100644--- a/pkg/detectors/weatherstack/weatherstack.go+++ b/pkg/detectors/weatherstack/weatherstack.go@@ -3,11 +3,12 @@ package weatherstackimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/web3storage/web3storage.go b/pkg/detectors/web3storage/web3storage.goindex 06516a662..988fabecf 100644--- a/pkg/detectors/web3storage/web3storage.go+++ b/pkg/detectors/web3storage/web3storage.go@@ -3,10 +3,11 @@ package web3storageimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -58,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 {diff --git a/pkg/detectors/webex/webex.go b/pkg/detectors/webex/webex.goindex 67bacc452..e3e9ec382 100644--- a/pkg/detectors/webex/webex.go+++ b/pkg/detectors/webex/webex.go@@ -3,11 +3,12 @@ package webeximport ("context""encoding/json"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -60,7 +61,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {body, err := io.ReadAll(res.Body)- res.Body.Close()+ _ = res.Body.Close()if err == nil {var message struct {Message string `json:"message"`diff --git a/pkg/detectors/webflow/webflow.go b/pkg/detectors/webflow/webflow.goindex 3a65cb603..3dd523689 100644--- a/pkg/detectors/webflow/webflow.go+++ b/pkg/detectors/webflow/webflow.go@@ -3,10 +3,11 @@ package webflowimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/webscraper/webscraper.go b/pkg/detectors/webscraper/webscraper.goindex 13319c8fd..b03edf540 100644--- a/pkg/detectors/webscraper/webscraper.go+++ b/pkg/detectors/webscraper/webscraper.go@@ -53,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/webscraping/webscraping.go b/pkg/detectors/webscraping/webscraping.goindex ebf57bee6..f34dbe58c 100644--- a/pkg/detectors/webscraping/webscraping.go+++ b/pkg/detectors/webscraping/webscraping.go@@ -2,11 +2,12 @@ package webscrapingimport ("context"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/websitepulse/websitepulse.go b/pkg/detectors/websitepulse/websitepulse.goindex 2a84454ed..5e23b2675 100644--- a/pkg/detectors/websitepulse/websitepulse.go+++ b/pkg/detectors/websitepulse/websitepulse.go@@ -3,11 +3,12 @@ package websitepulseimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -58,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/wepay/wepay.go b/pkg/detectors/wepay/wepay.goindex 6c2316014..341f960c2 100644--- a/pkg/detectors/wepay/wepay.go+++ b/pkg/detectors/wepay/wepay.go@@ -2,10 +2,11 @@ package wepayimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -66,7 +67,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultres, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/whoxy/whoxy.go b/pkg/detectors/whoxy/whoxy.goindex f84e7efe9..4e7af4e9a 100644--- a/pkg/detectors/whoxy/whoxy.go+++ b/pkg/detectors/whoxy/whoxy.go@@ -3,11 +3,12 @@ package whoxyimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""io""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -54,7 +55,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()bodyBytes, err := io.ReadAll(res.Body)if err != nil {continuediff --git a/pkg/detectors/wistia/wistia.go b/pkg/detectors/wistia/wistia.goindex 846565df1..80c7cda03 100644--- a/pkg/detectors/wistia/wistia.go+++ b/pkg/detectors/wistia/wistia.go@@ -2,10 +2,11 @@ package wistiaimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/wit/wit.go b/pkg/detectors/wit/wit.goindex fb1829a0d..a6a259d3d 100644--- a/pkg/detectors/wit/wit.go+++ b/pkg/detectors/wit/wit.go@@ -3,10 +3,11 @@ package witimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/worksnaps/worksnaps.go b/pkg/detectors/worksnaps/worksnaps.goindex 875339835..2ebef2726 100644--- a/pkg/detectors/worksnaps/worksnaps.go+++ b/pkg/detectors/worksnaps/worksnaps.go@@ -4,10 +4,11 @@ import ("context"b64 "encoding/base64""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -56,7 +57,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Basic %s", sEnc))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/workstack/workstack.go b/pkg/detectors/workstack/workstack.goindex 37883a01a..0a3d38b32 100644--- a/pkg/detectors/workstack/workstack.go+++ b/pkg/detectors/workstack/workstack.go@@ -2,10 +2,11 @@ package workstackimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -52,7 +53,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Accept", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/worldcoinindex/worldcoinindex.go b/pkg/detectors/worldcoinindex/worldcoinindex.goindex 92783c8e7..1a74179a0 100644--- a/pkg/detectors/worldcoinindex/worldcoinindex.go+++ b/pkg/detectors/worldcoinindex/worldcoinindex.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultbodyString := string(bodyBytes)validResponse := strings.Contains(bodyString, `"Markets"`)- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {if validResponse {s1.Verified = truediff --git a/pkg/detectors/worldweather/worldweather.go b/pkg/detectors/worldweather/worldweather.goindex 596c2d2d0..bba10a2cb 100644--- a/pkg/detectors/worldweather/worldweather.go+++ b/pkg/detectors/worldweather/worldweather.go@@ -3,10 +3,11 @@ package worldweatherimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Content-Type", "application/json")res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/wrike/wrike.go b/pkg/detectors/wrike/wrike.goindex a0017ab1c..146b00c8e 100644--- a/pkg/detectors/wrike/wrike.go+++ b/pkg/detectors/wrike/wrike.go@@ -3,10 +3,11 @@ package wrikeimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/yandex/yandex.go b/pkg/detectors/yandex/yandex.goindex a021e5204..91e06b68c 100644--- a/pkg/detectors/yandex/yandex.go+++ b/pkg/detectors/yandex/yandex.go@@ -2,10 +2,11 @@ package yandeximport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -51,7 +52,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/yelp/yelp.go b/pkg/detectors/yelp/yelp.goindex a5577b667..b287afd8e 100644--- a/pkg/detectors/yelp/yelp.go+++ b/pkg/detectors/yelp/yelp.go@@ -62,7 +62,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else if res.StatusCode == 401 || res.StatusCode == 403 {diff --git a/pkg/detectors/youneedabudget/youneedabudget.go b/pkg/detectors/youneedabudget/youneedabudget.goindex 49a83193e..3cb64d8e0 100644--- a/pkg/detectors/youneedabudget/youneedabudget.go+++ b/pkg/detectors/youneedabudget/youneedabudget.go@@ -3,10 +3,11 @@ package youneedabudgetimport ("context""fmt"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -53,7 +54,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/yousign/yousign.go b/pkg/detectors/yousign/yousign.goindex 973fd4b59..546fa4250 100644--- a/pkg/detectors/yousign/yousign.go+++ b/pkg/detectors/yousign/yousign.go@@ -59,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true} else {@@ -71,7 +71,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (resultreq.Header.Add("Authorization", fmt.Sprintf("Bearer %s", resMatch))res, err = client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/detectors/youtubeapikey/youtubeapikey.go b/pkg/detectors/youtubeapikey/youtubeapikey.goindex d0f6dffa1..3f28f6360 100644--- a/pkg/detectors/youtubeapikey/youtubeapikey.go+++ b/pkg/detectors/youtubeapikey/youtubeapikey.go@@ -2,10 +2,11 @@ package youtubeapikeyimport ("context"- regexp "github.com/wasilibs/go-re2""net/http""strings"+ regexp "github.com/wasilibs/go-re2"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/pb/detector_typepb"@@ -58,7 +59,7 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result}res, err := client.Do(req)if err == nil {- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()if res.StatusCode >= 200 && res.StatusCode < 300 {s1.Verified = true}diff --git a/pkg/engine/defaults/defaults_test.go b/pkg/engine/defaults/defaults_test.goindex 7e3521ea5..bdaf062ab 100644--- a/pkg/engine/defaults/defaults_test.go+++ b/pkg/engine/defaults/defaults_test.go@@ -111,6 +111,7 @@ func TestAllDetectorTypesAreInDefaultList(t *testing.T) {//// TODO: audit this list periodically β entries in the "mistakenly missed" group// should be removed once the corresponding detector is added to defaults.go.+//nolint:staticcheck // SA1019: intentionally references deprecated DetectorType values to keep them excluded.var excludedFromDefaultList = map[detector_typepb.DetectorType]struct{}{// TODO: these detectors have implementations but were mistakenly never added// to buildDetectorList() β discovered by TestAllDetectorTypesAreInDefaultList.diff --git a/pkg/engine/engine.go b/pkg/engine/engine.goindex 36cf3dce3..335855a72 100644--- a/pkg/engine/engine.go+++ b/pkg/engine/engine.go@@ -39,8 +39,8 @@ import (var detectionTimeout = detectors.DefaultResponseTimeoutvar errOverlap = errors.New(- "More than one detector has found this result. For your safety, verification has been disabled." +- "You can override this behavior by using the --allow-verification-overlap flag.",+ "more than one detector has found this result; for your safety, verification has been disabled. " ++ "You can override this behavior by using the --allow-verification-overlap flag",)// Metrics for the scan engine for external consumption.@@ -833,11 +833,11 @@ func iterativeDecode(chunk *sources.Chunk, allDecoders []decoders.Decoder, maxDeif depth+1 < maxDepth &&decoder.Type() != detectorspb.DecoderType_PLAIN &&- !bytes.Equal(decoded.Chunk.Data, data) &&- !slices.ContainsFunc(seen, func(s []byte) bool { return bytes.Equal(s, decoded.Chunk.Data) }) {+ !bytes.Equal(decoded.Data, data) &&+ !slices.ContainsFunc(seen, func(s []byte) bool { return bytes.Equal(s, decoded.Data) }) {- seen = append(seen, decoded.Chunk.Data)- nextInputs = append(nextInputs, decoded.Chunk.Data)+ seen = append(seen, decoded.Data)+ nextInputs = append(nextInputs, decoded.Data)}}}@@ -863,7 +863,7 @@ func (e *Engine) scannerWorker(ctx context.Context) {decoded := iterativeDecode(chunk, e.decoders, e.maxDecodeDepth)for _, d := range decoded {- matchingDetectors := e.AhoCorasickCore.FindDetectorMatches(d.Chunk.Data)+ matchingDetectors := e.AhoCorasickCore.FindDetectorMatches(d.Data)if len(matchingDetectors) > 1 && !e.verificationOverlap {wgVerificationOverlap.Add(1)e.verificationOverlapChunksChan <- verificationOverlapChunk{@@ -1060,7 +1060,7 @@ func (e *Engine) verificationOverlapWorker(ctx context.Context) {res,chunk.chunk,chunk.decoder,- detector.Detector.Description(),+ detector.Description(),isFalsePositive,)@@ -1187,7 +1187,7 @@ func (e *Engine) detectChunk(ctx context.Context, data detectableChunk) {}for _, res := range results {- e.processResult(ctx, res, data.chunk, data.decoder, data.detector.Detector.Description(), isFalsePositive)+ e.processResult(ctx, res, data.chunk, data.decoder, data.detector.Description(), isFalsePositive)}}diff --git a/pkg/engine/engine_test.go b/pkg/engine/engine_test.goindex 12630db2d..d68960096 100644--- a/pkg/engine/engine_test.go+++ b/pkg/engine/engine_test.go@@ -415,7 +415,7 @@ even more`,tmpFile, err := os.CreateTemp("", "test_aws_credentials")assert.NoError(t, err)- defer os.Remove(tmpFile.Name())+ defer func() { _ = os.Remove(tmpFile.Name()) }()err = os.WriteFile(tmpFile.Name(), []byte(tt.content), os.ModeAppend)assert.NoError(t, err)@@ -463,10 +463,10 @@ func TestEngine_VersionedDetectorsVerifiedSecrets(t *testing.T) {tmpFile, err := os.CreateTemp("", "testfile")assert.Nil(t, err)- defer tmpFile.Close()- defer os.Remove(tmpFile.Name())+ defer func() { _ = tmpFile.Close() }()+ defer func() { _ = os.Remove(tmpFile.Name()) }()- _, err = tmpFile.WriteString(fmt.Sprintf("test data using keyword %s", fakeDetectorKeyword))+ _, err = fmt.Fprintf(tmpFile, "test data using keyword %s", fakeDetectorKeyword)assert.NoError(t, err)const defaultOutputBufferSize = 64@@ -507,8 +507,8 @@ func TestEngine_VersionedDetectorsVerifiedSecrets(t *testing.T) {func TestEngine_CustomDetectorsDetectorsVerifiedSecrets(t *testing.T) {tmpFile, err := os.CreateTemp("", "testfile")assert.Nil(t, err)- defer tmpFile.Close()- defer os.Remove(tmpFile.Name())+ defer func() { _ = tmpFile.Close() }()+ defer func() { _ = os.Remove(tmpFile.Name()) }()_, err = tmpFile.WriteString("test stuff")assert.Nil(t, err)@@ -1445,7 +1445,7 @@ def test_something():tmpFile, err := os.CreateTemp("", "test_creds")assert.NoError(t, err)- defer os.Remove(tmpFile.Name())+ defer func() { _ = os.Remove(tmpFile.Name()) }()err = os.WriteFile(tmpFile.Name(), []byte(tt.content), os.ModeAppend)assert.NoError(t, err)@@ -1558,7 +1558,7 @@ func TestEngine_DetectChunk_UsesVerifyFlag(t *testing.T) {// Assert: Confirm that a result was generated and that it has the expected verify flag.select {case result := <-e.results:- assert.Equal(t, tc.verify, result.Result.Verified)+ assert.Equal(t, tc.verify, result.Verified)default:t.Errorf("expected a result but did not get one")}@@ -1680,7 +1680,7 @@ func TestEngine_VerificationOverlapWorker_DetectableChunkHasCorrectVerifyFlag(t// Assert: Confirm that every generated result is unverified (because overlap detection precluded it).for result := range e.results {- assert.False(t, result.Result.Verified)+ assert.False(t, result.Verified)}// Assert: Confirm that every generated detectable chunk's Chunk.SourceVerify flag is unchanged and that itsdiff --git a/pkg/engine/git_test.go b/pkg/engine/git_test.goindex e1b6ce51d..cdbc96de0 100644--- a/pkg/engine/git_test.go+++ b/pkg/engine/git_test.go@@ -41,7 +41,7 @@ func TestGitEngine(t *testing.T) {if err != nil {t.Error(err)}- defer os.RemoveAll(path)+ defer func() { _ = os.RemoveAll(path) }()ctx, cancel := context.WithCancel(ctx)defer cancel()@@ -130,7 +130,7 @@ func TestGitEngineWithMirrorAndBareClones(t *testing.T) {if err != nil {t.Fail()}- defer os.RemoveAll(parent)+ defer func() { _ = os.RemoveAll(parent) }()localRepo := filepath.Join(parent, "test_keys.git")cloneCtx, cancel := context.WithTimeout(ctx, 10*time.Second)defer cancel()diff --git a/pkg/gitparse/gitparse.go b/pkg/gitparse/gitparse.goindex 3c6a0c804..01fe53cbb 100644--- a/pkg/gitparse/gitparse.go+++ b/pkg/gitparse/gitparse.go@@ -371,10 +371,7 @@ func (c *Parser) FromReader(ctx context.Context, stdOut io.Reader, diffChan chandefer common.RecoverWithExit(ctx)defer close(diffChan)- for {- if common.IsDone(ctx) {- break- }+ for !common.IsDone(ctx) {line, err := outReader.ReadBytes([]byte("\n")[0])if err != nil && len(line) == 0 {@@ -616,15 +613,15 @@ func isMergeLine(isStaged bool, latestState ParseState, line []byte) bool {// commit 7a95bbf0199e280a0e42dbb1d1a3f56cdd0f6e05func isCommitLine(isStaged bool, latestState ParseState, line []byte) bool {- if isStaged || !(latestState == Initial ||- latestState == MessageStartLine ||- latestState == MessageEndLine ||- latestState == ModeLine ||- latestState == IndexLine ||- latestState == BinaryFileLine ||- latestState == ToFileLine ||- latestState == HunkContentLine ||- latestState == ParseFailure) {+ if isStaged || (latestState != Initial &&+ latestState != MessageStartLine &&+ latestState != MessageEndLine &&+ latestState != ModeLine &&+ latestState != IndexLine &&+ latestState != BinaryFileLine &&+ latestState != ToFileLine &&+ latestState != HunkContentLine &&+ latestState != ParseFailure) {return false}@@ -636,7 +633,7 @@ func isCommitLine(isStaged bool, latestState ParseState, line []byte) bool {// Author: Bill Rich <[email protected]>func isAuthorLine(isStaged bool, latestState ParseState, line []byte) bool {- if isStaged || !(latestState == CommitLine || latestState == MergeLine) {+ if isStaged || (latestState != CommitLine && latestState != MergeLine) {return false}if len(line) > 8 && bytes.Equal(line[:7], []byte("Author:")) {@@ -692,7 +689,7 @@ func isMessageStartLine(isStaged bool, latestState ParseState, line []byte) bool// Line that starts with 4 spacesfunc isMessageLine(isStaged bool, latestState ParseState, line []byte) bool {- if isStaged || !(latestState == MessageStartLine || latestState == MessageLine) {+ if isStaged || (latestState != MessageStartLine && latestState != MessageLine) {return false}if len(line) > 4 && bytes.Equal(line[:4], []byte(" ")) {@@ -726,7 +723,7 @@ func isNotesStartLine(isStaged bool, latestState ParseState, line []byte) bool {// Line after NotesStartLine that starts with 4 spacesfunc isNotesLine(isStaged bool, latestState ParseState, line []byte) bool {- if isStaged || !(latestState == NotesStartLine || latestState == NotesLine) {+ if isStaged || (latestState != NotesStartLine && latestState != NotesLine) {return false}if len(line) > 4 && bytes.Equal(line[:4], []byte(" ")) {@@ -748,15 +745,15 @@ func isNotesEndLine(isStaged bool, latestState ParseState, line []byte) bool {// diff --git a/internal/addrs/move_endpoint_module.go b/internal/addrs/move_endpoint_module.gofunc isDiffLine(isStaged bool, latestState ParseState, line []byte) bool {- if !(latestState == MessageStartLine || // Empty commit messages can go from MessageStart->Diff- latestState == MessageEndLine ||- latestState == NotesEndLine ||- latestState == BinaryFileLine ||- latestState == ModeLine ||- latestState == IndexLine ||- latestState == HunkContentLine ||- latestState == ParseFailure) {- if !(isStaged && latestState == Initial) {+ if latestState != MessageStartLine &&+ latestState != MessageEndLine &&+ latestState != NotesEndLine &&+ latestState != BinaryFileLine &&+ latestState != ModeLine &&+ latestState != IndexLine &&+ latestState != HunkContentLine &&+ latestState != ParseFailure {+ if !isStaged || latestState != Initial {return false}}@@ -774,7 +771,7 @@ func isDiffLine(isStaged bool, latestState ParseState, line []byte) bool {// rename to new.txt// deleted file mode 100644func isModeLine(latestState ParseState, line []byte) bool {- if !(latestState == DiffLine || latestState == ModeLine) {+ if latestState != DiffLine && latestState != ModeLine {return false}// This could probably be better written.@@ -793,7 +790,7 @@ func isModeLine(latestState ParseState, line []byte) bool {// index 1ed6fbee1..aea1e643a 100644// index 00000000..e69de29bfunc isIndexLine(latestState ParseState, line []byte) bool {- if !(latestState == DiffLine || latestState == ModeLine) {+ if latestState != DiffLine && latestState != ModeLine {return false}if len(line) > 6 && bytes.Equal(line[:6], []byte("index ")) {@@ -848,7 +845,7 @@ func pathFromBinaryLine(line []byte) (string, bool) {// --- a/internal/addrs/move_endpoint_module.go// --- /dev/nullfunc isFromFileLine(latestState ParseState, line []byte) bool {- if !(latestState == IndexLine || latestState == ModeLine) {+ if latestState != IndexLine && latestState != ModeLine {return false}if len(line) >= 6 && bytes.Equal(line[:4], []byte("--- ")) {@@ -906,7 +903,7 @@ func pathFromToFileLine(line []byte) (string, bool) {// @@ -298 +298 @@ func maxRetryErrorHandler(resp *http.Response, err error, numTries int)func isHunkLineNumberLine(latestState ParseState, line []byte) bool {- if !(latestState == ToFileLine || latestState == HunkContentLine) {+ if latestState != ToFileLine && latestState != HunkContentLine {return false}if len(line) >= 8 && bytes.Equal(line[:2], []byte("@@")) {@@ -918,7 +915,7 @@ func isHunkLineNumberLine(latestState ParseState, line []byte) bool {// fmt.Println("ok")// (There's a space before `fmt` that gets removed by the formatter.)func isHunkContextLine(latestState ParseState, line []byte) bool {- if !(latestState == HunkLineNumberLine || latestState == HunkContentLine) {+ if latestState != HunkLineNumberLine && latestState != HunkContentLine {return false}if len(line) >= 1 && bytes.Equal(line[:1], []byte(" ")) {@@ -929,7 +926,7 @@ func isHunkContextLine(latestState ParseState, line []byte) bool {// +fmt.Println("ok")func isHunkPlusLine(latestState ParseState, line []byte) bool {- if !(latestState == HunkLineNumberLine || latestState == HunkContentLine) {+ if latestState != HunkLineNumberLine && latestState != HunkContentLine {return false}if len(line) >= 1 && bytes.Equal(line[:1], []byte("+")) {@@ -940,7 +937,7 @@ func isHunkPlusLine(latestState ParseState, line []byte) bool {// -fmt.Println("ok")func isHunkMinusLine(latestState ParseState, line []byte) bool {- if !(latestState == HunkLineNumberLine || latestState == HunkContentLine) {+ if latestState != HunkLineNumberLine && latestState != HunkContentLine {return false}if len(line) >= 1 && bytes.Equal(line[:1], []byte("-")) {@@ -965,7 +962,7 @@ func isHunkNewlineWarningLine(latestState ParseState, line []byte) bool {//// commit 00920984e3435057f09cee5468850f7546dfa637 (tag: v3.42.0)func isHunkEmptyLine(latestState ParseState, line []byte) bool {- if !(latestState == HunkLineNumberLine || latestState == HunkContentLine) {+ if latestState != HunkLineNumberLine && latestState != HunkContentLine {return false}// TODO: Can this also be `\n\r`?diff --git a/pkg/giturl/giturl.go b/pkg/giturl/giturl.goindex ad8574bb0..dbd9bc019 100644--- a/pkg/giturl/giturl.go+++ b/pkg/giturl/giturl.go@@ -219,9 +219,9 @@ var (// UpdateLinkLineNumber updates the line number in a repository link.// Used post-link generation to refine reported issue locations within large scanned blocks.func UpdateLinkLineNumber(ctx context.Context, link string, newLine int64) string {- link = strings.Replace(link, "%", "%25", -1)- link = strings.Replace(link, "[", "%5B", -1)- link = strings.Replace(link, "]", "%5D", -1)+ link = strings.ReplaceAll(link, "%", "%25")+ link = strings.ReplaceAll(link, "[", "%5B")+ link = strings.ReplaceAll(link, "]", "%5D")parsedURL, err := url.Parse(link)if err != nil {ctx.Logger().Error(err, "unable to parse link to update line number", "link", link)diff --git a/pkg/handlers/apk.go b/pkg/handlers/apk.goindex 858161e53..8bc4d1acd 100644--- a/pkg/handlers/apk.go+++ b/pkg/handlers/apk.go@@ -241,10 +241,10 @@ func (h *apkHandler) processFile(if err != nil {return fmt.Errorf("failed to read file %s: %w", file.Name, err)}- defer f.Close()+ defer func() { _ = f.Close() }()rdr := iobuf.NewBufferedReaderSeeker(f)- defer rdr.Close()+ defer func() { _ = rdr.Close() }()var contentReader io.Reader// Decode the file based on its extension@@ -306,7 +306,7 @@ func parseResTable(zipReader *zip.Reader) (*apkparser.ResourceTable, error) {}resTable, err := apkparser.ParseResourceTable(rdr)- rdr.Close()+ _ = rdr.Close()if err != nil {return nil, err}diff --git a/pkg/handlers/apk_test.go b/pkg/handlers/apk_test.goindex b8ca00530..d23dd64ec 100644--- a/pkg/handlers/apk_test.go+++ b/pkg/handlers/apk_test.go@@ -34,7 +34,7 @@ func TestAPKHandler(t *testing.T) {resp, err := http.Get(testCase.archiveURL)assert.NoError(t, err)assert.Equal(t, http.StatusOK, resp.StatusCode)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()handler := newAPKHandler()@@ -42,7 +42,7 @@ func TestAPKHandler(t *testing.T) {if err != nil {t.Errorf("error creating reusable reader: %s", err)}- defer newReader.Close()+ defer func() { _ = newReader.Close() }()archiveChan := handler.HandleFile(context.Background(), newReader)@@ -76,7 +76,7 @@ func TestOpenInvalidAPK(t *testing.T) {rdr, err := newFileReader(ctx, io.NopCloser(reader))assert.NoError(t, err)- defer rdr.Close()+ defer func() { _ = rdr.Close() }()archiveChan := make(chan DataOrErr)@@ -91,7 +91,7 @@ func TestOpenValidZipInvalidAPK(t *testing.T) {resp, err := http.Get(validZipURL)assert.NoError(t, err)assert.Equal(t, http.StatusOK, resp.StatusCode)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()handler := newAPKHandler()@@ -100,7 +100,7 @@ func TestOpenValidZipInvalidAPK(t *testing.T) {t.Errorf("error creating reusable reader: %s", err)}assert.NoError(t, err)- defer newReader.Close()+ defer func() { _ = newReader.Close() }()archiveChan := make(chan DataOrErr)ctx := context.AddLogger(context.Background())diff --git a/pkg/handlers/ar_test.go b/pkg/handlers/ar_test.goindex 2f908e4d7..64cb69431 100644--- a/pkg/handlers/ar_test.go+++ b/pkg/handlers/ar_test.go@@ -13,14 +13,14 @@ import (func TestHandleARFile(t *testing.T) {file, err := os.Open("testdata/test.deb")assert.Nil(t, err)- defer file.Close()+ defer func() { _ = file.Close() }()ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)defer cancel()rdr, err := newFileReader(ctx, file)assert.NoError(t, err)- defer rdr.Close()+ defer func() { _ = rdr.Close() }()handler := newARHandler()dataOrErrChan := handler.HandleFile(context.AddLogger(ctx), rdr)diff --git a/pkg/handlers/archive.go b/pkg/handlers/archive.goindex c3bf11de7..374144ab5 100644--- a/pkg/handlers/archive.go+++ b/pkg/handlers/archive.go@@ -140,7 +140,7 @@ func (h *archiveHandler) openArchive(if err != nil {return fmt.Errorf("error opening decompressor with format: %s %w", reader.format.MediaType(), err)}- defer compReader.Close()+ defer func() { _ = compReader.Close() }()rdr, err := newFileReader(ctx, compReader)if err != nil {@@ -154,7 +154,7 @@ func (h *archiveHandler) openArchive(err,)}- defer rdr.Close()+ defer func() { _ = rdr.Close() }()return h.openArchive(ctx, depth+1, rdr, dataOrErrChan)case archives.Extractor:@@ -211,7 +211,7 @@ func (h *archiveHandler) extractorHandler(dataOrErrChan chan DataOrErr) func(conif err != nil {return fmt.Errorf("error opening file %s: %w", file.Name(), err)}- defer f.Close()+ defer func() { _ = f.Close() }()// Archiver v4 is in alpha and using an experimental version of// rardecode. There is a bug somewhere with rar decoder format 29@@ -237,7 +237,7 @@ func (h *archiveHandler) extractorHandler(dataOrErrChan chan DataOrErr) func(con}return fmt.Errorf("error creating reader for file %s: %w", file.Name(), err)}- defer rdr.Close()+ defer func() { _ = rdr.Close() }()h.metrics.incFilesProcessed()h.metrics.observeFileSize(fileSize)diff --git a/pkg/handlers/archive_test.go b/pkg/handlers/archive_test.goindex 7b82b1eba..aee1cc583 100644--- a/pkg/handlers/archive_test.go+++ b/pkg/handlers/archive_test.go@@ -81,7 +81,7 @@ func TestArchiveHandler(t *testing.T) {resp, err := http.Get(testCase.archiveURL)assert.NoError(t, err)assert.Equal(t, http.StatusOK, resp.StatusCode)- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()handler := newArchiveHandler()@@ -89,7 +89,7 @@ func TestArchiveHandler(t *testing.T) {if err != nil {t.Errorf("error creating reusable reader: %s", err)}- defer newReader.Close()+ defer func() { _ = newReader.Close() }()dataOrErrChan := handler.HandleFile(logContext.Background(), newReader)if testCase.expectErr {@@ -121,7 +121,7 @@ func TestOpenInvalidArchive(t *testing.T) {rdr, err := newFileReader(ctx, io.NopCloser(reader))assert.NoError(t, err)- defer rdr.Close()+ defer func() { _ = rdr.Close() }()dataOrErrChan := make(chan DataOrErr)diff --git a/pkg/handlers/default_test.go b/pkg/handlers/default_test.goindex 9220e182a..37e5dc5c9 100644--- a/pkg/handlers/default_test.go+++ b/pkg/handlers/default_test.go@@ -16,14 +16,14 @@ import (func TestHandleNonArchiveFile(t *testing.T) {file, err := os.Open("testdata/nonarchive.txt")assert.Nil(t, err)- defer file.Close()+ defer func() { _ = file.Close() }()ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)defer cancel()rdr, err := newFileReader(ctx, file)assert.NoError(t, err)- defer rdr.Close()+ defer func() { _ = rdr.Close() }()handler := newDefaultHandler(defaultHandlerType)dataOrErrChan := handler.HandleFile(context.AddLogger(ctx), rdr)diff --git a/pkg/handlers/handlers_test.go b/pkg/handlers/handlers_test.goindex 7d8218fc3..a738622e6 100644--- a/pkg/handlers/handlers_test.go+++ b/pkg/handlers/handlers_test.go@@ -44,7 +44,7 @@ func TestHandleFile(t *testing.T) {assert.NoError(t, err)defer func() {if resp != nil && resp.Body != nil {- resp.Body.Close()+ _ = resp.Body.Close()}}()@@ -58,7 +58,7 @@ func TestHandleHTTPJson(t *testing.T) {assert.NoError(t, err)defer func() {if resp != nil && resp.Body != nil {- resp.Body.Close()+ _ = resp.Body.Close()}}()@@ -82,7 +82,7 @@ func TestHandleHTTPJsonZip(t *testing.T) {assert.NoError(t, err)defer func() {if resp != nil && resp.Body != nil {- resp.Body.Close()+ _ = resp.Body.Close()}}()@@ -110,7 +110,7 @@ func BenchmarkHandleHTTPJsonZip(b *testing.B) {defer func() {if resp != nil && resp.Body != nil {- resp.Body.Close()+ _ = resp.Body.Close()}}()@@ -134,7 +134,7 @@ func BenchmarkHandleHTTPJsonZip(b *testing.B) {func BenchmarkHandleFile(b *testing.B) {file, err := os.Open("testdata/test.tgz")assert.Nil(b, err)- defer file.Close()+ defer func() { _ = file.Close() }()b.ReportAllocs()for i := 0; i < b.N; i++ {@@ -323,7 +323,7 @@ func TestHandleFileDOC(t *testing.T) {func BenchmarkHandleAR(b *testing.B) {file, err := os.Open("testdata/test.deb")assert.Nil(b, err)- defer file.Close()+ defer func() { _ = file.Close() }()b.ReportAllocs()for i := 0; i < b.N; i++ {@@ -382,7 +382,7 @@ func TestExtractTarContentWithEmptyFile(t *testing.T) {func TestHandleTar(t *testing.T) {file, err := os.Open("testdata/test.tar")assert.Nil(t, err)- defer file.Close()+ defer func() { _ = file.Close() }()chunkCh := make(chan *sources.Chunk, 1)go func() {@@ -402,7 +402,7 @@ func TestHandleTar(t *testing.T) {func BenchmarkHandleTar(b *testing.B) {file, err := os.Open("testdata/test.tar")assert.Nil(b, err)- defer file.Close()+ defer func() { _ = file.Close() }()b.ReportAllocs()for i := 0; i < b.N; i++ {@@ -432,7 +432,7 @@ func TestHandleLargeHTTPJson(t *testing.T) {defer func() {if resp != nil && resp.Body != nil {- resp.Body.Close()+ _ = resp.Body.Close()}}()@@ -455,10 +455,10 @@ func TestHandlePipe(t *testing.T) {r, w := io.Pipe()go func() {- defer w.Close()+ defer func() { _ = w.Close() }()file, err := os.Open("testdata/test.tar")assert.NoError(t, err)- defer file.Close()+ defer func() { _ = file.Close() }()_, err = io.Copy(w, file)assert.NoError(t, err)}()@@ -543,7 +543,7 @@ func TestHandleGitCatFile(t *testing.T) {} else {gitDir = setupTempGitRepoWithUnsupportedFile(t, tt.fileName, tt.fileSize)}- defer os.RemoveAll(gitDir)+ defer func() { _ = os.RemoveAll(gitDir) }()cmd := exec.Command("git", "-C", gitDir, "rev-parse", "HEAD")hashBytes, err := cmd.Output()@@ -634,7 +634,7 @@ func setupTempGitRepoCommon(t *testing.T, fileName string, fileSize int, isUnsupif err != nil {t.Fatalf("Failed to create file: %v", err)}- defer f.Close()+ defer func() { _ = f.Close() }()if isUnsupported {// Write ELF header for unsupported file.@@ -758,7 +758,7 @@ func TestHandleGitCatFileWithPipeError(t *testing.T) {simulatedError := errors.New("simulated error during newFileReader")gitDir := setupTempGitRepo(t, fileName, fileSize)- defer os.RemoveAll(gitDir)+ defer func() { _ = os.RemoveAll(gitDir) }()commitHash := getGitCommitHash(t, gitDir)diff --git a/pkg/handlers/rpm_test.go b/pkg/handlers/rpm_test.goindex ba4d5d622..a48d8d83d 100644--- a/pkg/handlers/rpm_test.go+++ b/pkg/handlers/rpm_test.go@@ -13,14 +13,14 @@ import (func TestHandleRPMFile(t *testing.T) {file, err := os.Open("testdata/test.rpm")assert.Nil(t, err)- defer file.Close()+ defer func() { _ = file.Close() }()ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)defer cancel()rdr, err := newFileReader(ctx, file)assert.NoError(t, err)- defer rdr.Close()+ defer func() { _ = rdr.Close() }()handler := newRPMHandler()dataOrErrChan := handler.HandleFile(context.AddLogger(ctx), rdr)diff --git a/pkg/iobuf/bufferedreaderseeker.go b/pkg/iobuf/bufferedreaderseeker.goindex b42ff72b8..4fbfbd886 100644--- a/pkg/iobuf/bufferedreaderseeker.go+++ b/pkg/iobuf/bufferedreaderseeker.go@@ -390,7 +390,7 @@ func (br *BufferedReadSeeker) Close() error {}if br.tempFile != nil {- br.tempFile.Close()+ _ = br.tempFile.Close()return os.Remove(br.tempFileName)}return nildiff --git a/pkg/output/github_actions.go b/pkg/output/github_actions.goindex 878a2de72..c83c7badf 100644--- a/pkg/output/github_actions.go+++ b/pkg/output/github_actions.go@@ -18,10 +18,10 @@ type GitHubActionsPrinter struct{ mu sync.Mutex }func (p *GitHubActionsPrinter) Print(_ context.Context, r *detectors.ResultWithMetadata) error {out := gitHubActionsOutputFormat{- DetectorType: r.Result.DetectorType.String(),+ DetectorType: r.DetectorType.String(),DetectorDescription: r.DetectorDescription,DecoderType: r.DecoderType.String(),- Verified: r.Result.Verified,+ Verified: r.Verified,}meta, err := structToMap(r.SourceMetadata.Data)@@ -61,7 +61,7 @@ func (p *GitHubActionsPrinter) Print(_ context.Context, r *detectors.ResultWithMdedupeCache[key] = struct{}{}name := ""- if nameValue, ok := r.Result.ExtraData["name"]; ok {+ if nameValue, ok := r.ExtraData["name"]; ok {name = fmt.Sprintf(" (%s)", nameValue)}diff --git a/pkg/output/legacy_json.go b/pkg/output/legacy_json.goindex 74683f457..5f3cf3ff6 100644--- a/pkg/output/legacy_json.go+++ b/pkg/output/legacy_json.go@@ -85,7 +85,7 @@ func convertToLegacyJSON(r *detectors.ResultWithMetadata, repoPath string) (*Legdiff := GenerateDiff(commit, fileName)- foundString := string(r.Result.Raw)+ foundString := string(r.Raw)// Add highlighting to the offending bit of string.printableDiff := strings.ReplaceAll(diff, foundString, fmt.Sprintf("\u001b[93m%s\u001b[0m", foundString))@@ -99,7 +99,7 @@ func convertToLegacyJSON(r *detectors.ResultWithMetadata, repoPath string) (*LegDiff: diff,Path: fileName,PrintDiff: printableDiff,- Reason: r.Result.DetectorType.String(),+ Reason: r.DetectorType.String(),StringsFound: []string{foundString},}return output, nildiff --git a/pkg/output/plain.go b/pkg/output/plain.goindex a1df13de7..14f972120 100644--- a/pkg/output/plain.go+++ b/pkg/output/plain.go@@ -30,16 +30,16 @@ type PlainPrinter struct{ mu sync.Mutex }func (p *PlainPrinter) Print(_ context.Context, r *detectors.ResultWithMetadata) error {out := outputFormat{- DetectorType: r.Result.DetectorType.String(),+ DetectorType: r.DetectorType.String(),DecoderType: r.DecoderType.String(),- Verified: r.Result.Verified,- VerificationError: r.Result.VerificationError(),+ Verified: r.Verified,+ VerificationError: r.VerificationError(),MetaData: r.SourceMetadata,- Raw: strings.TrimSpace(string(r.Result.Raw)),+ Raw: strings.TrimSpace(string(r.Raw)),DetectorDescription: r.DetectorDescription,}- meta, err := structToMap(out.MetaData.Data)+ meta, err := structToMap(out.Data)if err != nil {return fmt.Errorf("could not marshal result: %w", err)}@@ -49,43 +49,42 @@ func (p *PlainPrinter) Print(_ context.Context, r *detectors.ResultWithMetadata)defer p.mu.Unlock()if out.Verified {- boldGreenPrinter.Print("β Found verified result π·π\n")+ _, _ = boldGreenPrinter.Print("β Found verified result π·π\n")} else {printer = whitePrinter- boldWhitePrinter.Print("Found unverified result π·πβ\n")+ _, _ = boldWhitePrinter.Print("Found unverified result π·πβ\n")if out.VerificationError != nil {- yellowPrinter.Printf("Verification issue: %s\n", out.VerificationError)+ _, _ = yellowPrinter.Printf("Verification issue: %s\n", out.VerificationError)}}if r.VerificationFromCache {- cyanPrinter.Print("(π Using cached verification)\n")+ _, _ = cyanPrinter.Print("(π Using cached verification)\n")}+ _, _ = printer.Printf("Detector Type: %s\n", out.DetectorType)+ _, _ = printer.Printf("Decoder Type: %s\n", out.DecoderType)+ _, _ = printer.Printf("Raw result: %s\n", whitePrinter.Sprint(out.Raw))- printer.Printf("Detector Type: %s\n", out.DetectorType)- printer.Printf("Decoder Type: %s\n", out.DecoderType)- printer.Printf("Raw result: %s\n", whitePrinter.Sprint(out.Raw))-- for k, v := range r.Result.ExtraData {- printer.Printf(+ for k, v := range r.ExtraData {+ _, _ = printer.Printf("%s: %v\n",cases.Title(language.AmericanEnglish).String(k),v)}- if r.Result.StructuredData != nil {- for idx, v := range r.Result.StructuredData.GithubSshKey {- printer.Printf("GithubSshKey %d User: %s\n", idx, v.User)+ if r.StructuredData != nil {+ for idx, v := range r.StructuredData.GithubSshKey {+ _, _ = printer.Printf("GithubSshKey %d User: %s\n", idx, v.User)if v.PublicKeyFingerprint != "" {- printer.Printf("GithubSshKey %d Fingerprint: %s\n", idx, v.PublicKeyFingerprint)+ _, _ = printer.Printf("GithubSshKey %d Fingerprint: %s\n", idx, v.PublicKeyFingerprint)}}- for idx, v := range r.Result.StructuredData.TlsPrivateKey {- printer.Printf("TlsPrivateKey %d Fingerprint: %s\n", idx, v.CertificateFingerprint)- printer.Printf("TlsPrivateKey %d Verification URL: %s\n", idx, v.VerificationUrl)- printer.Printf("TlsPrivateKey %d Expiration: %d\n", idx, v.ExpirationTimestamp)+ for idx, v := range r.StructuredData.TlsPrivateKey {+ _, _ = printer.Printf("TlsPrivateKey %d Fingerprint: %s\n", idx, v.CertificateFingerprint)+ _, _ = printer.Printf("TlsPrivateKey %d Verification URL: %s\n", idx, v.VerificationUrl)+ _, _ = printer.Printf("TlsPrivateKey %d Expiration: %d\n", idx, v.ExpirationTimestamp)}}@@ -100,12 +99,12 @@ func (p *PlainPrinter) Print(_ context.Context, r *detectors.ResultWithMetadata)}sort.Strings(aggregateDataKeys)for _, k := range aggregateDataKeys {- printer.Printf("%s: %v\n", cases.Title(language.AmericanEnglish).String(k), aggregateData[k])+ _, _ = printer.Printf("%s: %v\n", cases.Title(language.AmericanEnglish).String(k), aggregateData[k])}// if analysis info is not nil, means the detector added key for analyzer and result is verified- if r.Result.SecretParts != nil && r.Result.Verified {- printer.Printf("Analyze: Run `trufflehog analyze` to analyze this key's permissions\n")+ if r.SecretParts != nil && r.Verified {+ _, _ = printer.Printf("Analyze: Run `trufflehog analyze` to analyze this key's permissions\n")}fmt.Println("")diff --git a/pkg/roundtripper/roundtripper.go b/pkg/roundtripper/roundtripper.goindex d81b7a89a..acaec85b1 100644--- a/pkg/roundtripper/roundtripper.go+++ b/pkg/roundtripper/roundtripper.go@@ -73,7 +73,7 @@ func (r *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {)if r.BasicAuthRoundTripper != nil {- req.SetBasicAuth(r.BasicAuthRoundTripper.username, r.BasicAuthRoundTripper.password)+ req.SetBasicAuth(r.username, r.password)}authMethod := determineAuth(req)@@ -94,9 +94,9 @@ func (r *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {)}- reason, shouldRetry, duration := r.RetryableRoundtripper.shouldRetryRequest(response, err)+ reason, shouldRetry, duration := r.shouldRetryRequest(response, err)if shouldRetry {- if retries >= int(r.RetryableRoundtripper.maxRetries) {+ if retries >= int(r.maxRetries) {r.logger.V(2).Info("max retries reached","host", req.Host,"reason", reason,diff --git a/pkg/sanitizer/utf8.go b/pkg/sanitizer/utf8.goindex 8ebe39834..7fe8b7957 100644--- a/pkg/sanitizer/utf8.go+++ b/pkg/sanitizer/utf8.go@@ -5,5 +5,5 @@ import ()func UTF8(in string) string {- return strings.Replace(strings.ToValidUTF8(in, "β"), "\x00", "", -1)+ return strings.ReplaceAll(strings.ToValidUTF8(in, "β"), "\x00", "")}diff --git a/pkg/sources/chunker_test.go b/pkg/sources/chunker_test.goindex ce14cd269..e04fb4539 100644--- a/pkg/sources/chunker_test.go+++ b/pkg/sources/chunker_test.go@@ -159,7 +159,7 @@ type panicReader struct{}var _ io.Reader = (*panicReader)(nil)-func (_ panicReader) Read([]byte) (int, error) {+func (panicReader) Read([]byte) (int, error) {panic("panic for testing")}diff --git a/pkg/sources/docker/docker.go b/pkg/sources/docker/docker.goindex 135bb10c4..ea376610a 100644--- a/pkg/sources/docker/docker.go+++ b/pkg/sources/docker/docker.go@@ -382,7 +382,7 @@ func (s *Source) processLayer(ctx context.Context, layer v1.Layer, imgInfo imageif err != nil {return err}- defer rc.Close()+ defer func() { _ = rc.Close() }()// Configure parallel gzip decompression for better performanceconst (@@ -394,7 +394,7 @@ func (s *Source) processLayer(ctx context.Context, layer v1.Layer, imgInfo imageif err != nil {return err}- defer gzipReader.Close()+ defer func() { _ = gzipReader.Close() }()// Layers are tar archives, so we read them as tar filestarReader := tar.NewReader(gzipReader)diff --git a/pkg/sources/docker/docker_test.go b/pkg/sources/docker/docker_test.goindex b8cfb6894..b3a89d071 100644--- a/pkg/sources/docker/docker_test.go+++ b/pkg/sources/docker/docker_test.go@@ -267,7 +267,7 @@ func TestDockerImageScanFromLocalDaemon(t *testing.T) {return}- defer resp.Close()+ defer func() { _ = resp.Close() }()// if we don't read the response, the image will not be available in the local Docker daemon_, err = io.ReadAll(resp)diff --git a/pkg/sources/elasticsearch/api.go b/pkg/sources/elasticsearch/api.goindex 02a2480d8..c75b28315 100644--- a/pkg/sources/elasticsearch/api.go+++ b/pkg/sources/elasticsearch/api.go@@ -145,7 +145,7 @@ func makeElasticSearchRequest(return nil, err}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()rawData, err := io.ReadAll(res.Body)if err != nil {@@ -216,17 +216,17 @@ func fetchIndexDocumentCount(hits, ok := data["hits"].(map[string]any)if !ok {- return 0, errors.New("No hits in response")+ return 0, errors.New("no hits in response")}total, ok := hits["total"].(map[string]any)if !ok {- return 0, errors.New("No total in hits")+ return 0, errors.New("no total in hits")}count, ok := total["value"].(float64)if !ok {- return 0, errors.New("No value in total")+ return 0, errors.New("no value in total")}return int(count), nil@@ -249,7 +249,7 @@ func createPITForSearch(pitID, ok := data["id"].(string)if !ok {- return "", errors.New("No id in response")+ return "", errors.New("no id in response")}return pitID, nil@@ -321,7 +321,7 @@ func processSearchedDocuments(if !ok {apiErr, ok := searchResults["error"].(map[string]any)if ok {- return 0, fmt.Errorf("Error fetching search results: %v\n", apiErr)+ return 0, fmt.Errorf("error fetching search results: %v", apiErr)}continue}diff --git a/pkg/sources/elasticsearch/elasticsearch_integration_test.go b/pkg/sources/elasticsearch/elasticsearch_integration_test.goindex cc7b821d0..4062f79c6 100644--- a/pkg/sources/elasticsearch/elasticsearch_integration_test.go+++ b/pkg/sources/elasticsearch/elasticsearch_integration_test.go@@ -86,7 +86,7 @@ func TestSource_ElasticAPI(t *testing.T) {if err != nil {t.Fatal(err)}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()t.Run("Adding a document to a new index creates a single index",@@ -126,7 +126,7 @@ func TestSource_ElasticAPI(t *testing.T) {if err != nil {t.Fatal(err)}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()t.Run("Indices have the correct document count",@@ -349,7 +349,7 @@ func TestSource_ElasticAPI(t *testing.T) {if err != nil {t.Fatal(err)}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()}docSearch := DocumentSearch{diff --git a/pkg/sources/errors_test.go b/pkg/sources/errors_test.goindex e7b9d3a03..a01ccaaa6 100644--- a/pkg/sources/errors_test.go+++ b/pkg/sources/errors_test.go@@ -7,7 +7,7 @@ import ("testing")-var testError = fmt.Errorf("simulated failure")+var errTest = fmt.Errorf("simulated failure")func TestNewScanErrors(t *testing.T) {testCases := []struct {@@ -86,7 +86,7 @@ func TestScanErrorsAdd(t *testing.T) {wg.Add(1)go func() {for j := 0; j < tc.wantErr/tc.concurrency; j++ {- se.Add(testError)+ se.Add(errTest)}wg.Done()}()@@ -137,7 +137,7 @@ func TestScanErrorsCount(t *testing.T) {wg.Add(1)go func() {for j := 0; j < tc.wantErrCnt/tc.concurrency; j++ {- se.Add(testError)+ se.Add(errTest)}wg.Done()}()@@ -153,8 +153,8 @@ func TestScanErrorsCount(t *testing.T) {func TestScanErrorsString(t *testing.T) {se := NewScanErrors()- se.Add(testError)- want := `["` + testError.Error() + `"]`+ se.Add(errTest)+ want := `["` + errTest.Error() + `"]`if got := fmt.Sprintf("%v", se); got != want {t.Errorf("got %q, want %q", got, want)}diff --git a/pkg/sources/filesystem/filesystem.go b/pkg/sources/filesystem/filesystem.goindex 5aced6666..e88c94a4c 100644--- a/pkg/sources/filesystem/filesystem.go+++ b/pkg/sources/filesystem/filesystem.go@@ -362,7 +362,7 @@ func (s *Source) scanFile(ctx trContext.Context, chunksChan chan *sources.Chunk,if err != nil {return fmt.Errorf("unable to open file: %w", err)}- defer inputFile.Close()+ defer func() { _ = inputFile.Close() }()fileCtx.Logger().V(3).Info("scanning file")diff --git a/pkg/sources/filesystem/filesystem_test.go b/pkg/sources/filesystem/filesystem_test.goindex 5a964d671..ab77cbd01 100644--- a/pkg/sources/filesystem/filesystem_test.go+++ b/pkg/sources/filesystem/filesystem_test.go@@ -132,7 +132,7 @@ func TestScanFile(t *testing.T) {func TestScanBinaryFile(t *testing.T) {tmpfile, err := os.CreateTemp("", "example.bin")require.NoError(t, err)- defer os.Remove(tmpfile.Name())+ defer func() { _ = os.Remove(tmpfile.Name()) }()// binary data that decodes to "TuffleHog"fileContents := []byte{0x54, 0x75, 0x66, 0x66, 0x6C, 0x65, 0x48, 0x6F, 0x67}@@ -171,7 +171,7 @@ func TestEnumerate(t *testing.T) {// Setup the connection to test enumeration.dir, err := os.MkdirTemp("", "trufflehog-test-enumerate")assert.NoError(t, err)- defer os.RemoveAll(dir)+ defer func() { _ = os.RemoveAll(dir) }()units := []string{"/one", "/two", "/three",@@ -184,14 +184,14 @@ func TestEnumerate(t *testing.T) {if i < 3 {f, err := os.Create(fullPath)assert.NoError(t, err)- f.Close()+ _ = f.Close()} else {assert.NoError(t, os.MkdirAll(fullPath, 0755))// Create a file in the directory for enumeration to find.f, err := os.CreateTemp(fullPath, "file")assert.NoError(t, err)units[i] = f.Name()- f.Close()+ _ = f.Close()}}conn, err := anypb.New(&sourcespb.Filesystem{@@ -309,7 +309,7 @@ func TestChunkUnitReporterErr(t *testing.T) {if err != nil {t.Fatal(err)}- defer os.Remove(tmpfile.Name())+ defer func() { _ = os.Remove(tmpfile.Name()) }()fileContents := []byte("TestChunkUnit")_, err = tmpfile.Write(fileContents)@@ -383,7 +383,7 @@ func TestScanSubDirFile(t *testing.T) {testDir := filepath.Join(os.TempDir(), "trufflehog-test")err := os.MkdirAll(testDir, 0755)require.NoError(t, err)- defer os.RemoveAll(testDir)+ defer func() { _ = os.RemoveAll(testDir) }()// Create a subdirectory and filechildDir := filepath.Join(testDir, "child")@@ -422,7 +422,7 @@ func TestSkipBinaries(t *testing.T) {// Create a temporary directory for testingtempDir, err := os.MkdirTemp("", "trufflehog_test")require.NoError(t, err)- defer os.RemoveAll(tempDir)+ defer func() { _ = os.RemoveAll(tempDir) }()// Create a binary file (executable)binaryFile := filepath.Join(tempDir, "test.exe")diff --git a/pkg/sources/gcs/gcs.go b/pkg/sources/gcs/gcs.goindex 413dde690..571c0ac70 100644--- a/pkg/sources/gcs/gcs.go+++ b/pkg/sources/gcs/gcs.go@@ -99,7 +99,7 @@ func newPersistableCache(increment int, cache cache.Cache[string], p *sources.Prfunc (c *persistableCache) Set(key string, val string) {c.Cache.Set(key, val)if ok, contents := c.shouldPersist(); ok {- c.Progress.EncodedResumeInfo = contents+ c.EncodedResumeInfo = contents}}@@ -261,7 +261,7 @@ func (s *Source) Chunks(ctx context.Context, chunksChan chan *sources.Chunk, _ .return fmt.Errorf("error listing objects: %w", err)}s.chunksCh = chunksChan- s.Progress.Message = "starting to process objects..."+ s.Message = "starting to process objects..."var wg sync.WaitGroupfor obj := range objectCh {@@ -295,8 +295,8 @@ func (s *Source) Chunks(ctx context.Context, chunksChan chan *sources.Chunk, _ .func (s *Source) setupCache(ctx context.Context) *persistableCache {var c cache.Cache[string]- if s.Progress.EncodedResumeInfo != "" {- keys := strings.Split(s.Progress.EncodedResumeInfo, ",")+ if s.EncodedResumeInfo != "" {+ keys := strings.Split(s.EncodedResumeInfo, ",")entries := make([]simple.CacheEntry[string], len(keys))for i, val := range keys {entries[i] = simple.CacheEntry[string]{Key: val, Value: val}@@ -321,14 +321,14 @@ func (s *Source) setProgress(ctx context.Context, md5, objName string, cache cacs.SectionsCompleted++cache.Set(md5, md5)- s.Progress.SectionsRemaining = int32(s.stats.numObjects)- s.Progress.PercentComplete = int64(float64(s.SectionsCompleted) / float64(s.stats.numObjects) * 100)+ s.SectionsRemaining = int32(s.stats.numObjects)+ s.PercentComplete = int64(float64(s.SectionsCompleted) / float64(s.stats.numObjects) * 100)}func (s *Source) completeProgress(ctx context.Context) {msg := fmt.Sprintf("GCS source finished processing %d objects", s.stats.numObjects)ctx.Logger().Info(msg)- s.Progress.Message = msg+ s.Message = msg}func (s *Source) processObject(ctx context.Context, o object) error {diff --git a/pkg/sources/gcs/gcs_test.go b/pkg/sources/gcs/gcs_test.goindex 9cde72ffe..7d3dc65cb 100644--- a/pkg/sources/gcs/gcs_test.go+++ b/pkg/sources/gcs/gcs_test.go@@ -400,14 +400,14 @@ func TestSourceChunks_ProgressSet(t *testing.T) {// Test that the resume progress is set.var progress strings.Builderfor i := range got {- progress.WriteString(fmt.Sprintf("md5hash%d", i))+ fmt.Fprintf(&progress, "md5hash%d", i)// Add a comma if not the last element.if i != len(got)-1 {progress.WriteString(",")}}- encodeResume := strings.Split(source.Progress.EncodedResumeInfo, ",")+ encodeResume := strings.Split(source.EncodedResumeInfo, ",")sort.Slice(encodeResume, func(i, j int) bool {numI, _ := strconv.Atoi(strings.TrimPrefix(encodeResume[i], "md5hash"))numJ, _ := strconv.Atoi(strings.TrimPrefix(encodeResume[j], "md5hash"))@@ -415,9 +415,9 @@ func TestSourceChunks_ProgressSet(t *testing.T) {})assert.Equal(t, progress.String(), strings.Join(encodeResume, ","))- assert.Equal(t, int32(defaultCachePersistIncrement), source.Progress.SectionsCompleted)- assert.Equal(t, int64(100), source.Progress.PercentComplete)- assert.Equal(t, fmt.Sprintf("GCS source finished processing %d objects", defaultCachePersistIncrement), source.Progress.Message)+ assert.Equal(t, int32(defaultCachePersistIncrement), source.SectionsCompleted)+ assert.Equal(t, int64(100), source.PercentComplete)+ assert.Equal(t, fmt.Sprintf("GCS source finished processing %d objects", defaultCachePersistIncrement), source.Message)}func TestSource_CachePersistence(t *testing.T) {@@ -457,8 +457,8 @@ func TestSource_CachePersistence(t *testing.T) {// Test that the resume progress is empty.// The cache should not have been persisted.- assert.Equal(t, "", source.Progress.EncodedResumeInfo)- assert.Equal(t, int32(wantObjCnt), source.Progress.SectionsCompleted)- assert.Equal(t, int64(100), source.Progress.PercentComplete)- assert.Equal(t, fmt.Sprintf("GCS source finished processing %d objects", wantObjCnt), source.Progress.Message)+ assert.Equal(t, "", source.EncodedResumeInfo)+ assert.Equal(t, int32(wantObjCnt), source.SectionsCompleted)+ assert.Equal(t, int64(100), source.PercentComplete)+ assert.Equal(t, fmt.Sprintf("GCS source finished processing %d objects", wantObjCnt), source.Message)}diff --git a/pkg/sources/git/git.go b/pkg/sources/git/git.goindex 57f349896..53489b2e0 100644--- a/pkg/sources/git/git.go+++ b/pkg/sources/git/git.go@@ -319,7 +319,7 @@ func (s *Source) scanRepo(ctx context.Context, repoURI string, reporter sources.// if legacy JSON is enabled, don't remove the directory because we need it for outputting legacy JSON.if !s.conn.GetPrintLegacyJson() {if strings.HasPrefix(path, filepath.Join(os.TempDir(), "trufflehog")) || (!s.conn.GetNoCleanup() && s.conn.GetClonePath() != "") {- defer os.RemoveAll(path)+ defer func() { _ = os.RemoveAll(path) }()}}@@ -373,7 +373,7 @@ func (s *Source) scanDir(ctx context.Context, gitDir string, reporter sources.Ch// if legacy JSON is enabled, don't remove the directory because we need it for outputting legacy JSON.if !s.conn.GetPrintLegacyJson() {if strings.HasPrefix(gitDir, filepath.Join(os.TempDir(), "trufflehog")) || (!s.conn.GetNoCleanup() && s.conn.GetClonePath() != "") {- defer os.RemoveAll(gitDir)+ defer func() { _ = os.RemoveAll(gitDir) }()}}@@ -404,7 +404,7 @@ func RepoFromPath(path string) (*git.Repository, error) {func CleanOnError(err *error, path string) {if *err != nil {- os.RemoveAll(path)+ _ = os.RemoveAll(path)}}@@ -863,7 +863,7 @@ func (s *Git) ScanCommits(ctx context.Context, repo *git.Repository, path string)return nil}- defer reader.Close()+ defer func() { _ = reader.Close() }()data := make([]byte, d.Len())if _, err := io.ReadFull(reader, data); err != nil {@@ -898,7 +898,7 @@ func (s *Git) gitChunk(ctx context.Context, diff *gitparse.Diff, fileName, emailctx.Logger().Error(err, "error creating reader for chunk", "filename", fileName, "commit", hash, "file", diff.PathB)return}- defer reader.Close()+ defer func() { _ = reader.Close() }()originalChunk := bufio.NewScanner(reader)newChunkBuffer := bytes.Buffer{}@@ -1115,7 +1115,7 @@ func (s *Git) ScanStaged(ctx context.Context, repo *git.Repository, path string,logger.Error(err, "error creating reader for staged")return nil}- defer reader.Close()+ defer func() { _ = reader.Close() }()data := make([]byte, d.Len())if _, err := reader.Read(data); err != nil {diff --git a/pkg/sources/git/git_test.go b/pkg/sources/git/git_test.goindex f419eee5e..7b8ccf357 100644--- a/pkg/sources/git/git_test.go+++ b/pkg/sources/git/git_test.go@@ -986,7 +986,7 @@ func TestPrepareRepoWithNormalization(t *testing.T) {}if path != repoPath && path != "" {- os.RemoveAll(path)+ _ = os.RemoveAll(path)}})}@@ -1028,7 +1028,7 @@ func TestPrepareRepoWithNormalization(t *testing.T) {}if path != repoPath && path != "" {- os.RemoveAll(path)+ _ = os.RemoveAll(path)}})}@@ -1104,7 +1104,7 @@ func TestPrepareRepoWithNormalizationBare(t *testing.T) {}if path != bareRepoPath && path != "" {- os.RemoveAll(path)+ _ = os.RemoveAll(path)}})}@@ -1158,7 +1158,7 @@ func TestPrepareRepoWithNormalizationBare(t *testing.T) {}if path != bareRepoPath && path != "" {- os.RemoveAll(path)+ _ = os.RemoveAll(path)}})}diff --git a/pkg/sources/github/github.go b/pkg/sources/github/github.goindex 5e1563c5c..6e84f7abf 100644--- a/pkg/sources/github/github.go+++ b/pkg/sources/github/github.go@@ -769,7 +769,7 @@ func (s *Source) cloneAndScanRepo(ctx context.Context, repoURL string, repoInfo// if legacy JSON is enabled, don't remove the directory because we need it for outputting legacy JSON.if !s.conn.GetPrintLegacyJson() {if strings.HasPrefix(path, filepath.Join(os.TempDir(), "trufflehog")) || (!s.conn.NoCleanup && s.conn.GetClonePath() != "") {- defer os.RemoveAll(path)+ defer func() { _ = os.RemoveAll(path) }()}}@@ -1363,7 +1363,7 @@ func (s *Source) processIssues(ctx context.Context, repoInfo repoInfo, reporterreturn err}- bodyTextsOpts.ListOptions.Page+++ bodyTextsOpts.Page++if len(issues) < defaultPagination {break@@ -1431,7 +1431,7 @@ func (s *Source) processIssueComments(ctx context.Context, repoInfo repoInfo, rereturn err}- issueOpts.ListOptions.Page+++ issueOpts.Page++if len(issueComments) < defaultPagination {break}@@ -1499,7 +1499,7 @@ func (s *Source) processPRs(ctx context.Context, repoInfo repoInfo, reporter soureturn err}- prOpts.ListOptions.Page+++ prOpts.Page++if len(prs) < defaultPagination {break@@ -1531,7 +1531,7 @@ func (s *Source) processPRComments(ctx context.Context, repoInfo repoInfo, reporreturn err}- prOpts.ListOptions.Page+++ prOpts.Page++if len(prComments) < defaultPagination {break@@ -1667,7 +1667,7 @@ func (s *Source) scanTarget(ctx context.Context, target sources.ChunkingTarget,// As of this writing, if the returned readCloser is not nil, it's just the Body of the returned github.Response, so// there's no need to independently close it.if resp != nil && resp.Body != nil {- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}if err != nil {return fmt.Errorf("could not download file for scan: %w", err)@@ -1684,7 +1684,7 @@ func (s *Source) scanCommitMetadata(ctx context.Context, owner, repo string, met// fetch the commitcommit, resp, err := s.connector.APIClient().Repositories.GetCommit(ctx, owner, repo, meta.GetCommit(), nil)if resp != nil && resp.Body != nil {- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()}if err != nil {return fmt.Errorf("could not fetch commit for metadata scan: %w", err)diff --git a/pkg/sources/github_experimental/object_discovery.go b/pkg/sources/github_experimental/object_discovery.goindex a09d8415e..991ec46a6 100644--- a/pkg/sources/github_experimental/object_discovery.go+++ b/pkg/sources/github_experimental/object_discovery.go@@ -209,7 +209,7 @@ func writeCommitsToDisk(commits []string, commitsType, folder string) error {if err != nil {return err}- defer file.Close()+ defer func() { _ = file.Close() }()for _, commit := range commits {if _, err := file.WriteString(commit + "\n"); err != nil {@@ -413,7 +413,7 @@ func checkHashes(ctx context.Context, client *github.Client, owner, repo string,if err != nil {return nil, fmt.Errorf("python request error: %w", err)}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()body, err := io.ReadAll(resp.Body)if err != nil {@@ -564,7 +564,7 @@ func (s *Source) EnumerateAndScanAllObjects(ctx context.Context, chunksChan chanreturn fmt.Errorf("failed to clone the repository: %w", err)}- defer os.RemoveAll(path)+ defer func() { _ = os.RemoveAll(path) }()// count total valid hashesvalidHashes, err := getExistingHashes(path)diff --git a/pkg/sources/gitlab/gitlab.go b/pkg/sources/gitlab/gitlab.goindex c13cda6f8..733792a99 100644--- a/pkg/sources/gitlab/gitlab.go+++ b/pkg/sources/gitlab/gitlab.go@@ -977,7 +977,7 @@ func (s *Source) scanRepos(ctx context.Context, chunksChan chan *sources.Chunk)// if legacy JSON is enabled, don't remove the directory because we need it for outputting legacy JSON.if !s.printLegacyJSON {if strings.HasPrefix(path, filepath.Join(os.TempDir(), "trufflehog")) || (!s.noCleanup && s.clonePath != "") {- defer os.RemoveAll(path)+ defer func() { _ = os.RemoveAll(path) }()}}@@ -1180,7 +1180,7 @@ func (s *Source) ChunkUnit(ctx context.Context, unit sources.SourceUnit, reporte// if legacy JSON is enabled, don't remove the directory because we need it for outputting legacy JSON.if !s.printLegacyJSON {if strings.HasPrefix(path, filepath.Join(os.TempDir(), "trufflehog")) || (!s.noCleanup && s.clonePath != "") {- defer os.RemoveAll(path)+ defer func() { _ = os.RemoveAll(path) }()}}diff --git a/pkg/sources/huggingface/client.go b/pkg/sources/huggingface/client.goindex d23626580..e2f10522f 100644--- a/pkg/sources/huggingface/client.go+++ b/pkg/sources/huggingface/client.go@@ -157,7 +157,7 @@ func (c *HFClient) get(ctx context.Context, url string, target interface{}) erroreturn errors.New("access to this repo is restricted and you are not in the authorized list. Visit the repository to ask for access")}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()return json.NewDecoder(resp.Body).Decode(target)}diff --git a/pkg/sources/huggingface/huggingface.go b/pkg/sources/huggingface/huggingface.goindex 133510020..57d6a1a0e 100644--- a/pkg/sources/huggingface/huggingface.go+++ b/pkg/sources/huggingface/huggingface.go@@ -599,7 +599,7 @@ func (s *Source) cloneAndScanRepo(ctx context.Context, repoURL string, repoInfoif err != nil {return 0, err}- defer os.RemoveAll(path)+ defer func() { _ = os.RemoveAll(path) }()var logger logr.Loggerlogger.V(2).Info("scanning %s", repoInfo.resourceType)diff --git a/pkg/sources/jenkins/jenkins.go b/pkg/sources/jenkins/jenkins.goindex e51805555..22c5f4e45 100644--- a/pkg/sources/jenkins/jenkins.go+++ b/pkg/sources/jenkins/jenkins.go@@ -250,7 +250,7 @@ func (s *Source) GetJenkinsObjectsForPath(ctx context.Context, absolutePath striif err != nil {return res, errors.WrapPrefix(err, "Failed to do get jenkins jobs request", 0)}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode != http.StatusOK {return res, errors.New(fmt.Sprintf("Received non-200 status from get jenkins jobs request: %d", resp.StatusCode))@@ -297,7 +297,7 @@ func (s *Source) GetJenkinsBuilds(ctx context.Context, jobAbsolutePath string) (if err != nil {return builds, errors.WrapPrefix(err, "Failed to do get jenkins builds request", 0)}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode != http.StatusOK {return builds, errors.New(fmt.Sprintf("Received non-200 status from get jenkins builds request: %d", resp.StatusCode))@@ -404,7 +404,7 @@ func (s *Source) chunkBuild(if err != nil {return fmt.Errorf("could not retrieve build log from %q: %w", buildLogURL.String(), err)}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode >= 400 {return fmt.Errorf("got unexpected HTTP status code %v when trying to retrieve build log from %q",diff --git a/pkg/sources/jenkins/jenkins_test.go b/pkg/sources/jenkins/jenkins_test.goindex 90461805e..3598df30c 100644--- a/pkg/sources/jenkins/jenkins_test.go+++ b/pkg/sources/jenkins/jenkins_test.go@@ -58,10 +58,10 @@ func createMockJenkinsServer(jobName string, buildNumber int, logContent string)response := fmt.Sprintf(`{"jobs":[{"_class":"org.jenkinsci.plugins.workflow.job.WorkflowJob",`+`"name":"%s","url":"%s/job/%s/"}]}`, jobName, server.URL, jobName)- fmt.Fprint(w, response)+ _, _ = fmt.Fprint(w, response)} else {w.Header().Set("Content-Type", "application/json")- fmt.Fprint(w, `{"jobs":[]}`)+ _, _ = fmt.Fprint(w, `{"jobs":[]}`)}})@@ -71,10 +71,10 @@ func createMockJenkinsServer(jobName string, buildNumber int, logContent string)w.Header().Set("Content-Type", "application/json")response := fmt.Sprintf(`{"builds":[{"number":%d,"url":"%s/job/%s/%d/"}]}`, buildNumber, server.URL, jobName, buildNumber)- fmt.Fprint(w, response)+ _, _ = fmt.Fprint(w, response)} else {w.Header().Set("Content-Type", "application/json")- fmt.Fprint(w, `{"builds":[]}`)+ _, _ = fmt.Fprint(w, `{"builds":[]}`)}})@@ -82,7 +82,7 @@ func createMockJenkinsServer(jobName string, buildNumber int, logContent string)// This is where the test data payload is served to verify chunking behavior.mux.HandleFunc(fmt.Sprintf("/job/%s/%d/consoleText", jobName, buildNumber), func(w http.ResponseWriter, r *http.Request) {w.Header().Set("Content-Type", "text/plain")- fmt.Fprint(w, logContent)+ _, _ = fmt.Fprint(w, logContent)})return server@@ -224,7 +224,7 @@ func TestJenkinsChunkBuildDirect(t *testing.T) {server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {if strings.HasSuffix(r.URL.Path, "/consoleText") {w.Header().Set("Content-Type", "text/plain")- fmt.Fprint(w, largeLogContent)+ _, _ = fmt.Fprint(w, largeLogContent)} else {http.NotFound(w, r)}diff --git a/pkg/sources/json_enumerator/json_enumerator.go b/pkg/sources/json_enumerator/json_enumerator.goindex a82cea96d..991d9fb52 100644--- a/pkg/sources/json_enumerator/json_enumerator.go+++ b/pkg/sources/json_enumerator/json_enumerator.go@@ -198,7 +198,7 @@ func (s *Source) chunkJSONEnumerator(if err != nil {return fmt.Errorf("unable to open file: %w", err)}- defer enumeratorFile.Close()+ defer func() { _ = enumeratorFile.Close() }()return s.chunkJSONEnumeratorReader(ctx, enumeratorFile, chunksChan)}diff --git a/pkg/sources/postman/postman.go b/pkg/sources/postman/postman.goindex b6e6140af..c0a7fccc1 100644--- a/pkg/sources/postman/postman.go+++ b/pkg/sources/postman/postman.go@@ -430,7 +430,7 @@ func (s *Source) scanItem(ctx context.Context, chunksChan chan *sources.Chunk, cmetadata.FolderID = item.Uid// check if there are any requests in the folderif item.Request.Method != "" {- metadata.FolderName = strings.Replace(metadata.FolderName, (" > " + item.Name), "", -1)+ metadata.FolderName = strings.ReplaceAll(metadata.FolderName, (" > " + item.Name), "")metadata.FolderID = parentItemIdif metadata.FolderID == "" {metadata.FolderName = ""@@ -470,7 +470,7 @@ func (s *Source) scanEvent(ctx context.Context, chunksChan chan *sources.Chunk,// Prep direct links. Ignore updating link if it's a local JSON fileif !metadata.fromLocal {- metadata.Link = LINK_BASE_URL + (strings.Replace(metadata.Type, " > event", "", -1)) + "/" + metadata.FullID+ metadata.Link = LINK_BASE_URL + (strings.ReplaceAll(metadata.Type, " > event", "")) + "/" + metadata.FullIDif event.Listen == "prerequest" {metadata.Link += "?tab=pre-request-scripts"} else {@@ -817,13 +817,13 @@ func unpackWorkspace(workspacePath string) (Workspace, error) {if err != nil {return workspace, err}- defer r.Close()+ defer func() { _ = r.Close() }()for _, file := range r.File {rc, err := file.Open()if err != nil {return workspace, err}- defer rc.Close()+ defer func() { _ = rc.Close() }()contents, err := io.ReadAll(rc)if err != nil {return workspace, errdiff --git a/pkg/sources/postman/postman_client.go b/pkg/sources/postman/postman_client.goindex 6ecb9f440..8379e8c56 100644--- a/pkg/sources/postman/postman_client.go+++ b/pkg/sources/postman/postman_client.go@@ -283,7 +283,7 @@ func (c *Client) getPostmanResponseBodyBytes(ctx trContext.Context, urlString st}return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()c.Metrics.apiRequests.WithLabelValues(urlString).Inc()diff --git a/pkg/sources/s3/s3.go b/pkg/sources/s3/s3.goindex 8b0939f20..7dd27fb5b 100644--- a/pkg/sources/s3/s3.go+++ b/pkg/sources/s3/s3.go@@ -326,7 +326,7 @@ func (s *Source) scanBuckets(bucketIdx,len(bucketsToScan),fmt.Sprintf("Bucket: %s", bucket),- s.Progress.EncodedResumeInfo,+ s.EncodedResumeInfo,)var startAfter *string@@ -554,7 +554,7 @@ func (s *Source) pageChunker(// It's uncertain if the body will be nil in such cases,// but we'll close it if it's not.if res != nil && res.Body != nil {- res.Body.Close()+ _ = res.Body.Close()}nErr, ok := state.errorCount.Load(prefix)@@ -573,7 +573,7 @@ func (s *Source) pageChunker(}return nil}- defer res.Body.Close()+ defer func() { _ = res.Body.Close() }()email := "Unknown"if obj.Owner != nil {@@ -748,7 +748,7 @@ func (s *Source) ChunkUnit(ctx context.Context, unit sources.SourceUnit, reportecheckpointer := NewCheckpointer(ctx, &s.Progress, true)var startAfterPtr *string- startAfter := s.Progress.GetEncodedResumeInfoFor(unitID)+ startAfter := s.GetEncodedResumeInfoFor(unitID)if startAfter != "" {ctx.Logger().V(3).Info("Resuming unit scan",@@ -757,7 +757,7 @@ func (s *Source) ChunkUnit(ctx context.Context, unit sources.SourceUnit, reporte)startAfterPtr = &startAfter}- defer s.Progress.ClearEncodedResumeInfoFor(unitID)+ defer s.ClearEncodedResumeInfoFor(unitID)s.scanBucket(ctx, defaultClient, s3unit.Role, s3unit.Bucket, reporter, startAfterPtr, checkpointer)return nil}diff --git a/pkg/sources/source_manager.go b/pkg/sources/source_manager.goindex 562a93947..5b5078b2b 100644--- a/pkg/sources/source_manager.go+++ b/pkg/sources/source_manager.go@@ -408,7 +408,7 @@ func (s *SourceManager) enumerate(ctx context.Context, source Source, report *Joctx.Logger().Info("running source", "with_units", true)return s.enumerateWithUnits(ctx, enumChunker, report, reporter)}- return fmt.Errorf("Enumeration not supported or configured for source: %s", source.Type().String())+ return fmt.Errorf("enumeration not supported or configured for source: %s", source.Type().String())}// scan runs a scan against a single SourceUnit as its only job. This methoddiff --git a/pkg/sources/syslog/syslog.go b/pkg/sources/syslog/syslog.goindex dc1a1af6c..6e8bf1905 100644--- a/pkg/sources/syslog/syslog.go+++ b/pkg/sources/syslog/syslog.go@@ -83,13 +83,13 @@ func (s *Source) Validate(ctx context.Context) []error {if err != nil {errs = append(errs, fmt.Errorf("error listening on tcp socket: %s", err))}- srv.Close()+ _ = srv.Close()case "udp":srv, err := net.ListenPacket(s.conn.Protocol, s.conn.ListenAddress)if err != nil {errs = append(errs, fmt.Errorf("error listening on udp socket: %s", err))}- srv.Close()+ _ = srv.Close()}}if s.conn.Protocol != "tcp" && s.conn.Protocol != "udp" {@@ -198,7 +198,7 @@ func (s *Source) Chunks(ctx context.Context, chunksChan chan *sources.Chunk, _ .if err != nil {return errors.WrapPrefix(err, "error creating TLS listener", 0)}- defer lis.Close()+ defer func() { _ = lis.Close() }()return s.acceptTCPConnections(ctx, lis, chunksChan)case s.conn.Protocol == "tcp":@@ -206,7 +206,7 @@ func (s *Source) Chunks(ctx context.Context, chunksChan chan *sources.Chunk, _ .if err != nil {return errors.WrapPrefix(err, "error creating TCP listener", 0)}- defer lis.Close()+ defer func() { _ = lis.Close() }()return s.acceptTCPConnections(ctx, lis, chunksChan)case s.conn.Protocol == "udp":@@ -218,7 +218,7 @@ func (s *Source) Chunks(ctx context.Context, chunksChan chan *sources.Chunk, _ .if err != nil {return errors.WrapPrefix(err, "could not set UDP deadline", 0)}- defer lis.Close()+ defer func() { _ = lis.Close() }()return s.acceptUDPConnections(ctx, lis, chunksChan)default:diff --git a/pkg/sources/test_helpers.go b/pkg/sources/test_helpers.goindex 25f59af8a..e1df37480 100644--- a/pkg/sources/test_helpers.go+++ b/pkg/sources/test_helpers.go@@ -8,7 +8,7 @@ import (type ChunkFunc func(chunk *Chunk) error-var MatchError = errors.New("chunk doesn't match")+var errMatch = errors.New("chunk doesn't match")func HandleTestChannel(chunksCh chan *Chunk, cf ChunkFunc) error {for {@@ -16,7 +16,7 @@ func HandleTestChannel(chunksCh chan *Chunk, cf ChunkFunc) error {case gotChunk := <-chunksCh:err := cf(gotChunk)if err != nil {- if errors.Is(err, MatchError) {+ if errors.Is(err, errMatch) {continue}return errdiff --git a/pkg/tui/common/style.go b/pkg/tui/common/style.goindex 2003869ad..3260eebbe 100644--- a/pkg/tui/common/style.go+++ b/pkg/tui/common/style.go@@ -18,7 +18,7 @@ func StyleConfig() gansi.StyleConfig {s.H1.Prefix = "# "s.H1.Suffix = ""s.H1.Color = strptr("39")- s.Document.StylePrimitive.Color = noColor+ s.Document.Color = noColors.CodeBlock.Chroma.Text.Color = noColors.CodeBlock.Chroma.Name.Color = noColor// This fixes an issue with the default style config. For examplediff --git a/pkg/tui/components/selector/selector.go b/pkg/tui/components/selector/selector.goindex 3b1b2ebb0..d1c908c97 100644--- a/pkg/tui/components/selector/selector.go+++ b/pkg/tui/components/selector/selector.go@@ -50,22 +50,22 @@ func New(common common.Common, items []IdentifiableItem, delegate ItemDelegate)// PerPage returns the number of items per page.func (s *Selector) PerPage() int {- return s.Model.Paginator.PerPage+ return s.Paginator.PerPage}// SetPage sets the current page.func (s *Selector) SetPage(page int) {- s.Model.Paginator.Page = page+ s.Paginator.Page = page}// Page returns the current page.func (s *Selector) Page() int {- return s.Model.Paginator.Page+ return s.Paginator.Page}// TotalPages returns the total number of pages.func (s *Selector) TotalPages() int {- return s.Model.Paginator.TotalPages+ return s.Paginator.TotalPages}// Select selects the item at the given index.@@ -138,7 +138,7 @@ func (s *Selector) Update(msg tea.Msg) (tea.Model, tea.Cmd) {cmds := make([]tea.Cmd, 0)switch msg := msg.(type) {case tea.KeyMsg:- filterState := s.Model.FilterState()+ filterState := s.FilterState()switch {case key.Matches(msg, s.common.KeyMap.Help):if filterState == list.Filtering {@@ -158,7 +158,7 @@ func (s *Selector) Update(msg tea.Msg) (tea.Model, tea.Cmd) {cmds = append(cmds, cmd)}// Track filter state and update active item when filter state changes.- filterState := s.Model.FilterState()+ filterState := s.FilterState()if s.filterState != filterState {cmds = append(cmds, s.activeFilterCmd)}@@ -182,7 +182,7 @@ func (s *Selector) SelectItem() tea.Msg {}func (s *Selector) selectCmd() tea.Msg {- item := s.Model.SelectedItem()+ item := s.SelectedItem()i, ok := item.(IdentifiableItem)if !ok {return SelectMsg{}@@ -191,7 +191,7 @@ func (s *Selector) selectCmd() tea.Msg {}func (s *Selector) activeCmd() tea.Msg {- item := s.Model.SelectedItem()+ item := s.SelectedItem()i, ok := item.(IdentifiableItem)if !ok {return ActiveMsg{}@@ -203,7 +203,7 @@ func (s *Selector) activeFilterCmd() tea.Msg {// Here we use VisibleItems because when list.FilterMatchesMsg is sent,// VisibleItems is the only way to get the list of filtered items. The list// bubble should export something like list.FilterMatchesMsg.Items().- items := s.Model.VisibleItems()+ items := s.VisibleItems()if len(items) == 0 {return nil}diff --git a/pkg/tui/components/viewport/viewport.go b/pkg/tui/components/viewport/viewport.goindex 77fa61828..df95cb105 100644--- a/pkg/tui/components/viewport/viewport.go+++ b/pkg/tui/components/viewport/viewport.go@@ -25,8 +25,8 @@ func New(c common.Common) *Viewport {// SetSize implements common.Component.func (v *Viewport) SetSize(width, height int) {v.common.SetSize(width, height)- v.Model.Width = width- v.Model.Height = height+ v.Width = width+ v.Height = height}// Init implements tea.Model.diff --git a/pkg/tui/pages/analyze_form/analyze_form.go b/pkg/tui/pages/analyze_form/analyze_form.goindex 6448a3f97..177db9c93 100644--- a/pkg/tui/pages/analyze_form/analyze_form.go+++ b/pkg/tui/pages/analyze_form/analyze_form.go@@ -188,7 +188,7 @@ func (ui *AnalyzeForm) Update(msg tea.Msg) (tea.Model, tea.Cmd) {return ui, nilcase tea.KeyMsg:switch {- case key.Matches(msg, ui.Common.KeyMap.Back):+ case key.Matches(msg, ui.KeyMap.Back):return nil, tea.Quit}}diff --git a/pkg/tui/pages/analyze_keys/analyze_keys.go b/pkg/tui/pages/analyze_keys/analyze_keys.goindex d85bc6e85..082a630f7 100644--- a/pkg/tui/pages/analyze_keys/analyze_keys.go+++ b/pkg/tui/pages/analyze_keys/analyze_keys.go@@ -62,9 +62,9 @@ func (ui *AnalyzeKeyPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {ui.list.SetSize(msg.Width-h, msg.Height-v)case tea.KeyMsg:switch {- case key.Matches(msg, ui.Common.KeyMap.Back):+ case key.Matches(msg, ui.KeyMap.Back):return nil, tea.Quit- case key.Matches(msg, ui.Common.KeyMap.Select):+ case key.Matches(msg, ui.KeyMap.Select):chosenAnalyzer := ui.list.SelectedItem().(KeyTypeItem)return ui, func() tea.Msg {diff --git a/pkg/tui/pages/wizard_intro/item.go b/pkg/tui/pages/wizard_intro/item.goindex 7fbefa704..5ae19e2c4 100644--- a/pkg/tui/pages/wizard_intro/item.go+++ b/pkg/tui/pages/wizard_intro/item.go@@ -129,7 +129,7 @@ func (d ItemDelegate) Render(w io.Writer, m list.Model, index int, listItem listcmd = styles.Command.Render(cmd)s.WriteString(cmd)- fmt.Fprint(w,+ _, _ = fmt.Fprint(w,d.common.Zone.Mark(i.ID(),styles.Base.Render(s.String()),),diff --git a/pkg/tui/pages/wizard_intro/wizard_intro.go b/pkg/tui/pages/wizard_intro/wizard_intro.goindex 4e54e9dfe..861e132b8 100644--- a/pkg/tui/pages/wizard_intro/wizard_intro.go+++ b/pkg/tui/pages/wizard_intro/wizard_intro.go@@ -101,8 +101,8 @@ func (m *WizardIntro) View() string {func (m *WizardIntro) ShortHelp() []key.Binding {kb := make([]key.Binding, 0)kb = append(kb,- m.Common.KeyMap.UpDown,- m.Common.KeyMap.Section,+ m.KeyMap.UpDown,+ m.KeyMap.Section,)return kb}diff --git a/pkg/updater/updater.go b/pkg/updater/updater.goindex b8ad42020..a1b06a440 100644--- a/pkg/updater/updater.go+++ b/pkg/updater/updater.go@@ -75,7 +75,7 @@ func (g *OSS) Fetch() (io.Reader, error) {if err != nil || resp == nil {return nil, err}- defer resp.Body.Close()+ defer func() { _ = resp.Body.Close() }()if resp.StatusCode == http.StatusNoContent {return nil, errors.New("already up to date")@@ -105,7 +105,7 @@ func (g *OSS) Fetch() (io.Reader, error) {if err != nil {return nil, errors.Errorf("Failed to read gzip archive: %s", err)}- defer gzipReader.Close()+ defer func() { _ = gzipReader.Close() }()tarReader := tar.NewReader(gzipReader)for {header, err := tarReader.Next()diff --git a/pkg/writers/buffered_file_writer/bufferedfilewriter.go b/pkg/writers/buffered_file_writer/bufferedfilewriter.goindex 49c3afa9a..e603f1580 100644--- a/pkg/writers/buffered_file_writer/bufferedfilewriter.go+++ b/pkg/writers/buffered_file_writer/bufferedfilewriter.go@@ -132,7 +132,7 @@ func (w *BufferedFileWriter) String() (string, error) {if err != nil {return "", fmt.Errorf("failed to open file: %w", err)}- defer file.Close()+ defer func() { _ = file.Close() }()var buf bytes.Buffer// Read the file contents into the buffer.@@ -312,6 +312,6 @@ func newAutoDeletingFileReader(file *os.File) *autoDeletingFileReader {// Close implements the io.Closer interface, deletes the file after closing.func (r *autoDeletingFileReader) Close() error {- defer os.Remove(r.Name()) // Delete the file after closing+ defer func() { _ = os.Remove(r.Name()) }() // Delete the file after closingreturn r.File.Close()}diff --git a/pkg/writers/buffered_file_writer/bufferedfilewriter_test.go b/pkg/writers/buffered_file_writer/bufferedfilewriter_test.goindex 193c398f2..61863dbd8 100644--- a/pkg/writers/buffered_file_writer/bufferedfilewriter_test.go+++ b/pkg/writers/buffered_file_writer/bufferedfilewriter_test.go@@ -118,7 +118,7 @@ func BenchmarkBufferedFileWriterString_BufferOnly_Small(b *testing.B) {rc, err := writer.ReadCloser()assert.NoError(b, err)- rc.Close()+ _ = rc.Close()}func BenchmarkBufferedFileWriterString_BufferOnly_Medium(b *testing.B) {@@ -135,7 +135,7 @@ func BenchmarkBufferedFileWriterString_BufferOnly_Medium(b *testing.B) {rc, err := writer.ReadCloser()assert.NoError(b, err)- rc.Close()+ _ = rc.Close()}func BenchmarkBufferedFileWriterString_OnlyFile_Small(b *testing.B) {@@ -153,7 +153,7 @@ func BenchmarkBufferedFileWriterString_OnlyFile_Small(b *testing.B) {rc, err := writer.ReadCloser()assert.NoError(b, err)- rc.Close()+ _ = rc.Close()}func BenchmarkBufferedFileWriterString_OnlyFile_Medium(b *testing.B) {@@ -171,7 +171,7 @@ func BenchmarkBufferedFileWriterString_OnlyFile_Medium(b *testing.B) {rc, err := writer.ReadCloser()assert.NoError(b, err)- rc.Close()+ _ = rc.Close()}func BenchmarkBufferedFileWriterString_BufferWithFile_Small(b *testing.B) {@@ -193,7 +193,7 @@ func BenchmarkBufferedFileWriterString_BufferWithFile_Small(b *testing.B) {rc, err := writer.ReadCloser()assert.NoError(b, err)- rc.Close()+ _ = rc.Close()}func BenchmarkBufferedFileWriterString_BufferWithFile_Medium(b *testing.B) {@@ -215,7 +215,7 @@ func BenchmarkBufferedFileWriterString_BufferWithFile_Medium(b *testing.B) {rc, err := writer.ReadCloser()assert.NoError(b, err)- rc.Close()+ _ = rc.Close()}func benchmarkBufferedFileWriterString(b *testing.B, w *BufferedFileWriter) {@@ -458,7 +458,7 @@ func BenchmarkBufferedFileWriterWriteLarge(b *testing.B) {rc, err := writer.ReadCloser()assert.NoError(b, err)- rc.Close()+ _ = rc.Close()}}@@ -487,7 +487,7 @@ func BenchmarkBufferedFileWriterWriteSmall(b *testing.B) {rc, err := writer.ReadCloser()assert.NoError(b, err)- rc.Close()+ _ = rc.Close()}}@@ -512,7 +512,7 @@ func TestBufferWriterCloseForWritingWithFile(t *testing.T) {rdr, err := writer.ReadCloser()assert.NoError(t, err)- defer rdr.Close()+ defer func() { _ = rdr.Close() }()// Get a buffer from the pool and check if it is the same buffer used in the writer.bufFromPool := bufPool.Get()@@ -584,7 +584,7 @@ func TestBufferedFileWriter_ReadFrom(t *testing.T) {rc, err := writer.ReadCloser()assert.NoError(t, err)- defer rc.Close()+ defer func() { _ = rc.Close() }()var result bytes.Bufferdiff --git a/scripts/lint.sh b/scripts/lint.shindex 9e889b2e3..bb60c83ef 100755--- a/scripts/lint.sh+++ b/scripts/lint.sh@@ -4,8 +4,7 @@ set -euo pipefail# NOTE: Version and args must match .github/workflows/lint.ymlGOLANGCI_LINT_VERSION="v2.11.4"-# TODO: Re-enable errcheck and staticcheck once pre-existing issues are resolved.-LINT_ARGS="--disable errcheck,staticcheck --enable bodyclose,copyloopvar,misspell --timeout 10m"+LINT_ARGS="--enable bodyclose,copyloopvar,misspell --timeout 10m"GOBIN="$(go env GOPATH)/bin"GOLANGCI_LINT="${GOBIN}/golangci-lint"