Skip to content

Commit 36a684c

Browse files
fjlkaralabe
authored andcommitted
accounts/abi: fix staticcheck warnings (ethereum#20358)
* accounts/abi: fix staticcheck warnings * accounts/abi: restore unused field for test
1 parent bcc1234 commit 36a684c

File tree

2 files changed

+2
-36
lines changed

2 files changed

+2
-36
lines changed

accounts/abi/abi_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ func TestABI_MethodById(t *testing.T) {
927927
}
928928
b := fmt.Sprintf("%v", m2)
929929
if a != b {
930-
t.Errorf("Method %v (id %v) not 'findable' by id in ABI", name, common.ToHex(m.ID()))
930+
t.Errorf("Method %v (id %x) not 'findable' by id in ABI", name, m.ID())
931931
}
932932
}
933933
// Also test empty

accounts/abi/event_test.go

+1-35
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func TestEventTupleUnpack(t *testing.T) {
173173
type EventTransferWithTag struct {
174174
// this is valid because `value` is not exportable,
175175
// so value is only unmarshalled into `Value1`.
176-
value *big.Int
176+
value *big.Int //lint:ignore U1000 unused field is part of test
177177
Value1 *big.Int `abi:"value"`
178178
}
179179

@@ -354,40 +354,6 @@ func unpackTestEventData(dest interface{}, hexData string, jsonEvent []byte, ass
354354
return a.Unpack(dest, "e", data)
355355
}
356356

357-
/*
358-
Taken from
359-
https://github.com/ethereum/go-ethereum/pull/15568
360-
*/
361-
362-
type testResult struct {
363-
Values [2]*big.Int
364-
Value1 *big.Int
365-
Value2 *big.Int
366-
}
367-
368-
type testCase struct {
369-
definition string
370-
want testResult
371-
}
372-
373-
func (tc testCase) encoded(intType, arrayType Type) []byte {
374-
var b bytes.Buffer
375-
if tc.want.Value1 != nil {
376-
val, _ := intType.pack(reflect.ValueOf(tc.want.Value1))
377-
b.Write(val)
378-
}
379-
380-
if !reflect.DeepEqual(tc.want.Values, [2]*big.Int{nil, nil}) {
381-
val, _ := arrayType.pack(reflect.ValueOf(tc.want.Values))
382-
b.Write(val)
383-
}
384-
if tc.want.Value2 != nil {
385-
val, _ := intType.pack(reflect.ValueOf(tc.want.Value2))
386-
b.Write(val)
387-
}
388-
return b.Bytes()
389-
}
390-
391357
// TestEventUnpackIndexed verifies that indexed field will be skipped by event decoder.
392358
func TestEventUnpackIndexed(t *testing.T) {
393359
definition := `[{"name": "test", "type": "event", "inputs": [{"indexed": true, "name":"value1", "type":"uint8"},{"indexed": false, "name":"value2", "type":"uint8"}]}]`

0 commit comments

Comments
 (0)