4 ms·
The first 3 lines of `errors.Is()` [0] are the following: if err == nil || target == nil { return err == target } [0]: https://github.com/golang/go/bl
by jay-barronville 2y ago
The first 3 lines of `errors.Is()` [0] are the following:
if err == nil || target == nil {
return err == target
}
[0]: https://github.com/golang/go/blob/9b43bfbc51c469ec13fca24960834a75b2bf66eb/src/errors/wrap.go#L45-L47 https://github.com/golang/go/blob/9b43bfbc51c469ec13fca24960...
- lenkite 2y agoGlad to know they have fixed this. In Go 1.22.3 (the latest release), the first 3 lines of `errors.is` [0] are the following: if target == nil { return err == target } [0]: https://github.com/golang/go/blob/go1.22.3/src/errors/wrap.go#L45-L47 https://github.com/golang/go/blob/go1.22.3/src/errors/wrap.g...
- zachmu 2y agoThat's interesting, because I ran the benchmarks on that version of Go.
- richbell 2y agoThe `err == nil` check was added in April to avoid expensive and unnecessary reflection. Perhaps 1.23, or whichever release that ends up in, would be faster? https://github.com/golang/go/commit/af43932c20d5b59cdffca45406754dbccbb46dfa https://github.com/golang/go/commit/af43932c20d5b59cdffca454...