From 0410b7e448e063fa9e30295fbe423ff1c0171d12 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 19 Aug 2024 16:52:54 +1000 Subject: [PATCH] Fix CI lint errors --- cannon/main.go | 3 ++- op-chain-ops/script/console2_gen.go | 1 - op-conductor/consensus/raft_fsm.go | 2 +- op-heartbeat/service.go | 5 +++-- op-proposer/cmd/main.go | 3 ++- op-service/ctxinterrupt/context_test.go | 3 ++- op-service/util.go | 3 ++- 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cannon/main.go b/cannon/main.go index 4442c492c7ed9..7af4125c9ffff 100644 --- a/cannon/main.go +++ b/cannon/main.go @@ -4,9 +4,10 @@ import ( "context" "errors" "fmt" + "os" + "github.com/ethereum-optimism/optimism/op-service/ctxinterrupt" "github.com/urfave/cli/v2" - "os" "github.com/ethereum-optimism/optimism/cannon/cmd" ) diff --git a/op-chain-ops/script/console2_gen.go b/op-chain-ops/script/console2_gen.go index 9430a9441ccec..4a7cc9a7aa7bf 100644 --- a/op-chain-ops/script/console2_gen.go +++ b/op-chain-ops/script/console2_gen.go @@ -1511,4 +1511,3 @@ func (c *ConsolePrecompile) Log_59cfcbe3(p0 *big.Int, p1 *big.Int, p2 *big.Int, func (c *ConsolePrecompile) Log_193fb800(p0 *big.Int, p1 *big.Int, p2 *big.Int, p3 *big.Int) { c.log("p0", p0, "p1", p1, "p2", p2, "p3", p3) } - diff --git a/op-conductor/consensus/raft_fsm.go b/op-conductor/consensus/raft_fsm.go index 31631d2c91e61..28c85c36d904b 100644 --- a/op-conductor/consensus/raft_fsm.go +++ b/op-conductor/consensus/raft_fsm.go @@ -29,7 +29,7 @@ func NewUnsafeHeadTracker(log log.Logger) *unsafeHeadTracker { // Apply implements raft.FSM, it applies the latest change (latest unsafe head payload) to FSM. func (t *unsafeHeadTracker) Apply(l *raft.Log) interface{} { - if l.Data == nil || len(l.Data) == 0 { + if len(l.Data) == 0 { return fmt.Errorf("log data is nil or empty") } diff --git a/op-heartbeat/service.go b/op-heartbeat/service.go index 99ee63659710b..3de17edf80345 100644 --- a/op-heartbeat/service.go +++ b/op-heartbeat/service.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/ethereum-optimism/optimism/op-service/ctxinterrupt" "io" "net" "net/http" @@ -13,6 +12,8 @@ import ( "strings" "time" + "github.com/ethereum-optimism/optimism/op-service/ctxinterrupt" + "github.com/urfave/cli/v2" "github.com/ethereum/go-ethereum/log" @@ -45,7 +46,7 @@ func Main(version string) func(ctx *cli.Context) error { l.Crit("error starting application", "err", err) } - ctxinterrupt.Wait(cliCtx.Context) + _ = ctxinterrupt.Wait(cliCtx.Context) // Possibly a better context here would be one that has an interrupt installed for forced // shutdown as used elsewhere. return srv.Stop(context.Background()) diff --git a/op-proposer/cmd/main.go b/op-proposer/cmd/main.go index 4959acc164158..cbb21fb285163 100644 --- a/op-proposer/cmd/main.go +++ b/op-proposer/cmd/main.go @@ -2,9 +2,10 @@ package main import ( "context" - "github.com/ethereum-optimism/optimism/op-service/ctxinterrupt" "os" + "github.com/ethereum-optimism/optimism/op-service/ctxinterrupt" + opservice "github.com/ethereum-optimism/optimism/op-service" "github.com/urfave/cli/v2" diff --git a/op-service/ctxinterrupt/context_test.go b/op-service/ctxinterrupt/context_test.go index 3eae5dc7df1cd..c853a3c5f7c6d 100644 --- a/op-service/ctxinterrupt/context_test.go +++ b/op-service/ctxinterrupt/context_test.go @@ -2,8 +2,9 @@ package ctxinterrupt import ( "context" - "github.com/stretchr/testify/require" "testing" + + "github.com/stretchr/testify/require" ) func TestContextKeyIsUnique(t *testing.T) { diff --git a/op-service/util.go b/op-service/util.go index 087b1eb610d35..e9dae2ec033f6 100644 --- a/op-service/util.go +++ b/op-service/util.go @@ -4,13 +4,14 @@ import ( "context" "errors" "fmt" - "github.com/ethereum-optimism/optimism/op-service/ctxinterrupt" "os" "path/filepath" "reflect" "strings" "time" + "github.com/ethereum-optimism/optimism/op-service/ctxinterrupt" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" "github.com/urfave/cli/v2"