If you're properly wrapping errors it isn't.
fmt.Errorf("... %w", err)I think you misunderstand me. I'm not complaining that there is no context. I'm complaining about destroying all structured content. If you want information out of that, you have to string parse your errors! No type checking or anything useful on error types either.
Yes, it's possible, but that usually comes with 3rd party libraries that manage errors with structure. Such as a large array of arrays producing a structured "stack". But if a single person uses string formatting with your nice structured error? Goodbye structure, hello string parsing.
It's a very, very low bar.
>If you want information out of that, you have to string parse your errors
I'm trying not to be an asshole here, but have you actually played with Go? It seems a lot of the Go hate comes from people with extremely trivial knowledge of it.
The %w directive is not just a simple string format/concat. It constructs an error which when String() is called on it, will appear as a concat'd string, but the underlying error is preserved.
Looking at the release notes, %w was introduced in 2019. So yea, my professional experience with Go predated that. It was all strings back then, and miserable. My team usually used libraries to deal with the shortcomings.
I ended up leaving Go frustrated mostly because of how simple patterns, like Iterators (in Rust) were so horribly expressed in Go. Stretched out into many, many lines of code. All the simplicity of the language left me with no help to manage my actual app complexity.
However i am aware that slowly Go is adding complexity to help you manage real problems. Generics, and apparently sane error handling. I'd love to see them add Enums, as Go's version always felt ... well, just a bunch of consts in userland pretending to be Enums heh.
Maybe one day Go will be feature complete enough for me to look back. Though i'm a big fan of Rust, so maybe not. The only area i feel Go is better than Rust is the way in implements Async, but that's likely more to do with the GC - so, tradeoffs as with everything.