Write doesn't need error checked

This commit is contained in:
Zach Ramsay 2017-10-03 20:20:15 -04:00 committed by Ethan Buchman
parent d033470817
commit 478a10aa41
5 changed files with 8 additions and 8 deletions

View File

@ -302,7 +302,7 @@ func shareAuthSignature(sc *SecretConnection, pubKey crypto.PubKeyEd25519, signa
// sha256
func hash32(input []byte) (res *[32]byte) {
hasher := sha256.New()
_, _ = hasher.Write(input) // error ignored
hasher.Write(input) // nolint: errcheck
resSlice := hasher.Sum(nil)
res = new([32]byte)
copy(res[:], resSlice)
@ -312,7 +312,7 @@ func hash32(input []byte) (res *[32]byte) {
// We only fill in the first 20 bytes with ripemd160
func hash24(input []byte) (res *[24]byte) {
hasher := ripemd160.New()
_, _ = hasher.Write(input) // error ignored
hasher.Write(input) // nolint: errcheck
resSlice := hasher.Sum(nil)
res = new([24]byte)
copy(res[:], resSlice)

View File

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

View File

@ -782,5 +782,5 @@ func writeListOfEndpoints(w http.ResponseWriter, r *http.Request, funcMap map[st
buf.WriteString("</body></html>")
w.Header().Set("Content-Type", "text/html")
w.WriteHeader(200)
_, _ = w.Write(buf.Bytes()) // error ignored
w.Write(buf.Bytes()) // nolint: errcheck
}

View File

@ -56,7 +56,7 @@ func WriteRPCResponseHTTPError(w http.ResponseWriter, httpCode int, res types.RP
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(httpCode)
_, _ = w.Write(jsonBytes) // error ignored
w.Write(jsonBytes) // nolint: errcheck
}
func WriteRPCResponseHTTP(w http.ResponseWriter, res types.RPCResponse) {
@ -66,7 +66,7 @@ func WriteRPCResponseHTTP(w http.ResponseWriter, res types.RPCResponse) {
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(200)
_, _ = w.Write(jsonBytes) // error ignored
w.Write(jsonBytes) // nolint: errcheck
}
//-----------------------------------------------------------------------------

View File

@ -34,7 +34,7 @@ func (part *Part) Hash() []byte {
return part.hash
} else {
hasher := ripemd160.New()
_, _ = hasher.Write(part.Bytes) // error ignored
hasher.Write(part.Bytes) // nolint: errcheck
part.hash = hasher.Sum(nil)
return part.hash
}