Skip to content

Commit be5ce9f

Browse files
remyleoneMonitob
andauthored
chore: fix gosec linter (#1294)
Co-authored-by: jaime Bernabe <[email protected]>
1 parent 0be00df commit be5ce9f

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

.golangci.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ linters:
2727
- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. [fast: true, auto-fix: false]
2828
- gomodguard # Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations. [fast: true, auto-fix: false]
2929
- goprintffuncname # Checks that printf-like functions are named with `f` at the end [fast: true, auto-fix: false]
30+
- gosec #(gas): Inspects source code for security problems [fast: false, auto-fix: false]
3031
- gosimple #(megacheck): Linter for Go source code that specializes in simplifying a code [fast: false, auto-fix: false]
3132
- govet #(vet, vetshadow): Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: false, auto-fix: false]
3233
- grouper # An analyzer to analyze expression groups. [fast: true, auto-fix: false]
@@ -75,13 +76,11 @@ linters:
7576
- goerr113 # Golang linter to check the errors handling expressions [fast: false, auto-fix: false]
7677
- gofumpt # Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true]
7778
- gomnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false]
78-
- gosec #(gas): Inspects source code for security problems [fast: false, auto-fix: false]
7979
- lll # Reports long lines [fast: true, auto-fix: false]
8080
- maintidx # maintidx measures the maintainability index of each function. [fast: true, auto-fix: false]
8181
- nestif # Reports deeply nested if statements [fast: true, auto-fix: false]
8282
- nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value. [fast: false, auto-fix: false]
8383
- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity [fast: true, auto-fix: false]
84-
- nonamedreturns # Reports all named returns [fast: true, auto-fix: false]
8584
- paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test [fast: true, auto-fix: false]
8685
- prealloc # Finds slice declarations that could potentially be preallocated [fast: true, auto-fix: false]
8786
- staticcheck #(megacheck): Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false, auto-fix: false]
@@ -102,3 +101,6 @@ issues:
102101
linters:
103102
- stylecheck
104103
- gosec
104+
105+
max-issues-per-linter: 0
106+
max-same-issues: 0

scaleway/resource_rdb_instance.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -566,13 +566,13 @@ func resourceScalewayRdbInstanceUpdate(ctx context.Context, d *schema.ResourceDa
566566
EnableHa: scw.BoolPtr(d.Get("is_ha_cluster").(bool)),
567567
})
568568
}
569-
for _, request := range upgradeInstanceRequests {
569+
for i := range upgradeInstanceRequests {
570570
_, err = waitForRDBInstance(ctx, rdbAPI, region, ID, d.Timeout(schema.TimeoutUpdate))
571571
if err != nil && !is404Error(err) {
572572
return diag.FromErr(err)
573573
}
574574

575-
_, err = rdbAPI.UpgradeInstance(&request, scw.WithContext(ctx))
575+
_, err = rdbAPI.UpgradeInstance(&upgradeInstanceRequests[i], scw.WithContext(ctx))
576576
if err != nil {
577577
return diag.FromErr(err)
578578
}

scaleway/resource_redis_cluster.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,12 @@ func resourceScalewayRedisClusterUpdate(ctx context.Context, d *schema.ResourceD
284284
NodeType: expandStringPtr(d.Get("node_type")),
285285
})
286286
}
287-
for _, request := range migrateClusterRequests {
287+
for i := range migrateClusterRequests {
288288
_, err = waitForRedisCluster(ctx, redisAPI, zone, ID, d.Timeout(schema.TimeoutUpdate))
289289
if err != nil && !is404Error(err) {
290290
return diag.FromErr(err)
291291
}
292-
_, err = redisAPI.MigrateCluster(&request, scw.WithContext(ctx))
292+
_, err = redisAPI.MigrateCluster(&migrateClusterRequests[i], scw.WithContext(ctx))
293293
if err != nil {
294294
return diag.FromErr(err)
295295
}

0 commit comments

Comments
 (0)