Skip to content

Commit 0de13c9

Browse files
authored
chore(golangci-lint): migrate to v2 (#618)
Signed-off-by: Nathanael Liechti <[email protected]>
1 parent 5daf973 commit 0de13c9

File tree

7 files changed

+137
-111
lines changed

7 files changed

+137
-111
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ jobs:
2727
- name: Build provider
2828
run: make build
2929
- name: Run linters
30-
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
30+
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
3131
with:
32-
version: v1.64.6
32+
version: v2.1.5
3333

3434
generate:
3535
runs-on: ubuntu-24.04

.golangci.yml

Lines changed: 109 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
1-
issues:
2-
exclude-rules:
3-
- linters:
4-
- paralleltest
5-
text: "Function TestAcc"
6-
- linters:
7-
- tparallel
8-
text: "TestAcc"
9-
- linters:
10-
- unparam
11-
text: "always receives"
12-
- path: _test\.go
13-
linters:
14-
- contextcheck
15-
max-same-issues: 0
16-
1+
version: "2"
172
linters:
18-
disable-all: true
3+
default: none
194
enable:
205
- asasalint
216
- asciicheck
@@ -29,8 +14,6 @@ linters:
2914
- errorlint
3015
- goconst
3116
- gocritic
32-
- gofmt
33-
- gosimple
3417
- govet
3518
- ineffassign
3619
- makezero
@@ -42,75 +25,117 @@ linters:
4225
- paralleltest
4326
- predeclared
4427
- staticcheck
45-
- stylecheck
4628
- tparallel
47-
- typecheck
4829
- unconvert
4930
- unparam
5031
- unused
5132
- usetesting
5233
- whitespace
5334
- wsl
54-
55-
linters-settings:
56-
dogsled:
57-
max-blank-identifiers: 3
58-
errcheck:
59-
exclude-functions:
60-
- github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set
61-
- fmt:.*
62-
- io:Close
63-
errorlint:
64-
errorf: false
65-
goconst:
66-
ignore-tests: true
67-
min-occurrences: 6
68-
gocritic:
69-
enabled-tags:
70-
- diagnostic
71-
disabled-tags:
72-
- style
73-
- performance
74-
- experimental
75-
- opinionated
76-
mnd:
77-
checks:
78-
- argument
79-
ignored-functions:
80-
# Terraform Plugin SDK
81-
- resource.Retry
82-
- schema.DefaultTimeout
83-
- validation.*
84-
# Terraform Plugin Framework
85-
- int64validator.*
86-
- listvalidator.*
87-
- stringvalidator.*
88-
- SetDefaultCreateTimeout
89-
- SetDefaultReadTimeout
90-
- SetDefaultUpdateTimeout
91-
- SetDefaultDeleteTimeout
92-
# Go
93-
- make
94-
- strconv.FormatFloat
95-
- strconv.FormatInt
96-
- strconv.ParseFloat
97-
- strconv.ParseInt
98-
- strings.SplitN
99-
nolintlint:
100-
allow-unused: false
101-
require-explanation: true
102-
require-specific: true
103-
allow-no-explanation:
104-
- gomnd
105-
- paralleltest
106-
- tparallel
107-
- unparam
108-
predeclared:
109-
ignore: cap,close,copy,delete,len,new
110-
staticcheck:
111-
checks: ["all", "-SA1019"]
112-
stylecheck:
113-
checks: ["all", "-ST1005", "-ST1003"]
114-
115-
run:
116-
timeout: 5m
35+
settings:
36+
dogsled:
37+
max-blank-identifiers: 3
38+
errcheck:
39+
exclude-functions:
40+
- github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set
41+
- fmt:.*
42+
- io:Close
43+
errorlint:
44+
errorf: false
45+
goconst:
46+
min-occurrences: 6
47+
gocritic:
48+
enabled-tags:
49+
- diagnostic
50+
disabled-tags:
51+
- style
52+
- performance
53+
- experimental
54+
- opinionated
55+
mnd:
56+
checks:
57+
- argument
58+
ignored-functions:
59+
- resource.Retry
60+
- schema.DefaultTimeout
61+
- validation.*
62+
- int64validator.*
63+
- listvalidator.*
64+
- stringvalidator.*
65+
- SetDefaultCreateTimeout
66+
- SetDefaultReadTimeout
67+
- SetDefaultUpdateTimeout
68+
- SetDefaultDeleteTimeout
69+
- make
70+
- strconv.FormatFloat
71+
- strconv.FormatInt
72+
- strconv.ParseFloat
73+
- strconv.ParseInt
74+
- strings.SplitN
75+
nolintlint:
76+
require-explanation: true
77+
require-specific: true
78+
allow-no-explanation:
79+
- gomnd
80+
- paralleltest
81+
- tparallel
82+
- unparam
83+
allow-unused: false
84+
predeclared:
85+
ignore:
86+
- cap
87+
- close
88+
- copy
89+
- delete
90+
- len
91+
- new
92+
staticcheck:
93+
checks:
94+
- -SA1019
95+
- -ST1005
96+
- all
97+
exclusions:
98+
generated: lax
99+
presets:
100+
- comments
101+
- common-false-positives
102+
- legacy
103+
- std-error-handling
104+
rules:
105+
- linters:
106+
- paralleltest
107+
text: Function TestAcc
108+
- linters:
109+
- tparallel
110+
text: TestAcc
111+
- linters:
112+
- unparam
113+
text: always receives
114+
- linters:
115+
- contextcheck
116+
path: _test\.go
117+
- linters:
118+
- goconst
119+
path: (.+)_test\.go
120+
- linters:
121+
- staticcheck
122+
text: "ST1003:"
123+
- linters:
124+
- staticcheck
125+
text: "SA1019:"
126+
path: internal/types/pgp_public_key.go
127+
paths:
128+
- third_party$
129+
- builtin$
130+
- examples$
131+
issues:
132+
max-same-issues: 0
133+
formatters:
134+
enable:
135+
- gofmt
136+
exclusions:
137+
generated: lax
138+
paths:
139+
- third_party$
140+
- builtin$
141+
- examples$

argocd/resource_argocd_cluster_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -682,9 +682,9 @@ func getInternalRestConfig() (*rest.Config, error) {
682682
authInfo := cfg.AuthInfos[key]
683683
rc.Host = cluster.Server
684684
rc.ServerName = cluster.TLSServerName
685-
rc.TLSClientConfig.CAData = cluster.CertificateAuthorityData
686-
rc.TLSClientConfig.CertData = authInfo.ClientCertificateData
687-
rc.TLSClientConfig.KeyData = authInfo.ClientKeyData
685+
rc.CAData = cluster.CertificateAuthorityData
686+
rc.CertData = authInfo.ClientCertificateData
687+
rc.KeyData = authInfo.ClientKeyData
688688

689689
return rc, nil
690690
}

argocd/structure_application.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -272,23 +272,23 @@ func expandApplicationSourceKustomizePatchTarget(in []interface{}) *application.
272272
t := in[0].(map[string]interface{})
273273

274274
if group, ok := t["group"]; ok {
275-
result.KustomizeResId.KustomizeGvk.Group = group.(string)
275+
result.Group = group.(string)
276276
}
277277

278278
if version, ok := t["version"]; ok {
279-
result.KustomizeResId.KustomizeGvk.Version = version.(string)
279+
result.Version = version.(string)
280280
}
281281

282282
if kind, ok := t["kind"]; ok {
283-
result.KustomizeResId.KustomizeGvk.Kind = kind.(string)
283+
result.Kind = kind.(string)
284284
}
285285

286286
if name, ok := t["name"]; ok {
287-
result.KustomizeResId.Name = name.(string)
287+
result.Name = name.(string)
288288
}
289289

290290
if namespace, ok := t["namespace"]; ok {
291-
result.KustomizeResId.Namespace = namespace.(string)
291+
result.Namespace = namespace.(string)
292292
}
293293

294294
if label_selector, ok := t["label_selector"]; ok {
@@ -834,11 +834,11 @@ func flattenApplicationSourceKustomize(as []*application.ApplicationSourceKustom
834834
if p.Target != nil {
835835
patch["target"] = []map[string]interface{}{
836836
{
837-
"group": p.Target.KustomizeResId.KustomizeGvk.Group,
838-
"version": p.Target.KustomizeResId.KustomizeGvk.Version,
839-
"kind": p.Target.KustomizeResId.KustomizeGvk.Kind,
840-
"name": p.Target.KustomizeResId.Name,
841-
"namespace": p.Target.KustomizeResId.Namespace,
837+
"group": p.Target.Group,
838+
"version": p.Target.Version,
839+
"kind": p.Target.Kind,
840+
"name": p.Target.Name,
841+
"namespace": p.Target.Namespace,
842842
"label_selector": p.Target.LabelSelector,
843843
"annotation_selector": p.Target.AnnotationSelector,
844844
},

argocd/structure_application_set.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -856,14 +856,14 @@ func expandApplicationMatchExpressions(mes []interface{}) []application.Applicat
856856
}
857857

858858
func expandApplicationSetSyncPolicyApplicationsSyncPolicy(p string) (asp application.ApplicationsSyncPolicy) {
859-
switch {
860-
case p == "create-only":
859+
switch p {
860+
case "create-only":
861861
asp = application.ApplicationsSyncPolicyCreateOnly
862-
case p == "create-update":
862+
case "create-update":
863863
asp = application.ApplicationsSyncPolicyCreateUpdate
864-
case p == "create-delete":
864+
case "create-delete":
865865
asp = application.ApplicationsSyncPolicyCreateDelete
866-
case p == "sync":
866+
case "sync":
867867
asp = application.ApplicationsSyncPolicySync
868868
}
869869

argocd/structure_cluster.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ func expandClusterConfig(config interface{}) application.ClusterConfig {
8787
for k, v := range tls[0].(map[string]interface{}) {
8888
switch k {
8989
case "ca_data":
90-
clusterConfig.TLSClientConfig.CAData = []byte(v.(string))
90+
clusterConfig.CAData = []byte(v.(string))
9191
case "cert_data":
92-
clusterConfig.TLSClientConfig.CertData = []byte(v.(string))
92+
clusterConfig.CertData = []byte(v.(string))
9393
case "key_data":
94-
clusterConfig.TLSClientConfig.KeyData = []byte(v.(string))
94+
clusterConfig.KeyData = []byte(v.(string))
9595
case "insecure":
96-
clusterConfig.TLSClientConfig.Insecure = v.(bool)
96+
clusterConfig.Insecure = v.(bool)
9797
case "server_name":
98-
clusterConfig.TLSClientConfig.ServerName = v.(string)
98+
clusterConfig.ServerName = v.(string)
9999
}
100100
}
101101
}

argocd/structure_repository_certificate.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ func expandRepositoryCertificate(d *schema.ResourceData) *application.Repository
4141
func flattenRepositoryCertificate(certificate *application.RepositoryCertificate, d *schema.ResourceData, ctx context.Context) error {
4242
var r map[string]interface{}
4343

44-
if certificate.CertType == "ssh" {
44+
switch certificate.CertType {
45+
case "ssh":
4546
r = map[string]interface{}{
4647
"ssh": []map[string]string{
4748
{
@@ -52,7 +53,7 @@ func flattenRepositoryCertificate(certificate *application.RepositoryCertificate
5253
},
5354
},
5455
}
55-
} else if certificate.CertType == "https" {
56+
case "https":
5657
r = map[string]interface{}{
5758
"https": []map[string]string{
5859
{

0 commit comments

Comments
 (0)