Skip to content

Commit

Permalink
chore: add support for wastedassign (#4062)
Browse files Browse the repository at this point in the history
  • Loading branch information
remyleone authored Aug 22, 2024
1 parent 8e26b78 commit 55490c2
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ linters:
- 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]
- usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library. [fast: true, 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]
- zerologlint # Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg` [fast: false, auto-fix: false]

Expand Down
2 changes: 1 addition & 1 deletion internal/human/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func marshalSlice(slice reflect.Value, opt *MarshalOpt) (string, error) {
}
fieldValue := reflect.ValueOf(v)

str := ""
var str string
switch {
// Handle inline slice.
case fieldValue.Type().Kind() == reflect.Slice:
Expand Down
2 changes: 1 addition & 1 deletion internal/interactive/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func Readline(config *ReadlineConfig) (string, error) {
}

promptHandler = &ReadlineHandler{rl: rl}
s := ""
var s string
for {
s, err = rl.Readline()
// If readline returns an error we return it
Expand Down
2 changes: 1 addition & 1 deletion internal/namespaces/object/v1/s3_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func newS3Client(ctx context.Context, region scw.Region) *s3.Client {
return nil
}

customEndpoint := ""
var customEndpoint string
if ep := os.Getenv("SCW_S3_ENDPOINT"); ep != "" {
customEndpoint = ep
} else {
Expand Down
2 changes: 1 addition & 1 deletion internal/namespaces/rdb/v1/custom_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func aclDeleteBuilder(c *core.Command) *core.Command {
return nil, fmt.Errorf("failed to remove ACL rule: %w", err)
}

message := ""
var message string
if ruleWasSet {
message = fmt.Sprintf("ACL rule %s successfully deleted", args.ACLRuleIPs.String())
} else {
Expand Down
2 changes: 1 addition & 1 deletion internal/namespaces/rdb/v1/custom_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ Learn more at: https://dev.mysql.com/doc/refman/8.0/en/option-files.html`
)

func passwordFileExist(ctx context.Context, family engineFamily) bool {
passwordFilePath := ""
var passwordFilePath string
switch family {
case PostgreSQL:
switch runtime.GOOS {
Expand Down
2 changes: 1 addition & 1 deletion internal/qa/ignore.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func filterIgnore(unfilteredErrors []error) []error {

func isIgnoredError(err error) bool {
for _, ignoredError := range ignoredErrors {
isEqual := false
var isEqual bool
switch typedError := err.(type) {
case *DifferentLocalizationForNamespaceError:
isEqual = areCommandsEquals(typedError.Command1, ignoredError.Command) || areCommandsEquals(typedError.Command2, ignoredError.Command)
Expand Down

0 comments on commit 55490c2

Please sign in to comment.