> One last thing with error handling. Everybody does if err!=nil. I tend to go the opposite way, if err==nil and nest these, if err isn't nil i drop out and deal with the error. If it is ok, it will return ok.
Don't you get "staircase of doom"?
err := unsafe1()
if err == nil {
err = unsafe2()
if err == nil {
err = unsafe3()
if err == nil {
err = unsafe4()
if err == nil {
err = unsafe5()
if err == nil {
// ...
}
}
}
}
}
Don't you get "staircase of doom"?