From 40c4d625c6f705ecc8d03da662b498ea9fb92032 Mon Sep 17 00:00:00 2001 From: Delweng Zheng Date: Thu, 14 Jun 2018 23:13:50 +0800 Subject: [PATCH] ethclient: golint of error variable name --- ethclient/ethclient.go | 12 ++++++------ interfaces.go | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index b40837c8cc..abb1cbee97 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -90,7 +90,7 @@ func (ec *Client) getBlock(ctx context.Context, method string, args ...interface if err != nil { return nil, err } else if len(raw) == 0 { - return nil, ethereum.NotFound + return nil, ethereum.ErrNotFound } // Decode header and transactions. var head *types.Header @@ -154,7 +154,7 @@ func (ec *Client) HeaderByHash(ctx context.Context, hash common.Hash) (*types.He var head *types.Header err := ec.c.CallContext(ctx, &head, "eth_getBlockByHash", hash, false) if err == nil && head == nil { - err = ethereum.NotFound + err = ethereum.ErrNotFound } return head, err } @@ -165,7 +165,7 @@ func (ec *Client) HeaderByNumber(ctx context.Context, number *big.Int) (*types.H var head *types.Header err := ec.c.CallContext(ctx, &head, "eth_getBlockByNumber", toBlockNumArg(number), false) if err == nil && head == nil { - err = ethereum.NotFound + err = ethereum.ErrNotFound } return head, err } @@ -195,7 +195,7 @@ func (ec *Client) TransactionByHash(ctx context.Context, hash common.Hash) (tx * if err != nil { return nil, false, err } else if json == nil { - return nil, false, ethereum.NotFound + return nil, false, ethereum.ErrNotFound } else if _, r, _ := json.tx.RawSignatureValues(); r == nil { return nil, false, fmt.Errorf("server returned transaction without signature") } @@ -243,7 +243,7 @@ func (ec *Client) TransactionInBlock(ctx context.Context, blockHash common.Hash, err := ec.c.CallContext(ctx, &json, "eth_getTransactionByBlockHashAndIndex", blockHash, hexutil.Uint64(index)) if err == nil { if json == nil { - return nil, ethereum.NotFound + return nil, ethereum.ErrNotFound } else if _, r, _ := json.tx.RawSignatureValues(); r == nil { return nil, fmt.Errorf("server returned transaction without signature") } @@ -261,7 +261,7 @@ func (ec *Client) TransactionReceipt(ctx context.Context, txHash common.Hash) (* err := ec.c.CallContext(ctx, &r, "eth_getTransactionReceipt", txHash) if err == nil { if r == nil { - return nil, ethereum.NotFound + return nil, ethereum.ErrNotFound } } return r, err diff --git a/interfaces.go b/interfaces.go index a8b48c93d7..5d1bb33e2d 100644 --- a/interfaces.go +++ b/interfaces.go @@ -26,8 +26,8 @@ import ( "github.com/ethereum/go-ethereum/core/types" ) -// NotFound is returned by API methods if the requested item does not exist. -var NotFound = errors.New("not found") +// ErrNotFound is returned by API methods if the requested item does not exist. +var ErrNotFound = errors.New("not found") // TODO: move subscription to package event