Skip to content

Commit 55490c2

Browse files
authored
chore: add support for wastedassign (#4062)
1 parent 8e26b78 commit 55490c2

File tree

7 files changed

+7
-6
lines changed

7 files changed

+7
-6
lines changed

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ linters:
5353
- unparam # Reports unused function parameters [fast: false, auto-fix: false]
5454
- unused #(megacheck): Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
5555
- usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library. [fast: true, auto-fix: false]
56+
- wastedassign # wastedassign finds wasted assignment statements. [fast: false, auto-fix: false]
5657
- whitespace # Tool for detection of leading and trailing whitespace [fast: true, auto-fix: true]
5758
- zerologlint # Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg` [fast: false, auto-fix: false]
5859

internal/human/marshal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ func marshalSlice(slice reflect.Value, opt *MarshalOpt) (string, error) {
318318
}
319319
fieldValue := reflect.ValueOf(v)
320320

321-
str := ""
321+
var str string
322322
switch {
323323
// Handle inline slice.
324324
case fieldValue.Type().Kind() == reflect.Slice:

internal/interactive/prompt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func Readline(config *ReadlineConfig) (string, error) {
145145
}
146146

147147
promptHandler = &ReadlineHandler{rl: rl}
148-
s := ""
148+
var s string
149149
for {
150150
s, err = rl.Readline()
151151
// If readline returns an error we return it

internal/namespaces/object/v1/s3_helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func newS3Client(ctx context.Context, region scw.Region) *s3.Client {
2424
return nil
2525
}
2626

27-
customEndpoint := ""
27+
var customEndpoint string
2828
if ep := os.Getenv("SCW_S3_ENDPOINT"); ep != "" {
2929
customEndpoint = ep
3030
} else {

internal/namespaces/rdb/v1/custom_acl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func aclDeleteBuilder(c *core.Command) *core.Command {
196196
return nil, fmt.Errorf("failed to remove ACL rule: %w", err)
197197
}
198198

199-
message := ""
199+
var message string
200200
if ruleWasSet {
201201
message = fmt.Sprintf("ACL rule %s successfully deleted", args.ACLRuleIPs.String())
202202
} else {

internal/namespaces/rdb/v1/custom_instance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ Learn more at: https://dev.mysql.com/doc/refman/8.0/en/option-files.html`
652652
)
653653

654654
func passwordFileExist(ctx context.Context, family engineFamily) bool {
655-
passwordFilePath := ""
655+
var passwordFilePath string
656656
switch family {
657657
case PostgreSQL:
658658
switch runtime.GOOS {

internal/qa/ignore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func filterIgnore(unfilteredErrors []error) []error {
1919

2020
func isIgnoredError(err error) bool {
2121
for _, ignoredError := range ignoredErrors {
22-
isEqual := false
22+
var isEqual bool
2323
switch typedError := err.(type) {
2424
case *DifferentLocalizationForNamespaceError:
2525
isEqual = areCommandsEquals(typedError.Command1, ignoredError.Command) || areCommandsEquals(typedError.Command2, ignoredError.Command)

0 commit comments

Comments
 (0)