Skip to content

Commit

Permalink
rules/errors: allow hash.Hash.Write to not return an error as its Go …
Browse files Browse the repository at this point in the history
…contract holds

Allows hash.Hash.Write to not return an error as the Go contracts
dictates at https://pkg.go.dev/hash#Hash.Write and thus it is useless
to flag such.

Fixes #45
  • Loading branch information
odeke-em committed Sep 24, 2022
1 parent 7741996 commit 8d0d8e0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions rules/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func NewNoErrorCheck(id string, conf gosec.Config) (gosec.Rule, []ast.Node) {
whitelist.AddAll("fmt", "Print", "Printf", "Println", "Fprint", "Fprintf", "Fprintln")
whitelist.AddAll("strings.Builder", "Write", "WriteByte", "WriteRune", "WriteString")
whitelist.Add("io.PipeWriter", "CloseWithError")
whitelist.Add("hash.Hash", "Write")

if configured, ok := conf["G104"]; ok {
if whitelisted, ok := configured.(map[string]interface{}); ok {
Expand Down

0 comments on commit 8d0d8e0

Please sign in to comment.