The go stdlib notoriously returns errors without wrapping. I think it has been shifting towards more wrapping more often, but still.
err1 := foo()
err2 := bar()
if err1 != nil || err2 != nil {
return err1 // if only err2 failed, returns nil!
}
```
func process() error {
err := foo()
if err != nil {
return err
} if something {
result, err := bar() // new err shadows outer err
if err != nil {
return err
}
use(result)
}
if somethingElse {
err := baz() // another shadow
log.Println(err)
}
return err // returns foo's err (nil), baz's error lost
}
```