pkg/vm/stack: fix unused binary.Read() result in testReadInt64()

GolangCI:
  Error return value of binary.Read is not checked (from errcheck)
This commit is contained in:
Roman Khimov 2019-08-12 17:56:51 +03:00
parent d6c3f74e3c
commit 613bad36e0
2 changed files with 4 additions and 3 deletions

View file

@ -64,7 +64,7 @@ func TestByteArrConversion(t *testing.T) {
ba, err := a.ByteArray()
assert.Nil(t, err)
assert.Equal(t, num, testReadInt64(ba.val))
assert.Equal(t, num, testReadInt64(t, ba.val))
have, err := ba.Integer()
assert.Nil(t, err)

View file

@ -36,14 +36,15 @@ func testMakeStackInt(t *testing.T, num int64) *Int {
return a
}
func testReadInt64(data []byte) int64 {
func testReadInt64(t *testing.T, data []byte) int64 {
var ret int64
var arr [8]byte
// expands or shrinks data automatically
copy(arr[:], data)
buf := bytes.NewBuffer(arr[:])
binary.Read(buf, binary.LittleEndian, &ret)
err := binary.Read(buf, binary.LittleEndian, &ret)
assert.Nil(t, err)
return ret
}