Skip to content

Commit

Permalink
fix lint action
Browse files Browse the repository at this point in the history
  • Loading branch information
Vritra4 committed Jul 17, 2024
1 parent b9484ca commit 044591e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 14 deletions.
38 changes: 29 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
- 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/[email protected]
id: git_diff
with:
PATTERNS: |
Expand All @@ -41,26 +44,43 @@ jobs:
go.sum
# for private repo access
- run: git config --global url.https://${GITHUB_ACCESS_TOKEN}:[email protected]/.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/[email protected]
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}:[email protected]/.insteadOf https://github.com/
- run: |
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 1082 in app/app.go

View check run for this annotation

Codecov / codecov/patch

app/app.go#L1082

Added line #L1082 was not covered by tests
}
return app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState)
}

Expand Down
4 changes: 2 additions & 2 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down

0 comments on commit 044591e

Please sign in to comment.