diff options
author | Egon Elbre <egonelbre@gmail.com> | 2017-08-05 18:40:51 +0800 |
---|---|---|
committer | Egon Elbre <egonelbre@gmail.com> | 2017-08-07 18:16:56 +0800 |
commit | 392151e251fef59bf72df5a33899724edb7238b9 (patch) | |
tree | 08255eb72ffea27afaba1f1c0eeee0885a0f7a12 | |
parent | b159cdd8dd33ba030e7af5aa144de43441e4f543 (diff) | |
download | dexon-392151e251fef59bf72df5a33899724edb7238b9.tar dexon-392151e251fef59bf72df5a33899724edb7238b9.tar.gz dexon-392151e251fef59bf72df5a33899724edb7238b9.tar.bz2 dexon-392151e251fef59bf72df5a33899724edb7238b9.tar.lz dexon-392151e251fef59bf72df5a33899724edb7238b9.tar.xz dexon-392151e251fef59bf72df5a33899724edb7238b9.tar.zst dexon-392151e251fef59bf72df5a33899724edb7238b9.zip |
common: fix megacheck warnings
-rw-r--r-- | common/bitutil/compress_test.go | 8 | ||||
-rw-r--r-- | common/hexutil/json.go | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/common/bitutil/compress_test.go b/common/bitutil/compress_test.go index 805ab0369..9bd1de103 100644 --- a/common/bitutil/compress_test.go +++ b/common/bitutil/compress_test.go @@ -121,20 +121,20 @@ func TestCompression(t *testing.T) { in := hexutil.MustDecode("0x4912385c0e7b64000000") out := hexutil.MustDecode("0x80fe4912385c0e7b64") - if data := CompressBytes(in); bytes.Compare(data, out) != 0 { + if data := CompressBytes(in); !bytes.Equal(data, out) { t.Errorf("encoding mismatch for sparse data: have %x, want %x", data, out) } - if data, err := DecompressBytes(out, len(in)); err != nil || bytes.Compare(data, in) != 0 { + if data, err := DecompressBytes(out, len(in)); err != nil || !bytes.Equal(data, in) { t.Errorf("decoding mismatch for sparse data: have %x, want %x, error %v", data, in, err) } // Check the the compression returns the input if the bitset encoding is longer in = hexutil.MustDecode("0xdf7070533534333636313639343638373532313536346c1bc33339343837313070706336343035336336346c65fefb3930393233383838ac2f65fefb") out = hexutil.MustDecode("0xdf7070533534333636313639343638373532313536346c1bc33339343837313070706336343035336336346c65fefb3930393233383838ac2f65fefb") - if data := CompressBytes(in); bytes.Compare(data, out) != 0 { + if data := CompressBytes(in); !bytes.Equal(data, out) { t.Errorf("encoding mismatch for dense data: have %x, want %x", data, out) } - if data, err := DecompressBytes(out, len(in)); err != nil || bytes.Compare(data, in) != 0 { + if data, err := DecompressBytes(out, len(in)); err != nil || !bytes.Equal(data, in) { t.Errorf("decoding mismatch for dense data: have %x, want %x, error %v", data, in, err) } // Check that decompressing a longer input than the target fails diff --git a/common/hexutil/json.go b/common/hexutil/json.go index 943288fad..11e14cae7 100644 --- a/common/hexutil/json.go +++ b/common/hexutil/json.go @@ -26,11 +26,10 @@ import ( ) var ( - textZero = []byte(`0x0`) - bytesT = reflect.TypeOf(Bytes(nil)) - bigT = reflect.TypeOf((*Big)(nil)) - uintT = reflect.TypeOf(Uint(0)) - uint64T = reflect.TypeOf(Uint64(0)) + bytesT = reflect.TypeOf(Bytes(nil)) + bigT = reflect.TypeOf((*Big)(nil)) + uintT = reflect.TypeOf(Uint(0)) + uint64T = reflect.TypeOf(Uint64(0)) ) // Bytes marshals/unmarshals as a JSON string with 0x prefix. |