Changes in new versions / Go 1.13

type PathError struct {
    Path string
}

func (e *PathError) Error() string {
    return "path error: " + e.Path
}

err := fmt.Errorf("read config: %w", &PathError{Path: "/etc/app.conf"})

// *** before: ***
if pe, ok := err.(*PathError); ok {
    // не сработает: err теперь *fmt.wrapError, а не *PathError
    fmt.Println(pe.Path)
}

// *** in version 1.13: ***
var pe *PathError
if errors.As(err, &pe) {
    fmt.Println(pe.Path)
}