A common code path is something like:
val, err := SomeFunc(somearg)
if err != nil {
return fmt.Errorf("Couldn't do some thing with %s", somearg)
}
However, in doing that we lose some error context, because we throw away the actual error message from SomeFunc. A better way would be to do the below, which we ideally should do everywhere.
return fmt.Errorf("Couldn't do some thing with %s: %w", somearg, err)