Skip to content

Commit eebdb75

Browse files
chore(deps): update golangci/golangci-lint docker tag to v2 (#95)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Signed-off-by: Francesco Canovai <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Francesco Canovai <[email protected]>
1 parent 02a8277 commit eebdb75

File tree

4 files changed

+69
-81
lines changed

4 files changed

+69
-81
lines changed

.golangci.yml

Lines changed: 46 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,25 @@
1-
linters-settings:
2-
lll:
3-
line-length: 120
4-
gci:
5-
sections:
6-
- standard
7-
- default
8-
- prefix(github.com/cloudnative-pg/barman-cloud)
9-
- blank
10-
- dot
11-
nlreturn:
12-
# Size of the block (including return statement that is still "OK")
13-
# so no return split required.
14-
# Default: 1
15-
block-size: 3
16-
1+
version: "2"
172
linters:
18-
disable-all: true
3+
default: none
194
enable:
205
- asciicheck
216
- bodyclose
7+
- copyloopvar
228
- dogsled
239
- dupl
2410
- durationcheck
2511
- errcheck
26-
- copyloopvar
27-
- gci
12+
- ginkgolinter
2813
- gocognit
2914
- goconst
3015
- gocritic
3116
- gocyclo
32-
- gofmt
33-
- gofumpt
3417
- goheader
35-
- goimports
3618
- gomoddirectives
3719
- gomodguard
3820
- goprintffuncname
3921
- gosec
40-
- gosimple
4122
- govet
42-
- ginkgolinter
4323
- importas
4424
- ineffassign
4525
- lll
@@ -53,44 +33,52 @@ linters:
5333
- rowserrcheck
5434
- sqlclosecheck
5535
- staticcheck
56-
- stylecheck
5736
- thelper
5837
- tparallel
59-
- typecheck
6038
- unconvert
6139
- unparam
6240
- unused
6341
- wastedassign
6442
- whitespace
65-
# TODO: Reverse the configuration to enable all linters and disable some
66-
#enable-all: true
67-
#disable:
68-
# - depguard
69-
# - execinquery
70-
# - exhaustruct
71-
# - exportloopref
72-
# - funlen
73-
# - gomnd
74-
# - paralleltest
75-
# - testpackage
76-
# - wsl
77-
78-
issues:
79-
exclude-rules:
80-
# Allow dot imports for ginkgo and gomega
81-
- source: ginkgo|gomega
82-
linters:
83-
- revive
84-
text: "should not use dot imports"
85-
# Exclude some linters from running on tests files.
86-
- path: _test\.go
87-
linters:
88-
- goconst
89-
# Exclude lll issues for lines with long annotations
90-
- linters:
91-
- lll
92-
source: "//\\s*\\+"
93-
exclude-use-default: false
94-
95-
run:
96-
timeout: 5m
43+
settings:
44+
lll:
45+
line-length: 120
46+
nlreturn:
47+
block-size: 3
48+
exclusions:
49+
generated: lax
50+
rules:
51+
- linters:
52+
- revive
53+
text: should not use dot imports
54+
source: ginkgo|gomega
55+
- linters:
56+
- goconst
57+
path: _test\.go
58+
- linters:
59+
- lll
60+
source: //\s*\+
61+
paths:
62+
- third_party$
63+
- builtin$
64+
- examples$
65+
formatters:
66+
enable:
67+
- gci
68+
- gofmt
69+
- gofumpt
70+
- goimports
71+
settings:
72+
gci:
73+
sections:
74+
- standard
75+
- default
76+
- prefix(github.com/cloudnative-pg/barman-cloud)
77+
- blank
78+
- dot
79+
exclusions:
80+
generated: lax
81+
paths:
82+
- third_party$
83+
- builtin$
84+
- examples$

Taskfile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ tasks:
3434
# renovate: datasource=git-refs depName=golangci-lint lookupName=https://github.com/sagikazarmark/daggerverse currentValue=main
3535
DAGGER_GOLANGCI_LINT_SHA: 21f771e7e26b6e4779af3a11fa290e689a8e0239
3636
# renovate: datasource=docker depName=golangci/golangci-lint versioning=semver
37-
GOLANGCI_LINT_VERSION: v1.64.8
37+
GOLANGCI_LINT_VERSION: v2.0.2
3838
cmds:
3939
- >
4040
GITHUB_REF= dagger -s call -m github.com/sagikazarmark/daggerverse/golangci-lint@${DAGGER_GOLANGCI_LINT_SHA}

pkg/api/webhooks/config.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ func ValidateBackupConfiguration(
3535
}
3636

3737
credentialsCount := 0
38-
if barmanObjectStore.BarmanCredentials.Azure != nil {
38+
if barmanObjectStore.Azure != nil {
3939
credentialsCount++
40-
allErrors = barmanObjectStore.BarmanCredentials.Azure.ValidateAzureCredentials(
40+
allErrors = barmanObjectStore.Azure.ValidateAzureCredentials(
4141
path.Child("azureCredentials"),
4242
)
4343
}
44-
if barmanObjectStore.BarmanCredentials.AWS != nil {
44+
if barmanObjectStore.AWS != nil {
4545
credentialsCount++
46-
allErrors = barmanObjectStore.BarmanCredentials.AWS.ValidateAwsCredentials(
46+
allErrors = barmanObjectStore.AWS.ValidateAwsCredentials(
4747
path.Child("awsCredentials"),
4848
)
4949
}
50-
if barmanObjectStore.BarmanCredentials.Google != nil {
50+
if barmanObjectStore.Google != nil {
5151
credentialsCount++
52-
allErrors = barmanObjectStore.BarmanCredentials.Google.ValidateGCSCredentials(
52+
allErrors = barmanObjectStore.Google.ValidateGCSCredentials(
5353
field.NewPath("spec", "backupConfiguration", "googleCredentials"))
5454
}
5555
if credentialsCount == 0 {

pkg/credentials/env.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ func EnvSetCloudCredentialsAndCertificates(
9393
env []string,
9494
certificatesLocation string,
9595
) ([]string, error) {
96-
if configuration.EndpointCA != nil && configuration.BarmanCredentials.AWS != nil {
96+
if configuration.EndpointCA != nil && configuration.AWS != nil {
9797
env = append(env, fmt.Sprintf("AWS_CA_BUNDLE=%s", certificatesLocation))
98-
} else if configuration.EndpointCA != nil && configuration.BarmanCredentials.Azure != nil {
98+
} else if configuration.EndpointCA != nil && configuration.Azure != nil {
9999
env = append(env, fmt.Sprintf("REQUESTS_CA_BUNDLE=%s", certificatesLocation))
100100
}
101101
return envSetCloudCredentials(ctx, c, namespace, configuration, env)
@@ -110,12 +110,12 @@ func envSetCloudCredentials(
110110
configuration *barmanApi.BarmanObjectStoreConfiguration,
111111
env []string,
112112
) (envs []string, err error) {
113-
if configuration.BarmanCredentials.AWS != nil {
114-
return envSetAWSCredentials(ctx, c, namespace, configuration.BarmanCredentials.AWS, env)
113+
if configuration.AWS != nil {
114+
return envSetAWSCredentials(ctx, c, namespace, configuration.AWS, env)
115115
}
116116

117-
if configuration.BarmanCredentials.Google != nil {
118-
return envSetGoogleCredentials(ctx, c, namespace, configuration.BarmanCredentials.Google, env)
117+
if configuration.Google != nil {
118+
return envSetGoogleCredentials(ctx, c, namespace, configuration.Google, env)
119119
}
120120

121121
return envSetAzureCredentials(ctx, c, namespace, configuration, env)
@@ -210,20 +210,20 @@ func envSetAzureCredentials(
210210
env []string,
211211
) ([]string, error) {
212212
// check if Azure credentials are defined
213-
if configuration.BarmanCredentials.Azure == nil {
213+
if configuration.Azure == nil {
214214
return nil, fmt.Errorf("missing Azure credentials")
215215
}
216216

217-
if configuration.BarmanCredentials.Azure.InheritFromAzureAD {
217+
if configuration.Azure.InheritFromAzureAD {
218218
return env, nil
219219
}
220220

221221
// Get storage account name
222-
if configuration.BarmanCredentials.Azure.StorageAccount != nil {
222+
if configuration.Azure.StorageAccount != nil {
223223
storageAccount, err := extractValueFromSecret(
224224
ctx,
225225
c,
226-
configuration.BarmanCredentials.Azure.StorageAccount,
226+
configuration.Azure.StorageAccount,
227227
namespace,
228228
)
229229
if err != nil {
@@ -233,11 +233,11 @@ func envSetAzureCredentials(
233233
}
234234

235235
// Get the storage key
236-
if configuration.BarmanCredentials.Azure.StorageKey != nil {
236+
if configuration.Azure.StorageKey != nil {
237237
storageKey, err := extractValueFromSecret(
238238
ctx,
239239
c,
240-
configuration.BarmanCredentials.Azure.StorageKey,
240+
configuration.Azure.StorageKey,
241241
namespace,
242242
)
243243
if err != nil {
@@ -247,11 +247,11 @@ func envSetAzureCredentials(
247247
}
248248

249249
// Get the SAS token
250-
if configuration.BarmanCredentials.Azure.StorageSasToken != nil {
250+
if configuration.Azure.StorageSasToken != nil {
251251
storageSasToken, err := extractValueFromSecret(
252252
ctx,
253253
c,
254-
configuration.BarmanCredentials.Azure.StorageSasToken,
254+
configuration.Azure.StorageSasToken,
255255
namespace,
256256
)
257257
if err != nil {
@@ -260,11 +260,11 @@ func envSetAzureCredentials(
260260
env = append(env, fmt.Sprintf("AZURE_STORAGE_SAS_TOKEN=%s", storageSasToken))
261261
}
262262

263-
if configuration.BarmanCredentials.Azure.ConnectionString != nil {
263+
if configuration.Azure.ConnectionString != nil {
264264
connString, err := extractValueFromSecret(
265265
ctx,
266266
c,
267-
configuration.BarmanCredentials.Azure.ConnectionString,
267+
configuration.Azure.ConnectionString,
268268
namespace,
269269
)
270270
if err != nil {

0 commit comments

Comments
 (0)