Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix wastedassign linter #1290

Merged
merged 6 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,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 @@ -62,7 +63,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,14 +81,10 @@ linters:
- 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]
- predeclared # find code that shadows one of Go's predeclared identifiers [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