Skip to content

Commit

Permalink
chore: fix wastedassign linter (scaleway#1290)
Browse files Browse the repository at this point in the history
  • Loading branch information
remyleone committed Jun 17, 2022
1 parent cb57280 commit 1d603ae
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
6 changes: 1 addition & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ linters:
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code [fast: false, auto-fix: false]
- unconvert # Remove unnecessary type conversions [fast: false, auto-fix: false]
- varcheck # Finds unused global variables and constants [fast: false, auto-fix: false]
- wastedassign # wastedassign finds wasted assignment statements. [fast: false, auto-fix: false]
- whitespace # Tool for detection of leading and trailing whitespace [fast: true, auto-fix: true]

disable:
Expand All @@ -65,7 +66,6 @@ linters:
- dupl # Tool for code clone detection [fast: true, auto-fix: false]
- 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]
- exhaustive # check exhaustiveness of enum switch statements [fast: false, auto-fix: false]
- exhaustruct # Checks if all structure fields are initialized [fast: false, auto-fix: false]
- forcetypeassert # finds forced type assertions [fast: true, auto-fix: false]
- funlen # Tool for detection of long functions [fast: true, auto-fix: false]
- gochecknoglobals # check that no global variables exist [fast: true, auto-fix: false]
Expand All @@ -81,13 +81,9 @@ linters:
- 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]
- 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]
- unparam # Reports unused function parameters [fast: false, auto-fix: false]
- unused #(megacheck): Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
- varnamelen # checks that the length of a variable's name matches its scope [fast: false, auto-fix: false]
- wastedassign # wastedassign finds wasted assignment statements. [fast: false, auto-fix: false]
- wrapcheck # Checks that errors returned from external packages are wrapped [fast: false, auto-fix: false]
- wsl # Whitespace Linter - Forces you to use empty lines! [fast: true, auto-fix: false]

Expand Down
3 changes: 1 addition & 2 deletions scaleway/resource_instance_security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ func updateSecurityGroupeRules(ctx context.Context, d *schema.ResourceData, zone
for direction := range stateRules {
// Loop for all state rules in this direction
for index, rawStateRule := range stateRules[direction] {
apiRule := (*instance.SecurityGroupRule)(nil)
stateRule, err := securityGroupRuleExpand(rawStateRule)
if err != nil {
return err
Expand All @@ -365,7 +364,7 @@ func updateSecurityGroupeRules(ctx context.Context, d *schema.ResourceData, zone
}

// We compare rule stateRule[index] and apiRule[index]. If they are different we update api rule to match state.
apiRule = apiRules[direction][index]
apiRule := apiRules[direction][index]
if ok, _ := securityGroupRuleEquals(stateRule, apiRule); !ok {
destPortFrom := stateRule.DestPortFrom
destPortTo := stateRule.DestPortTo
Expand Down
2 changes: 1 addition & 1 deletion scaleway/resource_k8s_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func resourceScalewayK8SClusterCreate(ctx context.Context, d *schema.ResourceDat

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

res, err = waitK8SClusterPool(ctx, k8sAPI, region, res.ID, d.Timeout(schema.TimeoutCreate))
_, err = waitK8SClusterPool(ctx, k8sAPI, region, res.ID, d.Timeout(schema.TimeoutCreate))
if err != nil {
return diag.FromErr(err)
}
Expand Down

0 comments on commit 1d603ae

Please sign in to comment.