Skip to content

Commit a365712

Browse files
committed
add linting to github actions
1 parent 185b56e commit a365712

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/lint.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
test-go:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 5
17+
steps:
18+
- uses: actions/[email protected]
19+
- uses: actions/setup-go@v2
20+
with:
21+
go-version: 1.22.8
22+
23+
24+
- name: Get golangci-lint cache dir
25+
run: |
26+
linter_ver=1.55.2
27+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$linter_ver
28+
dir=$(golangci-lint cache status | awk '/Dir/ { print $2 }')
29+
echo "LINT_CACHE_DIR=$dir" >> $GITHUB_ENV
30+
31+
- name: golangci-lint cache
32+
uses: actions/cache@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4.1.0
33+
with:
34+
path: |
35+
${{ env.LINT_CACHE_DIR }}
36+
key: golangci-lint-${{ runner.os }}-${{ hashFiles('**/*.go') }}
37+
restore-keys: |
38+
golangci-lint-${{ runner.os }}-

0 commit comments

Comments
 (0)