Skip to content

Commit 3488059

Browse files
authored
chore: upgrade to golangci-lint v2 (#99)
- Upgrades to golangci-lint configuration to support v2. - Updates workflow to v7 that supports v2. Signed-off-by: Ryan Johnson <[email protected]>
1 parent a16fa68 commit 3488059

File tree

4 files changed

+63
-40
lines changed

4 files changed

+63
-40
lines changed

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

+5-4
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
@@ -22,11 +23,11 @@ jobs:
2223
- name: Setup Go
2324
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@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
31+
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
3132
with:
3233
version: latest

Diff for: .golangci.yml

+56-33
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,15 @@
1-
# © Broadcom. All Rights Reserved.
2-
# The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
3-
# SPDX-License-Identifier: MPL-2.0
1+
---
2+
version: "2"
43

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
4+
output:
5+
formats:
6+
text:
7+
path: stdout
228

239
linters:
24-
disable-all: true
10+
default: none
2511
enable:
2612
- errcheck
27-
- gofmt
28-
- goimports
29-
- gosimple
3013
- gosec
3114
- govet
3215
- ineffassign
@@ -35,14 +18,54 @@ linters:
3518
- staticcheck
3619
- unconvert
3720
- unused
21+
settings:
22+
errcheck:
23+
exclude-functions:
24+
- github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set
25+
- fmt:.*
26+
- io:Close
27+
exclusions:
28+
generated: lax
29+
presets:
30+
- comments
31+
- common-false-positives
32+
- legacy
33+
- std-error-handling
34+
rules:
35+
# TODO: Setting temporary exclusions.
36+
- linters:
37+
- errcheck
38+
text: Error return value of `d.Set` is not checked
39+
- linters:
40+
- revive
41+
text: redefines-builtin-id
42+
- linters:
43+
- revive
44+
text: unused-parameter
45+
- linters:
46+
- revive
47+
text: indent-error-flow
48+
- linters:
49+
- gosec
50+
text: G402
51+
- linters:
52+
- goimports
53+
text: formatted
54+
paths:
55+
- third_party$
56+
- builtin$
57+
- examples$
3858

39-
output:
40-
formats:
41-
- format: colored-line-number
59+
issues:
60+
max-same-issues: 0
4261

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

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Learn more:
2626

2727
For general information about Terraform, visit [HashiCorp Developer][terraform-install] and [the project][terraform-github] on GitHub.
2828

29-
* [Go 1.22.7][golang-install]
29+
* [Go 1.23.8][golang-install]
3030

3131
Required, if [building][provider-build] the provider.
3232

Diff for: go.mod

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module github.com/vmware/terraform-provider-hcx
22

3-
go 1.22.7
4-
toolchain go1.24.1
3+
go 1.23.8
54

65
require (
76
github.com/hashicorp/go-cty v1.5.0

0 commit comments

Comments
 (0)