Skip to content

Commit a331373

Browse files
authored
Merge pull request #51 from initia-labs/chore/action-lint-fix
fix action to lint
2 parents fe2843e + 8c92052 commit a331373

File tree

3 files changed

+31
-56
lines changed

3 files changed

+31
-56
lines changed

.github/workflows/lint.yml

+29-9
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@ jobs:
2424
golangci:
2525
env:
2626
# for private repo access
27-
GOPRIVATE: github.com/initia-labs/*
27+
GOPRIVATE: github.com/initia-labs
2828
GITHUB_ACCESS_TOKEN: ${{ secrets.GH_READ_TOKEN }}
29+
GOLANGCI_LINT_VERSION: v1.59.1
2930
name: golangci-lint
3031
runs-on: ubuntu-latest
3132
steps:
32-
- uses: actions/setup-go@v4
33+
- uses: actions/checkout@v4
34+
- uses: actions/setup-go@v5
3335
with:
3436
go-version: 1.22
35-
- uses: technote-space/get-diff-action@v5
37+
check-latest: true
38+
- uses: technote-space/[email protected]
3639
id: git_diff
3740
with:
3841
PATTERNS: |
@@ -41,26 +44,43 @@ jobs:
4144
go.sum
4245
# for private repo access
4346
- run: git config --global url.https://${GITHUB_ACCESS_TOKEN}:[email protected]/.insteadOf https://github.com/
44-
- name: run go linters
47+
# install golangci-lint
48+
- run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
49+
- name: run go linters (long)
50+
if: env.GIT_DIFF
51+
id: lint_long
4552
run: |
46-
make tools
4753
make lint
48-
if: env.GIT_DIFF
54+
- uses: technote-space/[email protected]
55+
if: steps.lint_long.outcome == 'skipped'
56+
with:
57+
PATTERNS: |
58+
**/**.go
59+
go.mod
60+
go.sum
61+
- name: run go linters (short)
62+
if: steps.lint_long.outcome == 'skipped' && env.GIT_DIFF
63+
run: |
64+
make lint
65+
env:
66+
GIT_DIFF: ${{ env.GIT_DIFF }}
67+
LINT_DIFF: 1
4968
# Use --check or --exit-code when available (Go 1.19?)
5069
# https://github.com/golang/go/issues/27005
5170
tidy:
5271
env:
5372
# for private repo access
54-
GOPRIVATE: github.com/initia-labs/*
73+
GOPRIVATE: github.com/initia-labs,github.com/skip-mev/slinky
5574
GITHUB_ACCESS_TOKEN: ${{ secrets.GH_READ_TOKEN }}
5675
runs-on: ubuntu-latest
5776
name: tidy
5877
steps:
59-
- uses: actions/checkout@v3
78+
- uses: actions/checkout@v4
6079
- name: Setup go
61-
uses: actions/setup-go@v4
80+
uses: actions/setup-go@v5
6281
with:
6382
go-version: 1.22
83+
check-latest: true
6484
# for private repo access
6585
- run: git config --global url.https://${GITHUB_ACCESS_TOKEN}:[email protected]/.insteadOf https://github.com/
6686
- run: |

.golangci.yml

-45
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ linters:
22
enable:
33
- asciicheck
44
- bodyclose
5-
- depguard
65
- dogsled
76
- dupl
87
- errcheck
@@ -27,9 +26,6 @@ linters:
2726

2827
issues:
2928
exclude-rules:
30-
- path: _test\.go
31-
linters:
32-
- gosec
3329
- linters:
3430
- stylecheck
3531
text: "ST1003:"
@@ -46,44 +42,3 @@ linters-settings:
4642
# suggest-new: true
4743
misspell:
4844
locale: US
49-
depguard:
50-
rules:
51-
main:
52-
files:
53-
- $all
54-
- "!$test"
55-
allow:
56-
- $gostd
57-
- "cosmossdk.io/collections"
58-
- "cosmossdk.io/core/address"
59-
- "cosmossdk.io/core/store"
60-
- "cosmossdk.io/log"
61-
- "cosmossdk.io/store/cachekv"
62-
- "cosmossdk.io/store/dbadapter"
63-
- "cosmossdk.io/store/types"
64-
- "github.com/cometbft/cometbft/abci/types"
65-
- "github.com/cosmos/cosmos-db"
66-
- "github.com/cosmos/cosmos-sdk/baseapp"
67-
- "github.com/cosmos/cosmos-sdk/client"
68-
- "github.com/cosmos/cosmos-sdk/codec"
69-
- "github.com/cosmos/cosmos-sdk/server/types"
70-
- "github.com/cosmos/cosmos-sdk/types"
71-
- "github.com/cosmos/gogoproto/grpc"
72-
- "github.com/grpc-ecosystem/grpc-gateway/runtime"
73-
- "github.com/hashicorp/golang-lru"
74-
- "github.com/initia-labs/kvindexer/config"
75-
- "github.com/initia-labs/kvindexer/store"
76-
- "github.com/initia-labs/kvindexer/store/goleveldb"
77-
- "github.com/initia-labs/kvindexer/x/kvindexer/keeper"
78-
- "github.com/initia-labs/kvindexer/x/kvindexer/types"
79-
- "github.com/pkg/errors"
80-
- "github.com/spf13/cast"
81-
- "github.com/spf13/cobra"
82-
- "github.com/spf13/viper"
83-
- "github.com/syndtr/goleveldb/leveldb/filter"
84-
- "github.com/syndtr/goleveldb/leveldb/opt"
85-
test:
86-
files:
87-
- "$test"
88-
allow:
89-
- $gostd

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ benchmark:
176176
###############################################################################
177177

178178
lint:
179-
golangci-lint run --out-format=tab
179+
golangci-lint run --out-format=tab --timeout=15m
180180

181181
lint-fix:
182-
golangci-lint run --fix --out-format=tab --issues-exit-code=0
182+
golangci-lint run --fix --out-format=tab --timeout=15m
183183
.PHONY: lint lint-fix
184184

185185
format:

0 commit comments

Comments
 (0)