@@ -10,6 +10,7 @@ import (
1010 "sync"
1111
1212 "github.com/securego/gosec/v2"
13+ "github.com/securego/gosec/v2/issue"
1314 "github.com/securego/gosec/v2/rules"
1415 "golang.org/x/tools/go/analysis"
1516 "golang.org/x/tools/go/packages"
@@ -75,7 +76,7 @@ func runGoSec(lintCtx *linter.Context, pass *analysis.Pass, settings *config.GoS
7576 TypesInfo : pass .TypesInfo ,
7677 }
7778
78- analyzer .Check (pkg )
79+ analyzer .CheckRules (pkg )
7980
8081 secIssues , _ , _ := analyzer .Report ()
8182 if len (secIssues ) == 0 {
@@ -176,27 +177,27 @@ func gosecRuleFilters(includes, excludes []string) []rules.RuleFilter {
176177}
177178
178179// code borrowed from https://github.com/securego/gosec/blob/69213955dacfd560562e780f723486ef1ca6d486/cmd/gosec/main.go#L250-L262
179- func convertToScore (str string ) (gosec .Score , error ) {
180+ func convertToScore (str string ) (issue .Score , error ) {
180181 str = strings .ToLower (str )
181182 switch str {
182183 case "" , "low" :
183- return gosec .Low , nil
184+ return issue .Low , nil
184185 case "medium" :
185- return gosec .Medium , nil
186+ return issue .Medium , nil
186187 case "high" :
187- return gosec .High , nil
188+ return issue .High , nil
188189 default :
189- return gosec .Low , fmt .Errorf ("'%s' is invalid, use low instead. Valid options: low, medium, high" , str )
190+ return issue .Low , fmt .Errorf ("'%s' is invalid, use low instead. Valid options: low, medium, high" , str )
190191 }
191192}
192193
193194// code borrowed from https://github.com/securego/gosec/blob/69213955dacfd560562e780f723486ef1ca6d486/cmd/gosec/main.go#L264-L276
194- func filterIssues (issues []* gosec .Issue , severity , confidence gosec .Score ) []* gosec .Issue {
195- res := make ([]* gosec .Issue , 0 )
195+ func filterIssues (issues []* issue .Issue , severity , confidence issue .Score ) []* issue .Issue {
196+ res := make ([]* issue .Issue , 0 )
196197
197- for _ , issue := range issues {
198- if issue .Severity >= severity && issue .Confidence >= confidence {
199- res = append (res , issue )
198+ for _ , i := range issues {
199+ if i .Severity >= severity && i .Confidence >= confidence {
200+ res = append (res , i )
200201 }
201202 }
202203
0 commit comments