@@ -10,6 +10,7 @@ import (
10
10
"sync"
11
11
12
12
"github.com/securego/gosec/v2"
13
+ "github.com/securego/gosec/v2/issue"
13
14
"github.com/securego/gosec/v2/rules"
14
15
"golang.org/x/tools/go/analysis"
15
16
"golang.org/x/tools/go/packages"
@@ -75,7 +76,7 @@ func runGoSec(lintCtx *linter.Context, pass *analysis.Pass, settings *config.GoS
75
76
TypesInfo : pass .TypesInfo ,
76
77
}
77
78
78
- analyzer .Check (pkg )
79
+ analyzer .CheckRules (pkg )
79
80
80
81
secIssues , _ , _ := analyzer .Report ()
81
82
if len (secIssues ) == 0 {
@@ -176,27 +177,27 @@ func gosecRuleFilters(includes, excludes []string) []rules.RuleFilter {
176
177
}
177
178
178
179
// 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 ) {
180
181
str = strings .ToLower (str )
181
182
switch str {
182
183
case "" , "low" :
183
- return gosec .Low , nil
184
+ return issue .Low , nil
184
185
case "medium" :
185
- return gosec .Medium , nil
186
+ return issue .Medium , nil
186
187
case "high" :
187
- return gosec .High , nil
188
+ return issue .High , nil
188
189
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 )
190
191
}
191
192
}
192
193
193
194
// 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 )
196
197
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 )
200
201
}
201
202
}
202
203
0 commit comments