From 668512fc5c3fedc57c116e5336117f96bff2b407 Mon Sep 17 00:00:00 2001 From: Vitaly Velikodny Date: Wed, 6 May 2020 17:17:27 +0300 Subject: [PATCH] Update bad_defer.go Fix a mistake in the message: > G307: Deferring unsafe method "*os.File" on type "Close" (gosec) type and method changed --- rules/bad_defer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/bad_defer.go b/rules/bad_defer.go index 3c35880..b33a047 100644 --- a/rules/bad_defer.go +++ b/rules/bad_defer.go @@ -40,7 +40,7 @@ func (r *badDefer) Match(n ast.Node, c *gosec.Context) (*gosec.Issue, error) { for _, deferTyp := range r.types { if typ, method, err := gosec.GetCallInfo(deferStmt.Call, c); err == nil { 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 } } }