Skip to content

Commit

Permalink
chore: fix gosec linter (#1294)
Browse files Browse the repository at this point in the history
Co-authored-by: jaime Bernabe <6184069+Monitob@users.noreply.github.com>
  • Loading branch information
remyleone and Monitob committed May 19, 2022
1 parent 0be00df commit be5ce9f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions .golangci.yml
Expand Up @@ -27,6 +27,7 @@ linters:
- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. [fast: true, auto-fix: false]
- 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]
- goprintffuncname # Checks that printf-like functions are named with `f` at the end [fast: true, auto-fix: false]
- gosec #(gas): Inspects source code for security problems [fast: false, auto-fix: false]
- gosimple #(megacheck): Linter for Go source code that specializes in simplifying a code [fast: false, auto-fix: false]
- 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]
- grouper # An analyzer to analyze expression groups. [fast: true, auto-fix: false]
Expand Down Expand Up @@ -75,13 +76,11 @@ linters:
- goerr113 # Golang linter to check the errors handling expressions [fast: false, auto-fix: false]
- gofumpt # Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true]
- gomnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false]
- gosec #(gas): Inspects source code for security problems [fast: false, auto-fix: false]
- lll # Reports long lines [fast: true, auto-fix: false]
- maintidx # maintidx measures the maintainability index of each function. [fast: true, auto-fix: false]
- nestif # Reports deeply nested if statements [fast: true, auto-fix: false]
- nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value. [fast: false, auto-fix: false]
- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity [fast: true, auto-fix: false]
- nonamedreturns # Reports all named returns [fast: true, auto-fix: false]
- paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test [fast: true, auto-fix: false]
- prealloc # Finds slice declarations that could potentially be preallocated [fast: true, auto-fix: false]
- staticcheck #(megacheck): Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false, auto-fix: false]
Expand All @@ -102,3 +101,6 @@ issues:
linters:
- stylecheck
- gosec

max-issues-per-linter: 0
max-same-issues: 0
4 changes: 2 additions & 2 deletions scaleway/resource_rdb_instance.go
Expand Up @@ -566,13 +566,13 @@ func resourceScalewayRdbInstanceUpdate(ctx context.Context, d *schema.ResourceDa
EnableHa: scw.BoolPtr(d.Get("is_ha_cluster").(bool)),
})
}
for _, request := range upgradeInstanceRequests {
for i := range upgradeInstanceRequests {
_, err = waitForRDBInstance(ctx, rdbAPI, region, ID, d.Timeout(schema.TimeoutUpdate))
if err != nil && !is404Error(err) {
return diag.FromErr(err)
}

_, err = rdbAPI.UpgradeInstance(&request, scw.WithContext(ctx))
_, err = rdbAPI.UpgradeInstance(&upgradeInstanceRequests[i], scw.WithContext(ctx))
if err != nil {
return diag.FromErr(err)
}
Expand Down
4 changes: 2 additions & 2 deletions scaleway/resource_redis_cluster.go
Expand Up @@ -284,12 +284,12 @@ func resourceScalewayRedisClusterUpdate(ctx context.Context, d *schema.ResourceD
NodeType: expandStringPtr(d.Get("node_type")),
})
}
for _, request := range migrateClusterRequests {
for i := range migrateClusterRequests {
_, err = waitForRedisCluster(ctx, redisAPI, zone, ID, d.Timeout(schema.TimeoutUpdate))
if err != nil && !is404Error(err) {
return diag.FromErr(err)
}
_, err = redisAPI.MigrateCluster(&request, scw.WithContext(ctx))
_, err = redisAPI.MigrateCluster(&migrateClusterRequests[i], scw.WithContext(ctx))
if err != nil {
return diag.FromErr(err)
}
Expand Down

0 comments on commit be5ce9f

Please sign in to comment.