Skip to content

Commit 6ee3e83

Browse files
committed
chore: upgrade to golangci-lint v2
- Upgrades to golangci-lint configuration to support v2. - Updates workflow to v7 that supports v2. Signed-off-by: Ryan Johnson <[email protected]>
1 parent dd1310a commit 6ee3e83

File tree

2 files changed

+64
-41
lines changed

2 files changed

+64
-41
lines changed

Diff for: .github/workflows/golangci-lint.yml

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
---
12
name: golangci-lint
23

34
on:
45
pull_request:
56
paths-ignore:
6-
- 'README.md'
7+
- README.md
78
push:
89
paths-ignore:
9-
- 'README.md'
10+
- README.md
1011

1112
permissions:
1213
contents: read
@@ -18,17 +19,17 @@ jobs:
1819
timeout-minutes: 5
1920
steps:
2021
- name: Checkout
21-
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2223
- name: Setup Go
23-
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
24+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
2425
with:
25-
go-version-file: 'go.mod'
26+
go-version-file: go.mod
2627
cache: true
2728
- run: go mod download
2829
- run: go build -v .
2930
- name: Run Linters
30-
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
31+
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
3132
with:
32-
version: v1.60.3
33+
version: latest
3334
args: --issues-exit-code=1
3435
only-new-issues: true

Diff for: .golangci.yml

+56-34
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,71 @@
1-
# © Broadcom. All Rights Reserved.
2-
# The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
3-
# SPDX-License-Identifier: MPL-2.0
4-
5-
# For more information about the golangci-lint configuration file, refer to:
6-
# https://golangci-lint.run/usage/configuration/
7-
8-
issues:
9-
max-per-linter: 0
10-
max-same-issues: 0
11-
exclude-rules:
12-
# Exclude errcheck for some rules.
13-
- linters: [errcheck]
14-
text: "Error return value of `d.Set` is not checked"
15-
# Exclude revive for some rules.
16-
- linters:
17-
- revive
18-
text: 'redefines-builtin-id: redefinition of the built-in'
19-
20-
run:
21-
deadline: 5m
1+
---
2+
version: "2"
223

234
linters:
24-
disable-all: true
5+
default: none
256
enable:
267
- durationcheck
278
- errcheck
28-
- gofmt
29-
- goimports
30-
- gosimple
319
- govet
3210
- ineffassign
3311
- makezero
3412
- misspell
3513
- nakedret
3614
- revive
3715
- staticcheck
38-
- tenv
39-
- typecheck
4016
- unconvert
4117
- unused
42-
- govet
18+
settings:
19+
errcheck:
20+
exclude-functions:
21+
- github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set
22+
- fmt:.*
23+
- io:Close
24+
exclusions:
25+
generated: lax
26+
presets:
27+
- comments
28+
- common-false-positives
29+
- legacy
30+
- std-error-handling
31+
rules:
32+
- linters:
33+
- errcheck
34+
text: Error return value of `d.Set` is not checked
35+
- linters:
36+
- revive
37+
text: 'redefines-builtin-id: redefinition of the built-in'
38+
# TODO: Setting temporary exclusions.
39+
- linters:
40+
- staticcheck
41+
text: QF1001
42+
- linters:
43+
- staticcheck
44+
text: QF1003
45+
- linters:
46+
- staticcheck
47+
text: ST1005
48+
- linters:
49+
- staticcheck
50+
text: QF1004
51+
- linters:
52+
- staticcheck
53+
text: QF1011
54+
paths:
55+
- third_party$
56+
- builtin$
57+
- examples$
58+
59+
issues:
60+
max-same-issues: 0
4361

44-
linters-settings:
45-
errcheck:
46-
exclude-functions:
47-
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set"
48-
- "fmt:.*"
49-
- "io:Close"
62+
formatters:
63+
enable:
64+
- gofmt
65+
- goimports
66+
exclusions:
67+
generated: lax
68+
paths:
69+
- third_party$
70+
- builtin$
71+
- examples$

0 commit comments

Comments
 (0)