File tree Expand file tree Collapse file tree 2 files changed +38
-10
lines changed Expand file tree Collapse file tree 2 files changed +38
-10
lines changed Original file line number Diff line number Diff line change 6
6
- main
7
7
pull_request :
8
8
9
+ env :
10
+ GO_VERSION : 1.22
11
+ GOLANGCI_LINT_VERSION : v1.54.2
12
+
9
13
jobs :
10
- build_lint_test :
14
+ setup :
11
15
runs-on : ubuntu-latest
12
-
16
+ outputs :
17
+ go-path : ${{ steps.set-go-path.outputs.go-path }}
13
18
steps :
14
19
- name : Checkout code
15
20
uses : actions/checkout@v3
16
21
17
22
- name : Set up Go
23
+ id : set-go
18
24
uses : actions/setup-go@v4
19
25
with :
20
- go-version : " 1.22 "
26
+ go-version : ${{env.GO_VERSION}}
21
27
22
28
- name : Install Mage
29
+ id : set-go-path
23
30
run : |
24
31
go install github.com/magefile/mage@latest
25
32
echo "$HOME/go/bin" >> $GITHUB_PATH # Add Go binaries to the PATH
33
+ echo "::set-output name=go-path::$HOME/go/bin"
26
34
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
32
41
33
42
- name : Build
34
43
run : |
35
44
mage -v build
36
45
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
+
37
58
- name : Lint
38
59
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
40
68
41
69
- name : Install dependencies
42
70
run : |
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ enable = [
39
39
" misspell" ,
40
40
" nakedret" ,
41
41
" rowserrcheck" ,
42
- " exportloopref " ,
42
+ " copyloopvar " ,
43
43
" staticcheck" ,
44
44
" stylecheck" ,
45
45
" typecheck" ,
You can’t perform that action at this time.
0 commit comments