Slide 24
Slide 24 text
Error Inspection: errors.As
Programmatic analysis
func As(err error, target interface{}) bool
API for type assertion
// was if p, ok := err.(*os.PathError); ok {
var p *os.PathError
if errors.As(err, &p) {
if p := (*os.PathError)(nil); errors.As(err, &p) {
Example usage