This code is subtly wrong:
func f() (err os.Error) {
v, err := g();
if err != nil {
return;
}
if v {
v, err := h();
if err != nil {
return;
}
}
}
The := in the if statement causes a new err variable that shadows the
return parameter.
Maybe doing this should be an error. Maybe return parameters should be
special so that := doesn't ever shadow them. (I like the latter.)
This code is subtly wrong: func f() (err os.Error) { v, err := g(); if err != nil { return; } if v { v, err := h(); if err != nil { return; } } } The := in the if statement causes a new err variable that shadows the return parameter. Maybe doing this should be an error. Maybe return parameters should be special so that := doesn't ever shadow them. (I like the latter.)