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:
parent
d6c3f74e3c
commit
613bad36e0
2 changed files with 4 additions and 3 deletions
|
@ -64,7 +64,7 @@ func TestByteArrConversion(t *testing.T) {
|
||||||
ba, err := a.ByteArray()
|
ba, err := a.ByteArray()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
assert.Equal(t, num, testReadInt64(ba.val))
|
assert.Equal(t, num, testReadInt64(t, ba.val))
|
||||||
|
|
||||||
have, err := ba.Integer()
|
have, err := ba.Integer()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
|
@ -36,14 +36,15 @@ func testMakeStackInt(t *testing.T, num int64) *Int {
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
func testReadInt64(data []byte) int64 {
|
func testReadInt64(t *testing.T, data []byte) int64 {
|
||||||
var ret int64
|
var ret int64
|
||||||
var arr [8]byte
|
var arr [8]byte
|
||||||
|
|
||||||
// expands or shrinks data automatically
|
// expands or shrinks data automatically
|
||||||
copy(arr[:], data)
|
copy(arr[:], data)
|
||||||
buf := bytes.NewBuffer(arr[:])
|
buf := bytes.NewBuffer(arr[:])
|
||||||
binary.Read(buf, binary.LittleEndian, &ret)
|
err := binary.Read(buf, binary.LittleEndian, &ret)
|
||||||
|
assert.Nil(t, err)
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue