diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index dfbe439..b7f66a7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,15 +24,18 @@ jobs: golangci: env: # for private repo access - GOPRIVATE: github.com/initia-labs/* + GOPRIVATE: github.com/initia-labs GITHUB_ACCESS_TOKEN: ${{ secrets.GH_READ_TOKEN }} + GOLANGCI_LINT_VERSION: v1.59.1 name: golangci-lint runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v2.1.4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: 1.22 - - uses: technote-space/get-diff-action@v5 + check-latest: true + - uses: technote-space/get-diff-action@v6.1.2 id: git_diff with: PATTERNS: | @@ -41,26 +44,43 @@ jobs: go.sum # for private repo access - run: git config --global url.https://${GITHUB_ACCESS_TOKEN}:x-oauth-basic@github.com/.insteadOf https://github.com/ - - name: run go linters + # install golangci-lint + - run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION} + - name: run go linters (long) + if: env.GIT_DIFF + id: lint_long run: | - make tools make lint - if: env.GIT_DIFF + - uses: technote-space/get-diff-action@v6.1.2 + if: steps.lint_long.outcome == 'skipped' + with: + PATTERNS: | + **/**.go + go.mod + go.sum + - name: run go linters (short) + if: steps.lint_long.outcome == 'skipped' && env.GIT_DIFF + run: | + make lint + env: + GIT_DIFF: ${{ env.GIT_DIFF }} + LINT_DIFF: 1 # Use --check or --exit-code when available (Go 1.19?) # https://github.com/golang/go/issues/27005 tidy: env: # for private repo access - GOPRIVATE: github.com/initia-labs/* + GOPRIVATE: github.com/initia-labs,github.com/skip-mev/slinky GITHUB_ACCESS_TOKEN: ${{ secrets.GH_READ_TOKEN }} runs-on: ubuntu-latest name: tidy steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: 1.22 + check-latest: true # for private repo access - run: git config --global url.https://${GITHUB_ACCESS_TOKEN}:x-oauth-basic@github.com/.insteadOf https://github.com/ - run: | diff --git a/Makefile b/Makefile index 358c47c..ae67620 100644 --- a/Makefile +++ b/Makefile @@ -235,10 +235,10 @@ benchmark: ############################################################################### lint: - golangci-lint run --out-format=tab + golangci-lint run --out-format=tab --timeout=15m lint-fix: - golangci-lint run --fix --out-format=tab --issues-exit-code=0 + golangci-lint run --fix --out-format=tab --timeout=15m .PHONY: lint lint-fix format: diff --git a/app/app.go b/app/app.go index fc717bb..44a6e63 100644 --- a/app/app.go +++ b/app/app.go @@ -1078,7 +1078,9 @@ func (app *MinitiaApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) } - app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()) + if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()); err != nil { + panic(err) + } return app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState) } diff --git a/app/test_helpers.go b/app/test_helpers.go index ad1e517..5a9c24f 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -91,7 +91,7 @@ func SetupWithGenesisAccounts( // allow empty validator if valSet == nil || len(valSet.Validators) == 0 { privVal := ed25519.GenPrivKey() - pubKey, err := cryptocodec.ToTmPubKeyInterface(privVal.PubKey()) + pubKey, err := cryptocodec.ToTmPubKeyInterface(privVal.PubKey()) //nolint:staticcheck if err != nil { panic(err) } @@ -103,7 +103,7 @@ func SetupWithGenesisAccounts( validators := make([]opchildtypes.Validator, 0, len(valSet.Validators)) for _, val := range valSet.Validators { - pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) + pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) //nolint:staticcheck if err != nil { panic(err) }