• Muhammed Uluyol's avatar
    Properly handle nil interfaces in DeepCopy. · bc8bc372
    Muhammed Uluyol authored
    Running reflect.ValueOf(X) where X is a nil interface will return
    a zero Value. We cannot get the type (because no concrete type is
    known) and cannot check if the Value is nil later on due to the way
    reflect.Value works. So we should handle this case by immediately
    returning nil. We cannot type-assert a nil interface to another
    interface type (as no concrete type is assigned), so we must add
    another check to see if the returned interface is nil.
    bc8bc372
cloner.go 6.66 KB