From 4709ca3f139b769decd292207fc64776e78692f3 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Mon, 28 Oct 2024 15:13:21 +0800 Subject: [PATCH] all: fix staticcheck warning SA1006 --- accounts/abi/bind/backends/simulated.go | 4 ++-- consensus/XDPoS/engines/engine_v2/forensics_test.go | 4 ++-- consensus/tests/engine_v2_tests/helper.go | 4 ++-- metrics/json_test.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index ba62d58a70..e43cae4377 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -86,10 +86,10 @@ func SimulateWalletAddressAndSignFn() (common.Address, func(account accounts.Acc pass := "" // not used but required by API a1, err := ks.NewAccount(pass) if err != nil { - return common.Address{}, nil, fmt.Errorf(err.Error()) + return common.Address{}, nil, err } if err := ks.Unlock(a1, ""); err != nil { - return a1.Address, nil, fmt.Errorf(err.Error()) + return a1.Address, nil, err } return a1.Address, ks.SignHash, nil } diff --git a/consensus/XDPoS/engines/engine_v2/forensics_test.go b/consensus/XDPoS/engines/engine_v2/forensics_test.go index 3597bfb936..3b6dc1b252 100644 --- a/consensus/XDPoS/engines/engine_v2/forensics_test.go +++ b/consensus/XDPoS/engines/engine_v2/forensics_test.go @@ -58,10 +58,10 @@ func getSignerAndSignFn(pk *ecdsa.PrivateKey) (common.Address, func(account acco pass := "" // not used but required by API a1, err := ks.ImportECDSA(pk, pass) if err != nil { - return common.Address{}, nil, fmt.Errorf(err.Error()) + return common.Address{}, nil, err } if err := ks.Unlock(a1, ""); err != nil { - return a1.Address, nil, fmt.Errorf(err.Error()) + return a1.Address, nil, err } return a1.Address, ks.SignHash, nil } diff --git a/consensus/tests/engine_v2_tests/helper.go b/consensus/tests/engine_v2_tests/helper.go index a25019d467..14eceb6005 100644 --- a/consensus/tests/engine_v2_tests/helper.go +++ b/consensus/tests/engine_v2_tests/helper.go @@ -88,10 +88,10 @@ func getSignerAndSignFn(pk *ecdsa.PrivateKey) (common.Address, func(account acco pass := "" // not used but required by API a1, err := ks.ImportECDSA(pk, pass) if err != nil { - return common.Address{}, nil, fmt.Errorf(err.Error()) + return common.Address{}, nil, err } if err := ks.Unlock(a1, ""); err != nil { - return a1.Address, nil, fmt.Errorf(err.Error()) + return a1.Address, nil, err } return a1.Address, ks.SignHash, nil } diff --git a/metrics/json_test.go b/metrics/json_test.go index f91fe8cfa5..811bc29f11 100644 --- a/metrics/json_test.go +++ b/metrics/json_test.go @@ -13,7 +13,7 @@ func TestRegistryMarshallJSON(t *testing.T) { r.Register("counter", NewCounter()) enc.Encode(r) if s := b.String(); s != "{\"counter\":{\"count\":0}}\n" { - t.Fatalf(s) + t.Fatal(s) } }