if block ends with a continue statement, so drop this else and outdent its block
213 for i := 0; i < len(v); i++ {
214 if v[i] == t.Template(value[i]) {
215 continue
216 } else {217 return false
218 }
219 }
Description
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.
Bad practice
for {
if ok := f(); ok {
a := 1
continue
} else {
return "it's NOT okay!"
}
}
Recommended
for {
if ok := f(); ok {
a := 1
continue
}
return "it's NOT okay!"
}