Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    if display := data["Display"]; display == nil || reflect.ValueOf(display).IsNil() {
        <code>
I mean, even ignoring all of the interface{} design errors, the simple fix here is just

    if _, ok := data["Display"]; !ok {
        <code>
To reiterate, you should almost never need to interact with `interface{}` values in application code. If you find yourself trying to use, inspect, check, or otherwise program against `interface{}` values in application code, it almost always means that you're fighting the language, and that you need to change your approach to your problem.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: