mirror of
https://github.com/securego/gosec.git
synced 2024-12-25 12:05:52 +00:00
Update bad_defer.go
Fix a mistake in the message: > G307: Deferring unsafe method "*os.File" on type "Close" (gosec) type and method changed
This commit is contained in:
parent
ee3146e637
commit
668512fc5c
1 changed files with 1 additions and 1 deletions
|
@ -40,7 +40,7 @@ func (r *badDefer) Match(n ast.Node, c *gosec.Context) (*gosec.Issue, error) {
|
||||||
for _, deferTyp := range r.types {
|
for _, deferTyp := range r.types {
|
||||||
if typ, method, err := gosec.GetCallInfo(deferStmt.Call, c); err == nil {
|
if typ, method, err := gosec.GetCallInfo(deferStmt.Call, c); err == nil {
|
||||||
if normalize(typ) == deferTyp.typ && contains(deferTyp.methods, method) {
|
if normalize(typ) == deferTyp.typ && contains(deferTyp.methods, method) {
|
||||||
return gosec.NewIssue(c, n, r.ID(), fmt.Sprintf(r.What, typ, method), r.Severity, r.Confidence), nil
|
return gosec.NewIssue(c, n, r.ID(), fmt.Sprintf(r.What, method, typ), r.Severity, r.Confidence), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue