4 ms·
I really appreciate the lack of magic in go's error handling. I do not appreciate the specific implementation of errors in go. It's inefficient (`reflect` is al
by sidlls 3y ago
I really appreciate the lack of magic in go's error handling. I do not appreciate the specific implementation of errors in go. It's inefficient (`reflect` is all over the place) and prone to obscuring the actual "error path". In applications of non-trivial size, it also becomes an obstacle to implementing structured logging and other components of observability. This makes debugging/triage of, say, a production incident harder than it needs to be.
- Thaxll 3y agoI've never seen or used reflection with error handling in Go, what do you mean?
- sidlls 3y agohttps://cs.opensource.google/go/go/+/refs/tags/go1.21.6:src/errors/wrap.go;l=17 https://cs.opensource.google/go/go/+/refs/tags/go1.21.6:src/...
- Thaxll 3y agoBut this is a detail of implementation, user code does not use reflection with errors.
- derekperkins 3y agoI wouldn't classify type assertion as reflection. It's a super fast type check of the object header, not dynamic reflection.
- kbar13 3y agoin 8 years of writing go at scale i've never used reflection in production code. gonna need an example of what you mean.
- deleted 3y ago[deleted]