From 7e3a7ae7443e28f25d1aa114f0e89a568357157b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Fri, 9 Feb 2024 13:25:59 +0100 Subject: [PATCH] ci: fix goimports lint in CI (#628) * ci: fix goimports lint in CI * use different go versions for goimports and go mod tidy * goimports --- .github/workflows/l2geth_ci.yml | 22 +++++++++++++++++++--- core/types/blob_tx.go | 1 + core/types/transaction_marshalling.go | 1 + crypto/kzg4844/kzg4844_ckzg_cgo.go | 1 + 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/l2geth_ci.yml b/.github/workflows/l2geth_ci.yml index a6fe47d7b9..d27687303a 100644 --- a/.github/workflows/l2geth_ci.yml +++ b/.github/workflows/l2geth_ci.yml @@ -69,15 +69,31 @@ jobs: - name: Install Go uses: actions/setup-go@v2 with: - go-version: 1.20.x + go-version: 1.18.x - name: Install goimports run: go install golang.org/x/tools/cmd/goimports@latest - name: Checkout code uses: actions/checkout@v2 - run: goimports -local github.com/scroll-tech/go-ethereum/ -w . + # If there are any diffs from goimports, fail. + - name: Verify no changes from goimports + run: | + if [ -n "$(git status --porcelain)" ]; then + exit 1 + fi + go-mod-tidy-lint: + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: 1.20.x + - name: Checkout code + uses: actions/checkout@v2 - run: go mod tidy - # If there are any diffs from goimports or go mod tidy, fail. - - name: Verify no changes from goimports and go mod tidy + # If there are any diffs from go mod tidy, fail. + - name: Verify no changes from go mod tidy run: | if [ -n "$(git status --porcelain)" ]; then exit 1 diff --git a/core/types/blob_tx.go b/core/types/blob_tx.go index 44c862968d..1b1bfb035a 100644 --- a/core/types/blob_tx.go +++ b/core/types/blob_tx.go @@ -22,6 +22,7 @@ import ( "math/big" "github.com/holiman/uint256" + "github.com/scroll-tech/go-ethereum/common" "github.com/scroll-tech/go-ethereum/crypto/kzg4844" "github.com/scroll-tech/go-ethereum/params" diff --git a/core/types/transaction_marshalling.go b/core/types/transaction_marshalling.go index b8b7c0d5df..8602e1a83f 100644 --- a/core/types/transaction_marshalling.go +++ b/core/types/transaction_marshalling.go @@ -22,6 +22,7 @@ import ( "math/big" "github.com/holiman/uint256" + "github.com/scroll-tech/go-ethereum/common" "github.com/scroll-tech/go-ethereum/common/hexutil" ) diff --git a/crypto/kzg4844/kzg4844_ckzg_cgo.go b/crypto/kzg4844/kzg4844_ckzg_cgo.go index 59e6a9c4bf..39d71d76be 100644 --- a/crypto/kzg4844/kzg4844_ckzg_cgo.go +++ b/crypto/kzg4844/kzg4844_ckzg_cgo.go @@ -25,6 +25,7 @@ import ( gokzg4844 "github.com/crate-crypto/go-kzg-4844" ckzg4844 "github.com/ethereum/c-kzg-4844/bindings/go" + "github.com/scroll-tech/go-ethereum/common/hexutil" )