I've only been using Go for less than a week and my impressions are less than good. I'm still waiting and hoping to understand what it is that people like about Go, but I'm starting to suspect that won't happen. The biggest problem I have had most so far is when reading other code, finding the meaning amongst all of the error nil checks and the sprawling if conditions that they bring. Another thing that makes it diff…
That is the way it is done in C: avoid indentation if you can fail out. It is very readable.
When I see code like this I will assume that it's going to check every condition:
if !complete {
// do something
}
if stat, ok := r.Object.(*api.Status); ok && stat.Code != 0 {
// do something
}
if r.Created {
// do something
}
If the first condition matching causes the second, third, nth condition to not be checked then why not make it clear in the code by adding an `else`?The recommended way means that I can't trust my assumption and that I'll have to read the entire function and examine the `//do something`s instead