File tree 4 files changed +19
-51
lines changed
4 files changed +19
-51
lines changed Original file line number Diff line number Diff line change @@ -22,18 +22,9 @@ tasks:
22
22
dir : " {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
23
23
cmds :
24
24
- |
25
- if ! which golint &>/dev/null; then
26
- echo "golint not installed or not in PATH. Please install: https://github.com/golang/lint#installation"
25
+ if ! which golangci-lint &>/dev/null; then
26
+ echo "golangci-lint not installed or not in PATH."
27
+ echo "Please install: https://golangci-lint.run/usage/install/#local-installation"
27
28
exit 1
28
29
fi
29
- - |
30
- golint \
31
- {{default "-min_confidence 0.8 -set_exit_status" .GO_LINT_FLAGS}} \
32
- {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
33
-
34
- # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
35
- go:vet :
36
- desc : Check for errors in Go code
37
- dir : " {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
38
- cmds :
39
- - go vet {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
30
+ - golangci-lint run
Original file line number Diff line number Diff line change
1
+ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/go/.golangci.yml
2
+ # See: https://golangci-lint.run/usage/configuration/
3
+ issues :
4
+ exclude-use-default : false
5
+ linters :
6
+ enable :
7
+ - revive
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ Install the [`check-go-task.yml`](check-go-task.yml) GitHub Actions workflow to
12
12
13
13
- [ ` Taskfile.yml ` ] ( assets/check-go-task/Taskfile.yml ) - Linting and formatting [ tasks] ( https://taskfile.dev/ ) .
14
14
- Install to: repository root (or merge into the existing ` Taskfile.yml ` ).
15
+ - [ ` .golangci.yml ` ] ( assets/go/.golangci.yml ) - Contains all the go-linting configurations.
16
+ - Install to: repository root as ` .golangci.yml `
15
17
- [ ` Taskfile.yml ` ] ( assets/go-task/Taskfile.yml ) - ` DEFAULT_GO_MODULE_PATH ` and ` DEFAULT_GO_PACKAGES ` variables
16
18
- Merge into ` Taskfile.yml `
17
19
Original file line number Diff line number Diff line change 12
12
paths :
13
13
- " .github/workflows/check-go-task.ya?ml"
14
14
- " Taskfile.ya?ml"
15
+ - " .golangci.ya?ml"
15
16
- " **/go.mod"
16
17
- " **/go.sum"
17
18
- " **.go"
18
19
pull_request :
19
20
paths :
20
21
- " .github/workflows/check-go-task.ya?ml"
21
22
- " Taskfile.ya?ml"
23
+ - " .golangci.ya?ml"
22
24
- " **/go.mod"
23
25
- " **/go.sum"
24
26
- " **.go"
53
55
54
56
echo "result=$RESULT" >> $GITHUB_OUTPUT
55
57
56
- check-errors :
57
- name : check-errors (${{ matrix.module.path }})
58
- needs : run-determination
59
- if : needs.run-determination.outputs.result == 'true'
60
- runs-on : ubuntu-latest
61
- permissions :
62
- contents : read
63
-
64
- strategy :
65
- fail-fast : false
66
-
67
- matrix :
68
- module :
69
- # TODO: add paths of all Go modules here
70
- - path : ./
71
-
72
- steps :
73
- - name : Checkout repository
74
- uses : actions/checkout@v4
75
-
76
- - name : Install Go
77
- uses : actions/setup-go@v4
78
- with :
79
- go-version : ${{ env.GO_VERSION }}
80
-
81
- - name : Install Task
82
- uses : arduino/setup-task@v1
83
- with :
84
- repo-token : ${{ secrets.GITHUB_TOKEN }}
85
- version : 3.x
86
-
87
- - name : Check for errors
88
- env :
89
- GO_MODULE_PATH : ${{ matrix.module.path }}
90
- run : task go:vet
91
-
92
58
check-outdated :
93
59
name : check-outdated (${{ matrix.module.path }})
94
60
needs : run-determination
@@ -159,8 +125,10 @@ jobs:
159
125
repo-token : ${{ secrets.GITHUB_TOKEN }}
160
126
version : 3.x
161
127
162
- - name : Install golint
163
- run : go install golang.org/x/lint/golint@latest
128
+ - name : Install golangci-lint
129
+ uses : golangci/golangci-lint-action@v3
130
+ with :
131
+ version : v1.54
164
132
165
133
- name : Check style
166
134
env :
You can’t perform that action at this time.
0 commit comments