90 })
91
92 continue
93 } else { 94 logger.Debug("rebalancing")
95 }
96
99 if !found {
100 if taskInput.Optional {
101 continue
102 } else {103 return nil, nil, nil, nil, fmt.Errorf("missing required input `%s`", taskInput.Name)
104 }
105 }
36 if flagsErr, ok := err.(*flags.Error); ok && flagsErr.Type == flags.ErrHelp {
37 fmt.Println(err)
38 os.Exit(0)
39 } else {40 fmt.Fprintf(os.Stderr, "error: %s\n", err)
41 }
42
84 // stop scheduling other builds because of a rerun build cannot
85 // determine inputs
86 continue
87 } else { 88 // If it is a regular scheduler build, stop scheduling because it is
89 // failing to determine inputs
90 break
173 if worked {
174 // resolving recursively worked!
175 break
176 } else {177 span.SetStatus(codes.Error, "")
178 return false, db.NoSatisfiableBuilds, nil
179 }
To ensure as little nesting as possible (to improve code readability), the
else
blocks that can be eliminated should be removed. For example, if the if
block contains a return
statement, the else
block can be omitted entirely.
for {
if ok := f(); ok {
a := 1
continue
} else {
return "it's NOT okay!"
}
}
for {
if ok := f(); ok {
a := 1
continue
}
return "it's NOT okay!"
}