diff --git a/.golangci.yml b/.golangci.yml index a3a1da31f..495fbed11 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -60,6 +60,8 @@ linters-settings: goconst: min-len: 3 min-occurrences: 6 + goimports: + local-prefixes: github.com/taikoxyz/taiko-client severity: # Set the default severity for issues. diff --git a/Makefile b/Makefile index 280c8de67..98bfb2102 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,9 @@ clean: @rm -rf bin/* lint: - @go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.2 \ + @go install golang.org/x/tools/cmd/goimports@latest \ + && go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.2 \ + && goimports -local "github.com/taikoxyz/taiko-client" -w ./ \ && golangci-lint run test: diff --git a/cmd/logger/logger.go b/cmd/logger/logger.go index 4af556d45..f339a3db0 100644 --- a/cmd/logger/logger.go +++ b/cmd/logger/logger.go @@ -4,8 +4,9 @@ import ( "os" "github.com/ethereum/go-ethereum/log" - "github.com/taikoxyz/taiko-client/cmd/flags" "github.com/urfave/cli/v2" + + "github.com/taikoxyz/taiko-client/cmd/flags" ) // InitLogger initializes the root logger with the command line flags. diff --git a/driver/chain_syncer/blob/syncer.go b/driver/chain_syncer/blob/syncer.go index 2a6ecd670..3db1945b1 100644 --- a/driver/chain_syncer/blob/syncer.go +++ b/driver/chain_syncer/blob/syncer.go @@ -16,6 +16,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/rlp" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-client/driver/chain_syncer/beaconsync" diff --git a/driver/driver.go b/driver/driver.go index 388450a26..91bf9e1fa 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -13,11 +13,11 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/log" + "github.com/urfave/cli/v2" chainSyncer "github.com/taikoxyz/taiko-client/driver/chain_syncer" "github.com/taikoxyz/taiko-client/driver/state" "github.com/taikoxyz/taiko-client/pkg/rpc" - "github.com/urfave/cli/v2" ) const ( diff --git a/driver/txlist_fetcher/calldata.go b/driver/txlist_fetcher/calldata.go index ae011012d..928fdc5b5 100644 --- a/driver/txlist_fetcher/calldata.go +++ b/driver/txlist_fetcher/calldata.go @@ -4,6 +4,7 @@ import ( "context" "github.com/ethereum/go-ethereum/core/types" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-client/pkg" diff --git a/driver/txlist_fetcher/interface.go b/driver/txlist_fetcher/interface.go index b4b984cd7..8535c9f49 100644 --- a/driver/txlist_fetcher/interface.go +++ b/driver/txlist_fetcher/interface.go @@ -4,6 +4,7 @@ import ( "context" "github.com/ethereum/go-ethereum/core/types" + "github.com/taikoxyz/taiko-client/bindings" ) diff --git a/internal/utils/util_test.go b/internal/utils/util_test.go index 730831add..3dae28bbe 100644 --- a/internal/utils/util_test.go +++ b/internal/utils/util_test.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum/go-ethereum/params" "github.com/stretchr/testify/require" + "github.com/taikoxyz/taiko-client/internal/testutils" "github.com/taikoxyz/taiko-client/internal/utils" ) diff --git a/pkg/flags/config.go b/pkg/flags/config.go index b3be4ce92..12375f89c 100644 --- a/pkg/flags/config.go +++ b/pkg/flags/config.go @@ -6,8 +6,9 @@ import ( "github.com/ethereum-optimism/optimism/op-service/txmgr" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "github.com/taikoxyz/taiko-client/cmd/flags" "github.com/urfave/cli/v2" + + "github.com/taikoxyz/taiko-client/cmd/flags" ) // InitTxmgrConfigsFromCli initializes the transaction manager configs from the command line flags. diff --git a/pkg/rpc/blob_datasource.go b/pkg/rpc/blob_datasource.go index 89dbabf75..511a2003a 100644 --- a/pkg/rpc/blob_datasource.go +++ b/pkg/rpc/blob_datasource.go @@ -9,6 +9,7 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/go-resty/resty/v2" "github.com/prysmaticlabs/prysm/v4/beacon-chain/rpc/eth/blob" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/pkg" ) diff --git a/pkg/rpc/client.go b/pkg/rpc/client.go index 7380e03fd..4b431b4e2 100644 --- a/pkg/rpc/client.go +++ b/pkg/rpc/client.go @@ -8,6 +8,7 @@ import ( "github.com/cenkalti/backoff/v4" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" + "github.com/taikoxyz/taiko-client/bindings" ) diff --git a/pkg/rpc/methods_test.go b/pkg/rpc/methods_test.go index 599957202..231e15887 100644 --- a/pkg/rpc/methods_test.go +++ b/pkg/rpc/methods_test.go @@ -9,6 +9,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/require" + "github.com/taikoxyz/taiko-client/bindings/encoding" ) diff --git a/pkg/rpc/subscription_test.go b/pkg/rpc/subscription_test.go index ccce2c4e4..fefc2d02f 100644 --- a/pkg/rpc/subscription_test.go +++ b/pkg/rpc/subscription_test.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/event" "github.com/stretchr/testify/require" + "github.com/taikoxyz/taiko-client/bindings" ) diff --git a/proposer/proposer.go b/proposer/proposer.go index 6bdb9a0fa..f58371911 100644 --- a/proposer/proposer.go +++ b/proposer/proposer.go @@ -17,6 +17,8 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/rlp" + "github.com/urfave/cli/v2" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-client/internal/metrics" @@ -24,7 +26,6 @@ import ( "github.com/taikoxyz/taiko-client/pkg/rpc" selector "github.com/taikoxyz/taiko-client/proposer/prover_selector" builder "github.com/taikoxyz/taiko-client/proposer/transaction_builder" - "github.com/urfave/cli/v2" ) var ( diff --git a/proposer/transaction_builder/blob.go b/proposer/transaction_builder/blob.go index 2a26e94e3..601f77428 100644 --- a/proposer/transaction_builder/blob.go +++ b/proposer/transaction_builder/blob.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto/kzg4844" + "github.com/taikoxyz/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-client/pkg/rpc" selector "github.com/taikoxyz/taiko-client/proposer/prover_selector" diff --git a/proposer/transaction_builder/calldata_test.go b/proposer/transaction_builder/calldata_test.go index c63824728..6b5e72c98 100644 --- a/proposer/transaction_builder/calldata_test.go +++ b/proposer/transaction_builder/calldata_test.go @@ -4,6 +4,7 @@ import ( "context" "github.com/ethereum/go-ethereum/common" + "github.com/taikoxyz/taiko-client/bindings/encoding" ) diff --git a/proposer/transaction_builder/common.go b/proposer/transaction_builder/common.go index 7b8342ad7..023402336 100644 --- a/proposer/transaction_builder/common.go +++ b/proposer/transaction_builder/common.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + "github.com/taikoxyz/taiko-client/pkg/rpc" ) diff --git a/proposer/transaction_builder/interface.go b/proposer/transaction_builder/interface.go index 4d870d64d..e9d26ed8e 100644 --- a/proposer/transaction_builder/interface.go +++ b/proposer/transaction_builder/interface.go @@ -4,6 +4,7 @@ import ( "context" "github.com/ethereum-optimism/optimism/op-service/txmgr" + "github.com/taikoxyz/taiko-client/bindings/encoding" ) diff --git a/prover/event_handler/assignment_expired.go b/prover/event_handler/assignment_expired.go index be0d715b9..ddfac1aae 100644 --- a/prover/event_handler/assignment_expired.go +++ b/prover/event_handler/assignment_expired.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/pkg/rpc" proofProducer "github.com/taikoxyz/taiko-client/prover/proof_producer" diff --git a/prover/event_handler/block_proposed_test.go b/prover/event_handler/block_proposed_test.go index 3e81da3ca..02295ddb9 100644 --- a/prover/event_handler/block_proposed_test.go +++ b/prover/event_handler/block_proposed_test.go @@ -8,6 +8,7 @@ import ( state "github.com/taikoxyz/taiko-client/prover/shared_state" "github.com/ethereum/go-ethereum/common" + "github.com/taikoxyz/taiko-client/bindings" ) diff --git a/prover/event_handler/block_verified.go b/prover/event_handler/block_verified.go index 4a445fc99..7bb0c2ab7 100644 --- a/prover/event_handler/block_verified.go +++ b/prover/event_handler/block_verified.go @@ -3,6 +3,7 @@ package handler import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/internal/metrics" ) diff --git a/prover/event_handler/block_verified_test.go b/prover/event_handler/block_verified_test.go index 764385bb8..318569d38 100644 --- a/prover/event_handler/block_verified_test.go +++ b/prover/event_handler/block_verified_test.go @@ -2,6 +2,7 @@ package handler import ( "github.com/ethereum/go-ethereum/core/types" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/internal/testutils" ) diff --git a/prover/event_handler/transition_contested.go b/prover/event_handler/transition_contested.go index 9f54422dc..25345f33f 100644 --- a/prover/event_handler/transition_contested.go +++ b/prover/event_handler/transition_contested.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/pkg/rpc" proofProducer "github.com/taikoxyz/taiko-client/prover/proof_producer" diff --git a/prover/event_handler/transition_proved.go b/prover/event_handler/transition_proved.go index 3f597f3f1..e75578a45 100644 --- a/prover/event_handler/transition_proved.go +++ b/prover/event_handler/transition_proved.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/internal/metrics" "github.com/taikoxyz/taiko-client/pkg/rpc" diff --git a/prover/event_handler/util_test.go b/prover/event_handler/util_test.go index 072027a68..3e34b5d35 100644 --- a/prover/event_handler/util_test.go +++ b/prover/event_handler/util_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/stretchr/testify/suite" + "github.com/taikoxyz/taiko-client/bindings" "github.com/taikoxyz/taiko-client/bindings/encoding" "github.com/taikoxyz/taiko-client/internal/testutils" diff --git a/prover/init_test.go b/prover/init_test.go index 815672c3b..87169ebd1 100644 --- a/prover/init_test.go +++ b/prover/init_test.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum-optimism/optimism/op-service/txmgr" "github.com/ethereum/go-ethereum/common" + "github.com/taikoxyz/taiko-client/bindings/encoding" ) diff --git a/prover/server/server_test.go b/prover/server/server_test.go index c1910136a..99b94282f 100644 --- a/prover/server/server_test.go +++ b/prover/server/server_test.go @@ -17,6 +17,7 @@ import ( "github.com/go-resty/resty/v2" "github.com/phayes/freeport" "github.com/stretchr/testify/suite" + "github.com/taikoxyz/taiko-client/pkg/rpc" proofProducer "github.com/taikoxyz/taiko-client/prover/proof_producer" ) diff --git a/prover/shared_state/state.go b/prover/shared_state/state.go index ce570f921..e0a4e6edc 100644 --- a/prover/shared_state/state.go +++ b/prover/shared_state/state.go @@ -4,6 +4,7 @@ import ( "sync/atomic" "github.com/ethereum/go-ethereum/core/types" + "github.com/taikoxyz/taiko-client/pkg/rpc" ) diff --git a/prover/shared_state/state_test.go b/prover/shared_state/state_test.go index d6acbb492..bcd3a6040 100644 --- a/prover/shared_state/state_test.go +++ b/prover/shared_state/state_test.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/stretchr/testify/suite" + "github.com/taikoxyz/taiko-client/pkg/rpc" )