Skip to content

Commit fae2a38

Browse files
authored
chore: fix wastedassign linter (#1290)
1 parent 3911bec commit fae2a38

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

.golangci.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ linters:
5757
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code [fast: false, auto-fix: false]
5858
- unconvert # Remove unnecessary type conversions [fast: false, auto-fix: false]
5959
- varcheck # Finds unused global variables and constants [fast: false, auto-fix: false]
60+
- wastedassign # wastedassign finds wasted assignment statements. [fast: false, auto-fix: false]
6061
- whitespace # Tool for detection of leading and trailing whitespace [fast: true, auto-fix: true]
6162

6263
disable:
@@ -65,7 +66,6 @@ linters:
6566
- dupl # Tool for code clone detection [fast: true, auto-fix: false]
6667
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. [fast: false, auto-fix: false]
6768
- exhaustive # check exhaustiveness of enum switch statements [fast: false, auto-fix: false]
68-
- exhaustruct # Checks if all structure fields are initialized [fast: false, auto-fix: false]
6969
- forcetypeassert # finds forced type assertions [fast: true, auto-fix: false]
7070
- funlen # Tool for detection of long functions [fast: true, auto-fix: false]
7171
- gochecknoglobals # check that no global variables exist [fast: true, auto-fix: false]
@@ -81,13 +81,9 @@ linters:
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-
- paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test [fast: true, auto-fix: false]
85-
- prealloc # Finds slice declarations that could potentially be preallocated [fast: true, auto-fix: false]
8684
- staticcheck #(megacheck): Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false, auto-fix: false]
87-
- unparam # Reports unused function parameters [fast: false, auto-fix: false]
8885
- unused #(megacheck): Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
8986
- varnamelen # checks that the length of a variable's name matches its scope [fast: false, auto-fix: false]
90-
- wastedassign # wastedassign finds wasted assignment statements. [fast: false, auto-fix: false]
9187
- wrapcheck # Checks that errors returned from external packages are wrapped [fast: false, auto-fix: false]
9288
- wsl # Whitespace Linter - Forces you to use empty lines! [fast: true, auto-fix: false]
9389

scaleway/resource_instance_security_group.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ func updateSecurityGroupeRules(ctx context.Context, d *schema.ResourceData, zone
340340
for direction := range stateRules {
341341
// Loop for all state rules in this direction
342342
for index, rawStateRule := range stateRules[direction] {
343-
apiRule := (*instance.SecurityGroupRule)(nil)
344343
stateRule, err := securityGroupRuleExpand(rawStateRule)
345344
if err != nil {
346345
return err
@@ -365,7 +364,7 @@ func updateSecurityGroupeRules(ctx context.Context, d *schema.ResourceData, zone
365364
}
366365

367366
// We compare rule stateRule[index] and apiRule[index]. If they are different we update api rule to match state.
368-
apiRule = apiRules[direction][index]
367+
apiRule := apiRules[direction][index]
369368
if ok, _ := securityGroupRuleEquals(stateRule, apiRule); !ok {
370369
destPortFrom := stateRule.DestPortFrom
371370
destPortTo := stateRule.DestPortTo

scaleway/resource_k8s_cluster.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ func resourceScalewayK8SClusterCreate(ctx context.Context, d *schema.ResourceDat
382382

383383
d.SetId(newRegionalIDString(region, res.ID))
384384

385-
res, err = waitK8SClusterPool(ctx, k8sAPI, region, res.ID, d.Timeout(schema.TimeoutCreate))
385+
_, err = waitK8SClusterPool(ctx, k8sAPI, region, res.ID, d.Timeout(schema.TimeoutCreate))
386386
if err != nil {
387387
return diag.FromErr(err)
388388
}

0 commit comments

Comments
 (0)