From 06f9e1d123a651c7df7c8854965ac9367da63ec9 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 12 Aug 2019 16:36:06 +0300 Subject: [PATCH] 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. --- pkg/crypto/rfc6979/example_test.go | 4 ++-- pkg/vm/vmopscrypto.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/crypto/rfc6979/example_test.go b/pkg/crypto/rfc6979/example_test.go index 29693c272..b756ea80e 100755 --- a/pkg/crypto/rfc6979/example_test.go +++ b/pkg/crypto/rfc6979/example_test.go @@ -26,7 +26,7 @@ func ExampleSignECDSA() { // Hash a message. alg := sha512.New() - alg.Write([]byte("I am a potato.")) + _, _ = alg.Write([]byte("I am a potato.")) hash := alg.Sum(nil) // Sign the message. You don't need a PRNG for this. @@ -59,7 +59,7 @@ func ExampleSignDSA() { // Hash a message. alg := sha1.New() - alg.Write([]byte("I am a potato.")) + _, _ = alg.Write([]byte("I am a potato.")) hash := alg.Sum(nil) // Sign the message. You don't need a PRNG for this. diff --git a/pkg/vm/vmopscrypto.go b/pkg/vm/vmopscrypto.go index e38ab7402..5560c1d80 100644 --- a/pkg/vm/vmopscrypto.go +++ b/pkg/vm/vmopscrypto.go @@ -21,7 +21,7 @@ func SHA1(op stack.Instruction, ctx *stack.Context, istack *stack.Invocation, rs } alg := sha1.New() - alg.Write(ba.Value()) + _, _ = alg.Write(ba.Value()) hash := alg.Sum(nil) res := stack.NewByteArray(hash)