Comment by Mawr

Comment by Mawr 9 hours ago

1 reply

The difference between just "?" and "?" + <good error message> is much greater than the difference between "if err != nil { return err }" and "if err != nil { return fmt.Errorf("<good error message") }".

Part of it is the syntactical easiness of "?", how can any other solution compete with the ease of typing a single character?

But mostly, it's that "fmt.Errorf" is built-in and widely used, as opposed to whatever library you need to go out of your way to choose to be able to easily annotate errors in Rust.

tcfhgj 6 hours ago

But to be able to actually use just "?" you need a specific library as well. So according to your wording you go out of your way to to be able to just use "?".