Skip to content

Commit 6bf30f3

Browse files
committed
Use golangci-lint instead of golint
golint has been deprecated.
1 parent b9f5a82 commit 6bf30f3

File tree

3 files changed

+17
-59
lines changed

3 files changed

+17
-59
lines changed

.github/workflows/check-go-task.yml

+6-39
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ on:
1212
paths:
1313
- ".github/workflows/check-go-task.ya?ml"
1414
- "Taskfile.ya?ml"
15+
- ".golangci.ya?ml"
1516
- "**/go.mod"
1617
- "**/go.sum"
1718
- "**.go"
1819
pull_request:
1920
paths:
2021
- ".github/workflows/check-go-task.ya?ml"
2122
- "Taskfile.ya?ml"
23+
- ".golangci.ya?ml"
2224
- "**/go.mod"
2325
- "**/go.sum"
2426
- "**.go"
@@ -53,43 +55,6 @@ jobs:
5355
5456
echo "result=$RESULT" >> $GITHUB_OUTPUT
5557
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-
- path: ./
70-
- path: docsgen
71-
- path: ruledocsgen
72-
73-
steps:
74-
- name: Checkout repository
75-
uses: actions/checkout@v4
76-
77-
- name: Install Go
78-
uses: actions/setup-go@v5
79-
with:
80-
go-version: ${{ env.GO_VERSION }}
81-
82-
- name: Install Task
83-
uses: arduino/setup-task@v2
84-
with:
85-
repo-token: ${{ secrets.GITHUB_TOKEN }}
86-
version: 3.x
87-
88-
- name: Check for errors
89-
env:
90-
GO_MODULE_PATH: ${{ matrix.module.path }}
91-
run: task go:vet
92-
9358
check-outdated:
9459
name: check-outdated (${{ matrix.module.path }})
9560
needs: run-determination
@@ -162,8 +127,10 @@ jobs:
162127
repo-token: ${{ secrets.GITHUB_TOKEN }}
163128
version: 3.x
164129

165-
- name: Install golint
166-
run: go install golang.org/x/lint/golint@latest
130+
- name: Install golangci-lint
131+
uses: golangci/golangci-lint-action@v3
132+
with:
133+
version: v1.54
167134

168135
- name: Check style
169136
env:

.golangci.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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

Taskfile.yml

+4-20
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,6 @@ tasks:
5656
vars:
5757
GO_MODULE_PATH: ./ruledocsgen
5858
- task: go:test-integration
59-
- task: go:vet
60-
- task: go:vet
61-
vars:
62-
GO_MODULE_PATH: ./docsgen
63-
- task: go:vet
64-
vars:
65-
GO_MODULE_PATH: ./ruledocsgen
6659
- task: go:lint
6760
- task: go:lint
6861
vars:
@@ -250,14 +243,12 @@ tasks:
250243
dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
251244
cmds:
252245
- |
253-
if ! which golint &>/dev/null; then
254-
echo "golint not installed or not in PATH. Please install: https://github.com/golang/lint#installation"
246+
if ! which golangci-lint &>/dev/null; then
247+
echo "golangci-lint not installed or not in PATH."
248+
echo "Please install: https://golangci-lint.run/usage/install/#local-installation"
255249
exit 1
256250
fi
257-
- |
258-
golint \
259-
{{default "-min_confidence 0.8 -set_exit_status" .GO_LINT_FLAGS}} \
260-
{{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
251+
- golangci-lint run
261252

262253
go:rule-docs:
263254
desc: Generate rules documentation
@@ -308,13 +299,6 @@ tasks:
308299
cmds:
309300
- go mod tidy -compat={{.GO_VERSION}}
310301

311-
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
312-
go:vet:
313-
desc: Check for errors in Go code
314-
dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
315-
cmds:
316-
- go vet {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
317-
318302
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
319303
markdown:check-links:
320304
desc: Check for broken links

0 commit comments

Comments
 (0)