From 441b6d6093c92d304e37a4861f5822f34438e003 Mon Sep 17 00:00:00 2001 From: RJ Catalano Date: Mon, 26 Jun 2017 07:57:47 -0500 Subject: [PATCH] accounts/abi: fix ugly hack and fix error type declaration. Signed-off-by: RJ Catalano --- accounts/abi/error.go | 2 +- accounts/abi/unpack_test.go | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/accounts/abi/error.go b/accounts/abi/error.go index cf12c45edb..420acf4182 100644 --- a/accounts/abi/error.go +++ b/accounts/abi/error.go @@ -23,7 +23,7 @@ import ( ) var ( - errBadBool error = errors.New("abi: improperly encoded boolean value") + errBadBool = errors.New("abi: improperly encoded boolean value") ) // formatSliceString formats the reflection kind with the given slice size diff --git a/accounts/abi/unpack_test.go b/accounts/abi/unpack_test.go index a33754ccc0..8e3afee4e6 100644 --- a/accounts/abi/unpack_test.go +++ b/accounts/abi/unpack_test.go @@ -196,7 +196,7 @@ func TestSimpleMethodUnpack(t *testing.T) { case "hash": var v common.Hash err = abi.Unpack(&v, "method", test.marshalledOutput) - outvar = v + outvar = v.Bytes()[:] case "function": var v [24]byte err = abi.Unpack(&v, "method", test.marshalledOutput) @@ -222,12 +222,6 @@ func TestSimpleMethodUnpack(t *testing.T) { } if err == nil { - // bit of an ugly hack for hash type but I don't feel like finding a proper solution - if test.outVar == "hash" { - tmp := outvar.(common.Hash) // without assignment it's unaddressable - outvar = tmp[:] - } - if !reflect.DeepEqual(test.expectedOut, outvar) { t.Errorf("%d failed. Output error: expected %v, got %v", i, test.expectedOut, outvar) }