diff --git a/errcheck/excludes.go b/errcheck/excludes.go index a783b5a..450b798 100644 --- a/errcheck/excludes.go +++ b/errcheck/excludes.go @@ -47,6 +47,11 @@ var DefaultExcludedSymbols = []string{ // hash "(hash.Hash).Write", + + // hash/maphash + "(*hash/maphash.Hash).Write", + "(*hash/maphash.Hash).WriteByte", + "(*hash/maphash.Hash).WriteString", } // ReadExcludes reads an excludes file, a newline delimited file that lists diff --git a/testdata/hash.go b/testdata/hash.go new file mode 100644 index 0000000..6861994 --- /dev/null +++ b/testdata/hash.go @@ -0,0 +1,17 @@ +package main + +import ( + "crypto/sha256" + "hash/maphash" +) + +func ignoreHashReturns() { + sha256.New().Write([]byte{}) // EXCLUDED +} + +func ignoreHashMapReturns() { + var hasher maphash.Hash + hasher.Write(nil) // EXCLUDED + hasher.WriteByte(0) // EXCLUDED + hasher.WriteString("") // EXCLUDED +} diff --git a/testdata/main.go b/testdata/main.go index 0f57c43..0b6ee09 100644 --- a/testdata/main.go +++ b/testdata/main.go @@ -2,7 +2,6 @@ package main import ( "bytes" - "crypto/sha256" "fmt" "io" "math/rand" @@ -147,7 +146,6 @@ func main() { b2.Write(nil) rand.Read(nil) mrand.Read(nil) - sha256.New().Write([]byte{}) pr, pw := io.Pipe() pr.CloseWithError(nil) pw.CloseWithError(nil)