errcheck; sort some stuff out

This commit is contained in:
Zach Ramsay
2017-10-03 18:49:20 -04:00
committed by Ethan Buchman
parent 563faa98de
commit d7cb291fb2
26 changed files with 61 additions and 154 deletions

View File

@ -7,15 +7,9 @@ import (
// doubleSha256 calculates sha256(sha256(b)) and returns the resulting bytes.
func doubleSha256(b []byte) []byte {
hasher := sha256.New()
_, err := hasher.Write(b)
if err != nil {
panic(err)
}
_, _ := hasher.Write(b) // error ignored
sum := hasher.Sum(nil)
hasher.Reset()
_, err = hasher.Write(sum)
if err != nil {
panic(err)
}
_, _ = hasher.Write(sum) // error ignored
return hasher.Sum(nil)
}