internal,tests: replace noarg fmt.Errorf with errors.New (#27335)

* internal: replace noarg fmt.Errorf with errors.New

Signed-off-by: jsvisa <delweng@gmail.com>

* tests: replace noarg fmt.Errorf with errors.New

Signed-off-by: jsvisa <delweng@gmail.com>

* tests: go autoimport

Signed-off-by: jsvisa <delweng@gmail.com>

* tests: go autoimport

Signed-off-by: jsvisa <delweng@gmail.com>

---------

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
Delweng
2023-05-25 02:54:28 -04:00
committed by GitHub
parent dd25a4f5ab
commit b21ba668e6
8 changed files with 32 additions and 28 deletions
+2 -1
View File
@@ -19,6 +19,7 @@ package trie
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/core/rawdb"
@@ -183,7 +184,7 @@ func runRandTest(rt randTest) error {
checktr.MustUpdate(it.Key, it.Value)
}
if tr.Hash() != checktr.Hash() {
return fmt.Errorf("hash mismatch in opItercheckhash")
return errors.New("hash mismatch in opItercheckhash")
}
case opProve:
rt[i].err = tr.Prove(step.key, 0, proofDb{})
+2 -1
View File
@@ -18,6 +18,7 @@ package tests
import (
"encoding/json"
"errors"
"fmt"
"io"
"os"
@@ -180,7 +181,7 @@ func (tm *testMatcher) checkFailure(t *testing.T, err error) error {
t.Logf("error: %v", err)
return nil
}
return fmt.Errorf("test succeeded unexpectedly")
return errors.New("test succeeded unexpectedly")
}
return err
}
+2 -2
View File
@@ -59,7 +59,7 @@ func FromHex(s string) ([]byte, error) {
func (t *RLPTest) Run() error {
outb, err := FromHex(t.Out)
if err != nil {
return fmt.Errorf("invalid hex in Out")
return errors.New("invalid hex in Out")
}
// Handle simple decoding tests with no actual In value.
@@ -87,7 +87,7 @@ func checkDecodeInterface(b []byte, isValid bool) error {
case isValid && err != nil:
return fmt.Errorf("decoding failed: %v", err)
case !isValid && err == nil:
return fmt.Errorf("decoding of invalid value succeeded")
return errors.New("decoding of invalid value succeeded")
}
return nil
}
+2 -1
View File
@@ -19,6 +19,7 @@ package tests
import (
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"math/big"
"strconv"
@@ -395,7 +396,7 @@ func (tx *stTransaction) toMessage(ps stPostState, baseFee *big.Int) (*core.Mess
tx.MaxFeePerGas)
}
if gasPrice == nil {
return nil, fmt.Errorf("no gas price provided")
return nil, errors.New("no gas price provided")
}
msg := &core.Message{