Skip to content

Commit e1df971

Browse files
committed
Merge branch 'cleanup/code-dedup-safe-refactor' into 'master'
chore(engine): flatten nested if/else after error returns Closes #716 See merge request postgres-ai/database-lab!1151
2 parents 670f927 + 79fe9a2 commit e1df971

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

engine/cmd/cli/commands/global/actions.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ func initCLI(c *cli.Context) error {
3131

3232
cfg, err := config.Load(filename)
3333
if err != nil {
34-
if os.IsNotExist(err) {
35-
cfg = &config.CLIConfig{}
36-
} else {
34+
if !os.IsNotExist(err) {
3735
return err
3836
}
37+
38+
cfg = &config.CLIConfig{}
3939
}
4040

4141
environmentID := c.String(commands.EnvironmentIDKey)

engine/internal/cloning/base.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,11 +502,11 @@ func (c *Base) calculateProtectionTime(durationMinutes *uint) *models.LocalTime
502502
maxMinutes := c.config.ProtectionMaxDurationMinutes
503503

504504
if minutes == 0 {
505-
if maxMinutes > 0 {
506-
minutes = maxMinutes
507-
} else {
505+
if maxMinutes == 0 {
508506
return nil
509507
}
508+
509+
minutes = maxMinutes
510510
}
511511

512512
if maxMinutes > 0 && minutes > maxMinutes {

0 commit comments

Comments
 (0)