4 ms·
if display := data["Display"]; display == nil || reflect.ValueOf(display).IsNil() { <code> I mean, even ignoring all of the interface{} design errors,
by kiitos 3y ago
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.