From 79ff0c17e14daf4f38716700c4c994db4db16e70 Mon Sep 17 00:00:00 2001 From: marcello33 Date: Wed, 14 Jun 2023 17:21:52 +0200 Subject: [PATCH] dev: fix: error related lint issues --- accounts/abi/bind/backends/simulated.go | 1 + beacon/engine/errors.go | 1 + core/genesis.go | 1 + core/state/snapshot/generate.go | 1 + eth/ethconfig/config.go | 1 + eth/tracers/api_test.go | 1 + p2p/peer_error.go | 1 + 7 files changed, 7 insertions(+) diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index e2919577af..60d21f31fd 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -846,6 +846,7 @@ func (fb *filterBackend) ChainDb() ethdb.Database { return fb.db } func (fb *filterBackend) EventMux() *event.TypeMux { panic("not supported") } func (fb *filterBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error) { + // nolint : exhaustive switch number { case rpc.PendingBlockNumber: if block := fb.backend.pendingBlock; block != nil { diff --git a/beacon/engine/errors.go b/beacon/engine/errors.go index 769001b9e3..49a1e099a8 100644 --- a/beacon/engine/errors.go +++ b/beacon/engine/errors.go @@ -54,6 +54,7 @@ var ( _ rpc.DataError = new(EngineAPIError) ) +// nolint : errname var ( // VALID is returned by the engine API in the following calls: // - newPayloadV1: if the payload was already known or was just validated and executed diff --git a/core/genesis.go b/core/genesis.go index 91962c92a5..4ef8030d68 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -378,6 +378,7 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen return newcfg, stored, compatErr } // Don't overwrite if the old is identical to the new + // nolint : errchkjson if newData, _ := json.Marshal(newcfg); !bytes.Equal(storedData, newData) { rawdb.WriteChainConfig(db, stored, newcfg) } diff --git a/core/state/snapshot/generate.go b/core/state/snapshot/generate.go index a3fb7a8c27..b4730baf71 100644 --- a/core/state/snapshot/generate.go +++ b/core/state/snapshot/generate.go @@ -734,6 +734,7 @@ func increaseKey(key []byte) []byte { // abortErr wraps an interruption signal received to represent the // generation is aborted by external processes. +// nolint : errname type abortErr struct { abort chan *generatorStats } diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index e9b37251cf..e144f323b6 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -280,6 +280,7 @@ func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, et return bor.New(chainConfig, db, blockchainAPI, spanner, heimdallClient, genesisContractsClient, false) } } else { + // nolint : exhaustive switch ethashConfig.PowMode { case ethash.ModeFake: log.Warn("Ethash used in fake mode") diff --git a/eth/tracers/api_test.go b/eth/tracers/api_test.go index 441b26f052..e0891e803a 100644 --- a/eth/tracers/api_test.go +++ b/eth/tracers/api_test.go @@ -970,6 +970,7 @@ func TestTraceChain(t *testing.T) { t.Error("Unexpected tracing result") } for _, trace := range result.Traces { + // nolint : errchkjson blob, _ := json.Marshal(trace) if string(blob) != single { t.Error("Unexpected tracing result") diff --git a/p2p/peer_error.go b/p2p/peer_error.go index ebc59de251..ecc8094185 100644 --- a/p2p/peer_error.go +++ b/p2p/peer_error.go @@ -69,6 +69,7 @@ const ( DiscUnexpectedIdentity DiscSelf DiscReadTimeout + // nolint : errname DiscSubprotocolError = DiscReason(0x10) )