pkg/(crypto|vm): fix GolangCI errcheck warnings

Like:
  Error return value of alg.Write is not checked (from errcheck)

Actually even though the hash.Hash implements an io.Writer interface (that
return meaningful things on .Write()) it has this comment in its
documentation:

// Write (via the embedded io.Writer interface) adds more data to the running hash.
// It never returns an error.

so it should be OK to ignore return results here.
This commit is contained in:
Roman Khimov 2019-08-12 16:36:06 +03:00
parent a976c4d04f
commit 06f9e1d123
2 changed files with 3 additions and 3 deletions

View file

@ -26,7 +26,7 @@ func ExampleSignECDSA() {
// Hash a message. // Hash a message.
alg := sha512.New() alg := sha512.New()
alg.Write([]byte("I am a potato.")) _, _ = alg.Write([]byte("I am a potato."))
hash := alg.Sum(nil) hash := alg.Sum(nil)
// Sign the message. You don't need a PRNG for this. // Sign the message. You don't need a PRNG for this.
@ -59,7 +59,7 @@ func ExampleSignDSA() {
// Hash a message. // Hash a message.
alg := sha1.New() alg := sha1.New()
alg.Write([]byte("I am a potato.")) _, _ = alg.Write([]byte("I am a potato."))
hash := alg.Sum(nil) hash := alg.Sum(nil)
// Sign the message. You don't need a PRNG for this. // Sign the message. You don't need a PRNG for this.

View file

@ -21,7 +21,7 @@ func SHA1(op stack.Instruction, ctx *stack.Context, istack *stack.Invocation, rs
} }
alg := sha1.New() alg := sha1.New()
alg.Write(ba.Value()) _, _ = alg.Write(ba.Value())
hash := alg.Sum(nil) hash := alg.Sum(nil)
res := stack.NewByteArray(hash) res := stack.NewByteArray(hash)