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

update else if to switch #777

Merged
merged 2 commits into from
Mar 6, 2024
Merged
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
12 changes: 6 additions & 6 deletions cmd/redis-shake/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ func main() {

// create reader
var theReader reader.Reader
if v.IsSet("sync_reader") {
switch {
case v.IsSet("sync_reader"):
opts := new(reader.SyncReaderOptions)
defaults.SetDefaults(opts)
err := v.UnmarshalKey("sync_reader", opts)
Expand All @@ -48,7 +49,7 @@ func main() {
theReader = reader.NewSyncStandaloneReader(ctx, opts)
log.Infof("create SyncStandaloneReader: %v", opts.Address)
}
} else if v.IsSet("scan_reader") {
case v.IsSet("scan_reader"):
opts := new(reader.ScanReaderOptions)
defaults.SetDefaults(opts)
err := v.UnmarshalKey("scan_reader", opts)
Expand All @@ -62,7 +63,7 @@ func main() {
theReader = reader.NewScanStandaloneReader(ctx, opts)
log.Infof("create ScanStandaloneReader: %v", opts.Address)
}
} else if v.IsSet("rdb_reader") {
case v.IsSet("rdb_reader"):
opts := new(reader.RdbReaderOptions)
defaults.SetDefaults(opts)
err := v.UnmarshalKey("rdb_reader", opts)
Expand All @@ -71,7 +72,7 @@ func main() {
}
theReader = reader.NewRDBReader(opts)
log.Infof("create RdbReader: %v", opts.Filepath)
} else if v.IsSet("aof_reader") {
case v.IsSet("aof_reader"):
opts := new(reader.AOFReaderOptions)
defaults.SetDefaults(opts)
err := v.UnmarshalKey("aof_reader", opts)
Expand All @@ -80,10 +81,9 @@ func main() {
}
theReader = reader.NewAOFReader(opts)
log.Infof("create AOFReader: %v", opts.Filepath)
} else {
default:
log.Panicf("no reader config entry found")
}

// create writer
var theWriter writer.Writer
if v.IsSet("redis_writer") {
suxb201 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading