Skip to content

Commit 8d8f2be

Browse files
committed
chore: replace deprecated golangci lint
1 parent e0fc9df commit 8d8f2be

File tree

2 files changed

+38
-10
lines changed

2 files changed

+38
-10
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,65 @@ on:
66
- main
77
pull_request:
88

9+
env:
10+
GO_VERSION: 1.22
11+
GOLANGCI_LINT_VERSION: v1.54.2
12+
913
jobs:
10-
build_lint_test:
14+
setup:
1115
runs-on: ubuntu-latest
12-
16+
outputs:
17+
go-path: ${{ steps.set-go-path.outputs.go-path }}
1318
steps:
1419
- name: Checkout code
1520
uses: actions/checkout@v3
1621

1722
- name: Set up Go
23+
id: set-go
1824
uses: actions/setup-go@v4
1925
with:
20-
go-version: "1.22"
26+
go-version: ${{env.GO_VERSION}}
2127

2228
- name: Install Mage
29+
id: set-go-path
2330
run: |
2431
go install github.com/magefile/mage@latest
2532
echo "$HOME/go/bin" >> $GITHUB_PATH # Add Go binaries to the PATH
33+
echo "::set-output name=go-path::$HOME/go/bin"
2634
27-
- name: Install golangci-lint
28-
run: |
29-
# Install golangci-lint in the user's home directory
30-
wget -qO - https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $HOME/go/bin
31-
echo "$HOME/go/bin" >> $GITHUB_PATH # Add golangci-lint to the PATH
35+
build:
36+
runs-on: ubuntu-latest
37+
needs: setup # This job will run after the setup job completes
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v3
3241

3342
- name: Build
3443
run: |
3544
mage -v build
3645
46+
lint:
47+
runs-on: ubuntu-latest
48+
needs: setup # This job will run after the setup job completes
49+
steps:
50+
- name: Checkout code
51+
uses: actions/checkout@v3
52+
53+
- name: Install golangci-lint
54+
run: |
55+
wget -qO - https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${{ needs.setup.outputs.go-path }} ${{env.GOLANGCI_LINT_VERSION}}
56+
echo "$HOME/go/bin" >> $GITHUB_PATH # Add golangci-lint to the PATH
57+
3758
- name: Lint
3859
run: |
39-
mage -v lint
60+
mage -v lint # Run your lint command, which uses golangci-lint
61+
62+
test:
63+
runs-on: ubuntu-latest
64+
needs: setup # This job will run after the setup job completes
65+
steps:
66+
- name: Checkout code
67+
uses: actions/checkout@v3
4068

4169
- name: Install dependencies
4270
run: |

.golangci.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ enable = [
3939
"misspell",
4040
"nakedret",
4141
"rowserrcheck",
42-
"exportloopref",
42+
"copyloopvar",
4343
"staticcheck",
4444
"stylecheck",
4545
"typecheck",

0 commit comments

Comments
 (0)