Remove capitalization and trailing newlines from err strings (#5186)

This commit is contained in:
Håvard Anda Estensen 2022-08-26 08:20:19 +02:00 committed by GitHub
parent 7c15ed59e4
commit beeccc0f5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 13 additions and 13 deletions

View File

@ -31,7 +31,7 @@ var listStorageKeysCmd = &cobra.Command{
Short: "Returns all storage keys of the given address",
RunE: func(cmd *cobra.Command, args []string) error {
if !common.IsHexAddress(services.DevAddress) {
return fmt.Errorf("address: %v, is not a valid hex address\n", services.DevAddress)
return fmt.Errorf("address: %v, is not a valid hex address", services.DevAddress)
}
toAddress := common.HexToAddress(services.DevAddress)
offset := common.Hex2Bytes(strings.TrimSuffix(offsetAddr, "0x"))

View File

@ -122,7 +122,7 @@ func GetLogs(reqId int, fromBlock, toBlock uint64, address common.Address, show
var b rpctest.EthGetLogs
if res := reqGen.Erigon("eth_getLogs", reqGen.getLogs(fromBlock, toBlock, address), &b); res.Err != nil {
return fmt.Errorf("error fetching logs: %v\n", res.Err)
return fmt.Errorf("error fetching logs: %v", res.Err)
}
s, err := utils.ParseResponse(b)
@ -142,7 +142,7 @@ func GetTransactionCountCmd(reqId int, address common.Address, blockNum string)
var b rpctest.EthGetTransactionCount
if res := reqGen.Erigon("eth_getTransactionCount", reqGen.getTransactionCount(address, blockNum), &b); res.Err != nil {
return 0, fmt.Errorf("error getting transaction count: %v\n", res.Err)
return 0, fmt.Errorf("error getting transaction count: %v", res.Err)
}
if b.Error != nil {
@ -169,7 +169,7 @@ func GetTransactionCount(reqId int, address common.Address, blockNum string) (rp
var b rpctest.EthGetTransactionCount
if res := reqGen.Erigon("eth_getTransactionCount", reqGen.getTransactionCount(address, blockNum), &b); res.Err != nil {
return b, fmt.Errorf("error getting transaction count: %v\n", res.Err)
return b, fmt.Errorf("error getting transaction count: %v", res.Err)
}
if b.Error != nil {

View File

@ -26,7 +26,7 @@ func (s *TxNums) MinOf(blockNum uint64) (txnNum uint64) {
}
func (s *TxNums) Append(blockNum, maxTxnNum uint64) {
if len(s.nums) > int(blockNum) {
err := fmt.Errorf("trying append blockNum=%d, but already have=%d\n", blockNum, len(s.nums))
err := fmt.Errorf("trying append blockNum=%d, but already have=%d", blockNum, len(s.nums))
panic(err)
}
s.nums = append(s.nums, maxTxnNum)

View File

@ -110,7 +110,7 @@ func (v *Validator) MinimalVal() MinimalVal {
// ParseValidators returns validator set bytes
func ParseValidators(validatorsBytes []byte) ([]*Validator, error) {
if len(validatorsBytes)%40 != 0 {
return nil, errors.New("Invalid validators bytes")
return nil, errors.New("invalid validators bytes")
}
result := make([]*Validator, len(validatorsBytes)/40)

View File

@ -172,7 +172,7 @@ func (sdb *IntraBlockState) AddRefund(gas uint64) {
func (sdb *IntraBlockState) SubRefund(gas uint64) {
sdb.journal.append(refundChange{prev: sdb.refund})
if gas > sdb.refund {
sdb.setErrorUnsafe(fmt.Errorf("Refund counter below zero"))
sdb.setErrorUnsafe(fmt.Errorf("refund counter below zero"))
}
sdb.refund -= gas
}

View File

@ -48,7 +48,7 @@ func (c *tmHeaderValidate) RequiredGas(input []byte) uint64 {
func (c *tmHeaderValidate) Run(input []byte) (result []byte, err error) {
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("internal error: %v\n", r)
err = fmt.Errorf("internal error: %v", r)
}
}()
@ -106,7 +106,7 @@ func (c *iavlMerkleProofValidate) RequiredGas(input []byte) uint64 {
func (c *iavlMerkleProofValidate) Run(input []byte) (result []byte, err error) {
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("internal error: %v\n", r)
err = fmt.Errorf("internal error: %v", r)
}
}()

View File

@ -244,7 +244,7 @@ func (n *Node) openDataDir() error {
return convertFileLockError(err)
}
if !locked {
return fmt.Errorf("%w: %s\n", ErrDataDirUsed, instdir)
return fmt.Errorf("%w: %s", ErrDataDirUsed, instdir)
}
n.dirLock = l
return nil

View File

@ -1538,7 +1538,7 @@ func TransactionsIdx(ctx context.Context, chainID uint256.Int, blockFrom, blockT
}
defer d.Close()
if uint64(d.Count()) != expectedCount {
panic(fmt.Errorf("expect: %d, got %d\n", expectedCount, d.Count()))
panic(fmt.Errorf("expect: %d, got %d", expectedCount, d.Count()))
}
p.Name.Store(segFileName)
p.Total.Store(uint64(d.Count() * 2))
@ -1642,7 +1642,7 @@ RETRY:
}
if i != expectedCount {
panic(fmt.Errorf("expect: %d, got %d\n", expectedCount, i))
panic(fmt.Errorf("expect: %d, got %d", expectedCount, i))
}
if err := txnHashIdx.Build(); err != nil {
@ -2007,7 +2007,7 @@ func (m *Merger) merge(ctx context.Context, toMerge []string, targetFile string,
d.Close()
}
if f.Count() != expectedTotal {
return fmt.Errorf("unexpected amount after segments merge. got: %d, expected: %d\n", f.Count(), expectedTotal)
return fmt.Errorf("unexpected amount after segments merge. got: %d, expected: %d", f.Count(), expectedTotal)
}
if err = f.Compress(); err != nil {
return err