Skip to content

Commit 0be00df

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

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ linters:
4141
- noctx # noctx finds sending http request without context.Context [fast: false, auto-fix: false]
4242
- nolintlint # Reports ill-formed or insufficient nolint directives [fast: true, auto-fix: false]
4343
- nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL. [fast: true, auto-fix: false]
44+
- predeclared # find code that shadows one of Go's predeclared identifiers [fast: true, auto-fix: false]
4445
- promlinter # Check Prometheus metrics naming via promlint [fast: true, auto-fix: false]
4546
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. [fast: false, auto-fix: false]
4647
- rowserrcheck # checks whether Err of rows is checked successfully [fast: false, auto-fix: false]
@@ -83,7 +84,6 @@ linters:
8384
- nonamedreturns # Reports all named returns [fast: true, auto-fix: false]
8485
- paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test [fast: true, auto-fix: false]
8586
- prealloc # Finds slice declarations that could potentially be preallocated [fast: true, auto-fix: false]
86-
- predeclared # find code that shadows one of Go's predeclared identifiers [fast: true, auto-fix: false]
8787
- staticcheck #(megacheck): Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false, auto-fix: false]
8888
- unparam # Reports unused function parameters [fast: false, auto-fix: false]
8989
- unused #(megacheck): Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]

scaleway/helpers.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -543,30 +543,30 @@ func flattenMap(m map[string]string) interface{} {
543543
return flattenedMap
544544
}
545545

546-
func diffSuppressFuncDuration(k, old, new string, d *schema.ResourceData) bool {
547-
if old == new {
546+
func diffSuppressFuncDuration(k, oldValue, newValue string, d *schema.ResourceData) bool {
547+
if oldValue == newValue {
548548
return true
549549
}
550-
d1, err1 := time.ParseDuration(old)
551-
d2, err2 := time.ParseDuration(new)
550+
d1, err1 := time.ParseDuration(oldValue)
551+
d2, err2 := time.ParseDuration(newValue)
552552
if err1 != nil || err2 != nil {
553553
return false
554554
}
555555
return d1 == d2
556556
}
557557

558-
func diffSuppressFuncIgnoreCase(k, old, new string, d *schema.ResourceData) bool {
559-
return strings.EqualFold(old, new)
558+
func diffSuppressFuncIgnoreCase(k, oldValue, newValue string, d *schema.ResourceData) bool {
559+
return strings.EqualFold(oldValue, newValue)
560560
}
561561

562-
func diffSuppressFuncIgnoreCaseAndHyphen(k, old, new string, d *schema.ResourceData) bool {
563-
return strings.Replace(strings.ToLower(old), "-", "_", -1) == strings.Replace(strings.ToLower(new), "-", "_", -1)
562+
func diffSuppressFuncIgnoreCaseAndHyphen(k, oldValue, newValue string, d *schema.ResourceData) bool {
563+
return strings.Replace(strings.ToLower(oldValue), "-", "_", -1) == strings.Replace(strings.ToLower(newValue), "-", "_", -1)
564564
}
565565

566566
// diffSuppressFuncLocality is a SuppressDiffFunc to remove the locality from an ID when checking diff.
567567
// e.g. 2c1a1716-5570-4668-a50a-860c90beabf6 == fr-par-1/2c1a1716-5570-4668-a50a-860c90beabf6
568-
func diffSuppressFuncLocality(k, old, new string, d *schema.ResourceData) bool {
569-
return expandID(old) == expandID(new)
568+
func diffSuppressFuncLocality(k, oldValue, newValue string, d *schema.ResourceData) bool {
569+
return expandID(oldValue) == expandID(newValue)
570570
}
571571

572572
// TimedOut returns true if the error represents a "wait timed out" condition.

scaleway/resource_account_ssh_key.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ func resourceScalewayAccountSSKKey() *schema.Resource {
3434
ForceNew: true,
3535
Description: "The public SSH key",
3636
// We don't consider trailing \n as diff
37-
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
38-
return strings.Trim(old, "\n") == strings.Trim(new, "\n")
37+
DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool {
38+
return strings.Trim(oldValue, "\n") == strings.Trim(newValue, "\n")
3939
},
4040
},
4141
"organization_id": organizationIDSchema(),

0 commit comments

Comments
 (0)