Skip to content

Commit ed4bc7f

Browse files
authored
all: replace fmt.Errorf() with errors.New() if no param required (#29472)
1 parent cfc7d06 commit ed4bc7f

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

accounts/external/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transactio
239239
args.BlobHashes = tx.BlobHashes()
240240
sidecar := tx.BlobTxSidecar()
241241
if sidecar == nil {
242-
return nil, fmt.Errorf("blobs must be present for signing")
242+
return nil, errors.New("blobs must be present for signing")
243243
}
244244
args.Blobs = sidecar.Blobs
245245
args.Commitments = sidecar.Commitments

cmd/devp2p/internal/ethtest/transaction.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (s *Suite) sendTxs(t *utesting.T, txs []*types.Transaction) error {
102102
}
103103
}
104104

105-
return fmt.Errorf("timed out waiting for txs")
105+
return errors.New("timed out waiting for txs")
106106
}
107107

108108
func (s *Suite) sendInvalidTxs(t *utesting.T, txs []*types.Transaction) error {

core/blockchain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis
439439
}
440440

441441
if alloc == nil {
442-
return nil, fmt.Errorf("live blockchain tracer requires genesis alloc to be set")
442+
return nil, errors.New("live blockchain tracer requires genesis alloc to be set")
443443
}
444444

445445
bc.logger.OnGenesisBlock(bc.genesisBlock, alloc)

internal/era/iterator.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package era
1818

1919
import (
2020
"errors"
21-
"fmt"
2221
"io"
2322
"math/big"
2423

@@ -80,7 +79,7 @@ func (it *Iterator) Block() (*types.Block, error) {
8079
// Receipts returns the receipts for the iterator's current position.
8180
func (it *Iterator) Receipts() (types.Receipts, error) {
8281
if it.inner.Receipts == nil {
83-
return nil, fmt.Errorf("receipts must be non-nil")
82+
return nil, errors.New("receipts must be non-nil")
8483
}
8584
var receipts types.Receipts
8685
err := rlp.Decode(it.inner.Receipts, &receipts)

miner/worker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ type newPayloadResult struct {
7575
receipts []*types.Receipt // Receipts collected during construction
7676
}
7777

78-
// generateParams wraps various of settings for generating sealing task.
78+
// generateParams wraps various settings for generating sealing task.
7979
type generateParams struct {
8080
timestamp uint64 // The timestamp for sealing task
8181
forceTime bool // Flag whether the given timestamp is immutable or not
@@ -131,7 +131,7 @@ func (miner *Miner) prepareWork(genParams *generateParams) (*environment, error)
131131
if genParams.parentHash != (common.Hash{}) {
132132
block := miner.chain.GetBlockByHash(genParams.parentHash)
133133
if block == nil {
134-
return nil, fmt.Errorf("missing parent")
134+
return nil, errors.New("missing parent")
135135
}
136136
parent = block.Header()
137137
}

0 commit comments

Comments
 (0)