You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This one-word error message pattern seems to pop up sometimes, it's even in the standard library so it's definitely worth supporting.
Essentially what happens, I think, is that fmt.Errorf when used this way results in a single error with two messages nested within it:
ErrPost = "post"
ErrExampleOne = "post: example one"
ErrExampleTwo = "post: example one: example two"
So when you chain these together, you get a lot of duplication:
post: post: example one: post: example one: example two
Or, flattened:
"post"
"post: example one"
"post: example one: example two"
So when the de-duplication logic runs over this, it strips the 2 succeeding error messages because they begin with the first 4 bytes as the what the current iteration points to.
Which I guess is fine, as the actual chained error is mostly useless anyway, the Flatten output is what matters.
What I'd ideally want out of this is:
"post"
"example one"
"example two"
But, rolling all of these into one error will probably be simpler for now instead of trying to unwrap error messages into error chains where errors never existed. Otherwise you end up with:
fault/flatten.go
Lines 73 to 79 in 84c038e
Repro:
Expected chain:
What actually happens:
This one-word error message pattern seems to pop up sometimes, it's even in the standard library so it's definitely worth supporting.
Essentially what happens, I think, is that
fmt.Errorf
when used this way results in a single error with two messages nested within it:So when you chain these together, you get a lot of duplication:
Or, flattened:
So when the de-duplication logic runs over this, it strips the 2 succeeding error messages because they begin with the first 4 bytes as the what the current iteration points to.
Which I guess is fine, as the actual chained error is mostly useless anyway, the Flatten output is what matters.
What I'd ideally want out of this is:
But, rolling all of these into one error will probably be simpler for now instead of trying to unwrap error messages into error chains where errors never existed. Otherwise you end up with:
The text was updated successfully, but these errors were encountered: