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: add support for wastedassign #4062

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ linters:
- unconvert # Remove unnecessary type conversions [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]
- 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 @@ -319,7 +319,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
Loading